Xplat

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 Replies to “SCOM 2012 – Performance of Linux Processes CPU, Memory…

  1. hi I try to create this rule but in performance view it don’t show this rule what can I do for resolve problem?

    code of get cpu and mem works good on server

    1. Hi Sigera

      Sorry about the delay, I have been quite busy.

      What did you find out? Let me know and I will write it on the post.

      Thank you,

      Stefan

      1. In fact, the quotes in your linux command (for the awk part) aren’t correct (‘ instead of ´). The command works well like that but doesn’t work if you test it via a task in opsmgr. 3 hours to find this 🙂

        1. Hi Sigera

          Thanks for your hint. Well, it is always a problem if you copy / paste directly from a blog post, depending on the site and local character set. A lot of trouble generates also dashes “-“, or the ” ” ” characters, and pipe “|” symbols.

          Sorry, about that…

          Stefan

  2. Your mode of explaining the whole thing in this article is actually good, every one be able to
    without difficulty be aware of it, Thanks a lot.

  3. Hi, I used the command
    free -m|grep Mem| awk ‘{ram = ram + $3} END {print ram}’
    and aplied it to Red Hat computers, but the graphic dont show results

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.