On usage of check_procs

Andreas Ericsson ae at op5.se
Wed Aug 10 17:11:02 CEST 2005


Ralph.Grothe at itdz-berlin.de wrote:
> Hello,
> 
> I have a little question regarding the usage of check_procs.
> 
> Somehow I feel the usage of check_procs could well be overkill
> because I only want to monitor if a certain single process (that
> doesn't fork) is still running.
> 

check_procs will do this for you.

> I know that writing a minimal "plug-in" for this purpose would be
> rediculously simple, like
> 
> e.g. it wouldn't need much more than these two shell lines
> (n.b. platform being hpux, that's why the setting of env UNIX95
> here, which might look odd to you):
> 
> 
> 
> set -- $(UNIX95= ps -o pid= -o ppid= -C cron)
> ( if [[ $2 -eq 1 ]] && kill -0 $1; then rc=0; echo OK; else rc=2;
> echo CRITICAL; fi; return $rc )
> OK
> 0
> 

This 2-line shell-script will actually consume a great deal more CPU 
cycles than simply using check_procs, because it needs to invoke several 
subshells.

> 
> 
> Nevertheless I'd like to use the ready made check_procs.
> 
> But I'm unsure about the correct usage of the ranges type of
> arguments for the options -w and -c.
> 
> Since either the process to monitor is running (which would be
> OK),
> or otherwise is not running (which would be CRITICLA),
> it doesn't make much sense to me to specify ranges (of numbers of
> processes)
> 
> I thought I could use the check_procs for my purpose in such a
> (silly?) manner.
> Would that be one possible way how to check a single process for
> existence in the proc table?
> (well, if it was an un-wait-ed for child it could well be a
> zombie, so maybe a more sophisticated state check too was
> necessary?)
> 

check_procs -m PROCS -w 1:1 -c 1:1 -s RDS -C sleep

will show only the 'sleep' processes in Running (or Runnable), D 
(Dormant, uninterruptable IO), S (Sleeping, interruptable IO) mode, 
which is more or less the states that aren't crashed. Some systems have 
the W (Paging) state as well, but I'm not sure about AIX.

> 
> 
> # id
> uid=0(root) gid=3(sys)
> # sleep 1000 &
> [1]     24590
> # /usr/local/nagios/libexec/check_procs -m PROCS -w 1:1 -c 1:1 -p
> $$ -u 0 -C sleep
> PROCS OK: 1 process with PPID = 23629, UID = 0 (root), command
> name 'sleep'
> # echo $?
> 0
> # kill %1
> # /usr/local/nagios/libexec/check_procs -m PROCS -w 1:1 -c 1:1 -p
> $$ -u 0 -C sleep
> PROCS CRITICAL: 0 processes with PPID = 23629, UID = 0 (root),
> command name 'sleep'
> [1] + Terminated               sleep 1000 &
> # echo $?
> 2
> 
> 
> 
> Regards 
> Ralph
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> 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
> 

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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