logicmonitor.integration.lm_collector (2.0.3) — module

LogicMonitor Collector Ansible module for managing collectors

| "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 collectors within your LogicMonitor account (i.e. add, remove, sdt).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Example of adding a collector
- name: Add Collector
  hosts: localhost
  become: yes
  tasks:
    - name: Add LogicMonitor collector
      lm_collector:
        action: add
        company: batman
        access_id: "id123"
        access_key: "key123"
        description: "localhost"
        collector_group_name: "test group"
        device_group_full_path: "Devices by Type/Test Group"
        version: 29.107
        size: large
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Example of updating a collector
- name: Update Collector
  hosts: localhost
  tasks:
    - lm_collector:
        action: update
        company: batman
        access_id: "id123"
        access_key: "key123"
        id: 1
        description: "localhost new"
        escalating_chain_name: "ansible chain"
        backup_collector_id: 1
        resend_collector_down_alert_interval: 60
        properties:  {
            "size": "medium"
        }
        optype: replace
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Example of removing a collector
- name: Remove Collector
  hosts: localhost
  become: yes
  tasks:
    - name: Remove LogicMonitor collector
      lm_collector:
        action: remove
        company: batman
        access_id: "id123"
        access_key: "key123"
        id: 1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Example of putting a collector in SDT
- name: SDT Collector
  hosts: localhost
  tasks:
    - name: Place LogicMonitor collector into Scheduled downtime (default is 30 min.)
      lm_collector:
        action: sdt
        company: batman
        access_id: "id123"
        access_key: "key123"
        description: "localhost"
        start_time: "1/1/2022 15:00"
        duration: 60

Inputs

    
id:
    description:
    - ID of the collector.
    - Required for update, remove, sdt if description isn't provided.
    - Optional for action=add (only used when installing an existing collector).
    type: int

size:
    choices:
    - nano
    - small
    - medium
    - large
    default: small
    description:
    - The size of the collector to download.
    - nano = <2GB
    - small = 2GB
    - medium = 4GB
    - large = 8GB
    - Optional for action=add
    type: str

action:
    choices:
    - add
    - update
    - remove
    - sdt
    description:
    - The action you wish to perform on the collector.
    - Add = Install existing collector on a Linux machine or add a new collector to your
      LogicMonitor account & install it.
    - Update = Update properties, description, etc for a collector in your LogicMonitor
      account.
    - Remove = Remove a collector from your LogicMonitor account & uninstall it from Linux
      machine.
    - SDT = Schedule downtime for a collector 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 collector... (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

version:
    description:
    - The version of the collector to download & install.
    - 28.005 = required release
    - 29.003 = general release
    - 29.107 = early release
    - General release is typically recommended.
    - Defaults to the latest GD Collector.
    - Optional for action=add
    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

platform:
    description:
    - The operating system of the platform where playbook will be executed.
    - This field is only relevant for testing purposes.
    - This field should not be provided when using product since collector installation
      is only supported on Linux machines.
    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

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 collector.
    - This parameter will add or update existing properties in your LogicMonitor account.
    - Must be enclosed within {} braces.
    - Optional for 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 collector in your LogicMonitor account.
    - Optional for action=add.
    - Required for update, remove, sdt if id isn't provided.
    - Optional for action=add (only used when installing an existing collector).
    type: str

force_manage:
    choices:
    - true
    - false
    default: true
    description:
    - A boolean flag to enable/disable the feature to add a collector when the initial
      action=update because the collector doesn't exist.
    - Optional for action=update.
    type: bool

install_path:
    default: /usr/local/logicmonitor
    description:
    - The full path of the directory where the collector agent should be installed or
      is installed.
    - Optional for action=add & action=remove
    type: str

install_user:
    default: logicmonitor
    description:
    - The username to associate with the installed collector.
    - Optional for action=add
    type: str

device_group_id:
    description:
    - ID of the device group associated with the collector being added.
    - Optional for action=add
    type: int

collector_group_id:
    description:
    - ID of the collector group associated with the collector being added.
    - Optional for action=add and action=update
    type: int

backup_collector_id:
    description:
    - The ID of the failover collector to configure for the collector being updated.
    - 0 denotes to not assign any failover collector.
    - Optional for action=update.
    type: int

escalating_chain_id:
    description:
    - The ID of the escalation chain to configure for the collector being updated.
    - 0 denotes to not assign any escalation chain (i.e. disable alert routing/notifications)
    - Optional for action=update.
    type: int

collector_group_name:
    description:
    - Name of the collector group associated with the collector being added.
    - Default/ungrouped collector group should be denoted by empty string "" or "@default".
    - Optional for action=add and action=update
    type: str

escalating_chain_name:
    description:
    - The name of the escalation chain to configure for the collector being updated.
    - Optional for action=update.
    type: str

device_group_full_path:
    description:
    - Full path of the device group associated with the collector being added.
    - Default/root device group should be denoted by empty string "" or "/".
    - Optional for action=add
    type: str

backup_collector_description:
    description:
    - The long text description of the failover collector to configure for the collector
      being updated.
    - Optional for action=update.
    type: str

resend_collector_down_alert_interval:
    description:
    - The interval, in minutes, after which collector down alert notifications will be
      resent.
    - 0 denotes to send the collector down alert once.
    - Optional for action=update.
    type: int

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: Collector 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 collector or sdt details
  returned: success
  sample:
    description: new collector
    id: 4
  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