community.general.rax_mon_alarm (0.1.1) — module

Create or delete a Rackspace Cloud Monitoring alarm.

Authors: Ash Wilson (@smashwilson)

preview | supported by community

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

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*


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.
    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).
    version_added: '1.5'
    version_added_collection: community.general

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

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

region:
    default: DFW
    description:
    - Region to create an instance in.

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

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

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.

disabled:
    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.

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

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

tenant_id:
    description:
    - The tenant ID used for authentication.
    version_added: '1.5'
    version_added_collection: community.general

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

tenant_name:
    description:
    - The tenant name used for authentication.
    version_added: '1.5'
    version_added_collection: community.general

auth_endpoint:
    default: https://identity.api.rackspacecloud.com/v2.0/
    description:
    - The URI of the authentication service.
    version_added: '1.5'
    version_added_collection: community.general

identity_type:
    default: rackspace
    description:
    - Authentication mechanism to use, such as rackspace or keystone.
    version_added: '1.5'
    version_added_collection: community.general

validate_certs:
    aliases:
    - verify_ssl
    description:
    - Whether or not to require SSL validation of API endpoints.
    type: bool
    version_added: '1.5'
    version_added_collection: community.general

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