logicmonitor / logicmonitor.integration / 2.0.3 / module / lm_alert_rule LogicMonitor Alert Rule Ansible module for managing alert rules. | "added in version" 1.2.0 of logicmonitor.integration" Authors: Gunjan Kumar (@gunjan) preview | supported by communitylogicmonitor.integration.lm_alert_rule (2.0.3) — module
Install with ansible-galaxy collection install logicmonitor.integration:==2.0.3
collections: - name: logicmonitor.integration version: 2.0.3
LogicMonitor is a hosted, full-stack, infrastructure monitoring platform.
This module manages alert rules within your LogicMonitor account (i.e. add, update, remove).
# Example of adding a alert rule - name: Add Alert Rule hosts: localhost tasks: - name: Add LogicMonitor Alert Rule lm_alert_rule: action: add company: batman access_id: "id123" access_key: "key123" name: AlertRule-12 priority: 55 level: All escalation_chain_id: 2 escalation_interval: 23
# Example of updating a alert rule - name: Update Alert Rule hosts: localhost tasks: - name: Update LogicMonitor Alert Rule lm_alert_rule: action: update company: batman access_id: "id123" access_key: "key123" id: 16 priority: 55 level: All datasource: Ping datapoint: Ping instance: Ping groups: ["Customer", "Devices by Type"] devices: ["192.168.147.131", "127.0.0.1_collector_2"] suppress_clear: true suppress_ACK_STD: true escalation_chain_id: 2 escalation_interval: 30 resource_properties_filter : {"key1": "value1","key2": "value2"}
# Example of removing a alert rule - name: Remove Alert Rule hosts: localhost tasks: - name: Remove LogicMonitor Alert Rule lm_alert_rule: action: remove company: batman access_id: "id123" access_key: "key123" name: "alert rule name"
id: description: - ID of the alert rule to target. - Required for update, remove if name isn't provided. type: int name: description: - The name of the alert rule to target. - Required for action=add. - Required for update, remove if id isn't provided. type: str level: choices: - All - Warn - Error - Critical description: - alert severity level to which the alert rule would apply. - Defaults to All when creating rule. - Optional for managing alert rule (action=add or action=update) type: str action: choices: - add - update - remove description: - The action you wish to perform on the alert rule. - Add = Add a alert rule to your LogicMonitor account. - Update = priority, level, escalation chain etc for a alert rule in your LogicMonitor account. - Remove = Remove a alert rule from your LogicMonitor account. required: true type: str groups: description: - A comma-separated list of device groups for which the rule would be applicable. - Defaults to all groups when creating rule. - Must be enclosed within [] brackets. - Optional for managing alert rule (action=add or action=update). elements: str type: list company: description: - The LogicMonitor account company name. - A user logging into their account at "batman.logicmonitor.com" would use "batman". required: true type: str devices: description: - A comma-separated list of devices for which the rule would be applicable. - Defaults to all devices when creating rule. - Must be enclosed within [] brackets. - Optional for managing alert rules (action=add or action=update). elements: str type: list instance: description: - The instance for which the alert rule would be applicable. - Defaults to all instance when creating rule. - Optional for managing alert rule (action=add or action=update). type: str priority: description: - A numeric value determining the priority of alert rule. - Number '1' represents the highest priority. - Required for action=add. type: int 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 datapoint: description: - The datapoint for which the alert rule would be applicable. - Defaults to all datapoint when creating rule. - Optional for managing alert rule (action=add or action=update). 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 datasource: description: - The datasource for which the alert rule would be applicable. - Defaults to all datasource when creating rule. - Optional for managing alert rule (action=add or action=update). type: str force_manage: choices: - true - false default: true description: - A boolean flag to enable/disable the feature to ... (1) update a alert rule when the initial action=add because the rule exists or (2) add a alert rule when the initial action=update because the rule doesn't exist. - Optional for managing alert rule (action=add or action=update). type: bool suppress_clear: choices: - true - false description: - A boolean flag to enable/disable notification of alert clear. - Defaults to False when creating a rule. - Optional for managing rules (action=add or action=update). type: bool suppress_ACK_STD: choices: - true - false description: - A boolean flag to enable/disable notification of alert SDT and Acknowledge. - Defaults to False when creating a rule. - Optional for managing rule (action=add or action=update). type: bool escalation_chain_id: description: - ID of escalation chain to which the alert would be sent. - Required for action=add. - Optional for managing rules action=update. type: int escalation_interval: description: - the amount of time(min) that should elapse before an alert will be escalated to the next stage. - Required for action=add. - Optional for managing rules action=update. type: int resource_properties_filter: description: - A JSON object of properties that a resource or website must possess in order for this alert rule to match. - A maximum of five property filters can be specified. - Multiple property filters are joined by an AND logical operator. - Must be enclosed within {} braces. - Optional for managing rules (action=add or action=update). type: dict
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: Alert Rule 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 alert rule group details returned: success sample: id: 4 name: rule_1 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