grafana.grafana.alert_notification_policy module – Manage Alerting Policies points in Grafana
Note
This module is part of the grafana.grafana collection (version 5.6.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install grafana.grafana
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: grafana.grafana.alert_notification_policy
.
New in grafana.grafana 0.0.1
Synopsis
Set the notification policy tree using Ansible.
Requirements
The below requirements are needed on the host that executes this module.
requests >= 1.0.0
Parameters
Parameter |
Comments |
---|---|
Continue matching subsequent sibling nodes if set to Choices:
|
|
Grafana API Key used to authenticate with Grafana. |
|
URL of the Grafana instance. |
|
List of string. Group alerts when you receive a notification based on labels. If empty it will be inherited from the parent policy. Default: |
|
Sets the wait time to send a batch of new alerts for that group after the first notification was sent. Inherited from the parent policy if empty. Default: |
|
Sets the wait time until the initial notification is sent for a new group created by an incoming alert. Inherited from the parent policy if empty. Default: |
|
List of string. Sets the mute timing for the notfification policy. Default: |
|
Matchers is a slice of Matchers that is sortable, implements Stringer, and provides a Matches method to match a LabelSet. Default: |
|
Sets the waiting time to resend an alert after they have successfully been sent. Default: |
|
Sets the name of the contact point to be set as the default receiver. Default: |
|
List of objects Sets the Route that contains definitions of how to handle alerts. |
Notes
Note
Does not support
check_mode
.
Examples
- name: Set Notification policy tree
grafana.grafana.alert_notification_policy:
grafana_url: "{{ grafana_url }}"
grafana_api_key: "{{ grafana_api_key }}"
routes: [
{
receiver: myReceiver,
object_matchers: [["env", "=", "Production"]],
}
]
- name: Set nested Notification policies
grafana.grafana.alert_notification_policy:
routes: [
{
receiver: myReceiver,
object_matchers: [["env", "=", "Production"],["team", "=", "ops"]],
routes: [
{
receiver: myReceiver2,
object_matchers: [["region", "=", "eu"]],
}
]
},
{
receiver: myReceiver3,
object_matchers: [["env", "=", "Staging"]]
}
]
grafana_url: "{{ grafana_url }}"
grafana_api_key: "{{ grafana_api_key }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Dict object containing Notification tree information. Returned: On success |
|
The waiting time to send a batch of new alerts for that group after the first notification was sent. This is of the parent policy. Returned: on success Sample: |
|
The waiting time until the initial notification is sent for a new group created by an incoming alert. This is of the parent policy. Returned: on success Sample: |
|
The name of the default contact point. Returned: state is present and on success Sample: |
|
The waiting time to resend an alert after they have successfully been sent. This is of the parent policy Returned: on success Sample: |
|
The entire notification tree returned as a list. Returned: on success Sample: |