[Pkg-nagios-devel] Bug#596372: please use two w as argument for ps

Peter Palfrader weasel at debian.org
Fri Sep 10 19:25:58 UTC 2010


Package: nagios-plugins-basic
Version: 1.4.15-1
Severity: important
Tags: patch

Hi,

we noticed that after installing one of the new debian.org machines with
squeeze some of our remote nrpe checks would fail.

In particular

| /usr/lib/nagios/plugins/check_procs -w 1:1 -c 1:1 -u root -C monit -a '/usr/sbin/monit -d 300 -I -c /etc/monit/monitrc -s /var/lib/monit/monit.state'
| PROCS OK: 1 process with UID = 0 (root), command name 'monit', args '/usr/sbin/monit -d 300 -I -c /etc/monit/monitrc -s /var/lib/monit/monit.state'

when run locally would succeed, but running via NRPE would fail:

| weasel at tchaikovsky:~$ /usr/lib/nagios/plugins/check_nrpe -H 82.195.75.101 -n -c dsa_ps_monit
| PROCS CRITICAL: 0 processes with UID = 0 (root), command name 'monit', args '/usr/sbin/monit -d 300 -I -c /etc/monit/monitrc -s /var/lib/monit/monit.state'

until we restarted nrped on the server.  After a reboot it started
failing again. 

Stracing the nrpe process and its children suggested that the ps output
lines get truncated at one point:

} [pid 12235] <... read resumed> "      ....
} ...tty 38400 tty6\nSs       0  1093     1  31888  2292  0.0    01:19:56 monit           /usr/sbin/monit -d 300 -I -c /etc/monit/monitrc -s /var/lib/mon\nS        0  1247     2.....

We noticed that ps is run with only one w argument passed to it.


Sure enough, patching the debian source package to pass two w's to ps
fixed the issue:

| weasel at tchaikovsky:~$ /usr/lib/nagios/plugins/check_nrpe -H 82.195.75.101 -n -c dsa_ps_monit
| PROCS OK: 1 process with UID = 0 (root), command name 'monit', args '/usr/sbin/monit -d 300 -I -c /etc/monit/monitrc -s /var/lib/monit/monit.state'

Please consider applying this patch:

diff -ur nagios-plugins-1.4.15/debian/rules nagios-plugins-1.4.15.fixed/debian/rules
--- nagios-plugins-1.4.15/debian/rules	2010-09-10 19:24:34.000000000 +0000
+++ nagios-plugins-1.4.15.fixed/debian/rules	2010-09-10 19:13:51.000000000 +0000
@@ -88,7 +88,7 @@
 		--with-pgsql=/usr \
 		--with-mysql=/usr \
 		--with-proc-loadavg=/proc/loadavg \
-		--with-ps-command="/bin/ps axwo 'stat uid pid ppid vsz rss pcpu etime comm args'" \
+		--with-ps-command="/bin/ps axwwo 'stat uid pid ppid vsz rss pcpu etime comm args'" \
 		--with-ps-format="%s %d %d %d %d %d %f %s %s %n" \
 		--with-ps-cols=10 \
 		--with-ps-varlist="procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos" \

Thanks,
weasel





More information about the Pkg-nagios-devel mailing list