apt-get install logtail pflogsumm
Create /opt/zabbix/postfix-zabbix-stats.bash (see attachment)
Create /etc/zabbix/zabbix_agent.d/postfix with the following:
Create a cron job, /etc/cron.d/zabbix
# Things which help the zabbix agents out # Get postfix stats every 5 minutes */5 * * * * root /opt/zabbix/postfix-zabbix-stats.bash
Add "Template App Postfix" to your server.
What this Does
postfix-zabbix-stats.bash is a modified version of someone elses script. I'll have to find out so I can attribute it correctly.
pflogsumm is designed to give statistical information on a postfix mail log. The script parses that information and stores it in /tmp/postfix_statsfile.dat, which is a semicolon delimited file containing keys and values. One of my modifications was to add the ability to read the mail queue for postfix which the original did not do (pflogsumm does not do that).
When the Zabbix Server calls and asks for a postfix key, it passes a parameter to the same script. In this case, the script acts differently and it looks up the key in the data file and returns the value.
Attached files: postfix-zabbix-stats.bash