Share via


SCOM 2012: Monitoring a UNIX/Linux Process for a Role

Return to section contents

Monitoring a UNIX/Linux Process

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 Management Pack Fragment demonstrates monitoring of a specified process (mydaemon), where an alert will be generated if the count of running instances of the process is outside of the defined minimum and maximum thresholds. The process is specified by name, but an optional Regular Expression can be added (ArgumentsFilterExpression) to monitor only processes with the specified name and process arguments matching the Regular Expression.

For additional information about the UnitMonitorType used in this example, review the documentation of the following Monitor Type in the Unix.Authoring.Library Module Reference:

  • UNIX/Linux Process Count 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.MyProcess.Monitor##" Accessibility="Public" Enabled="true" Target="##MyMP.MyCustomRole##" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="UnixAuth!Unix.Authoring.WSManEnumeration.ProcessCount.MonitorType" ConfirmDelivery="false">
  <Category>AvailabilityHealth</Category>
  <AlertSettings AlertMessage="##MyMP.MyProcess.Monitor.AlertMessage##">
    <AlertOnState>##Error##</AlertOnState>
    <AutoResolve>true</AutoResolve>
    <AlertPriority>Normal</AlertPriority>
    <AlertSeverity>##Error##</AlertSeverity>
    <AlertParameters>
      <AlertParameter1>
        ##$Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$##
      </AlertParameter1>
      <AlertParameter2>##$Data/Context///*[local-name()="Count"]$##</AlertParameter2>
    </AlertParameters>
  </AlertSettings>
  <OperationalStates>
 <OperationalState ID="ProcessCountOK" MonitorTypeStateID="ProcessCountOK" HealthState="Success" />
 <OperationalState ID="ProcessCountError" MonitorTypeStateID="ProcessCountError" HealthState="Error" />
  </OperationalStates>
  <Configuration>
    <Interval>300</Interval>
    <TargetSystem>
      $Target/Host/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$
    </TargetSystem>
    <ProcessName>##mydaemon##</ProcessName>
    <ArgumentsFilterExpression></ArgumentsFilterExpression>
    <MinProcessCount>##1##</MinProcessCount>
    <MaxProcessCount>##5##</MaxProcessCount>
  </Configuration>
</UnitMonitor>
</Monitors>
</Monitoring>
<Presentation>
<StringResources>
<StringResource ID="##MyMP.MyProcess.Monitor.AlertMessage##" />
</StringResources>
</Presentation>
<LanguagePacks>
<LanguagePack ID="ENU" IsDefault="true">
<DisplayStrings>
  <DisplayString ElementID="##MyMP.MyProcess.Monitor##">
    <Name>##MyRole Process Monitor##</Name>
    <Description>##Process monitor for the mydaemon process##</Description>
  </DisplayString>
  <DisplayString ElementID="##MyMP.MyProcess.Monitor.AlertMessage##">
    <Name>##Too many or too few mydaemon processes##</Name>
    <Description>##The count of running instances of the mydaemon process on host {0} is outside of the defined threshold range. The current count is {1}##</Description>
  </DisplayString>
  <DisplayString ElementID="##MyMP.MyProcess.Monitor##" SubElementID="ProcessCountOK">
    <Name>ProcessCountOK</Name>
    <Description>ProcessCountOK</Description>
  </DisplayString>
  <DisplayString ElementID="##MyMP.MyProcess.Monitor##" SubElementID="ProcessCountError">
    <Name>ProcessCountError</Name>
    <Description>ProcessCountError</Description>
  </DisplayString>
</DisplayStrings>
</LanguagePack>
</LanguagePacks>
</ManagementPackFragment>