SCOM is a great tool for monitoring cross platform systems as for example Linux or other Unix derivate. Although Microsoft invested a lot in cross platform monitoring, one thing I am missing is a way for dynamic grouping Unix/Linux systems in SCOM.
What is the problem?
As you might know in SCOM you can create attributes (registry or WMI discoveries) which extend a selected class. This extended class can be used in a dynamic group where you filter for the appropriate attribute. Kevin Holman has written long time ago a very good blog post about these steps. Well something similar I am missing in SCOM for Unix/Linux systems. Because of that I decided to create a test management pack / solution using Visual Studio Authoring Extensions (VSAE).
I found some fundamental steps on TechNet where some cross platform authoring is well explained. Of course if you want to know more about authoring management packs using VSAE there is the best Authoring Guide from Brian Wren on TechNet Wiki. I highly recommend this guide for starting MP authoring!
How does the this solution look like at the end?
Before you can start, your Linux systems need to be monitored by SCOM 2012. If you need some help, I created some time ago a few blog posts about Linux monitoring.
If your Linux monitoring works create a text file in /tmp called type.txt…
and write PRODUCTION…
save the changes and quit.
After a minute you will have an extended Linux class with an additional custom attribute…
You can now use this attribute to dynamically group the Linux servers…
Isn’t that cool, huh :)?
How does it work?
First I created a custom class Linux.Dynamic.Group.ComputerRole with two additional properties OperatingSystem and Attribute…
<ClassType ID=“Linux.Dynamic.Group.ComputerRole“ Accessibility=“Public“ Abstract=“false“ Base=“MLSL!Microsoft.Linux.SUSE.Computer“ Hosted=“false“ Singleton=“false“ Extension=“false“>
<Property ID=“OperatingSystem“ Type=“string“ AutoIncrement=“false“ Key=“false“ CaseSensitive=“false“ MaxLength=“256“ MinLength=“0“ Required=“false“ Scale=“0“ />
<Property ID=“Attribute“ Type=“string“ AutoIncrement=“false“ Key=“false“ CaseSensitive=“false“ MaxLength=“256“ MinLength=“0“ Required=“false“ Scale=“0“ />
Next we need to discover the Linux systems and create instances of your custom class. Therefore I created a discovery Linux.Dynamic.Group.Computer.Discovery which is going to discover all SUSE Linux system and map the caption value to the OperatingSystem property. Note here the “SUSE” FilterValue which will scan the caption entry on each system of the Microsoft.Unix.Computer class…
At this moment we have an instance of the Microsoft.Linux.SUSE.Computer class created and have an additional attribute OperatingSystem “attached”.
The next step is to find a way to read some information from our newly created Linux instance and attach (extend) this information to our object. I found the easiest way is to read a text file and get the information from this text file.
As an example, we create a text file called type.txt on the Linux server in the directory /tmp and write for example PRODUCTION into this type.txt file. Now we need another discovery to read this information from the text file. For that purpose I created a discovery called Linux.Dynamic.Group.Computer.Discovery.Attribute which executes the command cat /tmp/type.txt and returns the string PRODUCTION. This string is mapped to the Attribute value of our custom class. It looks like this…
<Input><![CDATA[ <p:ExecuteCommand_INPUT xmlns:p=”http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem”><p:command>cat /tmp/type.txt</p:command><p:timeout>10</p:timeout></p:ExecuteCommand_INPUT>]]></Input>
<FilterValue>No such file or directory</FilterValue>
Finally we have our custom class extended with information from both discoveries…
How does it look in the SCOM console?
If you go to Object Discoveries in your SCOM console and filter the scope by typing “SCOMFAQ” you will find the two discoveries. The first discovery is targeted at Unix/Linux Computer class (Linux Dynamic Group Computer Discovery) and the second discovery is targeted at the Linux Computer Class Extended (Linux Dynamic Group Computer Discovery Attribute). The default discovery interval for both discoveries is set to 60 seconds which is NOT for production(!) just for testing. You can override the intervals as needed.
If you open Properties for Linux Dynamic Group Computer Discovery Attribute discovery and choose to override the discovery for the Linux Computer Class Extended, you can override the path to the text file which is being discovered on the Linux server for the attribute. This allows you to customize a location for your type.txt file which is appropriate for you…
If go to Discovered Inventory and select the custom class Linux computer Class Extended you will see this…
Visual Studio Authoring Extensions (VSAE)
To create the MP I used the Visual Studio Authoring Extensions. You can download the extensions here and make sure you have the Visual Studio 2010 Professional installed before installing the extensions.
If you open the solution you will find the following fragments and templates…
- Classes.mpx => This contains custom classes and descriptions
- Discoveries.mptg => Discovery template for the 2 discoveries discussed above
- DSDiscoveryAttribute.mpx => Data source and modules for the custom discovery Linux.Dynamic.Group.Computer.Discovery.Attribute
- ManagementPack.mpx => Metadata about the MP (display name etc.)
What is the purpose?
As I mentioned before by extending the Linux class through attributes your are able to utilize this attribute to create dynamic groups in SCOM. Building those dynamic groups is the same, as you would build dynamic groups for a Windows system. These groups can be used to scope down views or overrides for production, preproduction or development systems in SCOM. You also could group the Linux system according to some other criteria you just need to specify the appropriate string in the type.txt file.
For example this Extended Linux Attribute can be used to filter state views…
And there are many more use cases…
Where can I download the MP?
Please keep in mind this MP works, but you need to adapt it to your needs. For example adjust the discoveries and intervals as it fits your requirements. The MP is unsealed and is meant for testing and as a starting point for building final solutions.
For your convenience you can download the the unsealed MP or the entire VSAE solution.
I hope this helps you and if you have any additional ideas or suggestions please let me know!