airflow.providers.opsgenie.operators.opsgenie_alert

Module Contents

class airflow.providers.opsgenie.operators.opsgenie_alert.OpsgenieAlertOperator(*, message: str, opsgenie_conn_id: str = 'opsgenie_default', alias: Optional[str] = None, description: Optional[str] = None, responders: Optional[List[dict]] = None, visible_to: Optional[List[dict]] = None, actions: Optional[List[dict]] = None, tags: Optional[List[dict]] = None, details: Optional[dict] = None, entity: Optional[str] = None, source: Optional[str] = None, priority: Optional[str] = None, user: Optional[str] = None, note: Optional[str] = None, **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.

  • visible_to (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

Was this entry helpful?