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:
#!/bin/bash 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; fi;