Features
- Graphs based on latest data are sent directly to your messenger
- You can send messages both in private and group chats
- Channels support
- Saves chatid as a temporary file
Configuration / Installation
Zabbix server need to be install, configure and up and running.
- Put telegram.sh 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
- Set script path and log path in telegram.sh file
Script Source code you can download from below link.
"telegram.sh" Download
- Configure ZABBIX URL, User/Password and Telegram BOT token in telegram.sh file.
Create a bot in Telegram and get API key: https://core.telegram.org/bots#creating-a-new-bot.
As a best practice create readonly user in Zabbix web interface (for getting graphs from zabbix)
- Add new media for Telegram in Zabbix web interface with these settings:
- Create a Action for Telegram Alert
Add host groups to condition list.
- Under Operation Tab, Put default subject and default message like this.
Default Subject:
{TRIGGER.STATUS} {TRIGGER.SEVERITY} {TRIGGER.SEVERITY} : {TRIGGER.NAME}
Default Message:
Host IP: {HOSTNAME}Host Name: {HOST.NAME}Problem status: {STATUS}Severity: {TRIGGER.SEVERITY}Date and Time: {EVENT.DATE} - {EVENT.TIME}Item Graphic: [{ITEM.ID1}]Last tested value: {{HOSTNAME}:{TRIGGER.KEY}.last(0)}
- Under Recovery Operations tab, put default subject and default message like this.
Default Subject:
{TRIGGER.STATUS} {TRIGGER.SEVERITY} Resolved : {TRIGGER.NAME}
Default Message:
Host IP: {HOSTNAME}Host Name: {HOST.NAME}Problem status: {STATUS}Severity: {TRIGGER.SEVERITY}Date and Time: {EVENT.DATE} - {EVENT.TIME}Item Graphic: [{ITEM.ID1}]Last tested value: {{HOSTNAME}:{TRIGGER.KEY}.last(0)}
- Under Acknowledgement Operations tab, put default subject and default message like this.
Default Subject:
{TRIGGER.STATUS} {TRIGGER.SEVERITY} Acknowledged : {TRIGGER.NAME}
Default Message:
Host IP: {HOSTNAME}Host Name: {HOST.NAME}Problem status: {STATUS}Acknowledged Message: {ACK.MESSAGE}Severity: {TRIGGER.SEVERITY}Date and Time: {EVENT.DATE} - {EVENT.TIME}Item Graphic: [{ITEM.ID1}]Last tested value: {{HOSTNAME}:{TRIGGER.KEY}.last(0)}
Sample Output












No comments:
Post a Comment