salt.modules.opsgenie

Module for sending data to OpsGenie

New in version 2018.3.0.

configuration:

This module can be used in Reactor System for posting data to OpsGenie as a remote-execution function.

For example:

opsgenie_event_poster:
  local.opsgenie.post_data:
    - tgt: 'salt-minion'
    - kwarg:
        name: event.reactor
        api_key: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
        reason: {{ data['data']['reason'] }}
        action_type: Create
salt.modules.opsgenie.post_data(api_key=None, name=u'OpsGenie Execution Module', reason=None, action_type=None)

Post data to OpsGenie. It's designed for Salt's Event Reactor.

After configuring the sls reaction file as shown above, you can trigger the module with your designated tag (og-tag in this case).

CLI Example:

salt-call event.send 'og-tag' '{"reason" : "Overheating CPU!"}'

Required parameters:

api_key
It's the API Key you've copied while adding integration in OpsGenie.
reason
It will be used as alert's default message in OpsGenie.
action_type
OpsGenie supports the default values Create/Close for action_type. You can customize this field with OpsGenie's custom actions for other purposes like adding notes or acknowledging alerts.

Optional parameters:

name
It will be used as alert's alias. If you want to use the close functionality you must provide name field for both states like in this case.