Monitoring Postfix in Zabbix

First, configure the Zabbix agent.

Create a file (in the nano editor, press Ctrl+X to exit, and y/n to save or discard changes):

nano /etc/zabbix/zabbix_agentd.d/userparameter_postfix.conf

Add to it:

UserParameter=postfix.maildrop, find /var/spool/postfix/maildrop -type f | wc -l
UserParameter=postfix.deferred, find /var/spool/postfix/deferred -type f | wc -l
UserParameter=postfix.incoming, find /var/spool/postfix/incoming -type f | wc -l, find /var/spool/postfix/active -type f | wc -l
UserParameter=postfix.queue, mailq | grep -v "Mail queue is empty" | grep -c '^[0-9A-Z]'

Alternatively, you can simply add the lines above to the Zabbix agent configuration file.

Also open the Zabbix agent configuration file:

nano /etc/zabbix/zabbix_agentd.conf

We will allow Zabbix agent to work as root with the user specifying:


Restart the Zabbix agent to apply the changes:

sudo /etc/init.d/zabbix-agent restart

Now go to the Zabbix server.
Create a Postfix template, add data items to it, specifying the type – Zabbix agent, and the keys: postfix.maildrop, postfix.deferred, postfix.incoming,, postfix.queue.
Create graphics for the created data items.

You can also create a data item that counts the number of Postfix processes by specifying the type – Zabbix agent, and the key:


Also create a trigger that tells when processes 0.

Download the ready template here – Zabbix шаблон для Postfix

Did my article help you? How about buying me a cup of coffee as an encouragement? Buy me a coffe.

Leave a comment

Leave a Reply