community.general.rax_mon_alarm (6.6.8) — module

Create or delete a Rackspace Cloud Monitoring alarm

Authors: Ash Wilson (@smashwilson)

Install collection

Install with ansible-galaxy collection install community.general:==6.6.8


Add to requirements.yml

  collections:
    - name: community.general
      version: 6.6.8

Description

Create or delete a Rackspace Cloud Monitoring alarm that associates an existing rax_mon_entity, rax_mon_check, and rax_mon_notification_plan with criteria that specify what conditions will trigger which levels of notifications. Rackspace monitoring module flow | rax_mon_entity -> rax_mon_check -> rax_mon_notification -> rax_mon_notification_plan -> *rax_mon_alarm*.

This module relies on the C(pyrax) package which is deprecated in favour of using Openstack API.

Unless maintainers step up to work on the module, it will be marked as deprecated in community.general 7.0.0 and removed in version 9.0.0.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Alarm example
  gather_facts: false
  hosts: local
  connection: local
  tasks:
  - name: Ensure that a specific alarm exists.
    community.general.rax_mon_alarm:
      credentials: ~/.rax_pub
      state: present
      label: uhoh
      entity_id: "{{ the_entity['entity']['id'] }}"
      check_id: "{{ the_check['check']['id'] }}"
      notification_plan_id: "{{ defcon1['notification_plan']['id'] }}"
      criteria: >
        if (rate(metric['average']) > 10) {
          return new AlarmStatus(WARNING);
        }
        return new AlarmStatus(OK);
    register: the_alarm

Inputs

    
env:
    description:
    - Environment as configured in I(~/.pyrax.cfg), see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration).
    type: str

label:
    description:
    - Friendly name for this alarm, used to achieve idempotence. Must be a String between
      1 and 255 characters long.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Ensure that the alarm with this C(label) exists or does not exist.
    required: false
    type: str

region:
    description:
    - Region to create an instance in.
    type: str

api_key:
    aliases:
    - password
    description:
    - Rackspace API key, overrides I(credentials).
    type: str

check_id:
    description:
    - ID of the check that should be alerted on. May be acquired by registering the value
      of a rax_mon_check task.
    required: true
    type: str

criteria:
    description:
    - Alarm DSL that describes alerting conditions and their output states. Must be between
      1 and 16384 characters long. See http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/alerts-language.html
      for a reference on the alerting language.
    type: str

disabled:
    default: false
    description:
    - If yes, create this alarm, but leave it in an inactive state. Defaults to no.
    type: bool

metadata:
    description:
    - Arbitrary key/value pairs to accompany the alarm. Must be a hash of String keys
      and values between 1 and 255 characters long.
    type: dict

username:
    description:
    - Rackspace username, overrides I(credentials).
    type: str

entity_id:
    description:
    - ID of the entity this alarm is attached to. May be acquired by registering the value
      of a rax_mon_entity task.
    required: true
    type: str

tenant_id:
    description:
    - The tenant ID used for authentication.
    type: str

credentials:
    aliases:
    - creds_file
    description:
    - File to find the Rackspace credentials in. Ignored if I(api_key) and I(username)
      are provided.
    type: path

tenant_name:
    description:
    - The tenant name used for authentication.
    type: str

auth_endpoint:
    description:
    - The URI of the authentication service.
    - If not specified will be set to U(https://identity.api.rackspacecloud.com/v2.0/)
    type: str

identity_type:
    default: rackspace
    description:
    - Authentication mechanism to use, such as rackspace or keystone.
    type: str

validate_certs:
    aliases:
    - verify_ssl
    description:
    - Whether or not to require SSL validation of API endpoints.
    type: bool

notification_plan_id:
    description:
    - ID of the notification plan to trigger if this alarm fires. May be acquired by registering
      the value of a rax_mon_notification_plan task.
    required: true
    type: str