Zabbix lacks mail processing support. This is a feature request and some snippets how we work around this currently.
We use fetchmail to grab mails, extract from and subject and forward it to zabbix with zabbix_sender:
/etc/fetchmailrc
/opt/zabbix_mailparse.sh
We use fetchmail to grab mails, extract from and subject and forward it to zabbix with zabbix_sender:
/etc/fetchmailrc
Code:
poll pop.gmail.com with proto imap user '[email protected]' with password 'secret' mda "/opt/zabbix_mailparse.sh"
Code:
#!/bin/bash tempfile=/tmp/zabbix_mailprocessing.eml rm $tempfile while read x do echo $x >> $tempfile done subject=$(grep -m 1 -E "^[s|S]ubject:" $tempfile | sed -E s'/(s|S)ubject: (.*)/\2/') from=$(grep -m 1 -E "^[f|F]rom:" $tempfile | sed -E s'/(f|F)rom: (.*)/\2/') zabbix_sender -z zabbix -s "zabbix-mailprocessor" -k mails -o "$from $subject"