community.digitalocean.digital_ocean_monitoring_alerts_info (1.26.0) — module

Programmatically retrieve metrics as well as configure alert policies based on these metrics

| "added in version" 1.10.0 of community.digitalocean"

Authors: Mark Mercado (@mamercad)

Install collection

Install with ansible-galaxy collection install community.digitalocean:==1.26.0


Add to requirements.yml

  collections:
    - name: community.digitalocean
      version: 1.26.0

Description

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.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get Droplet Monitoring alerts polices
  community.digitalocean.digital_ocean_monitoring_alerts_info:
    oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
  register: monitoring_alerts
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get specific Droplet Monitoring alerts policy
  community.digitalocean.digital_ocean_monitoring_alerts_info:
    oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
    uuid: ec48b0e7-23bb-4a7f-95f2-d83da62fcd60
  register: monitoring_alert

Inputs

    
uuid:
    description:
    - Alert uuid (if specified only returns the specific alert policy)
    required: false
    type: str

state:
    choices:
    - present
    default: present
    description:
    - C(present) to return alerts
    type: str

oauth_token:
    aliases:
    - API_TOKEN
    description:
    - DigitalOcean OAuth token; can be specified in C(DO_API_KEY), C(DO_API_TOKEN), or
      C(DO_OAUTH_TOKEN) environment variables
    required: true
    type: str

Outputs

data:
  description: DigitalOcean Monitoring alerts policies
  returned: changed
  sample:
    data:
    - alerts:
        email:
        - mamercad@gmail.com
        slack: []
      compare: GreaterThan
      description: Droplet load1 alert
      enabled: true
      entities:
      - '262383737'
      tags:
      - my_alert_tag
      type: v1/insights/droplet/load_1
      uuid: ec48b0e7-23bb-4a7f-95f2-d83da62fcd60
      value: 3.14159
      window: 5m
  type: dict