Skip to content

StackStorm-Exchange/stackstorm-opsgenie

Repository files navigation

OpsGenie Pack

This pack allows you to integrate with OpsGenie. This is a service to manage alerts and oncall rosters.

Configuration

Copy the example configuration in opsgenie.yaml.example to /opt/stackstorm/configs/opsgenie.yaml and edit as required.

It should contain:

  • api_key - The integration API key from the OpsGenie integration page.

You'll need an OpsGenie account to create an integration API key.

Note : When modifying the configuration in /opt/stackstorm/configs/ please remember to tell StackStorm to load these new values by running st2ctl reload --register-configs

Using OpsGenie for hubot Heartbeat

This requires 2 StackStorm installations, with both hubots in the same channel.

The following needs to be configured in the datastore on both servers (replace hubot with the other bot name):

st2 key set opsgenie_timer_hb_user "other_hubot"
st2 key set opsgenie_timer_hb_name "StackStorm ChatOps hubot"
st2 key set opsgenie_timer_hb_channel "chatops_heartbeat"

Then you need to add your Heartbeat to OpsGenie and test it:

st2 run opsgenie.add_heartbeat name="{{system.opsgenie_timer_hb_name}}" interval=30 enabled=true
st2 run opsgenie.send_heartbeat name="{{system.opsgenie_timer_hb_name}}"

If both of these are successful you can eanble them with:

st2 rule enable opsgenie.send_heartbeat_timer

To get an alert if it expires an integration for Heartbeat should be configured in the OpsGenie web interface.

Special note for the Create Alert Action

The arguments responder and visibleTo require a list of specifically formatted strings. These strings present an OpsGenie entity, team, user, escalation or schedule. Each entity can be identified by an id, name or username.

As such, the format of the string is expected to be the entity identifier followed by a - then the entity type: <identifier>-<type>

Here are various examples showing possible forms of the string:

"4513b7ea-3b91-438f-b7e4-e3e54af9147c-team",
"NOC-team",
"bb4d9938-c3c2-455d-aaab-727aa701c0d8-user",
"[email protected]",
"aee8a0de-c80f-4515-a232-501c0bc9d715-escalation",
"Nightwatch Escalation-escalation",
"80564037-1984-4f38-b98e-8a1f662df552-schedule",
"First Responders Schedule-schedule"

Coverage of OpsGenie API

Key:

  • Completed.
  • [-] Partial coverage.
  • [?] Not currently planned.
  • Outstanding for current version.

[-] Alert API [-] Create Alert [X] Close Alert [X] Delete Alert [?] Get Alert [X] List Alerts [X] Count [?] List Alert Notes [?] Get Alert Activity Log [?] List Alert Recipients [?] Acknowledge [?] Snooze [?] Renotify [?] Take Ownership [?] Assign [?] Add Team [?] Add Recipient [?] Add Note [?] Add Tags [?] Remove Tags [?] Add Details [?] Remove Details [?] Execute Action [?] Attach File [-] User API [?] Create User [?] Update User [?] Delete User [?] Get User [X] List Users [?] Copy Notification Rules To Other Users [-] Group API [?] Create Group [?] Update Group [?] Add Member [?] Remove Member [?] Delete Group [?] Get Group [X] List Groups [-] Team API [?] Create Team [?] Add Team Member [?] Remove Team Member [?] Update Team [?] Delete Team [?] Get Team [X] List Teams [?] List Team Logs [?] Escalation API [?] Create Escalation [?] Update Escalation [?] Delete Escalation [?] Get Escalation [?] List Escalations [-] Schedule API [?] Create Schedule [?] Update Schedule [?] Delete Schedule [?] Get Schedule [?] Get Schedule Timeline [?] List Schedules [?] Who is on-call [?] List Who is on-call [X] Who is on-call Next [?] Export Schedule [?] Schedule Override API [?] Add Schedule Override [?] Update Schedule Override [?] Delete Schedule Override [?] Get Schedule Override [?] List Schedule Overrides [?] Forwarding Rule API [?] Add Forwarding Rule [?] Update Forwarding Rule [?] Delete Forwarding Rule [?] Get Forwarding Rule [?] List Forwarding Rules [?] List Forwarding Rules for a User [X] Heartbeat API [X] Add Heartbeat [X] Update Heartbeat [X] Enable Heartbeat [X] Disable Heartbeat [X] Delete Heartbeat [X] Get Heartbeat [X] List Heartbeats [X] Send Heartbeat [?] Notification Rule API [?] Notification Rule API Requests [?] Add Notification Rule [?] Update Notification Rule [?] Delete Notification Rule [?] Enable Notification Rule [?] Disable Notification Rule [?] Change Notification Rule Order [?] Repeat Notification Rule [?] Get Notification Rule [?] List Notification Rules [?] Notification Rule Step API Requests [?] Add Notification Rule Step [?] Update Notification Rule Step [?] Delete Notification Rule Step [?] Enable Notification Rule Step [?] Disable Notification Rule Step [?] Contacts API [?] Add Contact [?] Update Contact [?] Delete Contact [?] Enable Contact [?] Disable Contact [?] Get Contact [?] List Contact [X] Integration API [X] Enable Integration [X] Disable Integration [X] Policy API [X] Enable Policy [X] Disable Policy [X] Account API [X] Get Account Info