Opsgenie¶
Notify Opsgenie of a new alert status. If alert is active, then a new opsgenie alert will be created. If alert is inactive then the alert will be closed.
-
notify_opsgenie
(message='', teams=None, per_entity=False, priority=None, include_alert=True, description='', **kwargs)¶ Send notifications to Opsgenie.
Parameters: - message (str) – Alert message. If empty, then a message will be generated from the alert data.
- teams (str | list) – Opsgenie teams to be notified. Value can be a single team or a list of teams.
- per_entity (bool) – Send new alert per entity. This affects the
alias
value and impacts how de-duplication is handled in Opsgenie. Default isFalse
. - priority (str) – Set Opsgenie priority for this notification. Valid values are
P1
,P2
,P3
,P4
orP5
. - include_alert (bool) – Include alert data in alert body
details
. Default isTrue
. - include_captures (bool) – Include captures data in alert body
details
. Default isFalse
. - description (str) – An optional description. If present, this is inserted into the opsgenie alert description field.
Example:
notify_opsgenie(teams=['zmon', 'ops'], message='Number of failed requests is too high!', include_alert=True)
Note
If priority
is not set, then ZMON will set the priority according to the alert priority.