16 May 2011

Of Property Bags & Custom Performance Rules

This might not be the best kept secret with OpsMgr especially for those who had experience creating custom monitors/performance in OpsMgr.

Although OpsMgr provides many avenue to collect monitoring information on monitored systems (either via WMI, Perfmon etc), nevertheless at times there are still a need for us to collect information that is not available directly … or maybe the collected data needs a bit of manipulation before sending it to OpsMgr.

In this example, I will just share a simple scenario where we need to collect % Disk Utilization for a Logical Disk in a server. (Albeit OpsMgr already collects % Free Space, but I am going to flip things around in this scenario)

Let’s start things by exploring how do we get the necessary information to compute % Disk Utilization?

This is where our good friend Windows Management Instrumentation (WMI) comes into the picture. Many would know that WMI is a big repository class which stores the management information on the systems host and in this case, we need to query WMI to retrieve the information related to Logical Disk utilization.

There are many ways to achieve this (e.g Powershell, Scripts etc.) but being an old school VB guy, I will resort to VBScripts to do this.

The following are the excerpts for my code.

Const HARD_DISK = 3
Dim counter, strComputer
strComputer = "."

‘ Connect to the WMI class of root\cimv2 (which provides the systems information that we need)

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

‘ Query WMI to retrieve all Logical Disks in the local computer

Set colDisks = objWMIService.ExecQuery _
    ("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK )

‘ Iterate each Logical Disk (e.g C:\ D:\  etc & Provide the Size of the Disk)

For Each objDisk in colDisks   

‘Compute Disk Utilization = (Size – Free Space)/Size
    l_pct_util = ((objDisk.Size  - objDisk.FreeSpace)/objDisk.Size) * 100) 


Now we have the script to collect Disk Utilization, my next posting will show how we will modify this script to collect performance data to OpsMgr using Property Bag.

05 May 2011

Creating SNMP Performance Collection Rule

Many folks out there will bump into this problem when they tried to create a Performance Collection Rule and target it to a custom SNMP Device Group.

Let me give you an example here:

I have a group of Extreme Network Switches that I need to collect the temperature for these devices. Hence I created a Group that consist only the Extreme Network switches.


Then like most people, you will just go over to create an SNMP collection rule to collect the performance and will target the rule to the SNMP device –> Only to encounter error when you try to Create the rule.



How to resolve this:

One workaround that I tried was this. When you create the rule, instead of targeting the custom Group, target to the SNMP device. But DO NOT enable the rule.


This will create a Rule that is Disabled by default. Now you just need to Override this rule and target back at the Extreme Network Switch and set to Enable it.


This should get things working.

03 May 2011

Unable to execute .js file for Object Discovery in OpsMgr

Noticed that one of my monitored servers is giving up warnings on Health Service Modules


Looks like we have encountered issues on CScript executions on .JS files.

I went on further to the working folder and execute the .js script and I got hit with the following error

Input Error: There is no script engine for file extension ".js".

I then proceed to open command prompt and type

          ASSOC .js

and looks like the .js file is associated incorrectly.

Go back to command prompt and reassociate .js file

           ASSOC .js = JSFile

Restart Health Service and this should do the trick.