CentOS discovery in OpsMgr2007 R2 beta

Here we go again. Now that the OpsMgr2007 R2 beta is out, with an improved and revamped version of the System Center Cross Platform Extensions, I faced the issue of how to upgrade my test lab.

I have to say that OpsMgr2007 R2 beta release notes explain the known issues, and I had no trouble whatsoever upgrading the windows part. It just took its time (I am running virtual machines in my test lab, that don't have the best performance), but it went smoothly and without a glitch. In a couple of hours I had everything upgraded: databases, RMS, reporting, agents, gateway. All right then. The new purple icons in System Center look cute, and the new UI has some great stuff, such as a long-awaited way to update your management packs directly from the Internet, better display of Overrides (kind of what we used to rely on Override Explorer for)… andย  A LOT more new stuff that I won't be wasting my Sunday writing about since everybody else has already done it two days ago:

opsmgr aggregated feed on Twitter

Therefore let's get back to my upgrade, which is a lot more interesting (to me) than the marketing tam-tam ๐Ÿ™‚

As part of the upgrade to R2, I had to first uninstall the Xplat beta refresh bits, which I had installed, including all Unix Management Packs. Including my CentOS Management Pack I had improvised.

So this is the new start page of the integrated Discovery Wizard:

Discovery Wizard

Looks nice and integrates the functionality of discovering and deploying Windows machines, SNMP Devices, and Unix/Linux machines.

Of course, my CentOS machine would not be discovered, and showed up as an unsupported platform. Of course my old Management Pack I had hacked together in XPlat Beta 1 did not work anymore. Therefore, I figured out I had to see what changes were there, and how to make it work again (of course it IS possible – It is NOT SUPPORTED, but I don't care, as long as it works).

Since the existing agent could not be discovered, the first step I took was logging on the Linux box, un-install the old agent, and install the new one:

XPlat Agent RPM Install on CentOS

There I tried to discover again, but of course it still failed.

At that point I started taking a look at the new layout of things on the unix side. Most stuff is located in the same directories where beta1 was installed, and there are a bunch of useful commands under /opt/microsoft/scx/bin/tools.
You can check out the Open Pegasus version used:

[root@centos tools]# ./scxcimconfig –version
Version 2.7.0

Let's take a look at what SCX classes we have available:

./scxcimcli nc -n root/scx -di |grep SCX | sort

./scxcimcli nc -n root/scx -di |grep SCX | sort

Nice. That's the stuff we will be querying over WS-Man from the Management Server.

So let's look at the OS Discovery, and we test it from the OpsMgr 2007 box:

winrm enumerate http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx -username:root -password:password -r:https://centos:1270/wsman -auth:basic -skipCACheck

it returns results:

OS WS-Man Query

At first I assumed this worked like in Beta1, therefore I exported RedHat management pack and I made my own version of it, replacing the strings it is expecting to find to discover CentOS instead than Redhat.

While the MP was syntactically correct and would import fine, the Discovery wizard still didn't work.

I took one more look at the discoveries in the MP, and I found there are two more, targeted to Management Server, which is probably what gets used by the Discovery Wizard to understand what kind of agent kit needs to be deployed.

MP XML - Discoveries

So basically this discovery checks for the returned value from the module to determine if the discovered platform is a supported one:

Discovery Settings

But how does the module get its data?

Look at the layout of the /AgentManagement/UnixAgents folder on the Management Server:

/AgentManagement/unixAgents

That's it: GetOSVersion.sh – a shell script. A nice, open, clear text, hackable shell script. Let's take a look at it:

Discovery Script Hack

So that's it, and how my modification looks like. What happens during the discovery wizard is that we probably copy the script over SCP to the box, execute it, look at a number of things, and return the discovery data we need.

If you do those steps manually, you see how the script returns something very similar to a PropertyBag, just like discoveries done by VBScript on Windows machines:

Discovery Script Output

So after modifying the script… here we go. The Wizard now thinks CentOS is Red Hat, and can install an agent on it:

Discovery Wizard

Deploying Agent

Only when the Management Server discovery finally considers the CentOS machine worth managing, then the other discoveries that use WS-Man queries start kicking in, like the old one did, and find the OS objects and all the other hosted objects. In order for this to work you don't only need to hack the shell script, but to have a hacked MP – the "regular" Red Har one won't find CentOS, which is and remains an UNSUPPORTED platform.

CentOS Health Model

Disclaimer

The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my own personal opinion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
THIS WORK IS NOT ENDORSED AND NOT EVEN CHECKED, AUTHORIZED, SCRUTINIZED NOR APPROVED BY MY EMPLOYER, AND IT ONLY REPRESENT SOMETHING WHICH I'VE DONE IN MY FREE TIME. NO GUARANTEE WHATSOEVER IS GIVEN ON THIS. THE AUTHOR SHALL NOT BE MADE RESPONSIBLE FOR ANY DAMAGE YOU MIGHT INCUR WHEN USING THIS INFORMATION. The solution presented here IS NOT SUPPORTED by Microsoft.




15 thoughts on “CentOS discovery in OpsMgr2007 R2 beta

  • May 28, 2009 at 7:27 am
    Permalink

    Hi Daniele.

    Do you have any experience with Ubuntu server? Does OpsMgr R2 discover Ubuntu server and install an OpsMgr Agent on it so – for instance – the Novell MP for Apache can discover and monitor Apache on an Ubuntu server?

    Hope to hear from you.

    Best regards,
    Marnix

  • May 28, 2009 at 2:20 pm
    Permalink

    Not currently. Ubuntu and all debian-based distro's are not supported. The package for Redhat installs on CentOS just fine (they are pretty similar) and modifying the MP is easy, os you can get that to work pretty easily. But for different distributions you would technically need to build your own agent "package" by grabbing OpenPegasus's code at http://www.openpegasus.org/ . I am not sure if the SCX_ providers have been open sourced, or not, and under which license.

  • May 30, 2009 at 12:52 pm
    Permalink

    Marnix, you actually pushed me to test a bit more… check out for my next post!

  • July 7, 2009 at 10:18 am
    Permalink

    Hi Daniele,
    at the moment I'm playing with SCOM 2007 R2. I have 2 CentOS 5 servers. But I'm unable to get the MP for CentOS (5) not working. It only shows that it's alive but no server stats like, RAM/CPU/SWAP usage. ๐Ÿ™
    So my questions is if you have for me a working MP for CentOS 5 that I can import into SCOM 2007 R2? Thanks in advance…

  • July 12, 2009 at 1:16 pm
    Permalink

    As much as I would love to enable people to monitor other types of Linux Distributions, I cannot distribute a working MP, since it is basically based on *unsupported* reverse engineering of the original RedHat MP, as you understand, which is included in the product and copyrighted by Microsoft. But I believe that, in this serie of posts, I have explained pretty well how to proceed if you want to roll your own…

  • July 12, 2009 at 1:20 pm
    Permalink

    This said, if you have done the necessary monidifations/strings replacements in the MP, it might just be that not all objects (OS, CPU, network, etc…) have been discovered yet, therefore you don't get any monitoring going until they are. Try overriding the discoveries to speed up the process.

  • November 10, 2009 at 9:56 am
    Permalink

    HI ,
    I have been trying to see if data can be returned as property bag in a monitor type or composite data source type where we need a script to first run on linux and the out put can be put in property bag data. Using property bag approach will also make it easier to get the alert description to be more useful.
    Is this possible at all?

  • February 22, 2011 at 8:03 pm
    Permalink

    Hi,
    I tryed the same thing like you on a SCOM 2007 R2 CU4.
    I have edited the 2 MP from redhat (version 6.1.7000.277) and tryed to import them. The CentOS Linux 5 Operating MP tells me that it does not find the Microsoft.Linux.CentOS.Library. At the import I see that the MP has the corect name and the corect version.
    I have tryed importing it separatly not both at once.. and the same thing!
    Please HELP!

    Thank you in advanced

  • February 22, 2011 at 8:54 pm
    Permalink

    Update Regarding the issue:
    I found an issue if I export the MP in a unsealed MP with Get-ManagementPack | Export-ManagementPack I canot reimport it. I get the dependenci error.

  • February 22, 2011 at 9:23 pm
    Permalink

    Succes!
    I PublicKeyToken needs to be changed! ๐Ÿ™‚

  • April 27, 2011 at 7:02 pm
    Permalink

    @daniele, where did you find the Token.???

  • May 2, 2011 at 11:06 am
    Permalink

    MPs can be sealed with a key. When sealed, each depending MP will reference them by that key. I suggest you take a look at and get a bit familiar with the MP Schema here http://blogs.technet.com/b/authormps/archive/2011/02/24/management-pack-schema.aspx before walking into this territory.
    In particular, the Reference is explained here http://msdn.microsoft.com/en-us/library/ee533847.aspx
    For an easier-to-follow step-by-step guide on how to convert the RedHat MP to work with CentOS, use the guide (it is split across multiple articles) from Robert here http://blogs.msdn.com/b/scxplat/archive/2010/01/15/building-a-centos-management-pack-part-2.aspx

Comments are closed.

%d bloggers like this: