Is there a way to monitor the number of messages of a Postfix mail queue and alert if it exceeds a specific value ?
The command just displays '2' which is the current number of messages on the queue, I currently have a script that runs every minute and if the queue grows larger than 10000 messages it sends a email to the administrators to investigate.
Please find attached the plugin script for monitoring the Postfix mail queue count.
- Download and install the latest version of the Site24x7 Linux agent in the network where you plan to run the plugin.
Unzip and download the attachment postfix_mailq_stats.zip. Place the file in the Linux agent's plugin directory - /opt/site24x7/monagent/plugins
In the next data collection, the plugin will be added for monitoring.
You can also configure thresholds for the metric 'mailq_count' to get alerts when the given value is breached. Follow the steps below:
- Log in to Site24x7 and go to Server > Plugin Integrations.
- Click on the plugin monitor added.
- Hover on the hamburger icon beside the display name and click on Edit.
- In the Edit Plugin Monitor page, click on the pencil icon beside Threshold and Availability.
- Set a threshold value for the metric 'mailq_count' and select the alert type. You can also associate automation to automatically resolve the issue when the threshold is breached. Save your changes.
Hope this helps. Let us know for questions, if any, in the below thread.