SCOM 2012: Monitoring a UNIX/Linux CIM Property (WS-Man Enumeration)

Return to section contents

Monitoring the Value of a CIM Property

This example assumes the use of the UNIX/Linux Authoring Library example MP. For more information on creating and building the MP authoring project, see Getting Started*.
*
This example demonstrates monitoring of CIM property, retrieved through a WS-Man Enumeration. In this case, the PercentUserTime property of the SCX_UnixProcessStatisticalInformation class is evaluated for the process instance with the name: mydaemon, with a “Greater Than” threshold evaluation.

For additional information about the UnitMonitorType used in this example, as well as other WS-Man Enumeration monitor types, review the documentation of the following Monitor Types in the Unix.Authoring.Library Module Reference:

  • UNIX/Linux WS-Man Enumeration Matches Expression Two-State Monitor Type
  • UNIX/Linux WS-Man Enumeration Less Than Threshold Three-State Monitor Type
  • UNIX/Linux WS-Man Enumeration Greater Than Threshold Three-State Monitor Type

Note:  contents located between pairs of ## characters should be customized for your environment.  This includes ID and property values. Be sure to remove the ## characters before building the MP.

<``ManagementPackFragment SchemaVersion``=``"2.0" xmlns:xsd``=``"http://www.w3.org/2001/XMLSchema"``>

<Monitoring>
<Monitors>
<UnitMonitor ID="##MyMP.WSManEnumGreaterThan.Monitor##" Accessibility="Internal" Enabled="true" Target="##MyMP.MyCustomRole##" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.WSManEnumeration.GreaterThanThreshold.ThreeState.MonitorType" ConfirmDelivery="false">
  <Category>AvailabilityHealth</Category>
  <AlertSettings AlertMessage="MyMP.WSManEnumGreaterThan.Monitor.AlertMessage">
    <AlertOnState>##Warning##</AlertOnState>
    <AutoResolve>true</AutoResolve>
    <AlertPriority>Normal</AlertPriority>
    <AlertSeverity>##MatchMonitorHealth##</AlertSeverity>
    <AlertParameters>
      <AlertParameter1>
        ##$Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$##
      </AlertParameter1>
      <AlertParameter2>##$Data/Context/Value$##</AlertParameter2>
    </AlertParameters>
  </AlertSettings>
  <OperationalStates>
    <OperationalState ID="StatusOK" MonitorTypeStateID="StatusOK" HealthState="Success" />
    <OperationalState ID="StatusWarning" MonitorTypeStateID="StatusWarning" HealthState="Warning" />
    <OperationalState ID="StatusError" MonitorTypeStateID="StatusError" HealthState="Error" />
  </OperationalStates>
  <Configuration>
    <Interval>300</Interval>
    <TargetSystem>
      $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$
    </TargetSystem>
    <Uri>
      ##http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_UnixProcessStatisticalInformation?__cimnamespace=root/scx##
    </Uri>
    <WSManFilter>##Select Name,PercentUsedMemory,PercentUserTime from SCX_UnixProcessStatisticalInformation##</WSManFilter>
    <ObjectName>##Process##</ObjectName>
    <CounterName>##Percent User Time##</CounterName>
    <InstanceXPath>
      ##/DataItem/WsManData/*[local-name(.)='SCX_UnixProcessStatisticalInformation']/*[local-name(.)='Name'] ##
    </InstanceXPath>
    <InstanceName>##mydaemon##</InstanceName>
    <FilterExpression>
      <Not>
        <Expression>
          <Exists>
            <ValueExpression>
              <XPathQuery Type="String">WsManData/ErrorCode</XPathQuery>
            </ValueExpression>
          </Exists>
        </Expression>
      </Not>
    </FilterExpression>
    <Value>
      ##$Data/WsManData/*[local-name(.)='SCX_UnixProcessStatisticalInformation']/*[local-name(.)='PercentUserTime']$ ##
    </Value>
    <WarningThreshold>##10##</WarningThreshold>
    <ErrorThreshold>##20##</ErrorThreshold>
    <NumSamples>##2##</NumSamples>
  </Configuration>
</UnitMonitor>
 
</Monitors>
</Monitoring>
<Presentation>
<StringResources>
<StringResource ID="##MyMP.WSManEnumGreaterThan.Monitor.AlertMessage##" />
</StringResources>
</Presentation>
<LanguagePacks>
<LanguagePack ID="ENU" IsDefault="true">
<DisplayStrings>
  <DisplayString ElementID="##MyMP.WSManEnumGreaterThan.Monitor##">
    <Name>##mydaemon Percent User Time Monitor##</Name>
    <Description>##Monitors the Percent User Time of the process: mydaemon and generates an alert if the warning or error threshold is exceeded. ##</Description>
  </DisplayString>
  <DisplayString ElementID="##MyMP.WSManEnumGreaterThan.Monitor.AlertMessage##">
    <Name>##mydaemon Percent User Time is too high##</Name>
    <Description>##The Percent User Time for the mydaemon process on the host: {0} is greater than the threshold. The Percent User Time is: {1}##</Description>
  </DisplayString>
  <DisplayString ElementID="##MyMP.WSManEnumGreaterThan.Monitor##" SubElementID="StatusOK">
    <Name>StatusOK</Name>
    <Description>StatusOK</Description>
  </DisplayString>
  <DisplayString ElementID="##MyMP.WSManEnumGreaterThan.Monitor##" SubElementID="StatusWarning">
    <Name>StatusWarning</Name>
    <Description>StatusWarning</Description>
  </DisplayString>
  <DisplayString ElementID="##MyMP.WSManEnumGreaterThan.Monitor##" SubElementID="StatusError">
    <Name>StatusError</Name>
    <Description>StatusError</Description>
  </DisplayString>
</DisplayStrings>
</LanguagePack>
</LanguagePacks>
</ManagementPackFragment>