Skip to content

perhamm/zbxemail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zbxemail

Zabbix email with graphs scripts on python
Tested on Centos 7, zabbix 4.2, Outlook 2018

For install scripts you need python 3, requests, jinja2 and pyzabbix:
sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm
sudo yum update
sudo yum install -y python36u python36u-libs python36u-devel python36u-pip
pip3.6 install requests jinja2 pyzabbix





Zabbix Server: put zbxemail.py, zbxemail_settings.py and email_template.j2 into /usr/lib/zabbix/alertscripts (or you alertscripts folder for zabbix); create temp folder for image, for example /var/tmp/zbxemail, change permissions to rwxrwxrwx;
edit path in zbxemail_settings.py: zbx_tmp_path = '/var/tmp/zbxemail' zbx_alert_path = '/usr/lib/zabbix/alertscripts';
change settings for email in zbxemail_settings.py

Add media type:



Add media to user:



Add action:
select New action
in Action: Report problems to exmp.user



in Operations:

Problem: {TRIGGER.NAME}

<b>Host:</b> {HOST.NAME}
<b>Problem name:</b> {TRIGGER.NAME}
<b>Problem started at</b> {EVENT.TIME} <b>on</b> {EVENT.DATE}
<b>Severity:</b> {TRIGGER.SEVERITY}
item1:;{ITEM.ID1};{ITEM.NAME1}
item2:;{ITEM.ID2};{ITEM.NAME2}
item3:;{ITEM.ID3};{ITEM.NAME3}
item4:;{ITEM.ID4};{ITEM.NAME4}
item5:;{ITEM.ID5};{ITEM.NAME5}
item6:;{ITEM.ID6};{ITEM.NAME6}
eventid:;{EVENT.ID}
triggerid:;{TRIGGER.ID}
triggername:;{TRIGGER.NAME}
status:;{TRIGGER.STATUS}





in Recovery operations:

Resolved: {TRIGGER.NAME}

<b>Host:</b> {HOST.NAME}
<b>Problem name:</b> {TRIGGER.NAME}
<b>Problem has been resolved at</b> {EVENT.RECOVERY.TIME} <b>on </b>{EVENT.RECOVERY.DATE}
<b>Severity: {TRIGGER.SEVERITY}
item1:;{ITEM.ID1};{ITEM.NAME1}
item2:;{ITEM.ID2};{ITEM.NAME2}
item3:;{ITEM.ID3};{ITEM.NAME3}
item4:;{ITEM.ID4};{ITEM.NAME4}
item5:;{ITEM.ID5};{ITEM.NAME5}
item6:;{ITEM.ID6};{ITEM.NAME6}
eventid:;{EVENT.ID}
triggerid:;{TRIGGER.ID}
triggername:;{TRIGGER.NAME}
status:;{TRIGGER.STATUS}





in Acknowledgement operations:

Acknowledged: {TRIGGER.NAME}

<b>Host:</b> {HOST.NAME}
<b>Problem name:</b> {TRIGGER.NAME}
{USER.FULLNAME} <b>acknowledged problem at</b> {ACK.DATE} {ACK.TIME} <b>with the following message:</b> {ACK.MESSAGE}
<b>Severity:</b> {TRIGGER.SEVERITY}
item1:;{ITEM.ID1};{ITEM.NAME1}
item2:;{ITEM.ID2};{ITEM.NAME2}
item3:;{ITEM.ID3};{ITEM.NAME3}
item4:;{ITEM.ID4};{ITEM.NAME4}
item5:;{ITEM.ID5};{ITEM.NAME5}
item6:;{ITEM.ID6};{ITEM.NAME6}
eventid:;{EVENT.ID}
triggerid:;{TRIGGER.ID}
triggername:;{TRIGGER.NAME}
status:;{TRIGGER.STATUS}




About

Zabbix Email with Graphs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages