advanced SlackBot Script for Zabbix
- Zabbix Graph History
- direct Links to: Ack, Manage, Items, Trigger, History
- support for your own Icons
- compare before and after trigger values
- Kutt URL Shortner support
- debugging option
go into your alterscript folder on your zabbix server
#edit /etc/zabbix/zabbix_server.conf and add AlertScriptsPath=/usr/lib/zabbix/alertscripts
#restart zabbix server
service zabbix-server restart
cd /usr/lib/zabbix/alertscripts/
git clone https://github.com/corgan2222/zabbix2slackBot.git
cd zabbix2slackbot
#create config copy
cp slackbot.config.sample.sh slackbot.config.sh
#edit slackbot.config.sh
#change all values to fit your config
- create Media type:
- scriptname: zabbix2slackBot/zabbix2slackBot.sh
- {ALERT.SENDTO}
- {ALERT.SUBJECT}
- {ALERT.MESSAGE}
Problem
Problem started at {EVENT.TIME} on {EVENT.DATE} Problem name: {EVENT.NAME} Host: {HOST.NAME} Severity: {EVENT.SEVERITY} Operational data: {EVENT.OPDATA} Original problem ID: {EVENT.ID} {TRIGGER.URL}
Problem recovery
Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE} Problem name: {EVENT.RECOVERY.NAME} Host: {HOST.NAME} Severity: {EVENT.SEVERITY} Original problem ID: {EVENT.ID} {TRIGGER.URL}
Problem update
{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}. {EVENT.UPDATE.MESSAGE} Current problem status is {EVENT.STATUS}, acknowledged: {EVENT.ACK.STATUS}.
Discovery
Discovery rule: {DISCOVERY.RULE.NAME} Device IP: {DISCOVERY.DEVICE.IPADDRESS} Device DNS: {DISCOVERY.DEVICE.DNS} Device status: {DISCOVERY.DEVICE.STATUS} Device uptime: {DISCOVERY.DEVICE.UPTIME} Device service name: {DISCOVERY.SERVICE.NAME} Device service port: {DISCOVERY.SERVICE.PORT} Device service status: {DISCOVERY.SERVICE.STATUS} Device service uptime: {DISCOVERY.SERVICE.UPTIME}
Autoregistration
Host name: {HOST.HOST} Host IP: {HOST.IP} Agent port: {HOST.PORT}
Operations
Subject:
{EVENT.NAME} {TRIGGER.STATUS}
Message:
HOST|{HOST.NAME}
TRIGGER_NAME|{TRIGGER.NAME}
TRIGGER_STATUS|{TRIGGER.STATUS}
TRIGGER_SEVERITY|{TRIGGER.SEVERITY}
DATETIME|{DATE} / {TIME}
ITEM_ID|{ITEM.ID1}
ITEM_NAME|{ITEM.NAME1}
ITEM_KEY|{ITEM.KEY1}
ITEM_VALUE|{ITEM.VALUE1}
EVENT_ID|{EVENT.ID}
TRIGGER_URL|{TRIGGER.URL}
PROBLEM_STARTET|{EVENT.TIME} {EVENT.DATE}
TAG|{INVENTORY.TAG}
TYPE|{INVENTORY.TYPE}
LAST_VALUE|{ITEM.LASTVALUE1}
VALUE|{ITEM.NAME1} ({HOST.NAME1}): {ITEM.VALUE1}
URL_A|{INVENTORY.URL.A}
URL_B|{INVENTORY.URL.B}
SITE_A|{INVENTORY.SITE.ADDRESS.A}
SITE_B|{INVENTORY.SITE.ADDRESS.B}
LAST_VALUE_OLD|{{HOSTNAME}:{TRIGGER.KEY}.last(0)}
LAST_MIN|{{HOST.HOST}:{ITEM.KEY}.min(900)}
LAST_MAX|{{HOST.HOST}:{ITEM.KEY}.max(900)}
TRIGGER_ID|{TRIGGER.ID}
Recovery operations Subject:
Resolved: {EVENT.NAME} {TRIGGER.STATUS}
Recovery operations Message : same as above
Update operations Subject:
Updated problem: {EVENT.NAME}
Update operations Message: same as above
👤 Stefan Knaak
- Website: www.knaak.org
- Github: @corgan2222
Contributions, issues and feature requests are welcome!
Feel free to check issues page.