Building a CentOS Management Pack (part 3)

In part 1 of this article, I talked about the basics of building a CentOS Management Pack, beginning with trying out the Red Hat agent. In part 2, I talked about how to build the actual MPs. Now I need to actually install the MPs and make sure it all works.

Importing the Management Packs

To import the MPs:

  1. Go to the OpsMgr console and from the Administration pane on the left, right-click on Management Packs and select Import Management Packs.
    image
  2. Click Add > Add from Disk and then click on No at the Online Catalog Connection prompt.
  3. Select the library MP file (not the XML file) and the CentOS.5 XML file, and click OK.
    image
  4. You’ll see the two MPs in the list for import. Click Install. The MPs begin importing and each will show status of Imported when done.
    image
  5. Click Close to exit the wizard.

Deploying the Agent

II made sure I uninstalled the SCX agent from my test machine (using “rpm –e scx”) so that I could test agent deployment, which would now be automated. Just to be absolutely sure it would be a clean install, I made sure all “microsoft” directories were removed from /opt, and /etc/opt (which also removed the certificate). I also deleted the computer from OpsMgr.

Now we need to go through discovery and deployment of the agent. Right-click inside the Administration pane in OpsMgr and select Discovery Wizard. Select Unix/Linux computers and click Next. Click Add, enter the appropriate information for the remote computer, and enter root-level credentials. Click OK when done to save the entry.

image

Note: Make sure Enable SSH based discovery is checked or you’ll have to manually install the agent.

Click Discover. The discovery process starts and when complete, you should see something similar to this:

image

Note that it shows the operating system as CentOS. This means that the discovery in the MP we imported worked successfully. However, it’s set to “No Action” and if I click Details, the dialog states that this is an unsupported platform.

It just so happened that I was running the DebugView utility during my discovery, which allowed me to see some deeper information about what was going on. Looking at the output, I see the following:

Return from DiscoveryTaskHelper.GetSupportedAgentInfo() Microsoft.MOM.UI.Console.exe Error: 0 : 10.10.10.15: Did not find a matching supported agent.

The issue is that when the discovery runs, it returns information from the computer telling it the OS, architecture and other information. This information is matched against the MP’s discovery info, and then an agent file name is built from the settings information. If the agent file is not found in the AgentManagement\UnixAgents directory under OpsMgr’s installation directory, then this error occurs.

Here’s the XML that the discovery script returns to the Management Server:

<DiscoveredOS> <Hostname>myhost.microsoft.com</Hostname> <OSName>CentOS</OSName> <OSAlias>CentOS</OSAlias> <Version>5.4</Version> <Arch>x86_64</Arch> <IsLinux>true</IsLinux> </DiscoveredOS>

These values are mapped to the MP’s discovery settings like this:

  • OSAlias -> OS
  • Version -> MinVersion (only the major version is compared)
  • Arch -> Arch

Going back to the first part of this article, I see that the Red Hat agent files begin with “scx-1.0.4-252.rhel.5". So, I find the two files (one for x86 and one for x64) and create copies of them, and then rename the copies to the following:

  • scx-1.0.4-252.centos.5.i386.rpm
  • scx-1.0.4-252.centos.5.x86_64.rpm

This corresponds to the following properties in the Discovery Settings:

Property Name

Value in MP

Value in agent file name

Comparison

Version

1.0.3

1.0.4

If version of agent file is => this version, it can be used

Build

106

252

If build of agent file is => this build #, it can be used

OS

CentOS

CentOS

Must be equal

KitOSVersion

5

5

Must be equal

ArchKitName

x86_64

x86_64

Must be equal

Ext

rpm

rpm

Must be equal

After creating these files, I restarted the System Center Management and System Center Management Configuration services to make sure that everything was reloaded and not cached, or the discovery could fail again because OpsMgr didn’t know about the changes. After going back through the Discovery Wizard, I can see the output changed. The Action now shows as “Install Agent and Discover” and clicking on the Details button displays the message “Install agent and discover computer instance into Operations Manager.”

image

I can now select the checkbox next to the computer and the Next button is enabled. Click Next to start the deployment process. The Status field on the wizard will update as different actions occur.

image

If everything was successful, the status will display as such, and you can now click Done to end the process. If things didn’t work (probably a certificate error), then you can troubleshoot that and try again.

Monitoring the CentOS Computers

Now that a CentOS computer has been discovered, new things appear in the console. If you go to the Monitoring pane of OpsMgr, then drill down to Unix/Linux Servers->Linux, you’ll see a new CentOS Computers Diagram. You should see something like this:

image

Unfortunately, because of the standard Red Hat discoveries’ configuration, you will also see this under the Red Hat Computers Diagram.

image

We can take care of this issue a little later. First we need to make sure everything is working as expected. Right-click on the CentOS computer and select Health Explorer. This opens the Health Explorer for that computer, and you should see something similar to this:

 image

You’ll notice that some monitors are clear, and some monitors show green checkmarks even though there’s not any state change events for that monitor. This is not abnormal, but this bears some further investigation.

First, we want to make sure that all the discoveries and monitors are enabled. This is the only way to test that they work. The easiest way to check this in the console is to go to Authoring > Management Pack Objects > Object Discoveries. Click on Change Scope at the top right to filter everything just to what we need, which is the CentOS objects. Just type in CentOS in the Look for box, then click Select All, then OK.

image

From this list, you can see that two discoveries, Physical Disk and Processor, are not enabled by default (the same as the default Red Hat MP).

image

To enable these, just right-click on them and select Enable. Looking at all the Monitors and Rules, it appears that they are all enabled by default, so no changes needed here.

There are also the potential requirements for all the discoveries to actually fire. By default, some discoveries may take hours before they fire again, so you rely on cookdown for some stuff, and a repeat fire for other stuff. Just to make sure my discoveries are firing again instead of waiting for some potentially long timeout period, I restart the services again. Here is what I end up with:

image image

 

 

 

 

 

 

 

 

 

 

 

 

So far so good… it now looks like I have status monitoring for everything except Application/Service Availability, Availability - Processor0, Performance – eth1, and Security. Everything else is now showing a green checkmark. Assuming these are not just timing issues, let’s go investigate.

Looking back in Authoring -> Management Pack Objects -> Monitors, I can see that in the CentOS Linux 5 Processor group, there isn’t any monitor configured for the Availability category. So that makes sense that there’s no monitor status for that in the Health Explorer. It looks like the same is true for Performance under CentOS 5 Linux Network Adapter and Security under CentOS 5 Linux Computer.

So, it looks like we’re getting monitoring information for all the things we should be getting monitoring for. The next thing to do is to test that when things aren’t working, that the monitors change state, and that the diagnostics and recoveries work as expected.

Want to download the completed Management Pack? It's available from the "Source Code" section of the CodePlex site (not in release downloads) Go here: http://scxcommunity.codeplex.com/SourceControl/list/changesets