UPDATE 8/27/2012 – This worked on SCOM 2007 R2 but will most likely not work on SC 2012.
As part of my learning process in joining the Cross Platform & Interop team (some might call it hazing!), I recently built my first-ever Operations Manager Management Pack. It wasn’t exactly a “Hello World” MP (I built a CentOS MP) but those that know me would say that’s typical of me. I like to dive down and get going when I discover new things. Given that CentOS is a derivative of the Red Hat distro, it wasn’t really difficult to build, but it took some understanding of the discovery mechanisms and how Linux agents are deployed and installed. Much thanks goes to Barry Shilmover for the assistance to the new guy! My goal in this article is to describe the process I went through and provide enough detail and background info so you could take this and not only create your own CentOS MP (which you really don’t need to do since I will include the XML), but take the knowledge you get here and apply it to other distributions and create MPs for distros like Oracle Enterprise Linux (another Red Hat derivative) or just new versions of existing supported platforms.
Note from the legal dept: The CentOS management pack described here, and other MPs created using this process, are not officially supported by Microsoft and are provided only as examples and community samples.
Acknowledgement: Though I built this MP from start to finish on my own, learning the hard way about a number of different potential pitfalls, I’d like to give credit to Dan Muscetta who actually did a Red Hat to CentOS conversion some time ago (see his blog post here). Dan is a Microsoft Premier Field Engineer based in Rome and does a lot with OpsMgr cross platform and other Linux OSes. Look for more from Dan in the future!
I will assume you already have some of the prerequisites set up here, like an OpsMgr 2007 R2 Management Server, a Windows Server 2008 R2 Hyper-V server (you can even host a VM of the OpsMgr server), the System Center Operations Manager 2007 R2 Cross Platform Update downloaded and installed, and access to the CentOS distribution ISO file(s).
The first thing I did was set up a CentOS virtual machine on my Hyper-V server host. CentOS 5.4 installed easily, and I also added the Linux Integration Components for Windows Server 2008 R2 (version 2.0) for Hyper-V (even though SUSE was the supported platform). I used the default installation but made sure that development components were installed. I set the firewall to disabled and SELinux setting to permissive. In a real environment, these settings would likely be different, but I’m just testing here, and being new to all this, I took it easy on myself.
Once the CentOS VM was up and running, I needed to test the existing Red Hat agent on the CentOS machine. This would tell me whether this was going to be a simple find & replace of XML strings or whether it was going to require some C++ coding.
Handy Tip: The UNIX and Linux agents are located in the following directory on the OpsMgr server:
C:\Program Files\System Center Operations Manager 2007\AgentManagement\UnixAgents
Since I was looking for the Red Hat agent, I looked for “RHEL” and I found the most appropriate agent, which was scx-1.0.4-252.rhel.5.x64.rpm.
Note: At first I tried scx-1.0.4-248.rhel.5.x64.rpm and wondered why it wasn’t installing. I then realized that the file was just a text file, and that the latest update of the cross platform support for OpsMgr had installed new agents (the 252 version) and changed the 248 version agents to the text files. So, make sure you look further down the directory listing for the latest agent before you try to install it.
In order to get the agent to the CentOS computer, I used PuTTY Secure Copy (pscp.exe) to push the file over from the OpsMgr server to the VM. This is run from a command prompt on the OpsMgr server:
pscp -p -pw <password> <source file to copy> root@<server>:<dest filename>
I then ran rpm -i scx-1.0.4-248.rhel.5.x64.rpm on the CentOS VM and waited for it to finish. I verified the package was installed by typing rpm –q scx, which returned “scx-1.0.4-252”. I verified the CIM daemon was running by typing service scx-cimd status, which returned “Checking for service Microsoft SCX CIM Server scxcimserver (pid 18106) is running…”
So the agent package installed and the CIM server is running. Now I need to check if the CIM classes have been created and populated. I could do that either from the CentOS client using the scxcimcli utility, or by using WinRM from the OpsMgr server. For now I just used the local scxcimcli utility. I typed the following commands and verified the information was being populated:
- ./opt/microsoft/scx/bin/tools/scxcimcli -n root/scx ei SCX_OperatingSystem
- ./opt/microsoft/scx/bin/tools/scxcimcli -n root/scx xq “select name from SCX_DiskDrive”
- ./opt/microsoft/scx/bin/tools/scxcimcli -n root/scx xq “select * from SCX_FileSystemStatisticalInformation”
Here is the output for the first command:
Ok, so I’ve successfully installed the agent and verified that things appear to be worked as expected. This is good news! It means that apparently using the existing Red Hat agent is good enough to provide initial support for CentOS, and that I won’t have to go writing C++ code.
Up next – creating a management pack to actually use the information.