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

Tomasz Pilat poncki.lists at axelspringer.com.pl
Tue Dec 21 02:56:05 CET 2004


Hello Ton,

>> 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

# ./check_procs -v -v
CMD: /bin/ps -axwo 'state uid ppid vsz rss pcpu command command'
PROCS OK: 127 processes

(FreeBSD 4.10-STABLE Fri Jul 30 17:39:00 CEST 2004)

> 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.

-c switch also trims command name to 16 bytes -
# /bin/ps waxco 'state uid ppid vsz rss pcpu command command':

Ss       0     1 15976 3892  0.0 httpd            httpd
I        0     1   908  308  0.0 courierlogger    courierlogger
S        0 90193  1096  392  0.0 authdaemond.plai authdaemond.plai
                                 ^^^^^^^^^^^^^^^^ should be authdaemond.plain

> 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.

But  there  is another problem - sometimes you will still get
more than one string on first command column (for kernel threads):

$ ps -axwo 'stat comm vsz rss user uid ppid args'

STAT COMMAND               VSZ  RSS USER     UID  PPID COMMAND
RL   idle: cpu1              0   12 root       0     0  (idle: cpu1)
RL   idle: cpu0              0   12 root       0     0  (idle: cpu0)
IL   nfsiod 0                0   12 root       0     0  (nfsiod 0)
IL   nfsiod 1                0   12 root       0     0  (nfsiod 1)
Is   adjkerntz            1180   12 root       0     1 adjkerntz -i
Ss   routed               1360  264 root       0     1 /sbin/routed -s
Ss   syslogd              1320  288 root       0     1 /usr/sbin/syslogd -4 -s -cc

(FreeBSD 5.2.1-RELEASE #0: Mon Feb 23 20:45:55 GMT 2004)

> 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

Yes, and this is the only way i can see now...

> of what is the command and what is the arguments and I'm not convinced

Why, this should be pretty easy and straightforward -
with /bin/ps -axwo 'state uid ppid vsz rss pcpu command' You will get:

STAT   UID  PPID   VSZ  RSS %CPU COMMAND
Ss       0     1  1200  596  0.0 /usr/sbin/syslogd -4 -s -cc -l /jails/named/dev/log

First string on 7th columnt is a command, rest are arguments..

And  this  one  works  with  both FreeBSD-4 and FreeBSD-5 (i dont have
FreeBSD-6 aka current to check this).

Ponc






More information about the Devel mailing list