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