8.25 WMICounter

Use this Knowledge Script to monitor any Windows Management Instrumentation (WMI) object property. You can run this script on any WMI server and monitor any property available for an object. This script raises an event if the value of the property you select exceeds or falls below the threshold you set. You can also specify a consecutive number of times that the threshold must be exceeded before an event is raised.

Use this script to yield performance information for the WMI properties you are monitoring. Use the property data to start corrective actions when thresholds are exceeded, to generate complex and sophisticated graphs, and to provide historical information for reporting, trend analysis, and capacity planning.

NOTE:An event is raised only if the property value exceeds or falls below the thresholds you set. If a counter does not exist on the monitored computer, the job terminates with an error.

8.25.1 Resource Objects

Windows 2003 Server or later

8.25.2 Default Schedule

The default interval for this script is Every 5 minutes.

8.25.3 Setting Parameter Values

Set the following parameters as needed:

Parameter

How to Set It

Collect data for WMI object property values?

Set to y to collect data for charts and reports. When enabled, data collection returns the object property values that exceeded or fell below the threshold you set. The default is n.

Raise event when object property value exceeds threshold?

Set to y to raise an event if the object property value exceeds the maximum threshold you set. The default is y.

Threshold - Maximum value for object property

Specify the maximum value the object property can attain before an event is raised. The default is 100.

Raise event when object property value falls below threshold?

Set to y to raise an event if the object property value falls below the minimum threshold you set. The default is y.

Threshold - Minimum value for object property

Specify the minimum value the object property must maintain to prevent an event from being raised. The default is 10.

WMI object property to monitor

Specify the namespace, class, and property to monitor. For more information, see Selecting a Property to Monitor Using the WMI Browser and Entering Property Names Without Browsing.

For details about WMI classes and objects, see the WMI Object Browser available with the WMI platform SDK.

Number of consecutive times to exceed or fall below threshold

Specify the number of consecutive times a monitored object property value should exceed or fall below the threshold before an event is raised. The default is 1 time.

Raise event if value cannot be retrieved?

Set to y to raise an event if this script cannot retrieve the object property value. The default is y.

Event severity when object property value exceeds threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the object property value exceeds the threshold you set. The default is 8 (red event indicator).

Event severity when object property value falls below threshold

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the object property value falls below the threshold you set. The default is 8 (red event indicator).

Event severity when property/instance not found

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the specified property or instance does not exist. The default is 8 (red event indicator).

8.25.4 Selecting a Property to Monitor Using the WMI Browser

To select the property you want to monitor, click Browse [...] in the WMI object property to monitor parameter to launch the Windows Management Instrumentation Browser dialog box. Specify the target computer, the namespace and class in which the property resides, the instance of the property, such as the name of a service or particular log file, and the name of the specific property you want to monitor. The term “schema” in this dialog box refers to properties.

To select a property to monitor using the WMI browser:

  1. Click Browse [...] and select the target Computer.

  2. From the Classes In list, specify the namespace that contains the class in which the object and property (schema) are located.

  3. Click Enumerate to view the classes and objects in the namespace you specified.

  4. Select the Instance of the class you want to monitor.

  5. From the Schema list, select the name of the property you want to monitor.

  6. Click OK.

8.25.5 Entering Property Names Without Browsing

To type property names rather than use the Windows Management Instrumentation Browser, enter the name in the WMI object’s property to monitor parameter using the following format:

<namespace>:<class.instance="unique identifier">:<property>

where instance is the instance category (such as name or log file), and "unique identifier" is the name of the specific instance you want to monitor.

Using the example from the previous section, to monitor the state of the NetIQmc service, type this information in the WMI object’s property to monitor parameter as follows:

//./root/cimv2:Win32_Service.Name=""NetIQmc"":State

where

  • //./root/cimv2 is the namespace

  • Win32_Service is the class

  • Name is the instance

  • "NetIQmc" is the unique identifier that specifies the specific service you want to monitor

  • State is the property of the instance that you want to monitor