PostFix mail queue monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

PostFix mail queue monitoring

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: PostFix mail queue monitoring

Post 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
Former Nagios employee
https://www.mcapra.com/
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

Re: PostFix mail queue monitoring

Post by jyoti22 »

even after defining the command on the remote server I am getting attached error.
You do not have the required permissions to view the files attached to this post.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: PostFix mail queue monitoring

Post 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"?
You do not have the required permissions to view the files attached to this post.
Former Nagios employee
https://www.mcapra.com/
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

Re: PostFix mail queue monitoring

Post 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
}
You do not have the required permissions to view the files attached to this post.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: PostFix mail queue monitoring

Post by mcapra »

Can you send us the full contents of your check_postfix_queue script?
Former Nagios employee
https://www.mcapra.com/
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

Re: PostFix mail queue monitoring

Post by jyoti22 »

Hi,

PFA.. Thanks. i havent used .sh extension on the plugin
You do not have the required permissions to view the files attached to this post.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: PostFix mail queue monitoring

Post 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.
You do not have the required permissions to view the files attached to this post.
Former Nagios employee
https://www.mcapra.com/
jyoti22
Posts: 254
Joined: Mon Mar 23, 2015 4:50 am

Re: PostFix mail queue monitoring

Post by jyoti22 »

cool.. This worked.
Thanks for the help.
Kindly close this case
Locked