Page 1 of 1

PostFix mail queue monitoring

Posted: Mon Feb 27, 2017 2:31 am
by jyoti22
Hello Team,

I am working on monitoring the Mail queue for Linux server.
I have downloaded the postfix mail queue monitoring plugin. Its working fine on the remote server with sudo

[[email protected] plugins]# sudo /usr/lib64/nagios/plugins/check_postfix_queue -w 20 -c 40
Number of queued messages: 6

without sudo if I check I have to use " -f '!MAILER-DAEMON'"

[[email protected] plugins]# ./check_postfix_queue -w 50 -c 100 -f '!MAILER-DAEMON'. Not sure if this result is correct
Number of queued messages: 0

And on Nagios server, with NRPE I am not getting the results

[root@NagiosXI libexec]# ./check_nrpe -H 10.161.232.60 -c check_postfix_queue
NRPE: Command 'check_postfix_queue' not defined

on the webconsole I have entered the command.. Please check whats actually wrong

Re: PostFix mail queue monitoring

Posted: Mon Feb 27, 2017 11:47 am
by mcapra
NRPE is saying the command is not defined because the command likely does not exist in the remote machine's NRPE configuration set. The -c argument for check_nrpe is telling the remote NRPE agent that you wish to call its check_postfix_queue command. The check_postfix_queue command will need to exist in the remote machine's NRPE configuration (usually in /usr/local/nagios/etc/nrpe.cfg). It might look something like this:

Code: Select all

command[check_postfix_queue]=/usr/lib64/nagios/plugins/check_postfix_queue -w 20 -c 40

Re: PostFix mail queue monitoring

Posted: Mon Feb 27, 2017 11:59 pm
by jyoti22
even after defining the command on the remote server I am getting attached error.

Re: PostFix mail queue monitoring

Posted: Tue Feb 28, 2017 11:27 am
by mcapra
It looks like your Nagios XI command definition for "check_postfix_queue" has a space after it:
2017_02_28_10_26_02_file.php_1018_321_.png
Can you try removing that space from either the Command's "Command Name" or the Service's "Check Command"?

Re: PostFix mail queue monitoring

Posted: Mon Mar 06, 2017 7:40 am
by jyoti22
I am getting the results on CLI
But on webconsole, not giving me any result

I checked with Nagios user, I get the result on CLI, But not when I add the service to the host on webconsole.

My service definition -

define service {
host_name xx.xx.xx.xx
service_description PostFix queue monitoring_mailq
check_command check_nrpe!check_postfix_queue!-a w -100 -c 600!!!!!!
initial_state u
max_check_attempts 3
check_interval 5
retry_interval 5
check_period 24x7
notification_period 24x7
notification_options w,c,u,r,f,s,
register 1
}

Re: PostFix mail queue monitoring

Posted: Mon Mar 06, 2017 2:07 pm
by mcapra
Can you send us the full contents of your check_postfix_queue script?

Re: PostFix mail queue monitoring

Posted: Tue Mar 07, 2017 5:48 am
by jyoti22
Hi,

PFA.. Thanks. i havent used .sh extension on the plugin

Re: PostFix mail queue monitoring

Posted: Tue Mar 07, 2017 2:24 pm
by mcapra
Hmm, I haven't been able to reproduce this particular issue using that script.

On my remote machine:

Code: Select all

[root@localhost libexec]# ./check_postfix_queue.sh -w 100 -c 200
Number of queued messages: 200

...
# in nrpe.cfg
command[check_postfix_queue]=/usr/local/nagios/libexec/check_postfix_queue.sh -w 100 -c 200

On my XI machine:

Code: Select all

[root@xi-stable ~]# /usr/local/nagios/libexec/check_nrpe -H 192.168.67.97 -c check_postfix_queue
Number of queued messages: 200
2017_03_07_13_21_15_Nagios_XI.png
Though I think the problem is that your Nagios XI configuration isn't lining up with your NRPE configuration. In Nagios XI you have this:

Code: Select all

check_command check_nrpe!check_postfix_queue!-a w -100 -c 600!!!!!!
With the $ARG2$ value being -a w -100 -c 600. This doesn't line up with what you have configured in the remote machine's NRPE:

Code: Select all

command[check_postfix_queue]=/usr/lib64/nagios/plugins/check_postfix_queue -w 20 -c 40
Where no arguments are expected for this command at all. Try revising your check like so:

Code: Select all

check_command check_nrpe!check_postfix_queue
And see if that gives meaningful output.

Re: PostFix mail queue monitoring

Posted: Wed Mar 08, 2017 5:59 am
by jyoti22
cool.. This worked.
Thanks for the help.
Kindly close this case