Page 2 of 3

Re: Nagio plugin installation error

Posted: Mon Jun 02, 2014 3:31 pm
by abrist
Alright, I will attempt to reproduce this issue. What mailq package are you using and where can I get it (so I can test the conditional in the script)?

EDIT: Did you reconfigure and recompile after the installation of gawk?

Re: Nagio plugin installation error

Posted: Mon Jun 02, 2014 3:40 pm
by ydastous
On redhat 6.5

postfix-2.6.6-6.el6_5.x86_64

I do a plain

Code: Select all

 ./configure 
and after

Code: Select all

make

Yves

Re: Nagio plugin installation error

Posted: Mon Jun 02, 2014 4:35 pm
by ydastous
The perl code contain lines like:

Code: Select all

|| -e '/usr/sbin/exim' || -e '/usr/local/sbin/exim'
I think the bug is with the nagios-plugins-2.0.2/plugins-scripts/subst awk code,

Code: Select all

     50 # If a script contains a reference to a fully qualified command,
     51 # subst will replace the fully qualified command with whatever is
     52 # returned from the which subroutine. run before changes to INC to add libexecdir
     53 # FIXME: Prepend executables with a substitution keyword instead.
     54 #
     55 /^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// {
     56         match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/);
     57         c=substr($0,RSTART,RLENGTH);
     58         sub(c,which(c,path));
     59 }
Since check_mailq contain refrence to full path name cmd the script try to substitute them ........

you can reproduce the bug with a script of 1 line:

Code: Select all

echo "'/usr/sbin/exim'  || '/usr/local/sbin/exim'" > t.pl
and try to run subst on it:

Code: Select all

NP_VERSION=2.0.2 gawk -f ./subst t.pl > tt 

Re: Nagio plugin installation error

Posted: Mon Jun 02, 2014 5:14 pm
by abrist
Thanks for the bug report and example. I have been looking at the awk script and I feel it may be best to pull in the changes from monitoring-plugins that removes the ugly awk script in its entirety. Replacing '||' with 'or' will just cause problems with mawk. I will look at this more tomorrow. Even if we shim the regex in subst, there will be further problems down the road as we update other things in the perl plugins. The changes from MP will also bring with it better trusted path support.

The only issue is that using FindBin will force us to disable perl taint checks (though not all the perl scripts even do the taint check). Do you think this is acceptable? Maybe there is an alternative to FindBin?

I will patch a new branch tomorrow and post the link here for those interested in trying the subst/trusted path changes.

Re: Nagio plugin installation error

Posted: Tue Jun 03, 2014 8:51 am
by Napsty
There is indeed something bad happening with check_mailq.
Had the same compile error and then installed gawk as outlined in this thread. Compilation then worked but trying to launch the plugin gives this error:

Code: Select all

./plugins-scripts/check_mailq --help
Having no space between pattern and following word is deprecated at ./plugins-scripts/check_mailq line 613.
Bareword found where operator expected at ./plugins-scripts/check_mailq line 613, near "/usr/sbin"
        (Missing operator before bin?)
Semicolon seems to be missing at ./plugins-scripts/check_mailq line 618.
syntax error at ./plugins-scripts/check_mailq line 613, near "/usr/sbin"
syntax error at ./plugins-scripts/check_mailq line 618, near "exim4             elsif"
syntax error at ./plugins-scripts/check_mailq line 623, near "nullmailer                elsif"
syntax error at ./plugins-scripts/check_mailq line 670, near "}"
Execution of ./plugins-scripts/check_mailq aborted due to compilation errors.
The problems seem to come from this commit: https://github.com/nagios-plugins/nagio ... 8033cace40

Running Debian 7.5 here.

Re: Nagio plugin installation error

Posted: Tue Jun 03, 2014 10:05 am
by abrist
I think we will revert the commit for the next release and start testing the MP commits for trusted path/no awk-magic in a new branch.

Re: Nagio plugin installation error

Posted: Tue Jun 03, 2014 3:43 pm
by abrist
Commits reverted: https://github.com/nagios-plugins/nagio ... its/master
Branch of MP code coming shortly.

Re: Nagio plugin installation error

Posted: Tue Jun 03, 2014 4:57 pm
by abrist
Branch "findbin" pushed to github. If anyone gets a chance, try out the new branch and let me know your thoughts.
https://github.com/nagios-plugins/nagio ... ts/findbin

EDIT: Github issue: https://github.com/nagios-plugins/nagio ... /issues/35

Re: Nagio plugin installation error

Posted: Fri Jun 06, 2014 2:45 pm
by ydastous
Hello,

Just test the check_mailq produce with the change in the branch and the result work for me !!

Yves

Re: Nagio plugin installation error

Posted: Fri Jun 06, 2014 2:47 pm
by slansing
Excellent news! Lets see how it works out for the others.