Monday, October 26, 2020

Zabbix Custom Email Alert

 

Zabbix Custom Email Alert

Features

  • Graphs based on latest data are sent to your Email
  • You can send messages both in private and group email
  • Links to open Graph URL and Event URL.

Configuration / Installation

Zabbix server need to be install, configure and up and running.
  • Put problem.sh, resolved.sh, acknowledged.sh and sendEmail in your AlertScriptsPath directory, the path is set inside your zabbix_server.conf

Script should be execute by zabbix user. Default path of the "alertScriptPath is 

Download all the scripts from Github.  Download Link

  • Set below parameters in problem.sh, resolved.sh, acknowledged.sh files
SENDER="Zabbix-Alert<zabbix-alert@mycompany.com>"
ZBX_URL="https://mycompany.com/zabbix"
USERNAME="Admin" # Zabbix Username
PASSWORD="password" # Zabbix Password

Note: Better to use read only user instead of using admin user.

  • Configure email server details in "sendEmail" client.
  • Add 3 new media as "Zabbix Problem Email" , " Zabbix Resolved Email" and "Zabbix Acknowledged Email" in Zabbix web interface with these settings:

 




  • Create an Action for Email Alert
Add host groups to condition list.


  • Under Operation Tab, Put default subject and default message like this.

Default Subject:  

[{TRIGGER.SEVERITY}] : {TRIGGER.NAME}

Default Message: 

Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {TRIGGER.NAME}
Host: {HOST.NAME}
IP: {HOST.IP}
Severity: {TRIGGER.SEVERITY}

Original Problem ID: {EVENT.ID}
Status:  {EVENT.STATUS}
Trigger ID: {TRIGGER.ID}
Last Value: {ITEM.LASTVALUE}
Item ID: {ITEM.ID}
Item Graphic: [{ITEM.ID1}]

  • Add operation details

  • Then add Recovery Operation 

Default Subject:  

[Resolved] : {TRIGGER.NAME}

Default Message: 

Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {TRIGGER.NAME}
Host: {HOST.NAME}
IP: {HOST.IP}
Severity: {TRIGGER.SEVERITY}

Original Problem ID: {EVENT.ID}
Status:  {EVENT.STATUS}
Trigger ID: {TRIGGER.ID}
Last Value: {ITEM.LASTVALUE}
Item ID: {ITEM.ID}
Item Graphic: [{ITEM.ID1}]

  • Add operation details Recovery

  • Then add Acknowledgement Operation 

Default Subject:  

[Acknowledged] : {TRIGGER.NAME}

Default Message: 

{USER.FULLNAME} user acknowledged problem at {ACK.DATE} {ACK.TIME} with the following message:
{ACK.MESSAGE}

Problem name: {TRIGGER.NAME}
Host: {HOST.NAME}
IP: {HOST.IP}
Severity: {TRIGGER.SEVERITY}
Status:  {EVENT.STATUS}
Original Problem ID: {EVENT.ID}
Last Value: {ITEM.LASTVALUE}

  • Add operation details for Acknowledgement

Sample Email Notifications

Problem Email


Recovery Email



No comments:

Post a Comment