[Nagiosplug-help] Broken check_procs plug-in on Fedora 3
Ralph.Grothe at itdz-berlin.de
Ralph.Grothe at itdz-berlin.de
Thu Apr 6 01:19:06 CEST 2006
Hello Ton,
thank you for reminding me of newer releases of the plug-ins.
I simply had this tarball still lingering around from my build
for HP-UX where I didn't experience any ps related issues,
why simply didn't care to look.
I also haven't noticed that there is a triple verbosity level.
However, I could also spot the violating ps command in the binary
# strings check_procs|grep bin/ps
/bin/ps -axwo 'stat uid ppid vsz rss pcpu comm args'
And FC3's ps has the same inclination to issuing the warning
as with the -aux options
(where it indeed is reasonable, as for the in the FAQ mentioned
"user x" clash)
# /bin/ps -axwo 'stat uid ppid vsz rss pcpu comm args' >/dev/null
Warning: bad syntax, perhaps a bogus '-'? See
/usr/share/doc/procps-3.2.3/FAQ
Though myself not being a C hacker
I could spot a macro PS_COMMAND that appeared in the source of
check_procs.c
Even to my limited C knowledge this meant that the macro had to
be defined in some
included header file along the build hirarchy.
# find /usr/local/src/nagios-plugins-1.4/ -type f -name
\*.h|xargs grep -n PS_COMMAND
/usr/local/src/nagios-plugins-1.4/config.h:689:#define PS_COMMAND
"/bin/ps -axwo 'stat uid ppid vsz rss pcpu comm args'"
So that's a fix that even I could handle myself. :-)
Let's just swicth from ps BSD to UNIX style.
# mkdir RCS
# rcs -i config.h
RCS file: RCS/config.h,v
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> .
done
# ci -l config.h
RCS/config.h,v <-- config.h
initial revision: 1.1
done
# vi +689 config.h
# rcsdiff config.h
=================================================================
==
RCS file: RCS/config.h,v
retrieving revision 1.1
diff -r1.1 config.h
689c689
< #define PS_COMMAND "/bin/ps -axwo 'stat uid ppid vsz rss pcpu
comm args'"
---
> #define PS_COMMAND "/bin/ps -ewo 'stat uid ppid vsz rss pcpu
comm args'"
# make clean
# make all
# strings plugins/check_procs|grep bin/ps
/bin/ps -ewo 'stat uid ppid vsz rss pcpu comm args'
# plugins/check_procs -m PROCS -C httpd -u 0 -p 1 -c 1:1
PROCS OK: 1 process with command name 'httpd', UID = 0 (root),
PPID = 1
Great, it doesn't produce any warnings anymore :-)
# ci -u config.h
RCS/config.h,v <-- config.h
new revision: 1.2; previous revision: 1.1
enter log message, terminated with single '.' or end of file:
>> .
done
Maybe, when I later have more time I will get a more recent
plug-ins release.
Probably the developer already have fixed this.
Regards
Ralph
> -----Original Message-----
> From: nagiosplug-help-admin at lists.sourceforge.net
> [mailto:nagiosplug-help-admin at lists.sourceforge.net]On Behalf
Of Ton
> Voon
> Sent: Wednesday, April 05, 2006 4:07 PM
> To: Grothe, Ralph
> Cc: nagiosplug-help at lists.sourceforge.net
> Subject: Re: [Nagiosplug-help] Broken check_procs plug-in on
Fedora 3
>
>
> Ralph,
>
> 1.4 is quite an old release. Can you try the snapshot at
http://
> nagiosplug.sf.net/snapshot and see if that has the problem.
>
> If so, please run ./check_procs -v -v -v to see what the ps
command
> it is using on your platform.
>
> Ton
>
>
>
> On 5 Apr 2006, at 14:27, <Ralph.Grothe at itdz-berlin.de>
> <Ralph.Grothe at itdz-berlin.de> wrote:
>
> > 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
> >
> >
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking
scripting
> > language
> > that extends applications into web and mobile media. Attend
the
> > live webcast
> > and join the prime developer group breaking into this new
coding
> > territory!
> >
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat164
2
> > _______________________________________________
> > Nagiosplug-help mailing list
> > Nagiosplug-help at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> > ::: Please include plugins version (-v) and OS when reporting
any
> > issue.
> > ::: Messages without supporting info will risk being sent
> to /dev/null
> >
> >
> > This message has been scanned for viruses by MailController -
> > www.MailController.altohiway.com
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking
> scripting language
> that extends applications into web and mobile media. Attend
> the live webcast
> and join the prime developer group breaking into this new
> coding territory!
>
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
> _______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> ::: Please include plugins version (-v) and OS when reporting
> any issue.
> ::: Messages without supporting info will risk being sent to
/dev/null
>
More information about the Help
mailing list