In Part 1 – I have covered OpsGenie Email Integration - https://www.quest.com/community/blogs/b/performance-monitoring/posts/foglight-for-it-ops-a-genie-approach---foglight-email-integration-part-1 .
In Part 2 – let’s see how Foglight’s can forward alarms to OpsGenie using RestAPI call.
Dataflow and REST API Integration can be done in two steps.
- Using RestAPI - POST Method
- Invoking RestAPI using Foglight Rules
RestAPI calls can be used from either products, in this blog we will be sending alarms from Foglight to OpsGenie. As a first step you will need API key from OpsGenie
STEP 1 – OPSGENIE END
A few simple steps (screenshots below)
- Open OpsGenie | Goto Settings
- On the navigation pane, looks for Integrations List
- Create and configure Rest API integration
- Generate API Key
- Ensure correct permissions are set
- Read Access
- Create and Update Access
- Delete Access
- This step will involve matching Foglight Alarm fields
- OpsGenie Incident variables can be dragged and dropped into Alert field
- Tag them to a particular team e.g.: “L2 – Engineer” or “L1 – Engineer”
- Save your configuration settings.
STEP 2 – Test if the configuration works –– Use the sample script to test.
Java Script Example - Java_OpsGenie.java
import javax.xml.soap.*; URL url = new URL("https://api.eu.opsgenie.com/v1/incidents/create"); @Field byte[] out = data.getBytes(StandardCharsets.UTF_8); OutputStream stream = http.getOutputStream(); System.out.println(http.getResponseCode() + " " + http.getResponseMessage()); |
The example script posts the information into the following alert fields
"message": Incident message
"description": Description of the alert
"responders": Team responsible for the incident/alert
"tags": Tag Criticality
"details": Action to be taken
"priority": Priority of the incident/alert
"impactedServices": Services impacted
Additional Information: Please note: I have attached other script formats at the bottom of this page, either script can be used in order to create sample incidents in OpsGenie) JSON Code Example - JSONCode_OpsGenie.json For this step any SoapUI tools can be used to perform tests – one of my favourites that I use is postman https://www.postman.com/ and Reqbin https://reqbin.com, some other tools you may use SoapUI - https://www.soapui.org/ For additional read refer to Foglight RestAPI Reference Guide 6.1.0 - https://support.quest.com/technical-documents/foglight/6.1.0/rest-api-reference-guide#TOPIC-1771676 OpsGenie API Overview - https://docs.opsgenie.com/docs/api-overview OpsGenie Incident API - https://docs.opsgenie.com/docs/incident-api |
STEP 3 – FOGLIGHT END
As Foglight is a java based product, I have used java script for this example. Follow the steps below
Goto Foglight UI | Administration | All Rules | Copy over the Broadcast Alarm to OPSGenie_BroadcastAlarm
Expand Fire Condition | Paste the Java code | Test the Rule Logic to ensure there are no errors or issues.
Click Save .
RESULT - Alarms fired in Foglight will be sent as Incidents in OpsGenie (Output below)
That's it - Have a great day!!
Samples Scripts