community.digitalocean.digital_ocean_monitoring_alerts module – Programmatically retrieve metrics as well as configure alert policies based on these metrics
Note
This module is part of the community.digitalocean collection (version 1.22.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 community.digitalocean
.
To use it in a playbook, specify: community.digitalocean.digital_ocean_monitoring_alerts
.
New in community.digitalocean 1.10.0
Synopsis
The DigitalOcean Monitoring API makes it possible to programmatically retrieve metrics as well as configure alert policies based on these metrics.
The Monitoring API can help you gain insight into how your apps are performing and consuming resources.
Parameters
Parameter |
Comments |
---|---|
Alert object, required for Supports |
|
Alert comparison, required for Choices:
|
|
Alert description, required for |
|
Enabled or not, required for Choices:
|
|
Alert entities, required for |
|
DigitalOcean OAuth token; can be specified in |
|
The usual, Choices:
|
|
Alert tags, required for |
|
Alert type, required for See https://docs.digitalocean.com/reference/api/api-reference/#operation/create_alert_policy for valid types Choices:
|
|
Alert uuid, required for |
|
Alert threshold, required for |
|
Alert window, required for Choices:
|
Examples
- name: Create Droplet Monitoring alerts policy
community.digitalocean.digital_ocean_monitoring_alerts:
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
alerts:
email: ["[email protected]"]
slack: []
compare: GreaterThan
description: Droplet load1 alert
enabled: true
entities: ["{{ droplet_id }}"]
tags: ["my_alert_tag"]
type: v1/insights/droplet/load_1
value: 3.14159
window: 5m
register: monitoring_alert_policy
- name: Delete Droplet Monitoring alerts policy
community.digitalocean.digital_ocean_monitoring_alerts:
state: absent
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
uuid: "{{ monitoring_alert_policy.data.uuid }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A DigitalOcean Monitoring alerts policy Returned: changed Sample: |