SQL query in SCOM monitor or rule
Hello good people,
im looking for a script so I can create monitor's. The monitor mustl query against the ops database.
For example:
SELECT ManagedEntityGenericView.DisplayName, ManagedEntityGenericView.AvailabilityLastModified
FROM ManagedEntityGenericView
INNER JOIN ManagedTypeView ON ManagedEntityGenericView.MonitoringClassId = ManagedTypeView.Id
WHERE (ManagedTypeView.Name = 'microsoft.systemCenter.agent') AND (ManagedEntityGenericView.IsAvailable = 0)
ORDER BY ManagedEntityGenericView.DisplayName
this query will display " grey agents"...so the script I need must alert on output...no output: is healthy, otherwise the output must be put in an alert....Ive seen different scripts but none of them is working or is giving the right result.
Thx for reading this en hopefully you can provide me with a answer
kind regards
How should I adjust the following script si its suitable for my needs? the script works because its not generating any event id's but is not alerting also :-)
Dim objCN, strConnection
Set objCN = CreateObject("ADODB.Connection")
Dim objAPI, oBag
Set objAPI = CreateObject("MOM.ScriptAPI")
Set oBag = objAPI.CreateTypedPropertyBag(StateDataType)
strConnection = "Driver={SQL Server};Server=XXXXX;Database=XXXXX;Trusted_Connection=TRUE"
objCN.Open strConnection
Dim strSQLQuery
strSQLQuery = "SELECT ManagedEntityGenericView.DisplayName, ManagedEntityGenericView.AvailabilityLastModified FROM ManagedEntityGenericView INNER JOIN ManagedTypeView ON ManagedEntityGenericView.MonitoringClassId = ManagedTypeView.Id WHERE (ManagedTypeView.Name
= 'microsoft.systemCenter.agent') AND (ManagedEntityGenericView.IsAvailable = 0) ORDER BY ManagedEntityGenericView.DisplayName"
Dim objRS
Set objRS=CreateObject("ADODB.Recordset")
Set objRS = objCN.Execute(strSQLQuery)
Do Until objRS.EOF 'WScript.Echo objRS.Fields("Expr1?)
if objRS.Fields("Expr1?) = "SPECIFY TRIGGER FROM RESULT TO SET MONITOR in BAD State" then
Call oBag.AddValue("State","BAD") Call oBag.AddValue("Custom1?,objRS.Fields("Expr1?)) Call objAPI.Return(oBag)
else
Call oBag.AddValue("State","GOOD") Call objAPI.Return(oBag)
Similar Messages
-
Sql query can be monitored?
Is there any way to monitor sql base query through performance monitor in scom both version 2007 and 2012?
Hi
if i am not wrong, you are looking to monitor the performace of SQL query.
you can you OLEDB templete to collect the performace data.
refer below link for more information
http://technet.microsoft.com/en-us/library/hh457575.aspx
http://blogs.technet.com/b/authormps/archive/2011/02/24/oledb-based-monitoring.aspx
Regards
sridhar v -
Looking for a SQL query to get all the possible Alert Messages from the Rules in a Management Pack
For reporting, I'm looking to get a SQL query of all the possible Alert Messages for Rules configured in a Management Pack (not necessarily the ones that have thrown alerts). I can do this for Monitors, but not for Rules.
The configured alert messages for the Management Pack Monitors
go like this: ManagementPack > MonitorView> RuleModule > RuleModule.Alert Message > Localized Text
The configured alert messages for the Management Pack Rules
should go something like this, but there is a missing link: ManagementPack > RuleView > RuleModule > ? Missing Link ? > Localized Text
The Rules are tied to the Module, but I don't see a connection from the RulesModule to the Alert Message that I see in the LocalizedText. The Rule names do not always equal the Alert name.
Can someone provide the missing link?Hi,
please try below powershell code to find the corresponding management pack for specific alert:
$Alert = get-scomalert | where {$_.Name -like 'Agent Proxy Not Enabled*'} | select -first 1
If ($alert.IsMonitorAlert -eq "True") {
write-host "Ths is a monitor-generated alert"
get-scommonitor -ID $Alert.MonitoringRuleID | select Enabled, DisplayName, ManagementPack
else
write-host "This is a rule-generated alert"
get-scomrule -ID $Alert.MonitoringRuleID | select Enabled, DisplayName, ManagementPack
In addition, please also refer to the below link:
http://blogs.technet.com/b/mazenahmed/archive/2011/12/02/using-powershell-to-map-opsmgr-active-alert-to-its-corresponding-rule-monitor-and-management-pack-name.aspx
Regards,
Yan Li
Regards, Yan Li -
SQL query to get the monitor target on a monitor
Hi!
I have a list of some custom created Monitors. I need a list of which computers that are using the monitors, the "Monitor target". Please help me with this. It need to be a SQL Query because my powershell have stopped working.Yes that is what i have explained you with the screenshot right it is the one in your screen shot also which is mentioned as (This). If this is a default group then you will not get agents for that refer the below link on how to pull agent list of the Target
group
http://msdn.microsoft.com/en-us/library/bb960484.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
Or look at this. You can see what groups the agents are associated manually one by one by using the default SCOM Task.
Go to Administration==> Agent managed==> Select the agent ==> Right click it and click View ==> Select state view.
Once you select this you will have another window opened for that particular agent.
Then click on the name of the agent and on the right hand side bottom you will have a default made task to check to what group's or Targets this agent is associated to. Run that task and you will get the output.
Look at the ones highlighted in RED
Below is the screenshot for your reference. Hope this helps
Gautam.75801 -
[SQL QUERY] Select TCP Port Monitors and their related Watcher Node
Hi everybody,
I'm working on a SSRS report and SQL Query, I have no problem to find all my TCP Port Monitor (SCOM 2012 R2) based on the DisplayName, but I can't figure out how to get their related watcher nodes (in my case only 1 computer is a watcher node).
I can't find which table, which field, contains this information..?
Here is the query i started to write (i select * since i still searching for the right column):
SELECT
FROM StateView s
INNER JOIN BaseManagedEntity me on me.BaseManagedEntityId=s.BaseManagedEntityId
INNER JOIN MonitorView mv on mv.Id=s.MonitorId
INNER JOIN ManagedTypeView mtv on mtv.Id=s.TargetManagedEntityType
--where mv.DisplayName like 'Ping Target Status Check%'
AND me.IsDeleted = '0'
where mv.DisplayName like '%tcpmon%'
and mv.LanguageCode = 'ENU'
--and s.HealthState in (@state)
ORDER BY s.Lastmodified DESC
It would be great if someone can help me !
Thanks,
JulienHi,
After creating a TCP port monitor, we can find a table for this monitor under operationsmanager database :
SELECT *
FROM [OperationsManager].[dbo].[MT_TCPPortCheck_******WatcherComputersGroup]
You will find the warcher computer group.
Regards,
Yan Li
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
SCOM SQL Query to find Mail Latency (Send/ Receive) Data.
Hi,
I unable to find Mail Latency (Send/ Receive) Data in SCOM 2012 SQL Query.
need your help to find SQL query that fetches below details
1. Average Time for Accessing Mailbox.
2. Average Time to Send and Receive Mail.
Regards,
Vinoth Kumar.Hi Vinoth
There are no specific tables storing the mailbox related data.
To find information about Exchange in SCOM you need the Exchange management pack for the version of Exchange you are running, as well as monitoring the Exchange servers.
When that has been done you can find reports and performance views for Exchange.
I am unsure if you can find this specific information for Exchange in SCOM, i would look into the management pack. If you cannot find the information, i suggest you consult your Exchange administrator to get this information.
www.coretech.dk - blog.coretech.dk -
SCOM event ID 2115 - how can we check which which monitors or rules caused the issue
A Bind Data Source in Management Group XXX has posted items to the workflow, but has not received a response in 8220 seconds. This indicates a performance or functional problem with the workflow.
Workflow Id : Microsoft.SystemCenter.CollectDiscoveryData
Instance : XXX
Instance Id : {FB2DDD17-A942-4D7E-1EA6-09A5351CAB07}
A Bind Data Source in Management Group XXX has posted items to the workflow, but has not received a response in 8220 seconds. This indicates a performance or functional problem with the workflow.
Workflow Id : Microsoft.SystemCenter.CollectPerformanceData
Instance : XXX
Instance Id : {FB2DDD17-A942-4D7E-1EA6-09A5351CAB07}
A Bind Data Source in Management Group XXX has posted items to the workflow, but has not received a response in 7980 seconds. This indicates a performance or functional problem with the workflow.
Workflow Id : Microsoft.SystemCenter.CollectDiscoveryData
Instance : XXX
Instance Id : {FB2DDD17-A942-4D7E-1EA6-09A5351CAB07}Hi
Please refer below link for this issue
https://support2.microsoft.com/kb/2681388?wa=wsignin1.0
http://blogs.technet.com/b/kevinholman/archive/2008/04/21/event-id-2115-a-bind-data-source-in-management-group.aspx
http://blogs.technet.com/b/momteam/archive/2012/04/17/kb-how-to-troubleshoot-event-id-2115-in-operations-manager.aspx
you can find the object name for GID using powershell and sql query on operation manager :
Powershell :
(Get-MonitoringObject -id ‘GUID′).DisplayName
sql query :
Select * from BaseManagedEntity where BaseManagedEntityID = ‘GUID‘
Regards
sridhar v -
How can i get list of all monitors and rules that assigned to a node ?
Hello,
We r using the scom 2012 sp1
i need to get list of monitors and rules that have assigned to nodes.
for example :
nodename - type - name
node1 - monitor - montiorname1
node1 - monitor - monitorname2
node1 - rule - rule1
node1 - rule - rule2
can i get this list by using sql or powershell script ?
thanksHi,
Please refer to the link below:
How to View All Rules and Monitors Running on an Agent-Managed Computer
https://technet.microsoft.com/en-us/library/hh212748.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
SQL Query to show active alerts
Hi, i want to build a ASP page that shows a gridview with the current alerts in scom so we can see them clearly.
What SQL query can get me the current alerts that are showing on Monitoring - Active Alerts, where severity is Critical?
I use System Center 2012 SP1
I checked this post
http://social.technet.microsoft.com/Forums/systemcenter/en-US/898c6f62-9daf-493b-bfd9-193d1f42fc18/sql-query-to-view-current-active-alerts?forum=operationsmanagergeneral
And this page:
http://blogs.technet.com/b/kevinholman/archive/2007/10/18/useful-operations-manager-2007-sql-queries.aspx
But i can't see the correct query.
I don't want to use Powershell as i want to display it properly in a formatted gridview.
ThanksHi,
SELECT * FROM [OperationsManager].[dbo].[AlertView] where Severity = 2 and ResolutionState <> 255 and LanguageCode='ENU'
I want to report on all severity levels, but I'd like to see Warning instead of 1, and Critical instead of 2 and so on. Am I missing a field somewhere?
Jeffrey S. Patton Jeffrey S. Patton Systems Specialist, Enterprise Systems University of Kansas 1001 Sunnyside Ave. Lawrence, KS. 66045 (785) 864-0242 | http://patton-tech.com -
Using a SQL Query in an Alert and Matching a String
I've created an alert in 12.0.4 using a SQL Query and the field that I'm trying to match is a string. Originally the query returned multiple rows but when the alert still didn't fire, I modified the query WHERE clause to return only one row:
NAME RESPONSE
Are area lights working? No
My expression in the metric is RESPONSE. In the Monitor I'm matching a string equal to No. (Do I need double quotes around the matchvalue? Single quotes? No quotes?) The metric is in the 15min scan group, the role is xMII Developers and I'm in that role. The monitor alert string is ' = '. Both metric and monitor are active and I've subscribed to the monitor. Other alerts in the 15min scan group (all based on tag queries) are firing off properly.
Why is nothing showing up in the Alert Log?
David MacindoeDavid,
Did you figure out the answer? If not, I will try to find someone to address your question.
Mike -
How to view the sql query?
hi,
how to view the sql query formed from the xml structure in the receiver jdbc?You can view SAP Note at
http://service.sap.com/notes
But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
Reason and Prerequisites
You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
When you want to use a parameter documented here, please be aware to which category it belongs!
Solution
The following list shows all available parameters of category 1 or 2. Please note:
Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
The default value of a parameter is always chosen that it does not change the standard functionality
JDBC Receiver Adapter Parameters
1. Parameter name: "logSQLStatement"
Parameter type: boolean
Parameter value: true for any string value, false only for empty string
Parameter value default: false (empty String)
Available with: SP9
Category: 2
Description:
When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
This should be used only during the test phase and not in productive scenarios.
Regards,
Prateek -
SQL Query for TOP 10 Average CPU
Have a SCOM Report request for a line graph showing top 10 average CPU for a group of servers. I have a query that will show all of the servers in a group for the last day, with the average CPU by hour. How can I extend the SQL query to only select the TOP
10 average CPU from the group? Here is the Query I have:
SELECT
vPerf.DateTime,
vPerf.SampleCount,
cast(vPerf.AverageValue as numeric(10,2)) as AverageCPU,
vPerformanceRuleInstance.InstanceName,
vManagedEntity.Path,
vPerformanceRule.ObjectName,
vPerformanceRule.CounterName
FROM Perf.vPerfHourly AS vPerf INNER JOIN
vPerformanceRuleInstance ON vPerformanceRuleInstance.PerformanceRuleInstanceRowId = vPerf.PerformanceRuleInstanceRowId INNER JOIN
vManagedEntity ON vPerf.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId INNER JOIN
vPerformanceRule ON vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId
WHERE
vPerf.DateTime >= DATEADD(Day, -1, GetDate())
AND vPerformanceRule.ObjectName like '%Processor Information%'
AND vPerformanceRuleInstance.InstanceName = '_Total'
AND (vPerformanceRule.CounterName IN ('% Processor Time'))
AND (vManagedEntity.Path IN (SELECT dbo.vManagedEntity.Name
FROM dbo.vManagedEntity INNER JOIN
dbo.vRelationship On dbo.vManagedEntity.ManagedEntityRowId = dbo.vRelationship.TargetManagedEntityRowId INNER JOIN
dbo.vManagedEntity As CompGroup On dbo.vRelationship.SourcemanagedEntityRowId = CompGroup.ManagedEntityRowId
WHERE CompGroup.DisplayName = 'bemis ibb prod'
ORDER BY path, vPerf.DateTime
Results
DateTime
SampleCount
AverageCPU
InstanceName
Path
ObjectName
CounterName
2/26/15 3:00 PM
2
1.98
_Total
servername.corp.com
Processor Information
% Processor Time
2/26/15 4:00 PM
2
2.09
_Total
servername.corp.com
Processor Information
% Processor Time
2/26/15 5:00 PM
2
1.72
_Total
servername.corp.com
Processor Information
% Processor Time
2/26/15 6:00 PM
2
1.83
_Total
servername.corp.com
Processor Information
% Processor Time
Thanks in Advance!
Mike HanlonHi
Sql Query
SELECT TOP 10
vPerf.DateTime,
vPerf.SampleCount,
cast(vPerf.AverageValue as numeric(10,2)) as AverageCPU,
vPerformanceRuleInstance.InstanceName,
vManagedEntity.Path,
vPerformanceRule.ObjectName,
vPerformanceRule.CounterName
FROM Perf.vPerfHourly AS vPerf INNER JOIN
vPerformanceRuleInstance ON vPerformanceRuleInstance.PerformanceRuleInstanceRowId = vPerf.PerformanceRuleInstanceRowId
INNER JOIN
vManagedEntity ON vPerf.ManagedEntityRowId = vManagedEntity.ManagedEntityRowId INNER JOIN
vPerformanceRule ON vPerformanceRuleInstance.RuleRowId = vPerformanceRule.RuleRowId
WHERE
vPerf.DateTime >= DATEADD(Day, -1, GetDate())
AND vPerformanceRule.ObjectName like '%Processor Information%'
AND vPerformanceRuleInstance.InstanceName = '_Total'
AND (vPerformanceRule.CounterName IN ('% Processor Time'))
AND (vManagedEntity.Path IN (SELECT dbo.vManagedEntity.Name
FROM dbo.vManagedEntity INNER JOIN
dbo.vRelationship On dbo.vManagedEntity.ManagedEntityRowId = dbo.vRelationship.TargetManagedEntityRowId INNER
JOIN
dbo.vManagedEntity As CompGroup On dbo.vRelationship.SourcemanagedEntityRowId = CompGroup.ManagedEntityRowId
WHERE CompGroup.DisplayName = 'bemis ibb prod'
ORDER BY path, vPerf.DateTime
Regards
sridhar v -
Help with sql query the status of A/P Reserve Invoice
Hi,
I am trying to write a query which lists all A/P Reserve Invoice info with OPEN status.
I check the OPCH table and cannot find the rule to tell the status.
The "DocStatus" field has two values only: 'O' for open and 'C' for closed.
However, the status of A/P Reserve Invoice are OPEN, CLOSED, DELIVERED, PAID, etc.
I try to use DocStatus field to filter, but the result does not match what I see in SAP.
Could you please give me some hints about how to get the data I need? Thank you.
Best regards,
Sylvia
Edited by: csylvia on Jun 23, 2011 5:54 AMHi Darius,
Thanks for your reply.
However, I don't know what is the relationship between Purchase order and A/P Reserve Invoice.
Do you mean using "SELECT T0.DocEntry FROM OPCH T0, OPOR T1 WHERE T0.DocNum = T1.DocNum AND T1.DocStatus = 'O';" to query the A/P Reserve Invoice data with OPEN status?
But the result is not what I want.
The result of "*SELECT * FROM OPOR WHERE DocStatus = 'O';*" is also not.
I'd like to query A/P Reserve Invoice list with OPEN status, and I try the following sql query:
SELECT DocEntry FROM OPCH WHERE DocStatus = 'O' AND InvntSttus = 'O';
The result is close to what I need, but it's not exactly correct.
Moreover, I don't think the sql query conditions is accurate.
Please give me some advice. Thank you.
Best regards,
Sylvia -
See sql query from crystal report without crystal report
see sql query from crystal report without crystal report
Hi,
Depends on datasource type but you could have a look at ODBC trace or if you have access to the SQL Server you could use profiler to monitor the session.
Regards,
Craig
And this will only be of use if you know which Server/Insstance/Database the Report is connecting to...
Please click "Mark As Answer" if my post helped. Tony C. -
Is there a way to consolidate calculations used in SQL Query Data Sets?
I am building SQL Query Data Sets against multiple DB Views which all have different date formats. I have the date parameter working well, but want to consolidate the changes that I have to do to it especially for the quarter. For example the SQL against a monthly view would use "where year_month > to_char(:ST_DATE, 'YYYY-MM')" which is not too hard, but to make that work for the quarterly view I need several concats and a decode to get a "> '2012-Q2'". I would like not to have to do this within every where clause. I had put this into a global element hoping to use that in a filter for the data set, but the filter does not have access to global elements only parameters.
Is there any way to refer to a calculated global element from the data set to do this? I am using Layout Templates, so even if I wanted to I could not do the condition within the template.
Thanks,
RickChange the following line to include the red coloured parts
<div class="MasterColumn" spry:repeat="ds4" spry:setrow="ds4" spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">
<span>{Dsp_#}</span><span>{Dsp_WkDay}</span><span>{Dsp_Event}</span>
</div>
The add the following style rule to your document:
.MasterColumn span {
display: inline-block;
I hope this helps.
Ben
Maybe you are looking for
-
Itunes store wont load properly after upgrading to 10.5
My itunes store wont load at all. Loads halfway, and stops.
-
Hi guys, I am having some trouble with this config. All i am looking to do is a simple reverse proxy to this one host. When the page comes up it prompts me to download a bin file.... Probe succeeds and it says its working. I would also like to redire
-
Unable to crawl PDF files in fileshare
Search Crawler is unable to crawl some PDF files in the Fileshare.. The Crawl log has the below error message Processing this item failed because the parser server ran out of memory. ( Error parsing document 'file://servern ame/xxx/yyy/zzzz.pdf'. Doc
-
Record saving problem - help please
Hi, I'm having a problem with saving a set of records. I want to do this. I have a HTML form which generates a list of candidates who are selected from the interview. Here is that code: <%@ page language="java" import="java.util.*"%> <%@ page import=
-
I can't see my notes from iCloud
I can't see my notes on my iphone4 that I have on my ipad2. Notes is turned on all all devices iphone, ipad and in iCloud. Any ideas on how to fix this?