Here's a straighforward explanation of something I found took me a long time to figure out. I found lots of posts but none that explain this straight up...(also I'm sure I knew this 5 years ago when I was doing heaps of SCOM stuff but had since forgotten!)
If you make a SCOM scripted state monitor using say a vbscript and you want to check the result of a numeric value (say an integer), by default it does a string comparison not a numeric one.
Regardless of the variant type your script produces (note variant types listed here: http://www.culham.net/2012/scom/property-bags-and-variant-types ) the authoring gui's create a STRING type compare. This is because there is no datatype field on the SCOM editing screen (unlike say CA Spectrum event configuration where every value has to be typed explicitly).
For example say I return this with my MOM.ScriptAPI AddValue("diffThresholdMinusRun",iServiceCountThreshold-good)
this results in something like:
<DataItem type="System.PropertyBagData" time="2014-04-04T12:09:26.8984174+13:00" sourceHealthServiceId="2B60ADC4-15C5-0FE3-7FF8-1"></Property><Property Name="diffThresholdMinusRun" VariantType="2">-1</Property>...
Now I create a unhealthy expression in SCOM for >0 critical and <=0 OK. Unfortunately the comparisions default to STRING so don't work properly. Any negative value is evalutated as unhealth (becuase - is > 0 in string compare) For example
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='diffThresholdMinusRun']</XPathQuery>
</ValueExpression>
<Operator>Greater</Operator>
<ValueExpression>
<Value Type="String">0</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
The only way to fix this is to edit the management pack xml (in the 'edit' screen in authoring console or in xml editor) so that it has a valid numeric type (say Integer).
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Integer">Property[@Name='diffThresholdMinusRun']</XPathQuery>
</ValueExpression>
<Operator>Greater</Operator>
<ValueExpression>
<Value Type="Integer">0</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
Technical blog for IT stuff like SCOM, CA infrstructure Manager, Unicenter, vbscript and stuff I'm interested in in IT.
Showing posts with label SCOM. Show all posts
Showing posts with label SCOM. Show all posts
Thursday, 3 April 2014
Wednesday, 19 March 2014
SCOM Query to Show All Tasks Defined By Management Pack and Target Class
We've been looking at making better use of the built in tasks in SCOM recently. One of the biggest issues is that there are lots of tasks there but users don't realise they even exist because unless the select an object of the correct target class the pre-defined tasks are effectively invisible.
A common example is users select a windows computer object (which has one set of tasks) when if they selected a windows server operating system class object (in say the windows server MP view) htey will get a totally different set of possible tasks.
So I wrote this SQL query to dump out a list of all the tasks defined in your SCOM operations database (not the datawarehouse DB!).
Armed with this list you can easily find out what tasks exist and what target class you need to select to be able to execute them. Then using 'discovered inventory' you can specifically target a class of object to get the tasks you want (even if you don't know a canned view that targets objects of that type.)
SELECT dbo.TaskView.Id, dbo.TaskView.Name, dbo.TaskView.DisplayName, dbo.TaskView.Description, dbo.TaskView.Category,
dbo.ManagedType.TypeName AS TargetClassName, dbo.TaskView.Enabled, dbo.TaskView.Timeout, dbo.TaskView.TimeAdded,
dbo.ManagementPack.MPName, dbo.ManagementPack.MPFriendlyName AS MPFirendlyName
FROM dbo.TaskView LEFT OUTER JOIN
dbo.ManagementPack ON dbo.TaskView.ManagementPackId = dbo.ManagementPack.ManagementPackId LEFT OUTER JOIN
dbo.ManagedType ON dbo.TaskView.TargetMonitoringClassId = dbo.ManagedType.ManagedTypeId
ORDER BY dbo.TaskView.DisplayName
A common example is users select a windows computer object (which has one set of tasks) when if they selected a windows server operating system class object (in say the windows server MP view) htey will get a totally different set of possible tasks.
So I wrote this SQL query to dump out a list of all the tasks defined in your SCOM operations database (not the datawarehouse DB!).
Armed with this list you can easily find out what tasks exist and what target class you need to select to be able to execute them. Then using 'discovered inventory' you can specifically target a class of object to get the tasks you want (even if you don't know a canned view that targets objects of that type.)
SELECT dbo.TaskView.Id, dbo.TaskView.Name, dbo.TaskView.DisplayName, dbo.TaskView.Description, dbo.TaskView.Category,
dbo.ManagedType.TypeName AS TargetClassName, dbo.TaskView.Enabled, dbo.TaskView.Timeout, dbo.TaskView.TimeAdded,
dbo.ManagementPack.MPName, dbo.ManagementPack.MPFriendlyName AS MPFirendlyName
FROM dbo.TaskView LEFT OUTER JOIN
dbo.ManagementPack ON dbo.TaskView.ManagementPackId = dbo.ManagementPack.ManagementPackId LEFT OUTER JOIN
dbo.ManagedType ON dbo.TaskView.TargetMonitoringClassId = dbo.ManagedType.ManagedTypeId
ORDER BY dbo.TaskView.DisplayName
Thursday, 18 July 2013
Viacode MP Wiki - holy grail of SCOM management packs and overrides
I came across Viacode's management pack wiki today. What an awesome SCOM / Operations manager resource.
Most common management packs are inventoried here with diagrams of class structure (which you can drill down on!), downloadable inventory of the whole managmenet pack and detailed wiki pages for each rule and overrideable property.
Even better is the MP tuner tool which is the tool you always wanted to bulk manage overrides in your SCOM 2007 or 2012.
watch this video and you will see how amazing it truly is! You can even connect it directrly via SQL to the ops manager database for optimal speed and efficiency.
Microsoft why isn't this tool come as standard part of Operations Manager 2012. A 3rd party has built the interface you never did to make overrides manageable!
http://mpwiki.viacode.com/default.aspx?g=mptuner
Most common management packs are inventoried here with diagrams of class structure (which you can drill down on!), downloadable inventory of the whole managmenet pack and detailed wiki pages for each rule and overrideable property.
Even better is the MP tuner tool which is the tool you always wanted to bulk manage overrides in your SCOM 2007 or 2012.
watch this video and you will see how amazing it truly is! You can even connect it directrly via SQL to the ops manager database for optimal speed and efficiency.
Microsoft why isn't this tool come as standard part of Operations Manager 2012. A 3rd party has built the interface you never did to make overrides manageable!
http://mpwiki.viacode.com/default.aspx?g=mptuner
MP Tuner is a productivity tool that makes SCOM Operations
Manager a much better monitoring solution.
- Override Table. Filterable, sortable and editable grid of existing overrides.
- Effective Table. Filterable, sortable and editable grid of overrideable parameters’ effective values.
- Parameter Map. One view editable representation of a parameter overrides for the entire data center.
- Override Set. Editable set of override values that can be applied to object, class, group or entire data center.
- Integration with MP Wiki
Subscribe to:
Posts (Atom)