├── README.md
├── screenshots
├── alert.png
└── recovery.png
└── templates
├── alert.html
└── recovery.html
/README.md:
--------------------------------------------------------------------------------
1 | # AX Zabbix Trigger Alert HTML Template
2 | Default Zabbix trigger email alerts is not too attractive. Some tips on how to fix this and do something similar to it:
3 |
4 | Alert email:
5 |
6 |
7 |
8 | Recovery email:
9 |
10 |
11 |
12 | ## Instalation
13 |
14 | 1. Install sendEmail
15 | ```
16 | $ sudo apt-get install sendemail
17 | ```
18 |
19 | 2. Find AlertScriptsPath in Zabbix configuration file:
20 | ```
21 | $ cat /etc/zabbix/zabbix_server.conf | grep AlertScriptsPath
22 | ### Option: AlertScriptsPath
23 | # AlertScriptsPath=${datadir}/zabbix/alertscripts
24 | AlertScriptsPath=/usr/lib/zabbix/alertscripts
25 | $cd /usr/lib/zabbix/alertscripts
26 | ```
27 |
28 | 3. Create new alert script:
29 | ```
30 | $ sudo nano html_email.sh
31 | ```
32 |
33 | 4. Paste following or simmilar content, don't forget to fill it with your real SMTP data.
34 | ```
35 | #!/bin/sh
36 | export smtpemailfrom=zabbix@yourdomain.com
37 | export zabbixemailto="$1"
38 | export zabbixsubject="$2"
39 | export zabbixbody="$3"
40 | export smtpserver=localhost # or your SMTP server
41 | export smtplogin=SMTP_LOGIN
42 | export smtppass=SMTP_PASSWORD
43 | /usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject \-m $zabbixbody -s $smtpserver:25 -o tls=no \-o message-content-type=html
44 | ```
45 |
46 | 5. Login to your Zabbix GUI and go to Administration -> Media Types -> Email
47 |
48 | 6. Change type to Script and put 'html_email.sh' into script name.
49 |
50 | 7. Add next script parameters and click Update:
51 | ```
52 | {ALERT.SENDTO}
53 | {ALERT.SUBJECT}
54 | {ALERT.MESSAGE}
55 | ```
56 |
57 | 8. Open Email alert action tab: Configuration -> Action -> Event source [Triggers] -> Report problems to Zabbix administrators
58 |
59 | 9. Copy/paste to Operations Default message content from file templates/alert.html and to Recovery operations from templates/recovery.html
60 |
61 | 10. Click Update.
62 |
--------------------------------------------------------------------------------
/screenshots/alert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dimuskin/ax-zabbix-html-template/4104b4e4b3e03f1fbdcc079e2a85cb7b3aaa7b48/screenshots/alert.png
--------------------------------------------------------------------------------
/screenshots/recovery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dimuskin/ax-zabbix-html-template/4104b4e4b3e03f1fbdcc079e2a85cb7b3aaa7b48/screenshots/recovery.png
--------------------------------------------------------------------------------
/templates/alert.html:
--------------------------------------------------------------------------------
1 |
Trigger: {TRIGGER.NAME}
9 | Trigger status: {TRIGGER.STATUS}
10 | Trigger severity: {TRIGGER.SEVERITY}
Host: {HOST.NAME1} ({HOST.DNS1}, {HOST.IP1})
12 | Host description: {HOST.DESCRIPTION}
Trigger Description: {TRIGGER.DESCRIPTION}
14 |Item Description: {ITEM.DESCRIPTION1}
15 |Item values:
16 | Name: {ITEM.NAME1}
17 | Key: {ITEM.KEY1}
18 | Value: {ITEM.VALUE1}
Some info about this server:
20 |Uptime: {{HOST.HOST}:system.uptime.last()}
21 |CPU usage:
22 | Latest value: {{HOST.HOST}:system.cpu.util[,,avg1].last()}
23 | MAX for 15 minutes: {{HOST.HOST}:system.cpu.util[,,avg1].max(900)}
24 | MIN for 15 minutes: {{HOST.HOST}:system.cpu.util[,,avg1].min(900)}
CPU load:
26 | Latest value: {{HOST.HOST}:system.cpu.load[percpu,avg1].last()}
27 | MAX for 15 minutes: {{HOST.HOST}:system.cpu.load[percpu,avg1].max(900)}
28 | MIN for 15 minutes: {{HOST.HOST}:system.cpu.load[percpu,avg1].min(900)}
Original event ID: {EVENT.ID}
31 |Best Regards,
33 | May the Force be with you
34 |*** This is an automatically generated email by Zabbix, please do not reply, but take attention ***
35 | 36 | 37 | -------------------------------------------------------------------------------- /templates/recovery.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 |Trigger: {TRIGGER.NAME}
9 | Trigger status: {TRIGGER.STATUS}
10 | Trigger severity: {TRIGGER.SEVERITY}
11 | Trigger duration: {EVENT.AGE} ({EVENT.DATE} {EVENT.TIME}
12 | − {EVENT.RECOVERY.DATE} {EVENT.RECOVERY.TIME})
13 |
Host: {HOST.NAME1} ({HOST.DNS1}, {HOST.IP1})
15 | Host description: {HOST.DESCRIPTION}
Trigger Description: {TRIGGER.DESCRIPTION}
17 |Item Description: {ITEM.DESCRIPTION1}
18 |Item values:
19 | Name: {ITEM.NAME1}
20 | Key: {ITEM.KEY1}
21 | Value: {ITEM.VALUE1}
Some info about this server:
23 |Uptime: {{HOST.HOST}:system.uptime.last()}
24 |CPU usage:
25 | Latest value: {{HOST.HOST}:system.cpu.util[,,avg1].last()}
26 | MAX for 15 minutes: {{HOST.HOST}:system.cpu.util[,,avg1].max(900)}
27 | MIN for 15 minutes: {{HOST.HOST}:system.cpu.util[,,avg1].min(900)}
CPU load:
29 | Latest value: {{HOST.HOST}:system.cpu.load[percpu,avg1].last()}
30 | MAX for 15 minutes: {{HOST.HOST}:system.cpu.load[percpu,avg1].max(900)}
31 | MIN for 15 minutes: {{HOST.HOST}:system.cpu.load[percpu,avg1].min(900)}
Original event ID: {EVENT.ID}
34 |Best Regards,
36 | May the Force be with you
37 |*** This is an automatically generated email by Zabbix, please do not reply, but take attention ***
38 | 39 | 40 | --------------------------------------------------------------------------------