Using OpsMgr Class Inheritance to Extend Monitoring to New (Unsupported) Operating Systems
I got an email the other day from a customer who asked if we were planning on supporting Red Hat desktop anytime soon. It seems that they’ve installed the desktop versions on their servers instead of the server versions, and since the Management Packs included with Operations Manager R2 support only Red Hat Enterprise Linux (RHEL), and are geared to discovering that specific OS, their desktop systems won’t get discovered properly. It seems the agents get pushed out and installed properly, but none of the discoveries are working, so the machine sites there not being monitored.
Well, since I was already working on my other article on porting a Red Hat MP to work for CentOS, I thought it was an opportune time to see if I could generate a quick MP extension to make this work. I thought that the real problem was that the initial computer and OS discoveries were not working (because it was RHED instead of RHEL), but all the other monitors, rules, diagnostics and recoveries should be exactly the same. So, I worked on a hunch that if I could get OpsMgr to discover these systems and then act like they were actually RHEL machines (discover them using the RHEL classes), everything would work. My hunch worked, and the systems began getting discovered properly, so I thought I’d share the MP I created.
Differences between RHED and RHEL
The main differences between the discoveries that the RHEL MP performs and what the RHED OS provides are small. When you look at the computer discovery in the RHEL MP (OS discovery is the same), you can see that it’s looking for a specific value in the “Caption” property:
<FilterProperty>//*[local-name()="Caption"]</FilterProperty>
<FilterValue>Red Hat Enterprise Linux Server release 5</FilterValue>
In order for this to work with the desktop OS, it needs to be changed to this:
<FilterProperty>//*[local-name()="Caption"]</FilterProperty>
<FilterValue>Red Hat Enterprise Linux Client release 5</FilterValue>
Making this into an MP
Ok, so now that we know these differences, how can we make this into an MP that enables monitoring these machines? The key is in taking these new discoveries and making them apply to the existing targets and discovery classes. For the Operating System discovery, the existing RHEL MP has the Targets and DiscoveryClasses shown below:
This means that when the computer matches the “Caption” property filter, a RHEL.5.Computer object is created, and that this class belongs to the Linux.RedHat.Computer object.
This means that when the computer matches the “Caption” property filter, a RHEL.5.OperatingSystem object is created, belonging to the RHEL.5.Computer object created above.
So, if we want to take our RHED discoveries and make them discover as RHEL machines, all we have to do is give our new discoveries a Target and DiscoveryClass the same as the RHEL MP. The resulting XML looks like this:
The only other things that need to be done for this MP are to define the ClassTypes (which are really just definitions for the abbreviations used for targets), and to specify the other MPs that this MP will reference. Here’s how that looks:
The result is that one you import this Management Pack, any Red Hat Desktop systems you have in your environment will look exactly like RHEL systems! This technique is useful when you have other Linux versions or distros that don’t match the supported platforms list but where the agent installs just fine and all you care about is that the systems are monitored. Of course, if you actually want to have RHED systems show up as RHED instead of RHEL, you’ll have to do a lot more than this. You'll probably want to replicate a lot more of the MP and make other changes, but instead of referencing the RHEL classes, you’ll be making new RHED classes so those new object types will appear in OpsMgr.
The sample XML file from this article is attached below. Good luck!