Now that we are aware of the internals of syslog module, internals of managed discovery data mapper module, this blog-post aims at providing an example of how various modules in OM 2007 can be connected, configured and leveraged for various purposes.
Let us define the health of a host such that any syslog message generated by it with a severity less than 4 indicates something bad. So, how do we make this happen in OM 2007? We would first need a managed type. So, lets define that:
<ClassType ID="Demo.Syslog.IP" Accessibility="Public" Base="System!System.LogicalEntity" Hosted="false" Abstract="false">
<Property ID="IP" Type="string" Key="true" CaseSensitive="false" />
</ClassType>
Now, that we have this managed type, we need a discovery rule to submit various discovery instances of it. Let's add that to our demo MP too.
<Discovery ID="Demo.Syslog.Discovery" Target="SCLibrary!Microsoft.SystemCenter.RootManagementServer" Enabled="true" ConfirmDelivery="true">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Demo.Syslog.IP" />
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Demo.Syslog.Discovery.ModuleType" />
</Discovery>
The data source module 'Demo.Syslog.Discovery.ModuleType' used above would basically be a combination of 2 modules: Syslog and Discovery Data Mapper. The syslog receiver module outputs syslog data which has the hostName element which is used by discovery data mapper module to convert it into discovery data for 'Demo.Syslog.IP' class type. See attached MP for details.
Now, that instances are available in OM 2007, they can be viewed by creating a state view targeted towards the new type 'Demo.Syslog.IP' defined. The attached MP already defines one in a new folder 'Syslog Views' and so importing it into an existing installation of OM 2007 should suffice.
Next is addition of a monitor type and monitor to compute the health of the ''Demo.Syslog.IP' class type. For computation of the state, we would need information about the last message generated by the host. Let us add a few more properties to the class type then:
<ClassType ID="Demo.Syslog.IP" Accessibility="Public" Base="System!System.LogicalEntity" Hosted="false" Abstract="false">
<Property ID="IP" Type="string" Key="true" CaseSensitive="false" />
<Property ID="LastFacility" Type="int" Key="false" />
<Property ID="LastSeverity" Type="int" Key="false" />
<Property ID="LastPriority" Type="int" Key="false" />
<Property ID="LastPriorityName" Type="string" Key="false" />
<Property ID="LastTimeStamp" Type="string" Key="false" />
<Property ID="LastMessage" Type="string" Key="false" />
</ClassType>
Discovery data submitted by the discovery data mapper module will retreive information of the above extra fields from syslog message itself. We define the monitor type 'Demo.Syslog.MonitorType' to do a comparison such that the last facility value is greater than or equal to a least facility value, and that the priority name value matches a regular expression, and so on. See the attached MP for more details.
Now, that such a monitor type is defined, let us see how we use this to define a monitor associated with the 'Demo.Syslog.IP' class type.
<UnitMonitor ID="Demo.Syslog.Monitor" TypeID="Demo.Syslog.MonitorType" Target="Demo.Syslog.IP" Accessibility="Public" Enabled="true" ParentMonitorID="Health!System.Health.AvailabilityState" ConfirmDelivery="true">
<Category>Alert</Category>
<AlertSettings AlertMessage="Demo.Syslog.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>High</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
<AlertParameters>
...
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState HealthState="Success" MonitorTypeStateID="Healthy" ID="Regular"/>
<OperationalState HealthState="Error" MonitorTypeStateID="Unhealthy" ID="Iregular"/>
</OperationalStates>
<Configuration>
<LastFacility>$Target/Property[Type="Demo.Syslog.IP"]/LastFacility$</LastFacility>
<LastSeverity>$Target/Property[Type="Demo.Syslog.IP"]/LastSeverity$</LastSeverity>
<LastPriority>$Target/Property[Type="Demo.Syslog.IP"]/LastPriority$</LastPriority>
<LastPriorityName>$Target/Property[Type="Demo.Syslog.IP"]/LastPriorityName$</LastPriorityName>
<LastTimeStamp>$Target/Property[Type="Demo.Syslog.IP"]/LastTimeStamp$</LastTimeStamp>
<IP>$Target/Property[Type="Demo.Syslog.IP"]/IP$</IP>
<LastMessage>$Target/Property[Type="Demo.Syslog.IP"]/LastMessage$</LastMessage>
<MinutesFrequency>10</MinutesFrequency>
<LeastFacility>0</LeastFacility>
<LeastSeverity>4</LeastSeverity>
<LeastPriority>0</LeastPriority>
<PriorityNameRegexPattern>.*</PriorityNameRegexPattern>
<TimeStampRegexPattern>.*</TimeStampRegexPattern>
<HostNameRegexPattern>.*</HostNameRegexPattern>
<MessageRegexPattern>.*</MessageRegexPattern>
</Configuration>
</UnitMonitor>
In the above monitor definition, we also specified an alert to be generated when the state of an entity goes unhealthy. The above configuration means generate an alert and compute the state of an entity of class type 'Demo.Syslog.IP' as unhealthy when
-
the facility is less than 0 or
-
severity is less than 4 or
-
priority is less than 0 or
-
priority name/time stamp/host name/message doesn't match the regular expression ".*".
Overrides are defined for these threshold values which can be modified in the authoring pane of OM 2007 Console.
To summarize, the attached DEMO MP once imported into the system enables syslog listening on root management server and creates instances of various host names it discovers. At the same time, it computes health of each host which can be overridden using overrides for the 'Demo.Syslog.MonitorType' monitor type.