[Nagiosplug-devel] BUG: check_proc doeas not work under FreeBSD 4

Ton Voon tonvoon at mac.com
Fri Dec 17 20:43:03 CET 2004


On 17 Dec 2004, at 18:54, Tomasz Pilat wrote:

> Hello.
>
> This one well be quick...
>
> Environment:
>
> FreeBSD  4.10-STABLE  #410:  Fri  Jul 30 17:39:00 CEST 2004 (/proc not 
> mounted)
> check_procs (nagios-plugins 1.4.0alpha2) 1.2
>
> Problem:
>
> check_proc does not see processes with command line longer than 16
> bytes (not counting arguments). For example:
>
> # ps auxw | grep syslo[g]
> root        190  0.0  0.1  1196  588  ??  Ss   22Oct04  70:45.58 
> /usr/sbin/syslogd -4 -s -cc -l /jails/named/dev/log
>
> # ./check_procs -C syslogd
> PROCS OK: 0 processes with command name 'syslogd'
>
> but:
>
> # ./check_procs -C syslog
> PROCS OK: 1 process with command name 'syslog' -> /usr/sbin/syslog (16 
> bytes)
>
> Cause:
>
> Plugin executes "/bin/ps -axwo 'state uid ppid vsz rss pcpu command 
> command'", and gets
>
> Ss       0     1  1196  588  0.0 /usr/sbin/syslog /usr/sbin/syslogd -4 
> -s -cc -l /jails/named/dev/log
Are you sure this is what is being executed? On FreeBSD 4.8 (one of the 
compile farm on SF), check_procs -v -v shows:
CMD: /bin/ps waxco 'state uid ppid vsz rss pcpu command command'
PROCS OK: 80 processes

>
> but should execute "/bin/ps -axwo 'state uid ppid vsz rss pcpu 
> command'" and get
>
> Ss       0     1  1196  588  0.0 /usr/sbin/syslogd -4 -s -cc -l 
> /jails/named/dev/log
>
> (taking command-line from 7th column makes '-a' option unusable too).

Unfortunately, check_procs currently expects a column for the command 
and then another column for the command + arguments. It looks like in 
FreeBSD 4.8 that you cannot do that because it looks like the -c makes 
the command column into the short command name, but then disables the 
argument column.

I've just applied a patch for Michael Bakker which uses the command: ps 
-axwo 'stat comm vsz rss user uid ppid args'
for FreeBSD 5 which suggests to me that they realised there was a 
limitation in the way FreeBSD 4 handled ps options.

However, you are probably much better than me at understanding FreeBSD 
4 - is there another way to get the columns of information that 
check_procs wants? Alternatively, we'd have to change check_procs to 
only use one column for command + args and do some clever working out 
of what is the command and what is the arguments and I'm not convinced 
I want to go down this route so close to a 1.4 release.

Ton





More information about the Devel mailing list