Plugin for Postfix Mail Queue
-
mindspring
- Posts: 117
- Joined: Thu Jul 19, 2012 10:24 am
Plugin for Postfix Mail Queue
Hi there,
I am trying to get a plugin meant for Nagios Core working with Nagios XI.
This is the plugin:
https://exchange.nagios.org/directory/P ... ue/details
I have installed it on both the NagiosXI server as well as the server I am monitoring. When I run the command on the server I am monitoring it gives me the correct information regarding the queue.
I configured a command as per my attachment called postfix1.png and then linked that command to a service. Please see attached service.png to see how it is configured. I have sanitized the host.
NagiosXI reports back to me saying that there is 0 messages in the queue which is incorrect because when I run the command locally it comes up with a different amount.
Can you tell if there is anything I am doing wrong that would cause the plugin to give me incorrect information?
I checked permissions and gave the script Postfix:nagios permissions so that it can execute remotely.
Thanks.
I am trying to get a plugin meant for Nagios Core working with Nagios XI.
This is the plugin:
https://exchange.nagios.org/directory/P ... ue/details
I have installed it on both the NagiosXI server as well as the server I am monitoring. When I run the command on the server I am monitoring it gives me the correct information regarding the queue.
I configured a command as per my attachment called postfix1.png and then linked that command to a service. Please see attached service.png to see how it is configured. I have sanitized the host.
NagiosXI reports back to me saying that there is 0 messages in the queue which is incorrect because when I run the command locally it comes up with a different amount.
Can you tell if there is anything I am doing wrong that would cause the plugin to give me incorrect information?
I checked permissions and gave the script Postfix:nagios permissions so that it can execute remotely.
Thanks.
You do not have the required permissions to view the files attached to this post.
Re: Plugin for Postfix Mail Queue
The command that your check is calling to in the Service management is check_nrpe, not the check_command posted in your second screenshot check_nrpe_postqueue.
You may just need to update this to match, and then set your $ARG#$ variables accordingly.
You may just need to update this to match, and then set your $ARG#$ variables accordingly.
Former Nagios Employee
-
mindspring
- Posts: 117
- Joined: Thu Jul 19, 2012 10:24 am
Re: Plugin for Postfix Mail Queue
Thanks, sorry I was playing around with the config a bit.
I did have it as attached pic (service2.png) in the past.
I think I know what is happening, it is running the command locally on the NagiosXI server and not running it on the actual host I am monitoring.
The documentation shows below. It says I should configure NRPE with the -w and -c and then I should use the check command
"check_command to check_nrpe!check_queue"
It looks like it integrates with check_nrpe in some way. So I think the script actually doesn't need to be on the NagiosXI server and only on the client I am monitoring and then check_nrpe gets the results somehow to run the command on the server I am monitoring?
Thanks.
*********************************************************************
This will display the current queue of Postfix.
Client configuration
====================
1) Put the script in the appropiate directory on the client. If you compile from source, it should be /usr/local/nagios/libexec.
2) Add the following to nrpe.cfg.
command[check_queue]=/usr/local/nagios/libexec/check_postfix_queue -w 20 -c 40
3) Restart nrpe.
Server configuration
====================
1) Edit an existing nrpe service and change the check_command to check_nrpe!check_queue
2) Check if the configuration is correct. /usr/bin/nagios -v /etc/nagios/nagios.cfg
3) Restart Nagios. /etc/init.d/nagios restart
*****************************************************************************************************
I did have it as attached pic (service2.png) in the past.
I think I know what is happening, it is running the command locally on the NagiosXI server and not running it on the actual host I am monitoring.
The documentation shows below. It says I should configure NRPE with the -w and -c and then I should use the check command
"check_command to check_nrpe!check_queue"
It looks like it integrates with check_nrpe in some way. So I think the script actually doesn't need to be on the NagiosXI server and only on the client I am monitoring and then check_nrpe gets the results somehow to run the command on the server I am monitoring?
Thanks.
*********************************************************************
This will display the current queue of Postfix.
Client configuration
====================
1) Put the script in the appropiate directory on the client. If you compile from source, it should be /usr/local/nagios/libexec.
2) Add the following to nrpe.cfg.
command[check_queue]=/usr/local/nagios/libexec/check_postfix_queue -w 20 -c 40
3) Restart nrpe.
Server configuration
====================
1) Edit an existing nrpe service and change the check_command to check_nrpe!check_queue
2) Check if the configuration is correct. /usr/bin/nagios -v /etc/nagios/nagios.cfg
3) Restart Nagios. /etc/init.d/nagios restart
*****************************************************************************************************
You do not have the required permissions to view the files attached to this post.
-
mindspring
- Posts: 117
- Joined: Thu Jul 19, 2012 10:24 am
Re: Plugin for Postfix Mail Queue
When I change the command as the attached picture command.png
I get the following error message:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe!check_queue, ...) failed. errno is 2: No such file or directory
I get the following error message:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe!check_queue, ...) failed. errno is 2: No such file or directory
You do not have the required permissions to view the files attached to this post.
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Plugin for Postfix Mail Queue
Let's start at the beginning and verify each step. What does check_postfix_queue -w 20 -c 40 show when run on the remote system? From that system, please attach the file /usr/local/nagios/etc/nrpe.cfg. Also from there, what is the output of
Code: Select all
# netstat -plnt |grep 5666Previous Nagios employee
-
mindspring
- Posts: 117
- Joined: Thu Jul 19, 2012 10:24 am
Re: Plugin for Postfix Mail Queue
Hi There,
Out of the command:
out of netstat:
Also /etc/xinet.d/nrpe
I have also attached the file.
Thanks!
Out of the command:
Code: Select all
[root]@mail] /usr/local/nagios/libexec] $ ./check_postfix_queue -w 20 -c 40
OK: incoming queue messages: 0 active queue messages: 1 maildrop queue messages: 0 deferred queue messages: 3 bounce queue messages: 0
Code: Select all
[root]@mail. ~] $ netstat -plnt |grep 5666
tcp6 0 0 :::5666 :::* LISTEN 20561/xinetd
Code: Select all
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = 196.x.x.xx
Thanks!
You do not have the required permissions to view the files attached to this post.
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Plugin for Postfix Mail Queue
You appear to have modified your prompt. When logged in as the user shown in the previous What is the output of
Code: Select all
[root]@mail] /usr/local/nagios/libexec] $ ./check_postfix_queue -w 20 -c 40Code: Select all
[root]@mail] /usr/local/nagios/libexec] $ idPrevious Nagios employee
-
mindspring
- Posts: 117
- Joined: Thu Jul 19, 2012 10:24 am
Re: Plugin for Postfix Mail Queue
Sorry, that was me just playing around. I had it without the sudo and it still didn't work. Here is the output with the sudo.
Code: Select all
[nagios]@mail.] $ sudo /usr/local/nagios/libexec/check_postfix_queue -w 20 -c 40
OK: incoming queue messages: 0 active queue messages: 0 maildrop queue messages: 0 deferred queue messages: 8 bounce queue messages: 0
[nagios]@mail.] $ id
uid=5686(nagios) gid=5686(nagios) groups=5686(nagios),89(postfix),5687(nagcmd)
[nagios]@mail.] $
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
Re: Plugin for Postfix Mail Queue
Actually that command appears to be working correctly regardless the use of sudo. Now from the Nagios server try this:
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H <Your remote IP> -c check_queuePrevious Nagios employee
-
mindspring
- Posts: 117
- Joined: Thu Jul 19, 2012 10:24 am
Re: Plugin for Postfix Mail Queue
Ok great thanks, I think it's working now.
I didn't really understand the mechanism with check_nrpe!check_queue and how it was supposed to run.
Many thanks for you help on this, much appreciated.
I didn't really understand the mechanism with check_nrpe!check_queue and how it was supposed to run.
Many thanks for you help on this, much appreciated.
Code: Select all
[root]@[root]@nagiosxi] $ /usr/local/nagios/libexec/check_nrpe -H mail.xxx -c check_queue
OK: incoming queue messages: 0 active queue messages: 0 maildrop queue messages: 0 deferred queue messages: 16 bounce queue messages: 0