oneandone_monitoring_policy - Configure 1&1 monitoring policy.

New in version 2.5.

Synopsis

  • Create, remove, update monitoring policies (and add/remove ports, processes, and servers). This module has a dependency on 1and1 >= 1.0

Requirements

The below requirements are needed on the host that executes this module.

  • 1and1
  • python >= 2.6

Parameters

Parameter Choices/Defaults Comments
add_ports
Ports to add to the monitoring policy.
add_processes
Processes to add to the monitoring policy.
add_servers
Servers to add to the monitoring policy.
agent
required
Set true for using agent.
api_url
Custom API URL. Overrides the ONEANDONE_API_URL environement variable.
auth_token
required
Authenticating API token provided by 1&1.
description
Monitoring policy description. maxLength=256
email
required
User's email. maxLength=128
monitoring_policy
required
The identifier (id or name) of the monitoring policy used with update state.
name
required
Monitoring policy name used with present state. Used as identifier (id or name) when used with absent state. maxLength=128
ports
required
Array of ports that will be monitoring.
alert_if
required
    Choices:
  • RESPONDING
  • NOT_RESPONDING
Case of alert.
email_notification
required
Set true for sending e-mail notifications.
protocol
required
    Choices:
  • TCP
  • UDP
Internet protocol.
port
required
Port number. minimum=1, maximum=65535
processes
required
Array of processes that will be monitoring.
process
required
Name of the process. maxLength=50
alert_if
required
    Choices:
  • RUNNING
  • NOT_RUNNING
Case of alert.
remove_ports
Ports to remove from the monitoring policy.
remove_processes
Processes to remove from the monitoring policy.
remove_servers
Servers to remove from the monitoring policy.
state
    Choices:
  • present
  • absent
  • update
Define a monitoring policy's state to create, remove, update.
thresholds
required
Monitoring policy thresholds. Each of the suboptions have warning and critical, which both have alert and value suboptions. Warning is used to set limits for warning alerts, critical is used to set critical alerts. alert enables alert, and value is used to advise when the value is exceeded.
transfer
required
Consumption limits for transfer.
disk
required
Consumption limits of hard disk.
ram
required
Consumption limits of RAM.
cpu
required
Consumption limits of CPU.
internal_ping
required
Response limits of internal ping.
update_ports
Ports to be updated on the monitoring policy.
update_processes
Processes to be updated on the monitoring policy.
wait
    Choices:
  • yes
  • no
wait for the instance to be in state 'running' before returning
wait_interval Default:
5
Defines the number of seconds to wait when using the _wait_for methods
wait_timeout Default:
600
how long before wait gives up, in seconds

Examples

# Provisioning example. Create and destroy a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    name: ansible monitoring policy
    description: Testing creation of a monitoring policy with ansible
    email: [email protected]
    agent: true
    thresholds:
     -
       cpu:
         warning:
           value: 80
           alert: false
         critical:
           value: 92
           alert: false
     -
       ram:
         warning:
           value: 80
           alert: false
         critical:
           value: 90
           alert: false
     -
       disk:
         warning:
           value: 80
           alert: false
         critical:
           value: 90
           alert: false
     -
       internal_ping:
         warning:
           value: 50
           alert: false
         critical:
           value: 100
           alert: false
     -
       transfer:
         warning:
           value: 1000
           alert: false
         critical:
           value: 2000
           alert: false
    ports:
     -
       protocol: TCP
       port: 22
       alert_if: RESPONDING
       email_notification: false
    processes:
     -
       process: test
       alert_if: NOT_RUNNING
       email_notification: false
    wait: true

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    state: absent
    name: ansible monitoring policy

# Update a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy
    name: ansible monitoring policy updated
    description: Testing creation of a monitoring policy with ansible updated
    email: [email protected]
    thresholds:
     -
       cpu:
         warning:
           value: 70
           alert: false
         critical:
           value: 90
           alert: false
     -
       ram:
         warning:
           value: 70
           alert: false
         critical:
           value: 80
           alert: false
     -
       disk:
         warning:
           value: 70
           alert: false
         critical:
           value: 80
           alert: false
     -
       internal_ping:
         warning:
           value: 60
           alert: false
         critical:
           value: 90
           alert: false
     -
       transfer:
         warning:
           value: 900
           alert: false
         critical:
           value: 1900
           alert: false
    wait: true
    state: update

# Add a port to a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy updated
    add_ports:
     -
       protocol: TCP
       port: 33
       alert_if: RESPONDING
       email_notification: false
    wait: true
    state: update

# Update existing ports of a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy updated
    update_ports:
     -
       id: existing_port_id
       protocol: TCP
       port: 34
       alert_if: RESPONDING
       email_notification: false
     -
       id: existing_port_id
       protocol: TCP
       port: 23
       alert_if: RESPONDING
       email_notification: false
    wait: true
    state: update

# Remove a port from a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy updated
    remove_ports:
     - port_id
    state: update

# Add a process to a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy updated
    add_processes:
     -
       process: test_2
       alert_if: NOT_RUNNING
       email_notification: false
    wait: true
    state: update

# Update existing processes of a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy updated
    update_processes:
     -
       id: process_id
       process: test_1
       alert_if: NOT_RUNNING
       email_notification: false
     -
       id: process_id
       process: test_3
       alert_if: NOT_RUNNING
       email_notification: false
    wait: true
    state: update

# Remove a process from a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy updated
    remove_processes:
     - process_id
    wait: true
    state: update

# Add server to a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy updated
    add_servers:
     - server id or name
    wait: true
    state: update

# Remove server from a monitoring policy.

- oneandone_moitoring_policy:
    auth_token: oneandone_private_api_key
    monitoring_policy: ansible monitoring policy updated
    remove_servers:
     - server01
    wait: true
    state: update

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
monitoring_policy
dict
always
Information about the monitoring policy that was processed

Sample:
{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Policy"}


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Amel Ajdinovic (@aajdinov)
  • Ethan Devenport (@edevenport)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/modules/oneandone_monitoring_policy_module.html