May 25, 2019

BASH :: check the Postfix mail queues for Nagios

(Last Updated On: 16th September 2016)

Here is a tiny bash script that will check your Postfix mail queue and exit the code dependant on the result.  Often mail relays sit in the background not really ever breaking and therefore never being monitored.  I wrote this little check so the IT team would be the first to know if mail started backing up.

It can be added into your nrpe.cfg file if you are using nrpe as a monitoring agent by adding a line such as:


Result=$(postqueue -p | grep "Mail queue is empty");
if [[ ! $Result ]];
then echo "Mail in the Queue!";exit 1;
else echo "No Mail in the Queue!"; exit 0;

Previous «
Next »

Simon is a sysadmin for a global financial organisation and specialises in Windows, security and automation.

1 Comment

  1. Pingback: PowerShell :: check the Exchange 2010 queues for Nagios – Synack

Leave a Reply

Subscribe to SYNACK via Email

%d bloggers like this: