
Postfix Queue monitor,as name suggests, is a postfix queue monitoring package for Nagios. It uses NRPE plugin for monitoring.Through this you can monitoring postfix queue size and the number of mails in queue of single or multiple postfix instances on a single server. 

This package is tested successfully on CentOS/RedHat/Fedora distributions. And I am sure it will surely work on Ubuntu also. 
In case of any suggestions, queries or issues with package please report to gouravjoshi@gmail.com


INSTALLATION 

As this is Nagios based monitoring package we need Nagios, Nagios Plugin Architecture and, NRPE installed as prereuisites.

There is nothing to be install as such, just copy all the scripts in nagios installation libexec directory and start using.



NAGIOS INTEGRATION

                define service{
                host_name                              example.com
                service_description             Postfix-Queue
                is_volatile                     1
                check_command                   check_nrpe!check_postfix
                max_check_attempts                      4
                normal_check_interval           15
                retry_check_interval            1
                check_period                    24x7
                notification_interval           15
                notifications_enabled           1
                notification_period             24x7
                notification_options            w,u,c,r,f
                contact_groups                  Server-Administrator
                stalking_options                        w,u,c
                }


                Where example.com is the hostname on which you have configured monitoring package with NRPE.
                check_command will be the command you have defined in nrpe.cfg of the host. For multiple instances change the
                command name as defined in nrpe.cfg file.

                After any changes in nrpe configuration file, you need to restart the nrpe plugin.


#############################################################################################################################


SCRIPT DETAILS

check_postque.sh
Usage	:	Put this file into libexec directory of Nagios installation and configure its output file name to be used in 
		queuemon file.
                Example :-                                                                               
                /bin/bash /usr/local/nagios/libexec/check_postque.sh -w 500000 -c 700000 -p postfix > /tmp/que   
                where /tmp/queue is the output file name of quemon script.                               
                -w Warning limit(KB), -c Critical limit (KB), -p Postfix instance name 							     The above example will check postfix with warning limit 500MB and Critical limit 700MB   
		This is a componant which will be run by queuemon daemon. The above example is given if you want to test the
		script output. You do not need to run this script individually. 



queuemon
Usage	:	This script will run as a daemon to generate output file for NRPE Plugin. Just need to provide appropriate 
		variables and you are ready to go. -w <Warning Limit>(in KB),-c <Critical Limit>(in KB),-p <Postfix Instance>                You can change output file location and name, but remember to changes accordingly in other scripts and 
		configurtion files.
		The default is to check postfix with warning limit 500MB and Critical limit 700MB, which can be changed 
		according to requirements.
		To monitor start this script as : /usr/local/nagios/libexec/queuemon &
		This will put the script in background and it will be generating output every minute.
		
		MONITOR MULTIPLE INSTANCES
		To monitor multiple instances of postfix just make copies of queuemon script with different names and change
		the postfix instance name and the alert limits in each script and start it.
		


check_queue
Usage	:	Put this file into libexec directory of Nagios installation and configure in nrpe config file.
		Example :-                           
		command[check_postfix]=/usr/local/nagios/libexec/check_queue /tmp/que   
                where /tmp/que is the output file name of quemon script.
		
		MONITOR MULTIPLE INSTANCES
		In NRPE config file (nrpe.cfg) you will need to change the command name and the file name you are generating
		for each instance.
		
		For Example :-
		command[check_postfix]=/usr/local/nagios/libexec/check_queue /tmp/que [for 1st instance]
		command[check_postfix2]=/usr/local/nagios/libexec/check_queue /tmp/que2 [for 2nd instance]
