tribe29.checkmk.downtime (0.23.0) — module

Manage downtimes in Checkmk.

| "added in version" 0.2.0 of tribe29.checkmk"

Authors: Oliver Gaida (@ogaida), Lars Getwan (@lgetwan)

Install collection

Install with ansible-galaxy collection install tribe29.checkmk:==0.23.0


Add to requirements.yml

  collections:
    - name: tribe29.checkmk
      version: 0.23.0

Description

Manage downtimes within Checkmk.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Schedule host downtime."
  tribe29.checkmk.downtime:
    server_url: "{{ server_url }}"
    site: "{{ site }}"
    automation_user: "{{ automation_user }}"
    automation_secret: "{{ automation_secret }}"
    host_name: my_host
    start_after:
      minutes: 5
    end_after:
      days: 7
      hours: 5
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Schedule service downtimes for two given services."
  tribe29.checkmk.downtime:
    server_url: "{{ server_url }}"
    site: "{{ site }}"
    automation_user: "{{ automation_user }}"
    automation_secret: "{{ automation_secret }}"
    host_name: my_host
    start_time: 2022-03-24T20:39:28Z
    end_time: 2022-03-24T20:40:28Z
    state: "present"
    duration: 0
    service_descriptions:
      - "CPU utilization"
      - "Memory"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Delete all service downtimes for two given services."
  tribe29.checkmk.downtime:
    server_url: "{{ server_url }}"
    site: "{{ site }}"
    automation_user: "{{ automation_user }}"
    automation_secret: "{{ automation_secret }}"
    host_name: my_host
    service_descriptions:
      - "CPU utilization"
      - "Memory"
    state: absent

Inputs

    
site:
    description: The site you want to connect to.
    required: true
    type: str

force:
    default: false
    description: Force the creation of a downtime in case a hostname and comment combination
      already exists as a downtime.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description: The state of this downtime. If absent, all matching host/service-downtimes
      of the given host will be deleted.
    type: str

comment:
    description:
    - Remarks for the downtime. If omitted in combination with state = present, the default
      'Set by Ansible' will be used, in combination with state = absent, ALL downtimes
      of a host or host/service will be removed.
    type: str

duration:
    default: 0
    description:
    - Duration in seconds. When set, the downtime does not begin automatically at a nominated
      time, but when a non-OK status actually appears for the host. Consequently, the
      start_time and end_time is only the time window in which the scheduled downtime
      can occur.
    type: int

end_time:
    default: ''
    description:
    - The end datetime of the downtime. The format has to conform to the ISO 8601 profile
      I(e.g. 2017-07-21T17:32:28Z). The built-in default is 30 minutes after now.
    type: str

end_after:
    default: {}
    description:
    - The timedelta between I(start_time) and I(end_time). If you want to use I(end_after)
      you have to omit I(end_time). For keys and values see U(https://docs.python.org/3/library/datetime.html#datetime.timedelta)
    type: dict

host_name:
    description: The host to schedule the downtime on.
    required: true
    type: str

server_url:
    description: The base url of your Checkmk server.
    required: true
    type: str

start_time:
    default: ''
    description:
    - The start datetime of the downtime. The format has to conform to the ISO 8601 profile
      I(e.g. 2017-07-21T17:32:28Z). The built-in default is now.
    type: str

start_after:
    default: {}
    description:
    - The timedelta between now and I(start_time). If you want to use I(start_after) you
      have to omit I(start_time). For keys and values see U(https://docs.python.org/3/library/datetime.html#datetime.timedelta)
    type: dict

validate_certs:
    default: true
    description: Whether to validate the SSL certificate of the Checkmk server.
    type: bool

automation_user:
    description: The automation user you want to use. It has to be an 'Automation' user,
      not a normal one.
    required: true
    type: str

automation_secret:
    description: The secret to authenticate your automation user.
    required: true
    type: str

service_descriptions:
    default: []
    description: Array of service descriptions. If set only service-downtimes will be
      set. If omitted a host downtime will be set.
    elements: str
    type: list

Outputs

message:
  description: The output message that the module generates. Contains the API response
    details in case of an error. No output in case of success.
  returned: always
  sample: ''
  type: str