nagios-plugins check_procs inconsistencies
I've been noticing some inconsistencies with the check_procs plugin, likely due to Busybox's basic ps
implementation and the --with-ps-command='/bin/ps -o stat,pid,ppid,vsz,rss,comm,args'
that nagios-plugins appears to be compiled with.
For example, I get this result with rsyslogd
# /usr/lib/nagios/plugins/check_procs -C rsyslogd -w '1:' -c '1:' -vv
CMD: /bin/ps -o stat,pid,ppid,vsz,rss,comm,args
PROCS CRITICAL: 0 processes with command name 'rsyslogd' | procs=0;1:;1:;0;
Even though I can grep it with the same ps command
# /bin/ps -o stat,pid,ppid,vsz,rss,comm,args | grep rsyslogd | grep -v grep
S 2090 1 15m 1252 rsyslogd /usr/sbin/rsyslogd -i /run/rsyslog.pid -f /etc/rsyslog.conf
Then for another example, some proc checks that do work will actually break with the procps
package installed.
Without procps:
# /usr/lib/nagios/plugins/check_procs -C lighttpd -w '1:' -c '1:' -vv
CMD: /bin/ps -o stat,pid,ppid,vsz,rss,comm,args
Not parseable: Not parseable: Matched: uid=0 vsz=6052 rss=1136 pid=2244 ppid=1 jid=0 pcpu=0.00 stat=S etime= prog=lighttpd args=/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
PROCS OK: 1 process with command name 'lighttpd' | procs=1;1:;1:;0;
With procps:
# /usr/lib/nagios/plugins/check_procs -C lighttpd -w '1:' -c '1:' -vv
CMD: /bin/ps -o stat,pid,ppid,vsz,rss,comm,args
PROCS CRITICAL: 0 processes with command name 'lighttpd' | procs=0;1:;1:;0
I'm wondering if it might be more consistent to make nagios-plugins
depend on procps
and then compile with different ps args as other distros do where I haven't seen these issues.
Fedora: ps -eo 's uid pid ppid vsz rss pcpu etime comm args'
Ubuntu: ps axwwo 'stat uid pid ppid vsz rss pcpu etime comm args'
Gentoo: ps axwwo 'stat uid pid ppid vsz rss pcpu cgroup:256 comm args'