SCOM 2012 – Performance of Linux Processes CPU, Memory…

I am a huge fan of Microsoft and I love to work with Microsoft products but sometimes I like to make a step to the “Dark Side” and put my fingers on Linux Smile.  As I frequently answer some questions on TechNet I found an interesting question. How could you monitor processes on Linux and use a performance visualize it? Well let’s find out…

In this case we are going to show the %CPU used by the Linux SCOM agent. First we need some background information.

The Linux SCOM agent runs 2 processes:

  • scxcimserver
  • scxcimprovagt

Actually it runs scxcimprovagt two times under different accounts root and the Linux agent action account. To visualize it we run the “top” command in Linux…

image

The big deal now is to get a command which strips out the appropriate information and returns just the total amount of %CPU of all these 3 processes.

After some fumbling and binging I got it together. The secret formula is:

top -b n 1 | grep scxcim* | awk ‘{cpu = cpu + $9} END {print cpu}’

The “top” command shows the actual processes runnig. Using –b n 1 makes the output usable for filtering by “grep” and then we use “awk” to add up the CPU columns. In our case $9 means the 9th column from the left.

Now we just need to add things up and let build the performance rule first.

Step 1 – Performance Rule

Create a new rule “Unix/Linux Shell Command (Performance)” and save it into a separate management pack…

image

Next select a name and target…

image

Choose the interval to run the command…

image

Now you can insert the command we just discussed…

image

We just leave it the way it is and click “Next”…

image

Now you could map the parameters as they will appear on the performance view (don’t change the “Value” parameter) and click “Create”…

image

Next, because I have disabled the rule in the wizard I need to make an override for the appropriate target…

image

Step 2 – Performance View

In the Monitoring pane create a new Performance View…

image

Select the rule we just created…

image

The select the view and after a a few minutes your performance rule will appear…

image

Cool!

Hot tip:

If you analyze the “top” command in Linux you see there are multiple columns 1 to 10.

image

If you now adjust the command…

top -b n 1 | grep scxcim* | awk ‘{cpu = cpu + $9} END {print cpu}’

to something like…

top -b n 1 | grep gnome* | awk ‘{mem = mem + $10} END {print mem}’

you could use it to get the sum of the used %Memory for the gnome processes and then also build a performance view!

Got it? Is that cool or what?

Cheers,

Stefan

9 Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s