Postfix Mail Graph monitoring with Cacti
Se avete bisogno di graficare su Cacti l’andamento di un server mail che usa Postfix come MTA, questi semplici step vi saranno di particolare aiuto:
- Salvate nel vostro server mail lo script mailgraph.pl che trovate all’interno del download (thanks to David Schweikert)
- Lanciatelo come root con l’ozione -d per renderlo demone: ./mailgraph -d (usate –help per tutte le opzioni)
mailgraph.pl scrive dei semplici file di testo con i contatori relativi alla tipologi di traffico mail nella directory /var/tmp:
# ls -l /var/tmp
-rw-r--r-- 1 root root 3 2008-03-06 10:25 mailbounced
-rw-r--r-- 1 root root 3 2008-03-06 10:25 mailrecv
-rw-r--r-- 1 root root 3 2008-03-06 10:25 mailrejected
-rw-r--r-- 1 root root 2 2008-03-06 10:25 mailsent
-rw-r--r-- 1 root root 2 2008-03-06 10:25 mailspam
-rw-r--r-- 1 root root 2 2008-03-06 10:25 mailvirus
- configurate l’snmpd.conf del vostro server mail in modo che legga questi file associandoli a degli OID custom, in un modo simile a questo (ricordatevi di riavviare l’snmpd):
exec .1.3.6.1.4.1.2021.50 mailcount_sent /bin/cat /var/tmp/mailsent
exec .1.3.6.1.4.1.2021.51 mailcount_recv /bin/cat /var/tmp/mailrecv
exec .1.3.6.1.4.1.2021.52 mailcount_reject /bin/cat /var/tmp/mailrejected
exec .1.3.6.1.4.1.2021.53 mailcount_bounced /bin/cat /var/tmp/mailbounced
exec .1.3.6.1.4.1.2021.54 mailcount_spam /bin/cat /var/tmp/mailspam
exec .1.3.6.1.4.1.2021.55 mailcount_virus /bin/cat /var/tmp/mailvirus
- ora non resta che aggiungere il template xml (che trovate nel download) su Cacti con la funzione import e creare il grafico
Per approfondire:
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
19:35 on July 28th, 2012
Hi, Neat post. There is an issue with your web site in web explorer, could check this? IE nonetheless is the market leader and a large component to people will omit your great writing because of this problem.
00:51 on June 15th, 2012
I savor, cause I found just what I used to be taking a look for. You’ve ended my 4 day long hunt! God Bless you man. Have a nice day. Bye
06:24 on May 25th, 2012
Please ignore my previous post, simply adding the .1.0 to the OID will not work. I’ve updated the XML to make it simpler.
I’ve also updated the snmpd configs because exec is now deprecated.
You can find the set of instructions here:
http://coredump.id.au/graphing-postfix-with-cacti/
02:08 on May 25th, 2012
To Simone, I was seeing the same problems too…..but managed to fix it.
You have to edit your data template and add .1.0 to the end of all the OIDS that the Postfix template imported.
Next delete all your Postfix graphs and data sources then graph them again. They’ll start to work properly after that.
It worked for me :)
Also thanks for the instructions Michele.
16:56 on October 2nd, 2011
Hello There. I discovered your blog the use of msn. This is a very smartly written article. I?ll be sure to bookmark it and come back to read extra of your useful information. Thanks for the post. I will definitely comeback.
23:49 on August 15th, 2011
you are really a just right webmaster. The website loading velocity is incredible. It kind of feels that you are doing any distinctive trick. Moreover, The contents are masterpiece. you’ve done a fantastic job in this matter!
17:08 on April 6th, 2011
Non funziona, o meglio, funziona a metà… Sembra che il cacti non legga i file sulla temporanea che lo script crea. Ti inoltro il file di log del cacti con l’errore.
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:’127.0.0.1′, and OID:’.1.3.6.1.4.1.2021.53′
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] Host[1] DS[12] WARNING: Result from SNMP not valid. Partial Result: U
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:’127.0.0.1′, and OID:’.1.3.6.1.4.1.2021.51′
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] Host[1] DS[13] WARNING: Result from SNMP not valid. Partial Result: U
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:’127.0.0.1′, and OID:’.1.3.6.1.4.1.2021.52′
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] Host[1] DS[14] WARNING: Result from SNMP not valid. Partial Result: U
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:’127.0.0.1′, and OID:’.1.3.6.1.4.1.2021.50′
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] Host[1] DS[15] WARNING: Result from SNMP not valid. Partial Result: U
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:’127.0.0.1′, and OID:’.1.3.6.1.4.1.2021.54′
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] Host[1] DS[16] WARNING: Result from SNMP not valid. Partial Result: U
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:’127.0.0.1′, and OID:’.1.3.6.1.4.1.2021.55′
04/06/2011 06:05:02 PM – CMDPHP: Poller[0] Host[1] DS[17] WARNING: Result from SNMP not valid. Partial Result: U
04:07 on March 9th, 2008
Always wondered what happens in the catch all mailbox but was afraid to look. :D
Thanks, I’ll try to get this working.
22:11 on March 7th, 2008
Um.
I blog dei tecnocrati, che ti dicono che sei lì per la prima volta, mi inquietano.
Vorrei farti una domanda piuttosto ingenua. Vorrei sapere se, nel lasciare splinder (per motivi non tecnici) ho fatto una buona scelta tecnica a prendere wordpress (ho scelto a caso) rispetto ad altre piattaforme tipo blogspot, e se sì (o se no) perchè.
Grazie :)