check_mailq return code of 255 is out of bounds

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Heiko
Posts: 9
Joined: Thu Mar 28, 2013 4:35 am
Location: Amberg, Germany

check_mailq return code of 255 is out of bounds

Post by Heiko »

Hello,
after upgrading to Nagios XI 2014R1.3 I get the following error with check_mailq:
(return code of 255 is out of bounds)

If I call /usr/local/nagios/libexec/check_mailq from cli I get the following errors:

Code: Select all

[root@nagiosxi libexec]# ./check_mailq 
Bareword found where operator expected at ./check_mailq line 613, near "/usr/sbin"
	(Missing operator before bin?)
Semicolon seems to be missing at ./check_mailq line 618.
syntax error at ./check_mailq line 613, near "/usr/sbin"
syntax error at ./check_mailq line 618, near "exim4		elsif"
syntax error at ./check_mailq line 623, near "nullmailer		elsif"
syntax error at ./check_mailq line 670, near "}"
Execution of ./check_mailq aborted due to compilation errors.
I use CentOS 6.5, 64 Bit, manual installation,
What can I do?
Thank you in advance for helping
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_mailq return code of 255 is out of bounds

Post by sreinhardt »

Could you post your version of check_mailq.pl please?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Heiko
Posts: 9
Joined: Thu Mar 28, 2013 4:35 am
Location: Amberg, Germany

Re: check_mailq return code of 255 is out of bounds

Post by Heiko »

my version of check_mailq is 2.0.2
belvdr
Posts: 81
Joined: Tue Oct 08, 2013 9:17 pm

Re: check_mailq return code of 255 is out of bounds

Post by belvdr »

Mine exhibits the same behavior. However, I'm using check_mailq via NRPE to my mail servers and they don't have this issue.

Some potentially interesting stats:

Code: Select all

						Nagios		Mail Server
Version				2.0.2		1443 (nagios-plugins 1.4.13)
Lines of code		670			609
Here are the offending lines of code. I'm no perl expert, but these don't seem correct:

Code: Select all

/usr/sbin/postfix               elsif (-d '/var/lib/postfix' || -d '/var/local/lib/postfix'
/usr/sbin/postfix                      || -e '/usr/sbin/postfix' || -e '/usr/local/sbin/postfix')
                {
                        $mailq = 'postfix';
                }
exim4           elsif (-d '/usr/lib/exim4' || -d '/usr/local/lib/exim4'
exim                   || -e '/usr/sbin/exim' || -e '/usr/local/sbin/exim')
                {
                        $mailq = 'exim';
                }
nullmailer              elsif (-d '/usr/lib/nullmailer' || -d '/usr/local/lib/nullmailer'
I cannot find these lines in the latest code either:

https://github.com/nagios-plugins/nagio ... k_mailq.pl
Heiko
Posts: 9
Joined: Thu Mar 28, 2013 4:35 am
Location: Amberg, Germany

Re: check_mailq return code of 255 is out of bounds

Post by Heiko »

I have the same behavior on other machines as well.
The OS on those machines is SuSe and CentOS, where I use NRDS..
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_mailq return code of 255 is out of bounds

Post by lmiltchev »

Copy/paste is a great thing but it can get you in trouble... :) I suppose some text got copied over to the mailq plugin that didn't belong there... Create a backup of the plugin (just in case). Open it in a text editor and remove the following text:

/usr/sbin/postfix from line 613
/usr/sbin/postfix from line 614
exim4 from line 618
exim from line 619
nullmailer from line 623

save, and exit. Let me know if this fixed your issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Heiko
Posts: 9
Joined: Thu Mar 28, 2013 4:35 am
Location: Amberg, Germany

Re: check_mailq return code of 255 is out of bounds

Post by Heiko »

Thank you for your fast reply.
I removed the lines you pointed out.
Now I get new errors:

Code: Select all

[root@nagiosxi libexec]# ./check_mailq
syntax error at ./check_mailq line 619, near "||"
syntax error at ./check_mailq line 624, near "else"
syntax error at ./check_mailq line 627, near "}"
syntax error at ./check_mailq line 665, near "}"
Execution of ./check_mailq aborted due to compilation errors.
Is there a way to download a functional check_mailq plugin, maybe from nagios website?

addition:

Sorry maybe I misinterpreted you... :roll:
If I remove the lines from 613 to 628, then the plugin works correctly.

Thank you very much for your help! :)
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_mailq return code of 255 is out of bounds

Post by tmcdonald »

You're supposed to remove *parts* of the lines, not the *whole* lines. Removing the whole lines can still leave the plugin functional, but the lines you removed may have been needed in certain error-handling cases. The plugin link you provided seems to be a working version, so it's safe to use. Just make sure you do not accidentally copy in extra characters.
Former Nagios employee
Locked