Friday, December 12, 2008

Queuegraph - a RRDtool frontend for Postfix queue-statistics

queuegraph is a very simple mail statistics RRDtool frontend for Postfix that produces daily, weekly, monthly and yearly graphs of Postfix's active, deferred, incoming and bounce queues.The postfix's queue is usually in /var/spool/postfix. queuegraph is created by Ralf Hildebrandt and based on mailgraph by David Schweikert. Below is the dirs in my system:

# ls /var/spool/postfix/
active/ corrupt/ deferred/ etc/ flush/ incoming/ maildrop/ postgrey/ public/ tmp/ var/
bounce/ defer/ dev/ extern/ hold/ lib64/ pid/ private/ saved/ trace/
#

In connection with qshape it can be used to find out if your server is having performance issues:
  • a large deferred queue indicates delivery problems
  • a large active queue points to slow destinations (e.g. a content_filter)
You can download queuegraph here.

Before you download it, pls check the requirements:
  • rrdtools (Mandriva users: urpmi rrdtool)
  • librrds-perl (Mandriva users: urpmi perl-rrdtool)
After finish downloading it, extract it: tar xzvf queuegraph.tar.gz
List down the extracted files: ls -l (see below)

# ls
queuegraph.cgi* queuegraph-rrd.sh* README
#

Create a cronjob that runs queuegraph-rrd.sh every minute -- this populates the *.rrd database:

* * * * * /usr/local/bin/queuegraph-rrd.sh

Note: On Mandriva, i created a dir under /etc named cron.minutes and copied file queuegraph-rrd.sh into it: cp queuegraph-rrd.sh /etc/cron/minutes

And then I edited crontab by adding this line:
* * * * * root nice -19 run-parts --report /etc/cron.minutes

Then I copied queuegraph.cgi into the cgi-bin directory of my webserver: cp queuegraph.cgi /var/www/cgi-bin/ or where your webserver's cgi directory is (consult your distro manual.) Then chmoded it to 755 so that my webserver can run it: chmod 755 queuegraph.cgi

To see the statistics created by queuegraph, point your web browser to http://yourwebseraddress/cgi-bin/queuegraph.cgi

This is the graph for my postfix queue (without the Month and Year graph):


That's all there is to it.

No comments: