5.5 WMI and some Enterprise Management software


Most management software available today on the market utilizes WMI information. By developing scripts on top of the WMI COM API and discovering what WMI information is available from Windows 2000, Windows Server 2003, or Windows XP, we learned how to use WMI information from scripts. The great thing about WMI is that it abstracts the management information for all WMI information types, which means that management information accessed from scripts can be accessed in the same way from any other types of information. Therefore, all WMI information knowledge acquired throughout this book is directly applicable to any Enterprise Management software supporting WMI information utilization.

Considering Enterprise Management software as some powerful WMI consumers is just a partial view of the WMI capabilities offered by some software solutions. Actually, most Enterprise Management software also provides information through WMI, implementing WMI providers and Common Information Model (CIM) class extensions in order to provide management data. Of course, the WMI information available depends heavily on the software implementation. Today, all major management solutions for the Windows platform rely on WMI, such as Microsoft Operations Manager (http://www.microsoft.com/mom), Systems Management Server (http://www.microsoft.com/smserver/default.asp), IBM's Tivoli solution portfolio (http://www-3.ibm.com/software/tivoli/), Hewlett-Packard's OpenView (http://www.openview.hp.com), Computer Associates Unicenter (http://www.cai.com/products), and even Compaq Insight Manager (http://www.compaq.com/manage). Unfortunately, it will be impossible to review the WMI capabilities of all Enterprise Management software available on the market today. Therefore, we will only consider the following Enterprise Management software:

  • Compaq Insight Manager and Management Agents (now called Insight Manager after the HP/Compaq merger)

  • Microsoft Operation Manager (MOM)

  • HP OpenView Operations for Windows (OVOW)

Moreover, only the WMI provider aspects of the software solution will be considered, since they are the most interesting information to know about in order to utilize the WMI information they provide. If you use another management software solution, please contact your Enterprise Management software vendor to gather more information on this subject.

5.5.1 Insight Management Agents

The Insight Management Agents were developed by Compaq to manage the Compaq server's hardware. The complete management solution, also known under the name "Compaq Insight Manager," is made up of a management console and a series of agents.

Information retrieved by the agents can be very useful, because sometimes hardware will obscure things from the Operating System. For example, Windows can see logical drives created on a SmartArray controller but has no information about the physical drives or the RAID level. The Insight Management Agents provide information about this and many other aspects of a ProLiant. The management console consolidates the information collected by the Insight Management Agents. The architecture of the Insight Management Agents, coming with "Insight Manager version 7 SP1," is based on SNMP and HTTP and does not currently act as WMI providers. Although there is a WMI consumer component in the agents that does provide some limited information about Windows, no hardware-specific information is exposed through WMI with this version (see Figure 5.29). This data is routinely retrieved via SNMP.

click to expand
Figure 5.29: The Insight Management Web-enabled Agents architecture of CIM, version 7 SP1.

In Chapter 3, section 3.7.5.2, we saw how to integrate and access standard SNMP information (SNMPv1 and SNMPv2) from WMI. We also examined how private MIB information can be integrated (Cisco MIB) and how SNMP traps can be received. By applying this knowledge and integrating the SNMP information of the Insight Management Agents in WMI, we can use the same techniques to retrieve this information with WMI scripts (or any other WMI consumers). As a result, the Agents SNMP information of Insight Manager version 7 SP1 is accessed through the Windows WMI SNMP providers.

Because the Insight Agent SNMP information is part of a private MIB, it is obvious that we may find some specific SNMP information that is not defined in the standard RFC 1213. This Enterprise MIB information is defined in a set of MIB files available via download from the Management Toolkit or on the management CD in the ProLiant Essentials Value Pack included with every ProLiant.

To access the enterprise MIB information from WMI, it is necessary to load the MIB file information into the WMI CIM repository. This can be done using the SMI2SMIR.Exe MIB to MOF converter provided with WMI.

The Insight Agents have a lot of enterprise MIB information, so let's take a very easy example. Figure 5.30 shows some information that is specific to ProLiant hardware. The figure shows the system type with its serial number and its asset tag.

click to expand
Figure 5.30: The Insight Management Agents information.

To retrieve this information from WMI via SNMP, we must a use a private MIB file. The required MIB file is called "CPQSINFO.MIB." You can check Table 5.33 for a complete list of the SNMP MIB files. To successfully convert the "CPQSINFO.MIB" MIB file into a MOF file, we also need the "CPQHOST.MIB" and "RFC1213.MIB" MIB files, since they contain definitions used in "CPQSINFO.MIB." The conversion to a MOF file can be created as follows:

 C:\>SMI2SMIR /m 0 /g CPQSINFO.MIB CPQHOST.MIB Rfc1213.MIB > CPQSINFO.MOF SMI2SMIR : Version <UnknownVersion> : MIB definitions compiled from "CPQSINFO.MIB" SMI2SMIR : Syntax Check successful on "CPQSINFO.MIB" SMI2SMIR : Version <UnknownVersion> : MIB definitions compiled from "CPQHOST.MIB" SMI2SMIR : Syntax Check successful on "CPQHOST.MIB" SMI2SMIR : Version <UnknownVersion> : MIB definitions compiled from "Rfc1213.MIB" SMI2SMIR : Syntax Check successful on "Rfc1213.MIB" SMI2SMIR : Semantic Check successful on "CPQSINFO.MIB" SMI2SMIR: Generated MOF successfully 

Table 5.33: Insight SNMP MIB Files

MIB Filename

Description

Compaq Insight Manager Support

CPQAPLI.MIB

Compaq Appliance MIB

V4.70

CPQCLUS.MIB

Compaq Cluster MIB

v 4.21

CPQCMC.MIB

Compaq/Powerware/Rittal MIB

v 5.30

CPQCR.MB

ClusteredRaid MIB (Shrewsbury)

v 4.50

CPQFCA.MIB

Compaq Fibre Channel MIB

v 3.60

CPQHLTH.MIB

Compaq System Health MIB

V 2.x

CPQHOST.MIB

Compaq Host MIB

V 2.x

CPQIDA.MIB

Compaq Drive Array MIB

V 2.x

CPQIDE.MIB

Compaq IDE MIB

v 2.51

CPQNIC.MIB

Compaq NIC MIB

v 4.20

CPQRACK.MIB

Compaq Rack MIB

v 5.30

CPQRECOV.MIB

Compaq Recovery Server MIB

v 2.50

CPQSCSI.MIB

Compaq SCSI MIB

V 2.x

CPQSINFO.MIB

Compaq System Information MIB

v 2.x

CPQSM2.MIB

Compaq Remote Insight MIB

v 2.51

CPQSTAT.MIB

Compaq External Status MIB

v 3.50

CPQSTDEQ.MIB

Compaq Standard Equipment MIB

v 2.x

CPQSTSYS.MIB

Compaq Storage System MIB

v 2.x

CPQTHRSH.MIB

Compaq Threshold MIB

v 2.x

CPQUPS.MIB

Compaq UPS MIB

v 2.x

SVRCLU.MIB

Compaq Common Cluster Management MIB

v 4.70

SVRNTC.MIB

Digital Microsoft Windows Cluster MIB

v 4.70

Once the MOF file is generated, it is ready to be loaded in the WMI CIM repository with MOFComp.Exe, as follows:

 C:\>Mofcomp.Exe CPQSINFO.MOF Microsoft (R) 32-bit MOF Compiler Version 5.1.3590.0 Copyright (c) Microsoft Corp. 1997–2001. All rights reserved. Parsing MOF file: CPQSINFO.MOF MOF file has been  successfully parsed Storing data in the repository... Done ! 

Once completed, the selected namespace to access the Insight Management Agents should show the WMI classes representing the Insight Management Agents information. Ensure that the Insight Management Agents are properly installed and that the SNMP host is available on the network during this operation (see Figure 5.31).

click to expand
Figure 5.31: Some Insight Management Agents SNMP classes in the CIM repository.

If we reuse a sample script developed in Chapter 1 (Sample 1.4, "Listing a single instance of a class with its properties formatted") to retrieve the instances of the SNMP_CPQSINFO_MIB_cpqSiAsset class, we should obtain an output similar to this one:

  1:    C:\>GetSingleInstance.wsf SNMP_CPQSINFO_MIB_cpqSiAsset  2:    Microsoft (R) Windows Script Host Version 5.6  3:    Copyright (C) Microsoft Corporation 1996–2001. All rights reserved.  4:  5:  6:    - SNMP_CPQSINFO_MIB_cpqSiAsset ---------------------------------------------------  7:    cpqSiAssetTag: ........................... 8853CBK10158  8:    cpqSiFormFactor: ......................... tower  9:    cpqSiOwnershipTag: ....................... 20202020202020202020202020202020... 10:    cpqSiSysSerialNum: ....................... 8853CBK10158 

We recognize the serial number (line 10) and the asset tag (line 7) from Figure 5.30. Of course, we only compiled one single MOF file. To create all MOF files representing the complete Insight Manager v7 SP1 private MIB, you can use the following batch file:

 SMI2SMIR /m 0 /g MIBS\CPQSINFO.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQSINFO.MOF SMI2SMIR /m 0 /g MIBS\CPQAPLI.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQAPLI.MOF SMI2SMIR /m 0 /g MIBS\CPQCLUS.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQCLUS.MOF SMI2SMIR /m 0 /g MIBS\CPQCMC.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQCMC.MOF SMI2SMIR /m 0 /g MIBS\CPQCR.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQCR.MOF SMI2SMIR /m 0 /g MIBS\CPQFCA.MIB MIBS\CPQSTSYS.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB                  > CPQFCA.MOF SMI2SMIR /m 0 /g MIBS\CPQHLTH.MIB MIBS\CPQSINFO.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB                  > CPQHLTH.MOF SMI2SMIR /m 0 /g MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQHOST.MOF SMI2SMIR /m 0 /g MIBS\CPQIDA.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQIDA.MOF SMI2SMIR /m 0 /g MIBS\CPQIDE.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQIDE.MOF SMI2SMIR /m 0 /g MIBS\CPQNIC.MIB MIBS\CPQSTDEQ.MIB MIBS\CPQSINFO.MIB MIBS\CPQHOST.MIB                  MIBS\RFC1213.MIB > CPQNIC.MOF SMI2SMIR /m 0 /g MIBS\CPQRACK.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQRACK.MOF SMI2SMIR /m 0 /g MIBS\CPQRECOV.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQRECOV.MOF SMI2SMIR /m 0 /g MIBS\CPQSCSI.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQSCSI.MOF SMI2SMIR /m 0 /g MIBS\CPQSINFO.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQSINFO.MOF SMI2SMIR /m 0 /g MIBS\CPQSM2.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQSM2.MOF SMI2SMIR /m 0 /g MIBS\CPQSTAT.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQSTAT.MOF SMI2SMIR /m 0 /g MIBS\CPQSTDEQ.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQSTDEQ.MOF SMI2SMIR /m 0 /g MIBS\CPQSTSYS.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQSTSYS.MOF SMI2SMIR /m 0 /g MIBS\CPQTHRSH.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQTHRSH.MOF SMI2SMIR /m 0 /g MIBS\CPQUPS.MIB MIBS\CPQHOST.MIB MIBS\RFC1213.MIB > CPQUPS.MOF SMI2SMIR /m 0 /g MIBS\ETHER.MIB > ETHER.MOF SMI2SMIR /m 0 /g MIBS\SVRCLU.MIB > SVRCLU.MOF SMI2SMIR /m 0 /g MIBS\SVRNTC.MIB > SVRNTC.MOF SMI2SMIR /m 0 /g MIBS\TOKEN.MIB > TOKEN.MOF 

Once all generated MOF files are loaded in the CIM repository, only the MIBs that the correlation mechanism can resolve will be visible in the CIM repository. You can get more information about the created classes from Table 5.34.

Table 5.34: Insight Management Agents WMI Classes Created from the MIB Files

WMI Class name

Description

SNMP_CPQSTDEQ_MIB_cpqSeMibRev

The major and minor revision level of the MIB with the overall condition (1:other, 2:ok, 3:degraded, 4:failed).

SNMP_CPQSTDEQ_MIB_cpqSeOsCommon

The Insight Agent's polling frequency. The frequency, in seconds, at which the Insight Agent requests information from the device driver. A frequency of zero (0) indicates that the Insight Agent retrieves the information upon request of a management station; it does not poll the device driver at a specific interval.

SNMP_CPQSTDEQ_MIB_cpqSeOsCommonModuleTable

A table of software modules that provide an interface to the device this MIB describes. A description of a software module that provides an interface to the device this MB describes.

SNMP_CPQSTDEQ_MIB_cpqSeCpuTable

A list of the CPUs (processors) in the system. The main processor (if such a concept is valid for this machine) should be the first entry in the table. A description of a CPU (processor) in the system.

SNMP_CPQSTDEQ_MIB_cpqSeCpuCacheTable

A list of the CPU caches in the system. A description of a CPU caches in the system.

SNMP_CPQSTDEQ_MIB_cpqSeFpuTable

A list of the FPUs (floating-point coprocessors) in the system. A description of an FPU in the system. The fpuUnitIndex of any entry in this table will equal the cpuUnitIndex of the corresponding CPU in the cpqSeCpu table.

SNMP_CPQSTDEQ_MIB_cpqSeMemory

The amount of base memory and the total amount of memory in kilobytes. A kilobyte is 1024 bytes.

SNMP_CPQSTDEQ_MIB_cpqSeEisalnitTable

A list of EISA function port initialization entries. A description of an EISA function port initialization.

SNMP_CPQSTDEQ_MIB_cpqSeEisaSlotTable

A list of EISA slot information entries. A description of an EISA slot

SNMP_CPQSTDEQ_MIB_cpqSeEisaIntTable

A list of EISA function interrupt configuration entries. A description of an EISA function interrupt configuration.

SNMP_CPQSTDEQ_MIB_cpqSeEisaPortTable

A list of EISA function port I/O configuration entries. A description of an EISA function port I/O configuration.

SNMP_CPQSTDEQ_MIB_cpqSeEisaFreeFormTable

A list of EISA function free form entries. A description of an EISA function free form.

SNMP_CPQSTDEQ_MIB_cpqSeEisaDmaTable

A list of EISA function DMA configuration entries. A description of an EISA function DMA configuration.

SNMP_CPQSTDEQ_MIB_cpqSeEisaFunctTable

A list EISA function information entries. A description of an EISA function.

SNMP_CPQSTDEQ_MIB_cpqSeEisaMemTable

A list of EISA function memory configuration entries. A description of an EISA function memory configuration.

SNMP_CPQSTDEQ_MIB_cpqSeOptRomTable

A table of option ROM descriptions. An option ROM description.

SNMP_CPQSTDEQ_MIB_cpqSeRom

The BIOS ROM data area, System ROM version information for the redundant ROM image (this will be left blank if the system does not support a redundant ROM) and the system ROM version information.

SNMP_CPQSTDEQ_MIB_cpqSeKeyboard

A description of the keyboard.

SNMP_CPQSTDEQ_MIB_cpqSeVideo

A description of the video system in the computer. This may include the manufacturer, board name, modes supported, etc..

SNMP_CPQSTDEQ_MIB_cpqSeSerialPortTable

A table of serial port descriptions. A description of a serial port

SNMP_CPQSTDEQ_MIB_cpqSeParallelPortTable

A table of parallel port descriptions. A description of a parallel port.

SNMP_CPQSTDEQ_MIB_cpqSeFloppyDiskTable

A table of floppy drive descriptions. A floppy drive description.

SNMP_CPQSTDEQ_MIB_cpqSeFixedDiskTable

A table of ST-506 interface accessible fixed disk descriptions. A fixed disk description.

SNMP_CPQSTDEQ_MIB_cpqSePciFunctTable

A list of PCI function information entries. A description of the functions in each PCI slot.

SNMP_CPQSTDEQ_MIB_cpqSePciSlotTable

A list of PCI slot information entries. A description of a PCI slot

SNMP_CPQSTDEQ_MIB_cpqSePciMemoryTable

A list of PCI base memory entries. A description of the base memory usage in each function.

SNMP_CPQSINFO_MIB_cpqSiMibRev

The major and minor revision level of the MIB with the overall condition (1:other, 2:ok, 3:degraded, 4:failed).

SNMP_CPQSINFO_MIB_cpqSiOsCommonModuleTable

A table of software modules that provide an interface to the device this MIB describes. A description of a software module that provides an interface to the device this MIB describes.

SNMP_CPQSINFO_MIB.cpqSiOsCommon

The Insight Agent's polling frequency. The frequency, in seconds, at which the Insight Agent requests information from the device driver. A frequency of zero (0) indicates that the Insight Agent retrieves the information upon request of a management station, it does not poll the device driver at a specific interval.

SNMP_CPQSINFO_MIB_cpqSiAsset

Contains miscellaneous information about the system, such as the customer changeable identifier (asset) that is set to the system serial number at the time of manufacture, the form factor of the system, the serial number of the system unit, and the service number of the system unit

SNMP_CPQSINFO_MIB_cpqSiSecurity

Contains miscellaneous information about the system security, such as the state of the diskette boot control feature or the current configuration of the Compaq Smart Cover sensor.

SNMP_CPQSINFO_MIB_cpqSiSystemBoard

Contains miscellaneous information about the system board, such as the state of the auxiliary input (pointing) device or the current condition of the correctable memory.

SNMP_CPQSINFO_MIB_cpqSiMemModuleTable

A table of memory module descriptions. A memory module description.

SNMP_CPQSINFO_MB_cpqSiProcMicroPatchTable

This table lists the set of processor microcode patches that the system ROM contains. During post, the ROM will apply the appropriate patches to the CPU microcode. Scan this table to ensure that a patch is being applied to a processor. An entry describing one microcode patch contained in the system ROM.

SNMP_CPQSINFO_MIB_cpqSiFirmwareCfgTable

Table of soft switches and symbols maintained by the firmware. May be operating system and/or option-specific and will certainly be system-specific. This list is intended to be easily extensible and support arbitrary datatypes. It includes such switches as powerup options, default dump device, etc. Note: The string comparision for svrFwSymbolName is case insensitive. Each entry represents one variable or symbol maintained by or stored by some instance of firmware in the system.

SNMP_CPQSINFO_MIB_cpqSiBoardRev

The previous and current board revision configuration date in MM/DD/YY format. This is the date that the EISA Configuration Utility was used to define the current configuration.

SNMP_CPQSINFO_MIB_cpqSiFirmwareRevTable

A table of firmware revision descriptions. A firmware revision description.

SNMP_CPQSINFO_MIB_cpqSiBoardRevTable

A table of board revision descriptions. A board revision description.

SNMP_CPQSINFO_MIB_cpqSiVideo

The manufacturer, model description and technical information of the video display.

SNMP_CPQSINFO_MIB_cpqSiMonitorTable

A table of all video monitor descriptions connected to this system. A video monitor description.

SNMP_CPQSINFO_MIB_cpqSiMonitor

This value specifies the overall condition of the system's monitor(s).

SNMP_CPQSINFO_MIB_cpqSiSystemBattery

This value specifies the overall condition of all of the system batteries.

SNMP_CPQSINFO_MIB_cpqSiSysBatteryTable

A table of System Batteries. A system battery description.

SNMP_CPQSINFO_MIB_cpqSiDockingStation

Docking station miscellaneous information such as the asset tag, the serial number, status, and model.

SNMP_CPQSCSI_MIB_cpqScsiMibRev

The major and minor revision level of the MIB with the overall condition (1:other, 2:ok, 3:degraded, 4:failed).

SNMP_CPQSCSI_MIB_cpqScsiOsCommonModuleTable

A table of software modules that provide an interface to the device this MIB describes. A description of software modules that provide an interface to the device this MIB describes.

SNMP_CPQSCSI_MIB_cpqScsiOsCommon

The Insight Agent's polling frequency. The frequency, in seconds, at which the Insight Agent requests information from the device driver. A frequency of zero indicates that the Insight Agent retrieves the information upon request of a management station; it does not poll the device driver at a specific interval.

SNMP_CPQSCSI_MIB_cpqScsiCntlrTable

Compaq SCSI Controller Table. Compaq SCSI Controller Table Entry.

SNMP_CPQSCSI_MIB_cpqScsiPhyDrvTable

Compaq SCSI Physical Drive Table. Compaq SCSI Physical Drive Entry.

SNMP_CPQSCSI_MIB_cpqScsiTargetTable

Compaq SCSI Target Table. Compaq SCSI Target Entry.

SNMP_CPQHLTH_MIB_cpqHeMibRev

The major and minor revision level of the MIB with the overall condition (1:other, 2:ok, 3:degraded, 4:failed).

SNMP_CPQHLTH_MIB_cpqHeThermalFanTable

A table of fan descriptions. A fan description.

SNMP_CPQHLTH_MIB_cpqHeFltTolFanTable

A table of Fault-Tolerant Fan Entries. A Fault-Tolerant Fan Entry.

SNMP_CPQHLTH_MIB_cpqHeTemperatureTable

A table of Temperature Sensor Entries. A Temperature Sensor Entry.

SNMP_CPQHLTH_MIB_cpqHeThermal

Miscellaneous information about the thermal envrionment, such as the overall condition of the system's thermal environment or the status of the fan(s) in the system.

SNMP_CPQHLTH_MIB_cpqHeSysUtilPciTable

A table of PCI utilization numbers for a whole aggregate PCI bus or a specific device on that bus. PCI utilization entry.

SNMP_CPQHLTH_MIB_cpqHeSysUtil

The EISA bus utilization as a percentage of the theoretical maximum during the last hour, the last 30 minutes, the last 5 minutes, and the last minute. The total time (in minutes) the system has been in full operation (while the server health supporting software was running) is also available.

SNMP_CPQHOST_MIB_cpqHcMibRev

The major and minor revision level of the MIB with the overall condition (1:other, 2:ok, 3:degraded, 4:failed).

SNMP_CPQHOST_MIB_cpqHoInfo

A further description of the host OS.

SNMP_CPQHOST_MIB_cpqHoCpuUtilTable

A table of CPU utilization entries. A description of a CPU's utilization.

SNMP_CPQHOST_MIB_cpqHoFileSysTable

A table of file system descriptions. A file system description.

SNMP_CPQHOST_MIB_cpqHoIfPhysMap

The overall condition of all interfaces.

SNMP_CPQHOST_MIB_cpqHoIfPhysMapTable

A table of interface to physical hardware mappings. A mapping of an interface table entry to physical hardware.

SNMP_CPQHOST_MIB_cpqHoSystemStatus

This item indicates how many code server shares are currently configured on the system. The date/time when the agents were last loaded. The globally unique identifier of this server. If the OS cannot determine a unique ID, it will default the variable to contain all 0's. The management station can then perform a SET to this variable to provide the unique ID.

SNMP_CPQIDE_MIB_cpqIdeMibRev

The major and minor revision level of the MIB with the overall condition (1:other, 2:ok, 3:degraded, 4:failed).

SNMP_CPQIDE_MIB_cpqIdeOsCommonModuleTable

A table of software modules that provide an interface to the device this MIB describes. A description of software modules that provide an interface to the device this MIB describes.

SNMP_CPQIDE_MIB_cpqIdeOsCommon

The Insight Agent's polling frequency. The frequency, in seconds, at which the Insight Agent requests information from the device driver. A frequency of zero indicates that the Insight Agent retrieves the information upon request of a management station; it does not poll the device driver at a specific interval.

SNMP_CPQIDE_MIB_cpqIdeIdentTable

Compaq IDE Drive Identification Table. Compaq IDE Identification Table Entry.

This technique is applicable to any Insight Management Agents version. However, the Insight Management Agents also expose some performance data through WMI in the Root\Default namespace. Table 5.35 shows the list of classes and their related properties with the Agents version exposing that information. The ones marked with "< 5.5" were first exposed via WMI in version 5.5 but were also previously exposed through the BMC Legacy Patrol software.

Table 5.35: The Insight Management Agents Performance Classes

System Object

CPQ_System

Counter available from Agent version

System performance properties supported are:

System Up Time

SystemUpTime

< 5.5

Total Threads

TotalThreads

< 5.5

Context Switch Rate

ContextSwitchRate

< 5.5

Processor Queue Length

CPUQueueLength

< 5.5

Total Processes

Processes

5.5

Registry In Use Percent

RegistryUsage

5.5

Server Object

CPQ_Server

Server performance properties supported are:

Network Utilization

TotalByteRate

< 5.5

Server Sessions

ServerSessions

< 5.5

Access Permission Errors

AccessPermissionsErrors

< 5.5

Access Granted Errors

GrantedAccessErrors

< 5.5

Logon Errors

LogonErrors

<5.5

Sessions Errored-Out

SessionsErroredOut

5.5

Context Block Queue Rate

ContextBlockQueueRate

5.5

Processor Object

CPQ_Processor

Processor performance properties supported are:

Interrupts Per Second

InterruptRate

< 5.5

Processor Time Percent

CpuTimePercent

< 5.5

Processor User Time Percent

CpuUserTimePercent

< 5.5

Processor Privileged Time Percent

PrivilegedCpuTimePercent

< 5.5

Percent DPC Time

PercentDPCTime

6.2

Percent Interrupt Time

PercentInterruptTime

6.2

Memory Object

CPQ_Memory

Memory performance properties supported are:

Available Memory

AvailableBytes

< 5.5

Pages Rate

PageRate

<5.5

Pages Input Rate

PagelnputRate

< 5.5

Pages Output Rate

PageOutputRate

5.5

Page Fault Rate

PageFaultRate

< 5.5

Cache Faults Rate

CacheFaultRate

< 5.5

Page Reads/Sec

PageReadsPersec

6.2

Page Writes/Sec

PageWritesPersec

6.2

Pool Nonpaged Bytes

PoolNonpagedBytes

6.2

Cache Bytes

CacheBytes

6.2

Paging File Object

CPQ_PagingFile

Paging File performance properties supported are:

Paging File Instance Name

Paging File

< 5.5

Paging File Usage Percent

PageFileUsagePercent

<5.5

Cache Object

CPQ_Cache

Cache performance properties supported are:

Copy Read Hits Percent

CopyReadHits Percent

< 5.5

Cache Copy Reads Rate

CopyReadRate

< 5.5

Physical Disk Object

Logical Disk Object

CPQ_LogicalDisk

For each physical disk instance:

Disk Instance Name

PhysicalDisk

< 5.5

Average Disk Queue Length

DiskQueueLength

< 5.5

Disk Busy Time Percent

DiskTimePercent

< 5.5

Disk Bytes/Sec

DiskBytesPersec

6.2

Disk Transfers/Sec

DiskTransfersPersec

6.2

Disk Reads/Sec

DiskReadsPersec

6.2

Disk Writes/Sec

DiskWritesPersec

6.2

Disk Read Bytes/Sec

DiskReadBytesPersec

6.2

Disk Write Bytes/Sec

DiskWriteBytesPersec

6.2

Current Disk Queue Length

CurrentDiskQueueLength

6.2

Logical Disk performance properties supported are:

Disk Instance Name

LogicalDisk

< 5.5

Disk Free Space

FreeMegabytes

< 5.5

Disk Free Space Percent

FreeSpacePercent

< 5.5

Average Disk Queue Length

DiskQueueLength

< 5.5

Disk Busy Time Percent

DiskTimePercent

< 5.5

Network Interface Object

CPQ_Networklnterface

Network Interface performance properties supported are:

Controller Name

NetworkInterface

< 5.5

Total Byte Rate

TotalByteRate

< 5.5

Packet Rate

PacketRate

< 5.5

Output Queue Length

OutputQueueLength

< 5.5

Packet Outbound Errors

PacketOutboundErrs

5.5

Packet Receive Errors

PacketReceiveErrs

5.5

Current Bandwidth

CurrentBandwidth

5.5

Bytes Sent/Sec

BytesSentPersec

6.2

Bytes Received/Sec

BytesReceivedPersec

6.2

Packets Sent/Sec

PacketsSentPersec

6.2

Packets Received/Sec

PacketsReceivedPersec

6.2

TCP Object

CPQ_Tcp

Active Connections

ConnectionsActive

< 5.5

Established Connections

ConnectionsEstablished

< 5.5

Segments Rate

SegmentsRate

< 5.5

Retransmitted Segment Rate

SegmentsRetransmitRate

< 5.5

Connection Failures

ConnectionFailures

< 5.5

Process Object

CPQ_Process

Process performance properties supported are:

Process Name

Process

< 5.5

Thread Count

ThreadCount

< 5.5

Private Bytes

PrivateBytes

< 5.5

Page File Bytes

PageFileBytes

< 5.5

Working Set

WorkingSet

< 5.5

Processor Time Percent

CpuTimePercent

< 5.5

Processor Privileged Time Percent

PrivilegedTimePercent

< 5.5

Page Fault Rate

PageFaultRate

< 5.5

All classes are derived from the CPQ_System_Performance superclass (see Figure 5.32).

click to expand
Figure 5.32: The CPQ_System_Performance superclass with its subclasses, as shown in WMI CIM Studio.

5.5.2 Microsoft Operation Manager

When Microsoft Operation Manager (MOM) is installed, the WMI provider coming with the product is not installed by default. In the MOM installation directory ("C:\Program Files\Microsoft Operation Manager 2000\One Point"), there is a MOF file called OM.MOE You must compile the OM.MOF file with MOFComp.Exe to get the MOM provider and its unique extrinsic event class registered in the CIM repository.

Once completed, a new namespace is created, called Root\MCS. The MOM provider is implemented as an event provider, which means that WQL event queries don't need to use the WITHIN statement. The WQL event query will look as follows:

 Select * From OM_Alert 

The OM_Alert extrinsic event class represents the alerts generated on the MOM console. The aim of this provider with its unique class is to notify WMI event subscribers interested in receiving notifications for the MOM alerts. The OM_Alert class exposes the properties listed in Table 5.36.

Table 5.36: The OM_Alert Extrinsic Event Class with the MOM SP1 Classes

MOM Provider classes (RTM)

Class

Description

OM_Alert

One Point Operations Manager Alert

MOM Provider classes (SP1)

Class

Description

MSFT_Alert

Represents a MOM alert and it provides access to details about the alert's status and other properties.

MSFT_AlertHistory

Represents a MOM alert history and it provides access to details about the alert's status and other properties.

MSFT_AlertResolutionState

Represents a MOM alert and it provides access to details about the alert's status and other properties.

MSFT_Computer

Represents a MOM computer in the managed MOM environment.

MSFT_ComputerGroup

Represents a MOM computer group.

MSFT_MicrosoftOperationsManager

Represents information about the MOM software (installed date, version).

MSFT_TodayStatistics

Provides daily sums for several of the most important measurements in the network environment Microsoft Operations Manager is monitoring.

MSFT_Script

Represents a MOM script with all its parameters.

MSFT_AlertHistoryToAlertResolutionState

Associates an alert history with its state.

MSFT_AlertToAlertResolutionState

Associates an alert with its state.

MSFT_AlertToAlertHistory

Associates an alert with history.

MSFT_AlertToComputer

Associates an alert with a computer.

MSFT_ComputerToComputerGroup

Associates a computer with a computer group.

MSFT_ScriptToComputerGroup

Associates a script to a computer group.

The biggest interest of the OM_Alert extrinsic event class resides in the possibility to interface any other management products with MOM. Of course, this is only possible on the condition that management products support WMI data utilization. For instance, a company can decide to use MOM to manage and monitor the Microsoft environment, while the generated alerts are forwarded to another enterprise management software having WMI data utilization capabilities. In such a case, the enterprise management software will utilize alerts generated from the OM_Alert class.

When the MOM Service Pack 1 is installed, another WMI provider extends the management capabilities and the information set available from MOM through WMI. This new WMI provider exposes alerts, alert history, computers, computer groups, and "computer to computer group" associations. However, by default, as with the previous MOM provider, it is not registered by default in the CIM repository

Once the Service Pack 1 is installed, the MOM installation directory ("C:\Program Files\Microsoft Operation Manager 2000\One Point") contains a MOF file called MOMWMI.MOF. Once the registration with MOFCOMP.EXE is completed, it creates a new namespace called Root\MOM, containing classes listed in Table 5.36.

5.5.3 HP OpenView Operations for Windows

Understanding the WMI capabilities and the WMI information exposed by HP OpenView Operations for Windows v7 (OVOW v7) is invaluable for people who want to develop automated tasks, applications, or scripts integrating with OVOW v7. OVOW v7 provides the first and only service management engine based completely on the WBEM/WMI specification. The use of WMI/WBEM permits extensive customization of the OpenView Operations Management Server via scripting and automation tools—a capability used heavily by lights-out and highly automated enterprises.

There are hundreds of WMI classes, and it is impossible to review all the possibilities offered by the OVOW v7 WMI implementation in a few pages. Most classes available are used by OVOW for internal functions, such as supporting OVOW interconsole synchronization of events, status, and actions. Therefore, external WMI consumers are not officially supported. It is important to understand that even if the features presented in this section are fully functional, HP does not officially support them, because they rely on some internal WMI functions of the OVOW v7 architecture. These WMI internal functions are subject to change without notice with the next release of OVOW.

Despite this restriction, some aspects can be very useful in the field and deserve closer examination. For instance, the application of some typical tasks, such as programmatically acknowledging alerts or monitoring changes to some alerts, demonstrates how OVOW v7 can easily be extended with the use of a standard management interface such as WMI. Therefore, we will concentrate on a very typical WMI class exposed by the OVOW v7 WMI implementation and used heavily by the OVOW console: the OV_Message class.

When installing OVOW v7 in a Windows 2000 system, the setup process creates three new namespaces in the CIM repository:

  • Root\HewlettPackard\OpenView

  • Root\HewlettPackard\OpenView\Console

  • Root\HewlettPackard\OpenView\Data

By default, only administrators have full access to WMI namespaces. However, the OVOW setup modifies the default security on the Root\HewlettPackard\OpenView\Data namespace to allow access to members of the Local Administrators, HP-OVE-ADMINS, and HP-OVE-OPERATORS groups.

All namespaces contain one or more WMI providers, as summarized in Table 5.37.

Table 5.37: The HP OpenView Providers Capabilities

Provider Name

Class Provider

Instance Provider

Method Provider

Property Provider

Event Provider

Event Consumer Provider

Support Get

Support Put

Support Enumeration

Support Delete

Root\HewlettPackard\OpenView

storeprov_PermEventConsumer

X

Root\HewlettPackard\OpenView/Console

OVConsoleEvents

X

X

Root\HewlettPackard\OpenView/Data

AdsProv

X

X

DnsProv

X

X

NetProv

X

X

NnmProv

X

X

OV_ActionRequest_InstanceProvider

X

X

X

X

X

X

OV_ActionResponseEvent_Provider

X

OV_Message_InstanceCreationAndDeletionEvent_Provider

X

OV_Message_InstanceProvider

X

X

X

X

OV_Message_NumberOfAnnotationsChangeEvent_Provider

X

OV_Message_SeverityChangeEvent_Provider

X

OV_Message_StateChangeEvent_Provider

X

OV_Message_TextChangeEvent_Provider

X

OV_MessageAction_InstanceProvider

X

X

X

OV_MessageAction_StateChangeEvent_Provider

X

OvAutoDeploy_PermEventConsumer

X

OvEpStatusEventProvider

X

OvEpStatusInstProvider

X

X

X

Pppprov

X

X

X

X

RegPropProv

X

X

X

StoreInstanceProv

X

X

X

X

X

X

storeprov_PermEventConsumer

X

UnmAgtProv

X

X

As we can see in Table 5.37, OVOW v7 brings several instance providers, event providers, event consumer providers, method providers, and one property provider. Some providers also combine several roles. Each provider supports a set of WMI classes that mostly represent OVOW manageable objects, such as managed nodes, services, node groups, and console messages.

As an example, we can track OVOW v7 alerts displayed on the OVOW console (see Figure 5.33) to trigger the execution of a script. With the script Sample 6.17 ("A generic script for asynchronous event notification") in the appendix, we can easily track alerts via this WMI alert consumer script. Of course, in this case, we use a script as a WMI consumer, but this can be any other WMI consumer application, such as another Enterprise Management System, able to consume WMI alerts. To track all new messages displayed at the OVOW console, we should start the script with the following WQL event query:

 Select * From __InstanceCreationEvent Where TargetInstance ISA 'OV_Message' 

click to expand
Figure 5.33: The HP OpenView Operations for Windows console showing alerts.

The WQL query makes use of the __InstanceCreationEvent intrinsic event class, which captures any instance creation event of the OV_Message WMI class. The OV_Message class is a template representing the OVOW v7 alerts. With this WQL event query, the script receives a notification each time a new alert is available from the OVOW console. By observing the displayed data, you will see that the information exactly matches the alert information shown in Figure 5.33.

  1:    C:\>GenericEventAsyncConsumer.wsf "Select * From __InstanceCreationEvent                                          Where TargetInstance ISA 'OV_Message'"                                          /Namespace:root\HewlettPackard\OpenView\Data  2:    Microsoft (R) Windows Script Host Version 5.6  3:    Copyright (C) Microsoft Corporation 1996–2001. All rights reserved.  4:  5:    Waiting for events...  6:  7:    BEGIN - OnObjectReady.  8:    Thursday, 20 June, 2002 at 16:36:49: '__InstanceCreationEvent' has been triggered.  9:      TargetInstance (wbemCimtypeObject) 10:        AcknowledgeAfterTroubleTicket = False 11:        AgentId = 059bbdd0-7eed-71d6-1e0e-0a0a0a060000 12:        Application = OS 13:        AutomaticAction = (null) 14:        ConditionId = 000000000000000000000000000000000000 15:        CreateTroubleTicketInterface = False 16:        DoNotification = False 17:        *Id = 275d13b0-845b-71d6-161d-0a0a0a060000 18:        InstructionAvailable = False 19:        IsProxied = False 20:        LogOnly = False 21:        MessageGroup = WINOSSPI-CORE 22:        MessageKey = net-dpen6450.LissWare.NET WINOSSPI-SysMon_CacheFaultsSec 23:        MessageKeyRelation = net-dpen6450.LissWare.NET WINOSSPI-SysMon_CacheFaultsSec 24:        NodeName = {A0151862-79D6-47F9-8952-97F563F29429} 25:        NumberOfAnnotations = 0 26:        Object = Cache 27:        OperatorAction = (null) 28:        OriginalId = 000000000000000000000000000000000000 29:        OriginalServiceId = WINOSSPI:NT:Memory:Cache@@<$MSG_NODE_ID> 30:        OriginalText = Monitor WINOSSPI-SysMon_CacheFaultsSec: Threshold:... Value: 77.17 31:        ServiceId = WINOSSPI:NT:Memory:Cache@@{A0151862-79D6-47F9-8952-97F563F29429} 32:        Severity = 4 33:        Source = WINOSSPI-SysMon_CacheFaultsSec(7.0) 34:        SourceType = 8 35:        State = 2 36:        Text = Object: Memory, Counter: Cache Faults/sec: The threshold of 15 ... 37:        TimeCreated = 20-06-2002 16:36:49 (20020620163649.000000+120) 38:        TimeOfStateChange = 20-06-2002 16:36:49 (20020620163649.000000+120) 39:        TimeReceived = 20-06-2002 16:36:49 (20020620163649.000000+120) 40:        Type (wbemCimtypeString) = 41:        Unmatched (wbemCimtypeBoolean) = False 42:        UsedNotificationInterfaces (wbemCimtypeString) = 43:        UserOfStateChange (wbemCimtypeString) = 44:    END - OnObjectReady. ..: 50:    Finished. 

If we closely examine the OV_Message WMI class (), we can see that besides the 34 properties exposed by the class, there are also 16 methods available. Table 5.38 was generated with the LoadCIMinXL.Wsf script (see Sample 4.32 in the appendix).

Table 5.38: The OV_Message Class

Properties

Syntax

Access

Description

AcknowledgeAfterTroubleTicket

boolean

Read

If trouble ticket generation succeeds, acknowedge the message

AgentId

string

Read

The "Agent ID" that uniquely identifies the agent (different than the "NodeID) -used to support NAT and DHCP environments

Application

string

Read

The "Application" that created the message. Similar in many respects to the Windows Event Log "Source" field.

AutomaticAction

object:OV_MessageAction

Read

If an automatic action is assigned to the event, this object is valid.

ConditionId

string

Read

The "Condtion" id (a GUID) of the rule that triggered the event

CreateTroubleTicketInterface

boolean

Read

True if this event should generate a new trouble ticket

DoNotification

boolean

Read

True if this event should generate an e-mail message, SMS or page

Id (key)

string

Read

The internal ID of the message. This is the key for the OV_Message table, and can be used to directly retrieve a message object.

InstructionAvailable

boolean

Read

True if instruction text is available

IsProxied

boolean

Read

True if proxied through a secondary node. Not currently used

LogOnly

boolean

Read

True if the event is to be written to the log (acknowledged) browser without display to the console

MessageGroup

string

Read

A grouping to classify the message - arbitrary

MessageKey

string

Read

A unique "Key" to identify the message. Used to keep only the most recent message displayed in the browser. Also used for "paired" events (good acknowleged bad)

MessageKeyRelation

string

Read

The message key that will be acknowledged when this message is received. Can contain wildcards and pattern matches.

NodeName

string

Read

The ID of the node in the OV_ManagedNode table. This is not the display name of the node, but the GUID representing the node in the OV_ManagedNode table. Query or GetObject from OV_ManagedNode against objMessage.NodeName to get the Caption or PrimaryNodeName values.

NumberOfAnnotations

sint32

Read

Number of available annotations on a message

Object

string

Read

The "Object" of the message. Similar in many respects to the Windows Event Log "'Category" field.

OperatorAction

object:OV_MessageAction

Read

Exists if an operator-initiated action is available for this message

OriginalId

string

Read

The original message ID generating this event

OriginalServiceId

string

Read

The original service ID assigned to the event

OriginalText

string

Read

The original text of the event

ServiceId

string

Read

The ID of the service that this message belogs to. This is not the display name of the service, but the internal ID representing the service in the OV_Service table. Query or GetObject from the OV_Service against objMessage.ServiceID to get the Caption or Description properties.

Severity

sint32

Read

Defines the severity of the message ("Unknown=1", "Normal=2", "Warning=4", "Minor=8", "Major=16", "Critical=32")

Source

string

Read

Origin of the message.

SourceType

sint32

Read

Defines the message source type ("Unknown=0x2000", "MPE Console=0x2001", "Open Message Interface=0x2002", "Logfile Entry | Windows Event Log=0x2004", "Measurement Threshold=0x2008", "SNMP Interceptor=0x2010", "Message Stream Interface=0x2020", "Reserved=0x2040", "Reserved=0x2080", "Scheduled Command=0x2100", "Measurement Threshold =0x2200", "Windows Management Interface=0x2400")

State

sint32

Read

Defines the state of the message ("Undefined=1", "Unowned=2", "Owned=3", "Acknowledged=4", "Node Deleted=5", "Deleted=6")

Text

string

Read

The text of the message as displayed to the user.

TimeCreated

datetime

Read

The time the event was created at the node

TimeOfStateChange

datetime

Read

The time when the state of the message was last changed (owned, disowned,

acknowledged)

TimeReceived

datetime

Read

The time the event was received at the management server

Type

string

Read

The internal type of the message, assigned by the policy creator. This is often used in Manager of Manager environments to selectively route messages around.

Unmatched

boolean

Read

If the event didn't match any conditions of the policy, but the "send unmatched" option was enabled on the node.

UsedNotificationInterfaces

string

Read

Indicates if the notification interface was used

UserOfStateChange

string

Read

The NT/AD username of the user that performed the last state change (own,disown, acknowledge, unacknowledge)

GetInstruction

Output:

Gets the instruction text for this event.

  • Instruction

string

  • ReturnValue

sint32

ChangeText

Input:

Sets new text an existing message, a Tex tChange event

  • NewText

string

Output:

  • ReturnValue

sint32

ChangeSeverity

Input:

  • NewSeverity

sint32

Modifies the message severity ("Unknown", "Normal", "Warning", "Minor", "Major", "Critical")

Output:

  • ReturnValue

sint32

Acknowledge

Output:

Marks the message as acknowledged (resolved/superceded)

  • ReturnValue

sint32

Unacknowledge

Output:

Marks the message as unacknowledged (unresolved problem report)

  • ReturnValue

sint32

Own

Output:

Marks the message as "Owned". The caller of the method is the owner.

  • ReturnValue

sint32

Disown

Output:

Marks the messages as "Unowned".

  • ReturnValue

sint32

GetAnnotation

Input:

Gets a textual annotation to the message. Annotations are available to all operators that can view the message. OV_Message can have any number of annoations attached. It serves as a useful mechanism of tracking updates and changes of an ongoing problem report.

  • AnnotationNumber

sint32

Output:

  • Annotation

object:OV_MessageAnnotation

  • ReturnValue

sint32

ModifyAnnotation

Input:

Modifies a textual annotation to the message.

  • AnnotationNumber

sint32

  • NewText

string

Output:

  • ReturnValue

sint32

DeleteAnnotation

Input:

Deletes a textual annotation to the message.

  • AnnotationNumber

sint32

Output:

  • ReturnValue

sint32

AddAnnotation

Input:

Adds a textual annotation to the message.

  • Text

string

Output:

  • ReturnValue

sint32

AcknowledgeMessages

Input:

Marks a collection of messages as acknowledged (resolved/superceded)

  • MessageIDs

string

Output:

  • MassOperationResults

object:OV_Message_MassOperationResult

  • ReturnValue

sint32

UnacknowledgeMessages

Input:

Unmarks a Collection of messages as unacknowledged (unresolved problem report)

  • MessageIDs

string

Output:

  • MassOperationResults

object:OV_Message_MassOperationResult

  • ReturnValue

sint32

OwnMessages

Input:

Marks a collection of messages as "Owned". The caller of the method is the

owner.

  • MessageIDs

string

Output:

  • MassOperationResults

object:OV_Message_MassOperationResult

  • ReturnValue

sint32

DisownMessages

Input:

Marks a collection of messages as "Unowned".

  • MessageIDs

string

Output:

  • MassOperationResults

object:OV_Message_MassOperationResult

  • ReturnValue

sint32

CountMessages

Input:

For future use, not currently supported.

  • WhereClause

string

Output:

  • Count

sint32

  • ReturnValue

sint32

The methods exactly match the selection we get by right-clicking on the alerts in the OVOW console. For example, some of these methods are Acknowledge, AcknowledgeMessages, Disown, DisownMessages, Own, OwnMessages, Unacknowledge, UnacknowledgeMessages, AddAnnotation, and ChangeSeverity. In the same way, by using another set of WMI classes, such as OV_Message_SeverityChangeEvent, OV_Message_StateChangeEvent, OV_Message_TextChangeEvent, OV_Message_NumberOfAnnotationsChangeEvent, and OV_MessageAction_StateChangeEvent, it is possible to track the alert state modifications. These extrinsic event classes are very easy to use, since you just need to run the GenericEventAsyncConsumer.wsf script with a different WQL event query. For example, to track the alert severity changes, you use the OV_Message_SeverityChangeEvent event class in the following WQL event query:

 Select * From OV_Message_SeverityChangeEvent 

Since the OV_Message class, with its related OV_Message_InstanceProvider WMI provider, is used to implement the features to manage the OVOW v7 console messages, it is possible to create a script managing messages from the command line.

Before digging into the code details, let's see the command-line parameters exposed by the script. Basically, the script exposes most methods supported by the OV_Message class as a command-line parameter.

 C:\>OVOWMessageManager.wsf Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996–2001. All rights reserved. Usage: OVOWMessageManager.wsf MessageID /Action:value                               [/AnnotationNumber:value] [/Annotation:value]                               [/Severity:value] [/Text:value] [/WQLQuery:value]                               [/Machine:value] [/User:value] [/Password:value] Options: MessageID        : OVOW Message(s) ID. Action           : Determines the OVOW Message action to perform. AnnotationNumber : Specifies the annotation number. Annotation       : Specifies the annotation text. Severity         : Specifies the message severity. Text             : Specifies the text message. (Used with ChangeText) WQLQuery         : Specifies WQL Query for the messages to list. Machine          : Determines the WMI system to connect to. User             : Determines the UserID to perform the remote connection. Password         : Determines the password to perform the remote connection. Examples:       OVOWMessageManager.wsf /Action:List       OVOWMessageManager.wsf /Action:List                              /WQLQuery:"Select * From OV_Message Where Severity=4"       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000 /Action:View       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000 /Action:Acknowledge       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000,                              098fd400-7ef0-71d6-0b88-0a0a0a060000                              /Action:AcknowledgeMessages       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:Unacknowledge       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000,                              098fd400-7ef0-71d6-0b88-0a0a0a060000                              /Action:UnacknowledgeMessages       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000 /Action:Own       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000,                              098fd400-7ef0-71d6-0b88-0a0a0a060000                              /Action:OwnMessages       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:Disown       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000,                              098fd400-7ef0-71d6-0b88-0a0a0a060000                              /Action:DisownMessages       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:AddAnnotation                              /Annotation:"This is my message annotation"       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:GetAnnotation /AnnotationNumber:1       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:ModifyAnnotation                              /AnnotationNumber:1                              /Annotation:"This is my updated message annotation"       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:DeleteAnnotation                              /AnnotationNumber:1       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:ChangeSeverity /Severity:Unknown       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:ChangeSeverity /Severity:Normal       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:ChangeSeverity /Severity:Warning       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:ChangeSeverity /Severity:Minor       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:ChangeSeverity /Severity:Major       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:ChangeSeverity /Severity:Critical       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:ChangeText /Text:"This is my new text"       OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                              /Action:GetInstruction 

Although there are 16 methods exposed by the OV_Message class, we will see that most methods use the same scripting techniques. As shown in Sample 5.16, the first lines are devoted to the external functions inclusion (lines 63 through 69), constants declaration (lines 79 through 81), XML command-line parameters parsing (lines 130 through 213), and the WMI connection (lines 225 through 229).

Sample 5.16: The script initialization phase

start example

   1:<?xml version="1.0"?>   .:   8:<package>   9:  <job>  ..:  13:    <runtime>  ..:  61:    </runtime>  62:  63:    <script language="VBScript" src="/books/2/679/1/html/2/.\Functions\DecodeOVOWManagedNodeFunction.vbs" />  64:    <script language="VBScript" src="/books/2/679/1/html/2/.\Functions\DecodeOVOWMessageFunction.vbs" />  65:    <script language="VBScript" src="/books/2/679/1/html/2/.\Functions\OVOWErrorHandler.vbs" />  66:    <script language="VBScript" src="/books/2/679/1/html/2/.\Functions\ConvertStringInArrayFunction.vbs" />  67:    <script language="VBScript" src="/books/2/679/1/html/2/.\Functions\DisplayFormattedPropertiesFunction.vbs" />  68:    <script language="VBScript" src="/books/2/679/1/html/2/.\Functions\DisplayFormattedPropertyFunction.vbs" />  69:    <script language="VBScript" src="/books/2/679/1/html/2/.\Functions\TinyErrorHandler.vbs" />  70:  71:    <object prog  reference="true"/>  72:    <object prog  />  73:  74:    <script language="VBscript">  75:    <![CDATA[  ..:  79:    Const cComputerName = "LocalHost"  80:    Const cWMINameSpace = "Root/HewlettPackard/OpenView/Data"  81:    Const cWMIClass = "OV_Message" ...: 129:    ' -- COMMAND LINE PARSING --------------------------------------------------------- 130:    If WScript.Arguments.Named.Count Then 131:       Select Case Ucase(WScript.Arguments.Named("Action")) 132:              Case "LIST" 133:                   strWQLQuery = WScript.Arguments.Named("WQLQuery") 134:                   If Len(strWQLQuery) = 0 Then 135:                       strWQLQuery = "Select * From " & cWMIClass 136:                   End If 137:                   boolList = True 138:              Case "VIEW" 139:                   boolView = True ...: 203:       End Select 204:    End If 205: 206:    If boolList = False Then 207:       If WScript.Arguments.Unnamed.Count = 0 Then 208:          WScript.Arguments.ShowUsage() 209:          WScript.Quit 210:       Else 211:          arrayWMIOVMessages = ConvertStringInArray (WScript.Arguments.Unnamed.Item(0), ",") 212:       End If 213:    End If ...: 224:    ' -- WMI CONNECTION --------------------------------------------------------------- 225:    objWMILocator.Security_.AuthenticationLevel = wbemAuthenticationLevelDefault 226:    objWMILocator.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate 227: 228:    Set objWMIServices = objWMILocator.ConnectServer(strComputerName, cWMINameSpace, _ 229:                                                     strUserID, strPassword) ...: ...: ...: 

end example

Once the initialization phase is completed, based on the command-line parameters given, a specific section of the script will be executed. Let's start with the /Action:List switch. Basically, this switch displays the OVOW v7 messages in the same way as the OVOW console. This switch produces the following output (the output is divided into two blocks, since it is larger than the page).

 C:\>OVOWMessageManager.wsf /Action:List Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996–2001. All rights reserved. 1269 message(s) to list. OVOW Messages ================================================================================================                                                                                                     Severity        State             Time received                  Object      Application  ------------------------------------------------------------------------------------------------     Normal Acknowledged 20020613190429.000000+120                    None HP OpenView  Operations    Warning      Unowned 20020613190727.000000+120 opcmona (Monitor Agent) HP OpenView  Operations    Warning Acknowledged 20020613191226.000000+120                  Memory                    OS     Normal Acknowledged 20020613191319.000000+120               OvDnsDscr HP OpenView  Operations     Normal Acknowledged 20020614090237.000000+120                    None HP OpenView  Operations   ================================================================================                   Node name        OS Version                           Message ID ---------------------------------------------------------------------------------  NET-DPEN6450.LissWare.NET Windows 2000(5.0) 9f56fcd0-7eef-71d6-05bf-0a0a0a060000  NET-DPEN6450.LissWare.NET Windows 2000(5.0) 098fd400-7ef0-71d6-0b88-0a0a0a060000  NET-DPEN6450.LissWare.NET Windows 2000(5.0) bc12ae40-7ef0-71d6-0b88-0a0a0a060000  NET-DPEN6450.LissWare.NET Windows 2000(5.0) db5686a0-7ef0-71d6-05bf-0a0a0a060000  NET-DPEN6450.LissWare.NET Windows 2000(5.0) 6b8258d0-7f64-71d6-11fd-0a0a0a060000 

We recognize the different characteristics (severity, state, time received, etc.) of an OVOW message, as shown in Figure 5.33. Sample 5.17 shows how to code the logic retrieving the OVOW message list.

Sample 5.17: Retrieving a collection of OV_Message instances

start example

 ...: ...: ...: 232:    ' -- LIST ------------------------------------------------------------------------- 233:    If boolList Then 234:       Set objWMIOVMessages = objWMIServices.ExecQuery (strWQLQuery) ...: 237:       WScript.Echo objWMIOVMessages.Count & " message(s) to list." & vbCRLF 238: 239:       If objWMIOVMessages.Count Then 240:          WScript.Echo "OVOW Messages " & String (193, "=") & vbCRLF 241:          WScript.Echo "       Severity          State" & _ 242:                       "             Time received" & _ 243:                       "                              Object" & _ 244:                       "                    Application" & _ 245:                       "                      Node name" & _ 246:                       "           OS Version" & _ 247:                       "                           Message ID" 248:          WScript.Echo String (207, "-") 249: 250:          For Each objWMIOVMessage In objWMIOVMessages 251:              strSeverity = DecodeOVOWMessageSeverity (objWMIOVMessage.Severity) & _ 252:                            "(" & objWMIOVMessage.Severity & ")" 253:              strState = DecodeOVOWMessageState (objWMIOVMessage.State) & _ 254:                            "(" & objWMIOVMessage.State & ")" 255: 256:            Set objWMIManagedNode = objWMIServices.Get ("OV_ManagedNode.Name='" & _ 257:                                                        objWMIOVMessage.NodeName & "'") 258:            If Err.Number Then 259:               strPrimaryNodeName = "<ERROR>" 260:            Else 261:               strPrimaryNodeName = objWMIManagedNode.PrimaryNodeName 262:               strOSType = DecodeOVOWManagedNodeOSType (objWMIManagedNode.OSType) & "(" & _ 263:                           DecodeOVOWManagedNodeOSVersion (objWMIManagedNode.OSVersion) & ")" 264:            End If 265: 266:            WScript.Echo String (15 - Len (strSeverity), " ") & _ 267:                         strSeverity & " " & _ ...: 280:                         String (36 - Len (objWMIOVMessage.Id), " ") & _ 281:                         objWMIOVMessage.Id 282: 283:              Set objWMIManagedNode = Nothing 284:          Next 285:       Else 286:          WScript.Echo "No information available." & vbCRLF 287:       End If ...: 290:    End If 291: ...: ...: ...: 

end example

The first operation consists of retrieving a collection of instances by executing a WQL data query (line 234). The WQL data query is defined during the command parsing processing (lines 133 through 137 in Sample 5.16). The default WQL data query used is (line 135):

 Select * From OV_Message 

Of course, it is possible to specify another data query by using the /WQL-Query: switch on the command line (line 133). For example, a valid command line would be:

 C:\>OVOWMessageManager.wsf /Action:List /WQLQuery:"Select * From OV_Message Where Severity=4" 

where the severity number corresponds to the severity level listed in Table 5.39.

Table 5.39: The OV_Message and OV_ManagedNode Property Value Meanings

Severity

Unknown

1

Normal

2

Warning

4

Minor

8

Major

16

Critical

32

State

Undefined

1

Unowned

2

Owned

3

Acknowledged

4

Node Deleted

5

Deleted

6

SystemType

Alpha Family

35

Other

1

PA-RISC Family

144

Pentium Compatible

11

Power PC Family

27

SPARC Family

80

Source Type

Unknown

0x2000

MPE Console

0x2001

Open Message Interface

0x2002

Logfile Entry | Windows Event Log

0x2004

Measurement Threshold

0x2008

SNMP Interoeptor

0x2010

Message Stream Interface

0x2020

Reserved

0x2040

Reserved

0x2080

Scheduled Command

0x2100

Measurement Threshold

0x2200

Windows Management Interface

0x2400

OSType

AIX

9

HPUX

8

LINUX

36

SNMP

65535

Solaris

29

Tru64

6

Unknown

0

Windows 2000

58

Windows NT

18

Windows XP

101

Windows Server 2003

102

OSVersion

4.0

18000

2.6

29010

7

29020

8

29030

Red Hat 6.X

36206

Red Hat 7.X

36207

SuSE 6.X

36306

SuSE 7.X

36307

Turbo 6.X

36406

Turbo 7.X

36407

5.0

58000

V1

65535000

Once the WQL data query is completed, the script displays a header (lines 240 through 248) and enumerates all instances of the OV_Message class available for the specified WQL data query (lines 250 through 284). For each instance listed, Sample 5.17 retrieves and displays a specific set of properties:

  • The Severity level (lines 251 and 252) is decoded with the DecodeOVOWMessageSeverity() function included at line 64. The DecodeOVOWMessageSeverity() function uses the information shown in Table 5.39 to determine the corresponding severity text.

  • The Message State (lines 253 and 254) is decoded with the DecodeOVOWMessageState() function, also included at line 64. The DecodeOVOWMessageState() function uses information from Table 5.39 to determine the corresponding state text.

  • The Managed Node instance (lines 256 and 257) is retrieved by requesting an instance of the OV_ManagedNode class with the node identifier exposed by the NodeName property of the OV_Message class. An OV_ManagedNode instance represents a managed node (i.e., computer) in the OVOW world. The node identifier is nothing other than a GUID number generated by OVOW v7 for each node configured or discovered in OVOW.

  • The Managed Node name (line 261) corresponds to the DNS or WINS node name and is available from the PrimaryNodeName property exposed by the OV_ManagedNode class.

  • The Managed Node OS type and version (lines 262 and 263) are, respectively, decoded with the DecodeOVOWManagedNodeOSType() and DecodeOVOWManagedNodeOSVersion() functions included at line 63. The DecodeOVOWManagedNodeOSType() and DecodeOVOWManagedNodeOSVersion() functions use the information in Table 5.39 to determine the text corresponding to the OS type and version values.

  • The Message ID (lines 280 and 281) is the unique identifier of the message. Its value is a GUID number generated by OVOW. The script retrieves the message identifier by reading the ID property value exposed by the OV_Message class. The message identifier will be required to manage the various message attributes (severity, state, annotation, etc.)

From line 266 through 281, the script displays all these properties in a series of formatted columns.

It is possible to see all properties of an OVOW console message by referencing its GUID number (visible with the /Action:List switch) and the use of the /Action:View switch. For example, the following command line will show all properties of the OVOW message using the message identifier: 5bc2e7aO-7f66-71d6-09ae-0a0a0a060000:

  1:    C:\>OVOWMessageManager.wsf 5bc2e7a0-7f66-71d6-09ae-0a0a0a060000 /Action:View  2:    Microsoft (R) Windows Script Host Version 5.6  3:    Copyright (C) Microsoft Corporation 1996–2001. All rights reserved.  4:  5:    AcknowledgeAfterTroubleTicket: ........... FALSE  6:    AgentId: ................................. 059bbdd0-7eed-71d6-1e0e-0a0a0a060000  7:    Application: ............................. OS  8:    ConditionId: ............................. 000000000000000000000000000000000000  9:    CreateTroubleTicketInterface: ............ FALSE 10:    DoNotification: .......................... FALSE 11:    *Id: ..................................... 5bc2e7a0-7f66-71d6-09ae-0a0a0a060000 12:    InstructionAvailable: .................... FALSE 13:    IsProxied: ............................... FALSE 14:    LogOnly: ................................. FALSE 15:    MessageGroup: ............................ WINOSSPI-CORE 16:    MessageKey: .............................. net-dpen6450.LissWare.NET                                                   WINOSSPI-SysMon_CacheFaultsSec 17:    MessageKeyRelation: ...................... net-dpen6450.LissWare.NET                                                   WINOSSPI-SysMon_CacheFaultsSec 18:    NodeName: ................................ {A0151862-79D6-47F9-8952-97F563F29429} 19:    NumberOfAnnotations: ..................... 1 20:    Object: .................................. Cache 21:    OriginalId: .............................. 000000000000000000000000000000000000 22:    OriginalServiceId: ....................... WINOSSPI:NT:Memory:Cache@@<$MSG_NODE_ID> 23:    OriginalText: ............................ Monitor WINOSSPI-SysMon_CacheFaultsSec:                                                   Threshold: Scripting Value: 26.03 24:    ServiceId: ............................... WINOSSPI:NT:Memory:Cache@@{A0151862-79D6-...9429} 25:    Severity: ................................ Critical 26:    Source: .................................. WINOSSPI-SysMon_CacheFaultsSec(7.0) 27:    SourceType: .............................. 8 28:    State: ................................... Acknowledged 29:    Text: .................................... Object: Memory, Counter: Cache Faults/sec: 30:    The threshold of 20 has been crossed at 26! 31:    TimeCreated: ............................. 20020614091425.000000+120 32:    TimeOfStateChange: ....................... 20020614091934.000000+120 33:    TimeReceived: ............................ 20020614091425.000000+120 34:    Type: .................................... 35:    Unmatched: ............................... FALSE 36:    UsedNotificationInterfaces: .............. 37:    UserOfStateChange: ....................... SYSTEM 

The logic to display this information is not really different from the logic used for the /Action:List switch, and the output is similar to the one obtained with the GenericEventAsyncConsumer.wsf script used previously. This is illustrated in Sample 5.18.

Sample 5.18: Retrieving all properties of an OV_Message instance

start example

 ...: ...: ...: 291: 292:    ' -- VIEW ------------------------------------------------------------------------- 293:    If boolView Then 294:       Set objWMIOVMessage = objWMIServices.Get (cWMIClass & "='" & _ 295:                                                 arrayWMIOVMessages (0) & "'") ...: 298:       Set objWMIPropertySet = objWMIOVMessage.Properties_ 299:       For Each objWMIProperty In objWMIPropertySet 300:           Select Case objWMIProperty.Name 301:                  Case "AutomaticAction" 302:                       If IsObject (objWMIProperty.Value) Then 303:                          DisplayFormattedProperty objWMIOVMessage, _ 304:                                 objWMIProperty.Name, _ 305:                                 "Automatic Action", _ 306:                                 Null 307: 308:                          Set objWMIMessageAction = objWMIProperty.Value 309:                          DisplayFormattedProperties objWMIMessageAction, 2 310:                          Set objWMIMessageAction = Nothing 311:                          WScript.echo 312:                       End If 313:                  Case "OperatorAction" 314:                       If IsObject (objWMIProperty.Value) Then 315:                          DisplayFormattedProperty objWMIOVMessage, _ 316:                                 objWMIProperty.Name, _ 317:                                 "Operator Action", _ 318:                                 Null 319: 320:                          Set objWMIMessageAction = objWMIProperty.Value 321:                          DisplayFormattedProperties objWMIMessageAction, 2 322:                          Set objWMIMessageAction = Nothing 323:                          WScript.echo 324:                       End If 325:                  Case "Severity" 326:                       DisplayFormattedProperty objWMIOVMessage, _ 327:                              objWMIProperty.Name, _ 328:                              DecodeOVOWMessageSeverity (objWMIOVMessage.Severity), _ 329:                              Null 330:                  Case "SourceType" 331:                       DisplayFormattedProperty objWMIOVMessage, _ 332:                              objWMIProperty.Name, _ 333:                              DecodeOVOWMessageSourceType (objWMIOVMessage.SourceType), _ 334:                              Null 335:                  Case "State" 336:                       DisplayFormattedProperty objWMIOVMessage, _ 337:                              objWMIProperty.Name, _ 338:                              DecodeOVOWMessageState (objWMIOVMessage.State), _ 339:                              Null 340:                  Case Else 341:                       DisplayFormattedProperty objWMIOVMessage, _ 342:                              objWMIProperty.Name, _ 343:                              objWMIProperty.Name, _ 344:                              Null 345:           End Select 346:       Next 347:       Set objWMIPropertySet = Nothing 348: 349:       Set objWMIOVMessage = Nothing 350:    End If 351: ...: ...: ...: 

end example

First, the script retrieves the instance corresponding to the message ID given on the command line (lines 294 and 295). Since we can specify several message IDs separated by a column on the command line, the script converts all message IDs given in an array. This operation is completed during the command-line parsing at line 211 in Sample 5.16. This is why line 295 refers to the element zero of the array. Once done, the script enumerates all properties available from the OV_Message class. If a property requires a specific decoding, the Select Case statement will handle that for each property listed in the case. For example, we will recognize the decoding functions used previously for the severity and state properties. The SourceType property follows the same logic and is decoded by invoking the DecodeOVOWMessageSourceType() included at line 64. The AutomaticAction and OperatorAction properties are slightly different, since they expose an instance of the OV_MessageAction class. Instances of this class expose information about actions that must be performed in relation to the console message (automatic or operator actions). Since an OV_MessageAction instance is contained in these two properties, another set of properties is available. Therefore, the script invokes the DisplayFormattedProperties() function to display all its properties. Behind the scenes, the DisplayFormattedProperties() invokes the DisplayFormattedProperty() function to display the property values. These two functions are included at lines 67 and 68, respectively.

As previously mentioned, the OV_Message class also exposes a series of methods allowing the management of OVOW messages. From a scripting point of view, we can classify the methods into two categories:

  • The methods related to one specific instance of an OVOW message. These methods are: Acknowledge, Unacknowledge, Own, Disown, AddAnnotation, GetAnnotation, ModifyAnnotation, DeleteAnnotation, ChangeSeverity, ChangeText, GetInstruction, and CountMessages.

  • The methods not specifically related to one particular OVOW message but to a series of OVOW messages. These methods are: AcknowledgeMessages, UnacknowledgeMessages, OwnMessages, and DisownMessages.

As with the /Action:View command-line parameter, the management of a specific OV_Message instance starts with the retrieval of the OV_Message instance corresponding to the message ID specified on the command line. Some command-line examples managing an OVOW message are:

 C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000 /Action:Acknowledge C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000 /Action:Unacknowledge C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000 /Action:Own C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000 /Action:Disown 

The scripting technique is always the same for any of these command-line parameters. Sample 5.19 shows the code used to acknowledge an OVOW message. Only the invoked method differs if you want to unacknowledge, own, or disown an OVOW message.

Sample 5.19: Managing a specific OV_Message instance

start example

 ...: ...: ...: 352:    ' -- ACKNOWLEDGE ------------------------------------------------------------------ 353:    If boolAcknowledge Then 354:       Set objWMIOVMessage = objWMIServices.Get (cWMIClass & "='" & _ 355:                                                 arrayWMIOVMessages (0) & "'") ...: 358:       intRC = objWMIOVMessage.Acknowledge() 359:       If intRC Then 360:          OVOWErrorHandler (intRC) 361:       Else 362:          WScript.Echo "Message acknowledge successfully completed." 363:       End If ...: 366:    End If 367: ...: ...: ...: 

end example

The technique is pretty easy. The first step retrieves an instance of the OVOW message using the message ID given on the command line (lines 354 and 355). Next, the corresponding OV_Message method is invoked (line 358). If an error occurs, the OVOWErrorHandler() function is invoked to display the corresponding error message. This function is included at line 65.

Other methods, such as AddAnnotation, GetAnnotation, ModifyAnnotation, DeleteAnnotation, ChangeSeverity, ChangeText, GetInstruction, and CountMessages, follow the same logic. However, these methods require some extra parameters. For example, to change the message severity, the /Action:ChangeSeverity switch must be given with the /Severity:Minor switch to specify the severity level (see Sample 5.20). The severity level is converted to its corresponding value (see Table 5.39) during the command-line parsing parameters. An example command line would be:

 C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                            /Action:ChangeSeverity /Severity:Minor 

Sample 5.20: Changing the OVOW message severity level

start example

 ...: ...: ...: 547: 548:    ' -- CHANGE SEVERITY -------------------------------------------------------------- 549:    If boolChangeSeverity Then 550:       Set objWMIOVMessage = objWMIServices.Get (cWMIClass & "='" & _ 551:                                                 arrayWMIOVMessages (0) & "'") ...: 554:       intRC = objWMIOVMessage.ChangeSeverity(intSeverity) 555:       If intRC Then 556:          OVOWErrorHandler (intRC) 557:       Else 558:          WScript.Echo "Message ChangeSeverity successfully completed." 559:       End If ...: 562:    End If 563: ...: ...: ...: 

end example

After retrieving the OV_Message instance corresponding to the message ID given on the command line (lines 550 and 551), the script invokes the ChangeSeverity method with the desired severity level (line 554) input parameter. Next, the error handling is processed, as previously.

A final peculiarity in the scripting technique concerns the GetAnnotation method invocation—not especially in the command-line parameters, such as:

 C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000                            /Action:GetAnnotation /AnnotationNumber:1 

but more in the way that the annotation is returned by WMI. Sample 5.21 shows this.

Sample 5.21: Retrieving the OVOW message annotation

start example

 ...: ...: ...: 491: 492:    ' -- GET ANNOTATION --------------------------------------------------------------- 493:    If boolGetAnnotation Then 494:       Set objWMIOVMessage = objWMIServices.Get (cWMIClass & "='" & _ 495:                                                 arrayWMIOVMessages (0) & "'") ...: 498:       intRC = objWMIOVMessage.GetAnnotation(intAnnotationNumber, _ 499:                                             objWMIMessageAnnotation) 500:       If intRC Then 501:          OVOWErrorHandler (intRC) 502:       Else 503:          If Len (objWMIMessageAnnotation.Text) Then 504:             WScript.Echo "Message annotation: " & vbCRLF & vbCRLF & _ 505:                          objWMIMessageAnnotation.Text & vbCRLF 506:          Else 507:             WScript.Echo "Message Annotation not available." & vbCRLF 508:          End If 509:          WScript.Echo "Message GetAnnotation successfully completed." 510:       End If ...: 513:    End If 514: ...: ...: ...: 

end example

Once the OVOW message instance is retrieved (lines 494 and 495), the GetAnnotation method is invoked (lines 498 and 499). This method requires two parameters: one input parameter, which corresponds to the annotation number, and one output parameter, which is returned as an instance of the OV_MessageAnnotation class. Once this instance is retrieved, the script checks that the annotation text is not null by examining the length of the text property (line 503) and displaying the annotation text (lines 504 and 505) if it is available.

Instead of managing OVOW messages one by one, it is possible to acknowledge, unacknowledge, own, or disown a collection of messages. Some command-line examples are:

 C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000,098fd400-7ef0-71d6-0b88-0a0a0a060000                            /Action:AcknowledgeMessages C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000,098fd400-7ef0-71d6-0b88-0a0a0a060000                           /Action:UnacknowledgeMessages C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000,098fd400-7ef0-71d6-0b88-0a0a0a060000                            /Action: OwnMessages C:\>OVOWMessageManager.wsf 60ad8ae0-9014-71d6-08a8-0a0a0a060000,098fd400-7ef0-71d6-0b88-0a0a0a060000                            /Action:DisownMessages 

Because these OV_Message invoked methods do not refer to a particular OVOW message, the methods performing these actions are implemented as a static method (static qualifier set to true). Therefore, these methods must be invoked from an instance of a class (which means in this case an instance of the OV_Message class) and not from an instance of a real manageable entity (which means in this case, an instance of the OV_Message class created with a message ID). Sample 5.22 shows how to proceed.

Sample 5.22: Managing a series of OV_Message instances

start example

 ...: ...: ...: 367: 368:    ' -- ACKNOWLEDGE MESSAGES --------------------------------------------------------- 369:    If boolAcknowledgeMessages Then 370:       Set objWMIClass = objWMIServices.Get (cWMIClass) ...: 373:       intRC = objWMIClass.AcknowledgeMessages(arrayWMIOVMessages) 374:       If intRC Then 375:          OVOWErrorHandler (intRC) 376:       Else 377:          WScript.Echo "Messages acknowledge successfully completed." 378:       End If ...: 381:    End If 382: ...: ...: ...: 

end example

Instead of retrieving an instance corresponding to an OVOW message ID, the script retrieves an instance of the class only (line 370). Next, it invokes the AcknowledgeMessages method, which requires an array containing all message IDs of the OVOW messages that must be acknowledged (line 373). During the command-line parameters parsing, all message IDs given on the command line (and separated by a column) are stored in an array (line 211 in Sample 5.16). This technique is exactly the same for the UnacknowledgeMessages, OwnMessages, and DisownMessages methods.




Leveraging WMI Scripting
Leveraging WMI Scripting: Using Windows Management Instrumentation to Solve Windows Management Problems (HP Technologies)
ISBN: 1555582990
EAN: 2147483647
Year: 2003
Pages: 82
Authors: Alain Lissoir

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net