Recently Slack has gained a lot of usage, requiring Operations teams to try and integrate Zabbix Alerting with their Slack Installation, here’s how to do so.
You will need to get your Slack Post URL, fill that value in the following script.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#!/usr/bin/python import requests import sys requests.packages.urllib3.disable_warnings() slack_post_url = 'https://slack_post_url' def sendAlert(webhook_url, alert_msg): payload = alert_msg response = requests.post(webhook_url, json=payload) print payload sendAlert( slack_post_url, { "channel": "%s" % sys.argv[1], "username": "zabbix", "text": "```Status: %s\n%s```" %(sys.argv[2], sys.argv[3]), } ) |