From f509f2c896a03546f2f5c1b72e5d44f1cbbc0a89 Mon Sep 17 00:00:00 2001 From: Rick Sherman Date: Fri, 5 Feb 2021 00:22:49 -0600 Subject: [PATCH] datadog_monitor: Add missing monitor types query alert, trace-analytics alert, rum alert (#1723) * Add missing Datadog monitor types This commit adds the following monitor types: query alert, trace-analytics alert, rum alert * changelog PR1723 datadog_monitor types * datadog_monitor 1723 Apply suggestions from code review Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- .../1723-datadog_monitor-add-missing-monitor-types.yml | 2 ++ plugins/modules/monitoring/datadog/datadog_monitor.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/1723-datadog_monitor-add-missing-monitor-types.yml diff --git a/changelogs/fragments/1723-datadog_monitor-add-missing-monitor-types.yml b/changelogs/fragments/1723-datadog_monitor-add-missing-monitor-types.yml new file mode 100644 index 0000000000..8b01717897 --- /dev/null +++ b/changelogs/fragments/1723-datadog_monitor-add-missing-monitor-types.yml @@ -0,0 +1,2 @@ +minor_changes: + - datadog_monitor - add missing monitor types ``query alert``, ``trace-analytics alert``, ``rum alert`` (https://github.com/ansible-collections/community.general/pull/1723). diff --git a/plugins/modules/monitoring/datadog/datadog_monitor.py b/plugins/modules/monitoring/datadog/datadog_monitor.py index f6020c2bed..f63c66a57d 100644 --- a/plugins/modules/monitoring/datadog/datadog_monitor.py +++ b/plugins/modules/monitoring/datadog/datadog_monitor.py @@ -49,7 +49,8 @@ options: type: description: - The type of the monitor. - choices: ['metric alert', 'service check', 'event alert', 'process alert', 'log alert'] + - The types C(query alert), C(trace-analytics alert) and C(rum alert) were added in community.general 2.1.0. + choices: ['metric alert', 'service check', 'event alert', 'process alert', 'log alert', 'query alert', 'trace-analytics alert', 'rum alert'] type: str query: description: @@ -208,7 +209,9 @@ def main(): api_host=dict(required=False), app_key=dict(required=True, no_log=True), state=dict(required=True, choices=['present', 'absent', 'mute', 'unmute']), - type=dict(required=False, choices=['metric alert', 'service check', 'event alert', 'process alert', 'log alert']), + type=dict(required=False, choices=['metric alert', 'service check', 'event alert', + 'process alert', 'log alert', 'query alert', + 'trace-analytics alert', 'rum alert']), name=dict(required=True), query=dict(required=False), notification_message=dict(required=False, no_log=True, default=None, aliases=['message'], @@ -348,7 +351,7 @@ def install_monitor(module): if module.params['type'] == "service check": options["thresholds"] = module.params['thresholds'] or {'ok': 1, 'critical': 1, 'warning': 1} - if module.params['type'] in ["metric alert", "log alert"] and module.params['thresholds'] is not None: + if module.params['type'] in ["metric alert", "log alert", "query alert", "trace-analytics alert", "rum alert"] and module.params['thresholds'] is not None: options["thresholds"] = module.params['thresholds'] monitor = _get_monitor(module)