Page 1 of 1

Bug in Nagios Plugins 2.3.X

Posted: Thu May 28, 2020 8:10 pm
by eponymousalias
The Nagios Plugins 2.3.0 release added this stanza to the configure.ac
file, which is still present at this location in the file in the Nagios
Plugins 2.3.3 release:

Code: Select all

789 dnl jails on FreeBSD:
790 elif ps -axwo 'stat comm vsz rss user uid pid ppid jid args' 2>/dev/null | \
791         egrep -i "^ *STAT +COMMAND +VSZ +RSS +USER +UID +PID +PPID +JID +COMMAND" > /dev/null
792 then
793         ac_cv_ps_varlist="procstat,&procuid,&procpid,&procppid,&procjid,&procvsz,&procrss,&procpcpu,procprog,&pos"
794         ac_cv_ps_command="$PATH_TO_PS -axwo 'stat uid pid ppid jid vsz rss pcpu comm args'"
795         ac_cv_ps_format="%s %d %d %d %d %d %d %f %s %n"
796         ac_cv_ps_cols=10
797         AC_MSG_RESULT([$ac_cv_ps_command])
There are two problems with this.

(1) That stanza is placed within the configure.ac processing earlier than
other sibling tests which ought to be the executed first. That's because,
for instance, some versions of "ps" on Linux will accept a "jid" option,
and that can cause this test to succeed, but they only produce a "-"
value in the "JID" column of the output. That string will fail the %d
conversion that is specified as the format string for &procjid in this
stanza, stopping all scan conversion at that point and creating a very
misleading impression of what the later values are. The net effect is,
this stanza needs to be moved in the configure.ac file to some position
which is later than its present position, to allow other forms of the
ps command to be recognized first.

(2) Even when that stanza is moved, the build will fail if that test
is found to be true. That's because the cmpstringp() routine in the
check_load.c program fails to include a "int procjid = 0;" declaration,
as is present in both of the check_procs.c and check_nagios.c programs.

(I'm not going to report this on github; you can handle that yourself.)

Re: Bug in Nagios Plugins 2.3.X

Posted: Tue Jun 02, 2020 4:41 pm
by cdienger