Nagio plugin installation error

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagio plugin installation error

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ydastous
Posts: 4
Joined: Mon Jun 02, 2014 3:03 pm

Re: Nagio plugin installation error

Post 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
ydastous
Posts: 4
Joined: Mon Jun 02, 2014 3:03 pm

Re: Nagio plugin installation error

Post 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 
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagio plugin installation error

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Napsty
Posts: 1
Joined: Tue Jun 03, 2014 8:48 am

Re: Nagio plugin installation error

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagio plugin installation error

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagio plugin installation error

Post by abrist »

Commits reverted: https://github.com/nagios-plugins/nagio ... its/master
Branch of MP code coming shortly.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagio plugin installation error

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ydastous
Posts: 4
Joined: Mon Jun 02, 2014 3:03 pm

Re: Nagio plugin installation error

Post by ydastous »

Hello,

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

Yves
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagio plugin installation error

Post by slansing »

Excellent news! Lets see how it works out for the others.
Locked