Send Zabbix Alerts To HipChat
In my current environment we use HipChat extensively for communication, and our CI server sends a lot of events to HipChat so I figured I would send Zabbix alerts there as well. This is a pretty simple how-to and should only take you about 10 minutes to implement.
Setup HipChat and Script
The first thing you are going to want to do is figure out the following information:
- HipChat API Token
- Room ID
It was pretty easy to get this information. To get the HipChat API Token from the HipChat API Documentation once I created my API token I simply needed to figure out what the Room ID was. I wasn’t able to find the Room ID from the HipChat client so I had to log into the web interface and noticed what the room ID was from the URL in my browser
Next, I needed to clone the following repo:
https://github.com/hipchat/hipchat-cli
Once I cloned the repo I coped the hipchat_room_message scrip to /usr/local/bin on my Zabbix server.
Setup Zabbix
Finally I simply needed to setup my Zabbix server to send the actual HipChat messages. Simply log into the Zabbix UI, go to configuration >> actions and press the “Create action” button:
Next configure your conditions tab, for this example I only wanted “Warning” and higher messages, you can configure this how ever you see fit for your environment:
Finally, you simply need to setup your condition. This is where you need to plugin your API Token and Room ID. Also make sure to set the “Host Target” to your Zabbix server or the script will try and run from the system that triggered the alert.
Hopefully this helps you out!
This is great and works perfectly…for alerts. But we don’t seem to get Recovery in to Hipchat.
Anything I could be missing?
Msims – Just clone the message, and set the conditions for the action to Trigger Value=OK, then change the command as needed.
Two years later and this is still a useful tutorial. For anyone else that hits the same roadblock on getting notifications to work correctly, especially push notifications to mobile devices, I created a private room and use @all to make sure I get messages even when away or offline. However, you need to send messages using “-m text” otherwise it will not translate the @ to a mention.
Seriously. Good tutorial. Simple, worked perfectly.
Thanks!
-Dan
It`s work!
And I create a other action for send the “OK” status and green message, this post just setting the problem status.
—-
Conditions:
– Maintenance status not in manintenance
– Trugger value = OK
Operations:
– echo “{TRIGGER.STATUS}:{TRIGGER.NAME}” | /usr/local/bin/hipchat_room_message -t -f “Zabbix” -r -n -c green
Brian – I am with Atlassian. You should look into our new API – hipchat.com/connect. What you have done with the existing API is awesome and I am sure you could do even more. Please reach out of interested. Happy to help. Good stuff…
This worked perfectly for me, other than having to tweak the notification command.
I needed to add “-o hipchat.example.com -v v2” to our own hipchat server and use API version 2.