CPU monitor for a single Linux user space process ?

Frost, Mark {PBC} mark.frost1 at pepsico.com
Thu Dec 16 02:34:43 CET 2010


> -----Original Message-----
> From: Bruce Edge [mailto:bruce.edge at gmail.com] 
> Sent: Wednesday, December 15, 2010 8:06 PM
> 
> Rookie question here. Trying to determine nagios suitability for an
> embedded app.
> 
> Can I monitor the CPU utilization for a single user space process on a
> Linux box with nagios?
> And, can I define an action if it exceeds a threshold?
> 
> Thanks
> 
> -Bruce

Bruce,

I'm not sure that there's an existing check plugin that would do this (might be).

I can say that "yes" you can do this, it's just a question of what you're willing
to do.  If I were to do this for our environment, I'd write a perl script that
used the 'ps' command to look at the process and pull the 'pcpu' field (% cpu
-- see the 'ps' man page) info for that process.  I'd also use the Nagios::Plugin
perl module to make the Nagios side easier and probably report the actual pcpu
value as performance data suitable for graphing.

You could then configure the an event on that service check.  That essentially
another script that gets called when the state changes on the check.  This means
it gets called anytime the state changes, including when it goes to an "OK" state
so you need to have the script detect when it's called and potentially exit if
it hasn't gone into a hard critical state (depending on what you want, actually).
You can read up on events on the Nagios documentation.

Mark

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list