-
Notifications
You must be signed in to change notification settings - Fork 35
Hipchat Setup
Now HipChat. Again if you don't have account there you can create it here:
First choose a HipChat room where you want your events from Zabbix to land.
Then you will need to create new Notification token inside this room:
once finished copy token, you will need in Zabbix.
Once you have done , go back to console and test the script by running it under user Zabbix:
root#:su - zabbix
cd /usr/local/share/zabbix/alertscripts
To ADD ALARM
./zbx-notify 'roomname' 'PROBLEM:myHOSTNAME Temperature Failure on DAE5S Bus 1 Enclosure 1' \
'Host: myHOSTNAME \
Trigger: PROBLEM: myHOSTNAME Температуа Failure on DAE5S Bus 1 Enclosure 1: High \
Timestamp: 2016.03.14 11:57:10 eventid: 100502' \
--api_token=5y9zBYM4Htgg4SNrYovMGE1uGvyrUtFOQGHXdK3J \
--hipchat
Now all is left is to setup new Action and Media Type.
First go to Administration -> Media Types, press Create media type
Choose Type: Script
Name: HipChat
Script name: zbx-notify
Fill Script parameters in the following order
1: {ALERT.SENDTO}
2: {ALERT.SUBJECT}
3: {ALERT.MESSAGE}
4: --api_token=you_token_here
5: --hipchat
Note that there should be no ticks or quotes after --api-token=
only the key itself.
You may provide additional params as well, by pressing Add and filling them in the form:
--param=value
Here is what you can setup for HipChat:
Parameter | Description | Default value | Example value | JSON mode (see below) |
---|---|---|---|---|
api_token | you bot api token(Mandatory) | none | --api_token=5y9zBYM4Htgg4SNrYovMGE1uGvyrUtFOQGHXdK3J | Yes |
hipchat_api_url | HipChat api url endpoint | https://api.hipchat.com | --hipchat_api_url=https://192.168.10.0/hipchat | Yes |
hipchat_message_format | text or html(see API documentation) | text | --hipchat_message_format=html | Ignored |
hipchat_notify | whether to notify HipChat users on new message arrival | true | --hipchat_notify=false | Ignored |
hipchat_from | Additional user name in HipChat | none | --hipchat_from='Zabbix NW Instance' | Ignored |
debug | For providing debug output, useful when running from command line | none | --debug | Yes |
nofork | To prevent script from forking on posting to Slack | none | --nofork | Yes |
no-ssl_verify_hostname | To ignore SSL certificate validation failures. | none | --no-ssl_verify_hostname | Yes |
Press Add to finish media type creation.
As you finish with defining new Media Type for HipChat proceed to next step and create impersonal user:
Go to Administration->Users press Create user:
In User tab:
Alias: Notification Agent
Groups: Make sure you add him proper Group Membership so this user has the rights to see new Events (and so notify on them).
Password: anything complex you like, you will never use it
In Media tab:
Create New media:
Type: HipChat
Send to: Place your HipChat room name here for example Zbx-test.
Create new action (go to Configuration -> Action ,choose Event source: Triggers press Create action) that is to be send to HipChat.
Here is the example:
In Action tab:
Default/recovery subject: anything you like, but I recommend
{STATUS} : {HOSTNAME} : {TRIGGER.NAME}
Default message:
anything you like, for example:
{TRIGGER.DESCRIPTION}
Status: {STATUS}
Severity: {TRIGGER.SEVERITY}
Timestamp: {EVENT.DATE} {EVENT.TIME}
eventid: {EVENT.ID}
Recovery message:
{TRIGGER.DESCRIPTION}
Status: {STATUS}
Severity: {TRIGGER.SEVERITY}
Timestamp: {EVENT.DATE} {EVENT.TIME}
eventid: {EVENT.ID}
Event Acknowledgement history: {EVENT.ACK.HISTORY}
Escalation history: {ESC.HISTORY}
Note: if you place Macros {TRIGGER.SEVERITY} and {STATUS} then your messages in HipChat will be color coded.
As an alternative you can place JSON object here that would represent HipChat
See send_room_notification API.
Note though, that it is required to place all Zabbix MACROS in double brackets , so they are properly transformed into JSON String.
In Condition tab do not forget to include Trigger value = Problem condition(This option is removed in Zabbix 3.4). The rest depends on your needs.
In Operations tab select Notification Agent as recipient of the message sent via HipChat.
More on Action configuration in Zabbix can be found here:
That it is it again.