[Nagiosplug-help] Broken check_procs plug-in on Fedora 3

Ralph.Grothe at itdz-berlin.de Ralph.Grothe at itdz-berlin.de
Wed Apr 5 06:29:06 CEST 2006


Hello,

I stumbeled over a nasty quirk from check_procs that I compiled
from the sources.

To start, this constitutes my platform and build

# /usr/local/src/nagios-plugins-1.4/plugins/check_procs -V
check_procs (nagios-plugins 1.4) 1.43
# uname -srv
Linux 2.6.9-1.667smp #1 SMP Tue Nov 2 14:59:52 EST 2004
# cat /etc/redhat-release 
Fedora Core release 3 (Heidelberg)
# gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info --en
able-shared --enable-threads=posix --disable-checking
--with-system-zlib --enable-__cxa_atexit --d
isable-libunwind-exceptions --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)


What happens is an obvious obsolete (and deprecated) invocation
of BSD style ps
which causes messages on stderr

# /usr/local/src/nagios-plugins-1.4/plugins/check_procs -m PROCS
-C httpd -u 0 -p 1
System call sent warnings to stderr
PROCS WARNING: 1 process with command name 'httpd', UID = 0
(root), PPID = 1


To see what gets written to stderr I had a look at the syscall
trace.


# strace -v -f -s 256 -e trace=read
/usr/local/src/nagios-plugins-1.4/plugins/check_procs -m PROCS -C
httpd -u 0 -p 1 2>&1|tail -6
"", 4096)           = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
read(5, "Warning: bad syntax, perhaps a bogus \'-\'? See
/usr/share/doc/procps-3.2.3/FAQ\n", 4096)
 = 78
read(5, "", 4096)                       = 0
System call sent warnings to stderr
PROCS WARNING: 1 process with command name 'httpd', UID = 0
(root), PPID = 1


Ah, a helpful reference to the ps FAQ there

# head /usr/share/doc/procps-3.2.3/FAQ
Frequently Asked Questions about procps

Why does "ps -aux" complain?

According to the POSIX and UNIX standards, the above command asks
to display 
all processes with a TTY (generally the commands users are
running) plus all 
processes owned by a user named "x". If that user doesn't exist,
then ps will
assume you really meant "ps aux". The warning is given to gently
break you
of a habit that will cause you trouble if a user named "x" were
created.



And, yes ps didn't like to be invoked in an ambiguous old BSD
style

# ps -aux >/dev/null
Warning: bad syntax, perhaps a bogus '-'? See
/usr/share/doc/procps-3.2.3/FAQ


But the ps hackers did provide a weird kludge
(only for such a purpose made the mentioning of that env var in
ps's manpage sense to me)

# I_WANT_A_BROKEN_PS= ps -aux >/dev/null|wc -l
0


As long as I cannot find a fix for that in check_procs
I maybe could set my environment accordingly for my Nagios
checks.
But how do I propagate this to the plug-in,
because it doesn't work like this?

# I_WANT_A_BROKEN_PS=
/usr/local/src/nagios-plugins-1.4/plugins/check_procs -m PROCS -C
httpd -u 
0 -p 1
System call sent warnings to stderr
PROCS WARNING: 1 process with command name 'httpd', UID = 0
(root), PPID = 1

# env I_WANT_A_BROKEN_PS=1
/usr/local/src/nagios-plugins-1.4/plugins/check_procs -m PROCS -C
http
d -u 0 -p 1
System call sent warnings to stderr
PROCS WARNING: 1 process with command name 'httpd', UID = 0
(root), PPID = 1

# env -i I_WANT_A_BROKEN_PS=1
/usr/local/src/nagios-plugins-1.4/plugins/check_procs -m PROCS -C
h
ttpd -u 0 -p 1
System call sent warnings to stderr
PROCS WARNING: 1 process with command name 'httpd', UID = 0
(root), PPID = 1

# (export I_WANT_A_BROKEN_PS=1;
/usr/local/src/nagios-plugins-1.4/plugins/check_procs -m PROCS -C
 httpd -u 0 -p 1)
System call sent warnings to stderr
PROCS WARNING: 1 process with command name 'httpd', UID = 0
(root), PPID = 1


Regards
Ralph









More information about the Help mailing list