logicmonitor.integration.lm_device_group (2.0.3) — module

LogicMonitor Device Group Ansible module for managing device groups.

| "added in version" 1.0.0 of logicmonitor.integration"

Authors: Carlos Alvarenga (@cealvar)

preview | supported by community

Install collection

Install with ansible-galaxy collection install logicmonitor.integration:==2.0.3


Add to requirements.yml

  collections:
    - name: logicmonitor.integration
      version: 2.0.3

Description

LogicMonitor is a hosted, full-stack, infrastructure monitoring platform.

This module manages device groups within your LogicMonitor account (i.e. add, update, remove, sdt).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Example of adding a device group
- name: Add Device Group
  hosts: localhost
  tasks:
    - name: Add LogicMonitor Device Group
      lm_device_group:
        action: add
        company: batman
        access_id: "id123"
        access_key: "key123"
        full_path: "Devices by Type/Collectors/Ansible Group"
        collector_id: 1
        description: "test"
        disable_alerting: true
        properties: {
            snmp.community: commstring,
            type: dev
        }
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Example of updating a device group
- name: Update Device Group
  hosts: localhost
  tasks:
    - name: Update LogicMonitor Device Group
      lm_device_group:
        action: update
        company: batman
        access_id: "id123"
        access_key: "key123"
        full_path: "Devices by Type/Collectors"
        collector_id: 1
        description: "test"
        disable_alerting: true
        properties: {
            snmp.community: commstring,
            type: dev
        }
        optype: add
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Example of removing a device group
- name: Remove Device Group
  hosts: localhost
  tasks:
    - name: Remove LogicMonitor Device Group
      lm_device_group:
        action: remove
        company: batman
        access_id: "id123"
        access_key: "key123"
        id: 123
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Example of putting a device group in SDT
- name: SDT Device Group
  hosts: localhost
  tasks:
    - name: Place LogicMonitor device group into Scheduled downtime (default is 30 min.)
      lm_device_group:
        action: sdt
        company: batman
        access_id: "id123"
        access_key: "key123"
        full_path: "Devices by Type/Collectors"
        datasource_id: 123
        datasource_name: "ping"
        duration: 60

Inputs

    
id:
    description:
    - ID of the device group to target.
    - Required for update, remove, sdt if full_path isn't provided.
    type: int

action:
    choices:
    - add
    - update
    - remove
    - sdt
    description:
    - The action you wish to perform on the device group.
    - Add = Add a device group to your LogicMonitor account.
    - Update = Update properties, description, etc for a device group in your LogicMonitor
      account.
    - Remove = Remove a device group from your LogicMonitor account.
    - SDT = Schedule downtime for a device group in your LogicMonitor account.
    required: true
    type: str

optype:
    choices:
    - add
    - replace
    - refresh
    default: replace
    description:
    - A string describing the operation on properties when updating device group... (1)
      replace - a property would be updated if it exists already else a new property will
      be created (2) refresh - a property would be updated if it exists already else a
      new property will be created, any existing property not provided during update will
      be removed (3) add - a property would be ignored if it exists already else a new
      property will be created
    - Optional for action=update.
    type: str

comment:
    description:
    - The note/comment to add to an SDT action.
    - Optional for action=sdt.
    type: str

company:
    description:
    - The LogicMonitor account company name.
    - A user logging into their account at "batman.logicmonitor.com" would use "batman".
    required: true
    type: str

duration:
    default: 30
    description:
    - The duration (minutes) of the Scheduled Down Time (SDT).
    - Optional for action=sdt.
    type: int

end_time:
    description:
    - The time that the Scheduled Down Time (SDT) should end.
    - Format must be 'yyyy-MM-dd HH:mm' or "yyyy-MM-dd HH:mm z" where z is "am" or "pm".
      The former is used for a 24-hr clock while the latter is for a 12-hr clock.
    - If end time is provided it will be used otherwise duration would be used (duration
      defaults to 30 min).
    - Optional for action=sdt.
    type: str

access_id:
    description:
    - The Access ID API token associated with the user's account that's used to query
      the LogicMonitor API.
    - Please contact your LogicMonitor admin if you need new API tokens created for your
      account.
    required: true
    type: str

full_path:
    description:
    - The full path of the device group to target.
    - Root group full_path should be denoted by empty string "" or "/".
    - Required for action=add.
    - Required for update, remove, sdt if id isn't provided.
    type: str

access_key:
    description:
    - The Access Key API token associated with the user's account that's used to query
      the LogicMonitor API.
    - Please contact your LogicMonitor admin if you need new API tokens created for your
      account.
    - Must start with the "!unsafe" keyword if the the key starts with a special character
      (e.g. '[', ']', etc.) to prevent playbook issues.
    required: true
    type: str

properties:
    description:
    - A JSON object of properties to configure for the LogicMonitor device group.
    - This parameter will add or update existing properties in your LogicMonitor account.
    - Optional for managing device groups (action=add or action=update).
    type: dict

start_time:
    description:
    - The time that the Scheduled Down Time (SDT) should begin.
    - Format must be "yyyy-MM-dd HH:mm" or "yyyy-MM-dd HH:mm z" where z is "am" or "pm".
      The former is used for a 24-hr clock while the latter is for a 12-hr clock.
    - Optional for action=sdt.
    - Defaults to the time action is executed.
    - Required in case start time differ from the execution time of action.
    type: str

description:
    description:
    - The long text description of the device group to add.
    - Optional for managing device groups (action=add or action=update).
    type: str

collector_id:
    description:
    - ID of preferred collector to monitor newly added device group.
    - Optional for managing device groups (action=add or action=update).
    type: int

force_manage:
    choices:
    - true
    - false
    default: true
    description:
    - A boolean flag to enable/disable the feature to ... (1) update a device group when
      the initial action=add because the group exists or (2) add a device group when the
      initial action=update because the group doesn't exist.
    - Optional for managing device groups (action=add or action=update).
    type: bool

datasource_id:
    description:
    - The ID of the device group datasource in your LogicMonitor account to SDT.
    - If datasource_id & datasource_name are not supplied for device group SDT, all datasources
      under the group are SDT'd.
    - Optional for action=sdt.
    type: int

datasource_name:
    description:
    - The name of the device group datasource in your LogicMonitor account to SDT.
    - If datasource_id & datasource_name are not supplied for device group SDT, all datasources
      under the group are SDT'd.
    - Optional for action=sdt.
    type: str

disable_alerting:
    choices:
    - true
    - false
    description:
    - A boolean flag to turn alerting on or off for a device groups.
    - Defaults to False when creating a device group.
    - Optional for managing device groups (action=add or action=update).
    type: bool

collector_description:
    description:
    - Description of preferred collector to monitor newly added device group.
    - Optional for managing device groups (action=add or action=update).
    type: str

Outputs

action_performed:
  description: a string describing which action was performed
  returned: success
  sample: add
  type: str
addition_info:
  description: any additional detail related to the action
  returned: success
  sample: Device Group updated successfully
  type: str
changed:
  description: a boolean indicating that changes were made to the target
  returned: changed
  sample: true
  type: bool
data:
  description: contain device group details
  returned: success
  sample:
    id: 4
    name: aws_devices
  type: dict
failed:
  description: a boolean indicating that execution failed
  returned: failed
  sample: false
  type: bool
success:
  description: flag indicating that execution was successful
  returned: success
  sample: true
  type: bool