]] Massimiliano Ferrero 

| If default shell is /bin/dash then all check_procs commands run though
| nrpe daemon return a +1 value in the number of processes they count
| i.e. if there is one /usr/sbin/acpid process running the check will
| return 2, more seriously if there are none the check will return one,
| so if the check is used to restart dead daemons this won't be done
| anymore.
| 
| The problem is dash-related: this can be easily verified by running

The problem seems to be:

With bash:

: tfheen@qurzaw /tmp > /bin/bash -c "/usr/lib/nagios/plugins/check_procs -vvv 
-c 1: -a '/sbin/init'"
[...]
S+    1000 30206 18709  11272   808  0.0       00:00 check_procs     
/usr/lib/nagios/plugins/check_procs -vvv -c 1: -a /sbin/initproc#=0 uid=1000 
vsz=11272 rss=808 pid=30206 ppid=18709 pcpu=0.00 stat=S+ etime=00:00 
prog=check_procs args=/usr/lib/nagios/plugins/check_procs -vvv -c 1: -a 
/sbin/init

vs with dash:

: tfheen@qurzaw /tmp > /bin/dash -c "/usr/lib/nagios/plugins/check_procs -vvv 
-c 1: -a '/sbin/init'"
S+    1000 30129 18709   4140   584  0.0       00:00 dash            /bin/dash 
-c /usr/lib/nagios/plugins/check_procs -vvv -c 1: -a '/sbin/init'proc#=0 
uid=1000 vsz=4140 rss=584 pid=30129 ppid=18709 pcpu=0.00 stat=S+ etime=00:00 
prog=dash args=/bin/dash -c /usr/lib/nagios/plugins/check_procs -vvv -c 1: -a 
'/sbin/init'
Matched: uid=1000 vsz=4140 rss=584 pid=30129 ppid=18709 pcpu=0.00 stat=S+ 
etime=00:00 prog=dash args=/bin/dash -c /usr/lib/nagios/plugins/check_procs 
-vvv -c 1: -a '/sbin/init'
S+    1000 30130 30129  11272   800  0.0       00:00 check_procs     
/usr/lib/nagios/plugins/check_procs -vvv -c 1: -a /sbin/initproc#=1 uid=1000 
vsz=11272 rss=800 pid=30130 ppid=30129 pcpu=0.00 stat=S+ etime=00:00 
prog=check_procs args=/usr/lib/nagios/plugins/check_procs -vvv -c 1: -a 
/sbin/init

you probably want to use a stricter match, such as

/bin/dash -c "/usr/lib/nagios/plugins/check_procs -vvv -c 1: 
--ereg-argument-array=^/sbin/init"

This will only match processes whose command line starts with /sbin/init
and not those where it's part of the command line.

I'm not entirely convinced this is a bug in check_procs at all, if
anything, it'd be a (minor, I think) bug in dash.

Note that you can get the same behaviour from bash by doing something
like:

/bin/bash -c "/usr/lib/nagios/plugins/check_procs -vvv -c 1: -a '/sbin/init'; 
true"

where bash won't just exec() a simple command, but will stay around
until the last command has run.

-- 
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to