[Nagios-users] CPU monitor for a single Linux user space process ?

Frost, Mark {PBC} mark.frost1 at pepsico.com
Thu Dec 16 01:34:43 UTC 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




More information about the Nagios-users mailing list