airflow.contrib.operators.opsgenie_alert_operator

Module Contents

class airflow.contrib.operators.opsgenie_alert_operator.OpsgenieAlertOperator(message, opsgenie_conn_id='opsgenie_default', alias=None, description=None, responders=None, visibleTo=None, actions=None, tags=None, details=None, entity=None, source=None, priority=None, user=None, note=None, *args, **kwargs)[source]

Bases:airflow.models.BaseOperator

This operator allows you to post alerts to Opsgenie. Accepts a connection that has an Opsgenie API key as the connection’s password. This operator sets the domain to conn_id.host, and if not set will default to https://api.opsgenie.com.

Each Opsgenie API key can be pre-configured to a team integration. You can override these defaults in this operator.

Parameters
  • opsgenie_conn_id (str) – The name of the Opsgenie connection to use

  • message (str) – The Message of the Opsgenie alert (templated)

  • alias (str) – Client-defined identifier of the alert (templated)

  • description (str) – Description field of the alert (templated)

  • responders (list[dict]) – Teams, users, escalations and schedules that the alert will be routed to send notifications.

  • visibleTo (list[dict]) – Teams and users that the alert will become visible to without sending any notification.

  • actions (list[str]) – Custom actions that will be available for the alert.

  • tags (list[str]) – Tags of the alert.

  • details (dict) – Map of key-value pairs to use as custom properties of the alert.

  • entity (str) – Entity field of the alert that is generally used to specify which domain alert is related to. (templated)

  • source (str) – Source field of the alert. Default value is IP address of the incoming request.

  • priority (str) – Priority level of the alert. Default value is P3. (templated)

  • user (str) – Display name of the request owner.

  • note (str) – Additional note that will be added while creating the alert. (templated)

template_fields = ['message', 'alias', 'description', 'entity', 'priority', 'note'][source]
_build_opsgenie_payload(self)[source]

Construct the Opsgenie JSON payload. All relevant parameters are combined here to a valid Opsgenie JSON payload.

Returns

Opsgenie payload (dict) to send

execute(self, context)[source]

Call the OpsgenieAlertHook to post message