How can one configure notifications sent to a Stride room?
Note: Atlassian has discontinued both HipChat and Stride messaging services in favor of Slack. Please refer to our Slack integration article. These instructions are provided for archive reasons.
Q: I am switching to Stride messaging suite; can I send IPHost alert notifications to a Stride room?
A: Yes, you can. Stride from Atlassian is a HipChat successor. The below tutorial explains how to post IPHost Network monitor alert notifications to any Stride room. We will create custom application token and send messages using corresponding Stride API.
1. Obtain API token
Create a new room or use an existing room. Navigate to Apps (grey “+” in top right corner)
Select the very first item, “Connect your own app”.
Specify token name and create a token:
On the next screen we are interested in curl command. Copy it to a text editor.
2. Create Send HTTP(S) request action
Now open IPHost GUI client and create new “Send HTTP(S) request” action (click “Alerting > Alerts”, select “Simple Actions” tab):
In this action, use the keys from the above mentioned curl command, and define JSON payload using the variables:
- Copy URL from –url option of a curl command
- Copy HTTP headers specified in two -H options to custom HTTP headers
- Use the following message payload:
{ "version": 1, "type": "doc", "content": [ { "type": "applicationCard", "attrs": { "text": "unused", "link": {"url": "$MonitorReportUrl"}, "collapsible": true, "title": { "text": "$MonitorName on $HostName: $EventShortDescription $Duration | since $Time", "user": { "icon": { "url": "//cdn.iphostmonitor.com/images/icons/40x40/$NewState.png", "label": "$NewState" } } }, "description": {"text": "$EventDetails, click to see report"} } } ] }
- Add 201 to Accepted response codes (Stride uses HTTP 201 Created to report operation success)
Note that
- link to report will only work if Web interface is served over secure (HTTPS) protocol, otherwise Stride will refuse the whole alert message; thus you should either configure HTTPS in “Settings > Web Interface”, or remove “link” JSON element from message template above
- when link is configured, it becomes possible to click any application card to open a report for the monitor that caused this alert.
Now create new alert using this simple action:
Alternatively, you can add this simple action to any existing alert.
Finally, create new alerting rule with this alert. We create the one that issues given alert when monitor transitions from OK to Warning state and back. You can also use it for Down State Alerts.
Alternatively, you can use Stride alert in any existing alerting rule.
Assign this alerting rule to some monitors. For example, assign it to “All Agents” tree node in Main view, this way it will be inherited by all monitors, unless explicitly overridden.
3. Test Stride notifications
Now that Post to Stride ”Alerts” room action has been added to alerts, try putting a monitor to Warning state and back (by altering its “State conditions” and polling the monitor), or use “Alerting > Testing” tab to simulate alert execution. For example, you can set Response Time Limit for a PING monitor to 0 to switch it to Warning state and to 1 (one second) to switch it back to OK state.
If Stride integration has been done correctly, you will see something like below in your Stride room. In this case, Stride alerts are also executed for state transitions from / to Down state.