How to monitor an Exim queue on a WHM server using SNMP and PRTG

Synopsis

This article described types of queue  monitoring you might want to do on an Exim server.

  1. Monitor the Exim queue length and pre-empt getting your IP address blacklisted.
  2. Monitor the SMTP connection count to catch denial of service attacks and avoid “421 Too many concurrent SMTP connections; please try again later”

This technique uses an HTTPS connection and PRTG’s delta integer type to keep track of the queue size and connection count.

You have to pick a “static” site on your server, ie. one that will never be deleted.

The contents of exim.sh is:

#!/bin/bash

echo "[`/usr/sbin/exim -bpc`]" > "/home/cpanel_user/public_html/exim-queue.example.com/monitor/eximqueue.txt"

echo "[`grep -a "TCP/IP connection count" /var/log/exim_mainlog | tail -1 | sed -E 's/.*count = ([0-9]+).*/\1/'`]" \
> /home/cpanel_user/public_html/exim-queue.example.com/monitor/eximconnections.txt

The root CRON required is this:

* * * * * /bin/sh /home/domain/public_html/exim/exim.sh

Now every minute it will count the message and output a text file. For example:

cat eximqueue.txt
[10]

cat eximconnections.txt
[51]

Now in PRTG you can use the HTTP Content sensor that looks like this:

When adding the PRTG sensor, specify the path to the website TXT file, e.g.:

https://domain.com/exim/eximqueue.txt or
https://domain.com/exim/eximconnections.txt

See Also

 

 

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *