Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kstka/zabbix-postfix-template.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYouniverse <y0un1verse@yandex.ru>2019-03-21 18:21:00 +0300
committerYouniverse <y0un1verse@yandex.ru>2019-03-21 18:21:00 +0300
commitd07458326075e53e6c9eae1852ad8667219e7c19 (patch)
tree6937d0b58002ab30ea4a85d3f078badaaaecaaae
parent6b81e9f75376c56b0a252696d18be1f209df8b70 (diff)
Updates
-rw-r--r--README.md32
-rw-r--r--template_app_zabbix.xml1289
-rw-r--r--userparameter_postfix.conf3
-rw-r--r--zabbix-postfix-stats.sh109
4 files changed, 1433 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4761f9d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,32 @@
+# zabbix-postfix-template
+Zabbix template for Postfix SMTP server
+Works for Zabbix 4.x
+
+Forked from http://admin.shamot.cz/?p=424
+
+# Requirements
+* [pflogsum](http://jimsun.linxnet.com/postfix_contrib.html)
+* [pygtail](https://pypi.org/project/pygtail/)
+
+# Installation
+ # for Ubuntu / Debian
+ apt-get install pflogsumm
+
+ # for CentOS
+ yum install postfix-perl-scripts
+
+ cp pygtail.py /usr/sbin/
+ chmod +x /usr/sbin/pygtail.py
+
+ # ! check MAILLOG path in zabbix-postfix-stats.sh
+ cp zabbix-postfix-stats.sh /usr/bin/
+ chmod +x /usr/bin/zabbix-postfix-stats.sh
+
+ cp userparameter_postfix.conf /etc/zabbix/zabbix_agentd.d/
+
+ # run **visudo** as root
+ zabbix ALL=(ALL) NOPASSWD: /usr/bin/zabbix-postfix-stats.sh
+
+ systemctl restart zabbix-agent
+
+Finally import template_app_zabbix.xml and attach it to your host \ No newline at end of file
diff --git a/template_app_zabbix.xml b/template_app_zabbix.xml
new file mode 100644
index 0000000..1cd9345
--- /dev/null
+++ b/template_app_zabbix.xml
@@ -0,0 +1,1289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<zabbix_export>
+ <version>4.0</version>
+ <date>2019-03-21T15:18:19Z</date>
+ <groups>
+ <group>
+ <name>Templates</name>
+ </group>
+ </groups>
+ <templates>
+ <template>
+ <template>Template App Postfix</template>
+ <name>Template App Postfix</name>
+ <description/>
+ <groups>
+ <group>
+ <name>Templates</name>
+ </group>
+ </groups>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <items>
+ <item>
+ <name>SMTP Service</name>
+ <type>3</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>net.tcp.service[smtp,{$POSTFIX_SMTP_IP},25]</key>
+ <delay>1m</delay>
+ <history>1w</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units/>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing/>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Mail Queue</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix.pfmailq</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix data update request</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix.update_data</key>
+ <delay>1m</delay>
+ <history>30d</history>
+ <trends>0</trends>
+ <status>0</status>
+ <value_type>4</value_type>
+ <allowed_hosts/>
+ <units/>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing/>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Bounced</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[bounced]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Bytes Delivered</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[bytes_delivered]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>B</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Bytes Received</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[bytes_received]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>B</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Deferred</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[deferred]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Delivered</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[delivered]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Discarded</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[discarded]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Forwarded</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[forwarded]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Held</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[held]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Received</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[received]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Rejected</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[rejected]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ <item>
+ <name>Postfix Reject Warnings</name>
+ <type>0</type>
+ <snmp_community/>
+ <snmp_oid/>
+ <key>postfix[reject_warnings]</key>
+ <delay>3m</delay>
+ <history>30d</history>
+ <trends>365d</trends>
+ <status>0</status>
+ <value_type>3</value_type>
+ <allowed_hosts/>
+ <units>mails</units>
+ <snmpv3_contextname/>
+ <snmpv3_securityname/>
+ <snmpv3_securitylevel>0</snmpv3_securitylevel>
+ <snmpv3_authprotocol>0</snmpv3_authprotocol>
+ <snmpv3_authpassphrase/>
+ <snmpv3_privprotocol>0</snmpv3_privprotocol>
+ <snmpv3_privpassphrase/>
+ <params/>
+ <ipmi_sensor/>
+ <authtype>0</authtype>
+ <username/>
+ <password/>
+ <publickey/>
+ <privatekey/>
+ <port/>
+ <description/>
+ <inventory_link>0</inventory_link>
+ <applications>
+ <application>
+ <name>Postfix</name>
+ </application>
+ </applications>
+ <valuemap/>
+ <logtimefmt/>
+ <preprocessing>
+ <step>
+ <type>9</type>
+ <params/>
+ </step>
+ </preprocessing>
+ <jmx_endpoint/>
+ <timeout>3s</timeout>
+ <url/>
+ <query_fields/>
+ <posts/>
+ <status_codes>200</status_codes>
+ <follow_redirects>1</follow_redirects>
+ <post_type>0</post_type>
+ <http_proxy/>
+ <headers/>
+ <retrieve_mode>0</retrieve_mode>
+ <request_method>0</request_method>
+ <output_format>0</output_format>
+ <allow_traps>0</allow_traps>
+ <ssl_cert_file/>
+ <ssl_key_file/>
+ <ssl_key_password/>
+ <verify_peer>0</verify_peer>
+ <verify_host>0</verify_host>
+ <master_item/>
+ </item>
+ </items>
+ <discovery_rules/>
+ <httptests/>
+ <macros>
+ <macro>
+ <macro>{$POSTFIX_SMTP_IP}</macro>
+ <value>{HOST.IP}</value>
+ </macro>
+ </macros>
+ <templates/>
+ <screens/>
+ </template>
+ </templates>
+ <triggers>
+ <trigger>
+ <expression>{Template App Postfix:postfix[bounced].last(0)}&gt;50</expression>
+ <recovery_mode>0</recovery_mode>
+ <recovery_expression/>
+ <name>Postfix: Too many bounced mails on {HOST.NAME}</name>
+ <correlation_mode>0</correlation_mode>
+ <correlation_tag/>
+ <url/>
+ <status>0</status>
+ <priority>2</priority>
+ <description/>
+ <type>0</type>
+ <manual_close>0</manual_close>
+ <dependencies/>
+ <tags/>
+ </trigger>
+ <trigger>
+ <expression>{Template App Postfix:postfix[deferred].last(0)}&gt;50</expression>
+ <recovery_mode>0</recovery_mode>
+ <recovery_expression/>
+ <name>Postfix: Too many deferred mails on {HOST.NAME}</name>
+ <correlation_mode>0</correlation_mode>
+ <correlation_tag/>
+ <url/>
+ <status>0</status>
+ <priority>4</priority>
+ <description/>
+ <type>0</type>
+ <manual_close>0</manual_close>
+ <dependencies/>
+ <tags/>
+ </trigger>
+ <trigger>
+ <expression>{Template App Postfix:postfix[held].last(0)}&gt;200 or {Template App Postfix:postfix.pfmailq.last(0)}&gt;200</expression>
+ <recovery_mode>0</recovery_mode>
+ <recovery_expression/>
+ <name>Postfix: Too many held mails on {HOST.NAME}</name>
+ <correlation_mode>0</correlation_mode>
+ <correlation_tag/>
+ <url/>
+ <status>0</status>
+ <priority>2</priority>
+ <description/>
+ <type>0</type>
+ <manual_close>0</manual_close>
+ <dependencies/>
+ <tags/>
+ </trigger>
+ <trigger>
+ <expression>{Template App Postfix:postfix[rejected].last(0)}&gt;20 or {Template App Postfix:postfix[reject_warnings].last(0)}&gt;20</expression>
+ <recovery_mode>0</recovery_mode>
+ <recovery_expression/>
+ <name>Postfix: Too many rejected mails on {HOST.NAME}</name>
+ <correlation_mode>0</correlation_mode>
+ <correlation_tag/>
+ <url/>
+ <status>0</status>
+ <priority>4</priority>
+ <description/>
+ <type>0</type>
+ <manual_close>0</manual_close>
+ <dependencies/>
+ <tags/>
+ </trigger>
+ <trigger>
+ <expression>{Template App Postfix:postfix.update_data.regexp(ERROR)}=1</expression>
+ <recovery_mode>0</recovery_mode>
+ <recovery_expression/>
+ <name>Postfix statistics could not be updated</name>
+ <correlation_mode>0</correlation_mode>
+ <correlation_tag/>
+ <url/>
+ <status>0</status>
+ <priority>2</priority>
+ <description/>
+ <type>0</type>
+ <manual_close>0</manual_close>
+ <dependencies/>
+ <tags/>
+ </trigger>
+ <trigger>
+ <expression>{Template App Postfix:net.tcp.service[smtp,{$POSTFIX_SMTP_IP},25].max(#3)}=0</expression>
+ <recovery_mode>0</recovery_mode>
+ <recovery_expression/>
+ <name>SMTP service is down on {HOST.NAME}</name>
+ <correlation_mode>0</correlation_mode>
+ <correlation_tag/>
+ <url/>
+ <status>0</status>
+ <priority>4</priority>
+ <description/>
+ <type>0</type>
+ <manual_close>0</manual_close>
+ <dependencies/>
+ <tags/>
+ </trigger>
+ </triggers>
+ <graphs>
+ <graph>
+ <name>Postfix Error Pie</name>
+ <width>900</width>
+ <height>200</height>
+ <yaxismin>0.0000</yaxismin>
+ <yaxismax>0.0000</yaxismax>
+ <show_work_period>0</show_work_period>
+ <show_triggers>0</show_triggers>
+ <type>3</type>
+ <show_legend>1</show_legend>
+ <show_3d>1</show_3d>
+ <percent_left>0.0000</percent_left>
+ <percent_right>0.0000</percent_right>
+ <ymin_type_1>0</ymin_type_1>
+ <ymax_type_1>0</ymax_type_1>
+ <ymin_item_1>0</ymin_item_1>
+ <ymax_item_1>0</ymax_item_1>
+ <graph_items>
+ <graph_item>
+ <sortorder>0</sortorder>
+ <drawtype>0</drawtype>
+ <color>C80000</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[bounced]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>1</sortorder>
+ <drawtype>0</drawtype>
+ <color>00C800</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[deferred]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>2</sortorder>
+ <drawtype>0</drawtype>
+ <color>0000C8</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[discarded]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>3</sortorder>
+ <drawtype>0</drawtype>
+ <color>C800C8</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[rejected]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>4</sortorder>
+ <drawtype>0</drawtype>
+ <color>00C8C8</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[reject_warnings]</key>
+ </item>
+ </graph_item>
+ </graph_items>
+ </graph>
+ <graph>
+ <name>Postfix Mails Scoreboard</name>
+ <width>900</width>
+ <height>300</height>
+ <yaxismin>0.0000</yaxismin>
+ <yaxismax>100.0000</yaxismax>
+ <show_work_period>0</show_work_period>
+ <show_triggers>0</show_triggers>
+ <type>0</type>
+ <show_legend>1</show_legend>
+ <show_3d>0</show_3d>
+ <percent_left>0.0000</percent_left>
+ <percent_right>0.0000</percent_right>
+ <ymin_type_1>0</ymin_type_1>
+ <ymax_type_1>0</ymax_type_1>
+ <ymin_item_1>0</ymin_item_1>
+ <ymax_item_1>0</ymax_item_1>
+ <graph_items>
+ <graph_item>
+ <sortorder>0</sortorder>
+ <drawtype>0</drawtype>
+ <color>009900</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[bounced]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>1</sortorder>
+ <drawtype>0</drawtype>
+ <color>FF99FF</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[reject_warnings]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>2</sortorder>
+ <drawtype>0</drawtype>
+ <color>AAAA00</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix.pfmailq</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>3</sortorder>
+ <drawtype>0</drawtype>
+ <color>EE00EE</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[discarded]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>4</sortorder>
+ <drawtype>0</drawtype>
+ <color>880088</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[rejected]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>5</sortorder>
+ <drawtype>0</drawtype>
+ <color>0000CC</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[received]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>6</sortorder>
+ <drawtype>0</drawtype>
+ <color>FF6666</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[held]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>7</sortorder>
+ <drawtype>0</drawtype>
+ <color>FFFF33</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[forwarded]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>8</sortorder>
+ <drawtype>0</drawtype>
+ <color>00EE00</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[delivered]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>9</sortorder>
+ <drawtype>0</drawtype>
+ <color>EE0000</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[deferred]</key>
+ </item>
+ </graph_item>
+ </graph_items>
+ </graph>
+ <graph>
+ <name>Postfix Traffic</name>
+ <width>900</width>
+ <height>200</height>
+ <yaxismin>0.0000</yaxismin>
+ <yaxismax>100.0000</yaxismax>
+ <show_work_period>0</show_work_period>
+ <show_triggers>0</show_triggers>
+ <type>0</type>
+ <show_legend>1</show_legend>
+ <show_3d>0</show_3d>
+ <percent_left>0.0000</percent_left>
+ <percent_right>0.0000</percent_right>
+ <ymin_type_1>0</ymin_type_1>
+ <ymax_type_1>0</ymax_type_1>
+ <ymin_item_1>0</ymin_item_1>
+ <ymax_item_1>0</ymax_item_1>
+ <graph_items>
+ <graph_item>
+ <sortorder>0</sortorder>
+ <drawtype>0</drawtype>
+ <color>C80000</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[bytes_received]</key>
+ </item>
+ </graph_item>
+ <graph_item>
+ <sortorder>1</sortorder>
+ <drawtype>0</drawtype>
+ <color>00C800</color>
+ <yaxisside>0</yaxisside>
+ <calc_fnc>2</calc_fnc>
+ <type>0</type>
+ <item>
+ <host>Template App Postfix</host>
+ <key>postfix[bytes_delivered]</key>
+ </item>
+ </graph_item>
+ </graph_items>
+ </graph>
+ </graphs>
+</zabbix_export>
diff --git a/userparameter_postfix.conf b/userparameter_postfix.conf
new file mode 100644
index 0000000..a22c57a
--- /dev/null
+++ b/userparameter_postfix.conf
@@ -0,0 +1,3 @@
+UserParameter=postfix.pfmailq,mailq | grep -v "Mail queue is empty" | grep -c '^[0-9A-Z]'
+UserParameter=postfix[*],sudo /usr/bin/zabbix-postfix-stats.sh $1
+UserParameter=postfix.update_data,sudo /usr/bin/zabbix-postfix-stats.sh
diff --git a/zabbix-postfix-stats.sh b/zabbix-postfix-stats.sh
new file mode 100644
index 0000000..9219f53
--- /dev/null
+++ b/zabbix-postfix-stats.sh
@@ -0,0 +1,109 @@
+#!/usr/bin/env bash
+
+MAILLOG=/var/log/mail.log
+PFOFFSETFILE=/tmp/zabbix-postfix-offset.dat
+PFSTATSFILE=/tmp/postfix_statsfile.dat
+TEMPFILE=$(mktemp)
+PFLOGSUMM=/usr/sbin/pflogsumm
+PYGTAIL=/usr/sbin/pygtail.py
+
+# list of values we are interested in
+PFVALS=( 'received' 'delivered' 'forwarded' 'deferred' 'bounced' 'rejected' 'held' 'discarded' 'reject_warnings' 'bytes_received' 'bytes_delivered' )
+
+# write result of running this script
+write_result () {
+
+ echo "$2"
+ exit $1
+
+}
+
+# check for binaries we need to run the script
+if [ ! -x ${PFLOGSUMM} ] ; then
+ echo "ERROR: ${PFLOGSUMM} not found"
+ exit 1
+fi
+
+if [ ! -x ${PYGTAIL} ] ; then
+ echo "ERROR: ${PYGTAIL} not found"
+ exit 1
+fi
+
+if [ ! -r ${MAILLOG} ] ; then
+ echo "ERROR: ${MAILLOG} not readable"
+ exit 1
+fi
+
+
+# check whether file exists and the write permissions are granted
+if [ ! -w "${PFSTATSFILE}" ]; then
+ touch "${PFSTATSFILE}" && chown zabbix:zabbix "${PFSTATSFILE}" > /dev/null 2>&1
+
+ if [ ! $? -eq 0 ]; then
+ result_text="ERROR: wrong exit code returned while creating file ${PFSTATSFILE} and setting its owner to zaabbix:zabbix"
+ result_code="1"
+ write_result "${result_code}" "${result_text}"
+ fi
+fi
+
+# read specific value from data file and print it
+readvalue () {
+ local $key
+ key=$(echo ${PFVALS[@]} | grep -wo $1)
+ if [ -n "${key}" ]; then
+ value=$(grep -e "^${key};" "${PFSTATSFILE}" | cut -d ";" -f2)
+ echo "${value}"
+
+ else
+ rm "${TEMPFILE}"
+ result_text="ERROR: could not get value \"$1\" from ${PFSTATSFILE}"
+ result_code="1"
+ write_result "${result_code}" "${result_text}"
+ fi
+}
+
+# update value in data file
+updatevalue() {
+ local $key
+ local $pfkey
+
+ key=$1
+ pfkey=$(echo "$1" | tr '_' ' ')
+
+ # convert value to bytes
+ value=$(grep -m 1 "$pfkey" $TEMPFILE | awk '{print $1}' | awk '/k|m/{p = /k/?1:2}{printf "%d\n", int($1) * 1024 ^ p}')
+
+ # update values in data file
+ old_value=$(grep -e "^${key};" "${PFSTATSFILE}" | cut -d ";" -f2)
+ if [ -n "${old_value}" ]; then
+ sed -i -e "s/^${key};${old_value}/${key};$((${old_value}+${value}))/" "${PFSTATSFILE}"
+ else
+ echo "${key};${value}" >> "${PFSTATSFILE}"
+
+ fi
+}
+
+# is there a requests for specific value or do we update all values ?
+if [ -n "$1" ]; then
+ readvalue "$1"
+else
+ # read the new part of mail log and read it with pflogsumm to get the summary
+ "${PYGTAIL}" -o"${PFOFFSETFILE}" "${MAILLOG}" | "${PFLOGSUMM}" -h 0 -u 0 --no_bounce_detail --no_deferral_detail --no_reject_detail --no_smtpd_warnings --no_no_msg_size > "${TEMPFILE}" 2>/dev/null
+
+ if [ ! $? -eq 0 ]; then
+ result_text="ERROR: wrong exit code returned while running \"${PYGTAIL}\" -o\"${PFOFFSETFILE}\" \"${MAILLOG}\" | \"${PFLOGSUMM}\" -h 0 -u 0 --no_bounce_detail --no_deferral_detail --no_reject_detail --no_smtpd_warnings --no_no_msg_size > \"${TEMPFILE}\" 2>/dev/null"
+ result_code="1"
+ write_result "${result_code}" "${result_text}"
+ fi
+
+ # update all values from pflogsumm summary
+ for i in "${PFVALS[@]}"; do
+ updatevalue "$i"
+ done
+
+ result_text="OK: statistics updated"
+ result_code="0"
+ write_result "${result_code}" "${result_text}"
+fi
+
+rm "${TEMPFILE}"