[Updated 2015-03-09]
There are a bunch of articles and information on this topic out there, but most of them either don’t work, are outdated, or are scattered across multiple pages on the Cacti forums.
I’ve worked out the kinks for you, so here’s what you need to do to graph Postfix with Cacti.
This was performed on Debian 6 with Cacti 0.8.7g from the apt repository but should work on other distros too.
Note that this article tackles graphing the sent, received, rejected, bounced, spam, and virus statistics. It does not graph mail queues.
You need two files, the first is mailgraph.pl which you’ll need to put on your mail server. It’s a modified version of David Schweikert’s mailgraph which writes mail statistics into /var/tmp instead of generating rrds. The second is the xml template file which you’ll import into Cacti. You’ll find both files in the link below.
- Copy mailgraph.pl to your mail server and place in a suitable location, eg /usr/local/bin
- Run mailgraph in daemon mode with “mailgraph.pl -d”. Mailgraph will write its statistic files to /var/tmp.
- Configure your snmpd.conf file on your mail server by adding the following:
extend .1.3.6.1.4.1.2021.50 mailcount_sent /bin/cat /var/tmp/mailsent
extend .1.3.6.1.4.1.2021.51 mailcount_recv /bin/cat /var/tmp/mailrecv
extend .1.3.6.1.4.1.2021.52 mailcount_reject /bin/cat /var/tmp/mailrejected
extend .1.3.6.1.4.1.2021.53 mailcount_bounced /bin/cat /var/tmp/mailbounced
extend .1.3.6.1.4.1.2021.54 mailcount_spam /bin/cat /var/tmp/mailspam
extend .1.3.6.1.4.1.2021.55 mailcount_virus /bin/cat /var/tmp/mailvirus - Restart snmpd
- Import the xml template into Cacti
- Create graphs for the mail server
Notes:
RBL spam rejections will show up under the rejected mailcount.
If you’re still having problems getting Cacti to graph, try adding this to snmpd.conf “view systemonly included .1.3.6.1.4.1”.
If you can’t get this to work or have any questions, i’d be happy to help.