mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
datadog_monitor: Added notification preset name and renotify options (#6523)
* added notification_preset_name to datadog_monitor module * added renotify optiond * fix renotify_interval * remove renotify_interval, it's already there * add renotify_status only if renotify_interval not None * add default for renotify_occurrences * fix renotify_occurrences * set renotify_occurrences default to 1 * fix renotify_occurrences * fix renotify_occurrences * fix renotify_occurrences * fix renotify_occurrences * fix renotify_statuses * fix renotify_statuses * fix renotify_statuses * fix renotify_statuses * final changes * added changelog fragment * added choices for renotify_statuses and changed version * remove choices duplication Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
a6dd7d789b
commit
ee47497e97
2 changed files with 38 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- datadog_monitor - adds ``notification_preset_name``, ``renotify_occurrences`` and ``renotify_statuses`` parameters (https://github.com/ansible-collections/community.general/issues/6521,https://github.com/ansible-collections/community.general/issues/5823).
|
|
@ -167,6 +167,32 @@ options:
|
||||||
- Integer from 1 (high) to 5 (low) indicating alert severity.
|
- Integer from 1 (high) to 5 (low) indicating alert severity.
|
||||||
type: int
|
type: int
|
||||||
version_added: 4.6.0
|
version_added: 4.6.0
|
||||||
|
notification_preset_name:
|
||||||
|
description:
|
||||||
|
- Toggles the display of additional content sent in the monitor notification.
|
||||||
|
choices:
|
||||||
|
- show_all
|
||||||
|
- hide_query
|
||||||
|
- hide_handles
|
||||||
|
- hide_all
|
||||||
|
type: str
|
||||||
|
version_added: 7.1.0
|
||||||
|
renotify_occurrences:
|
||||||
|
description:
|
||||||
|
- The number of times re-notification messages should be sent on the current status at the provided re-notification interval.
|
||||||
|
type: int
|
||||||
|
version_added: 7.1.0
|
||||||
|
renotify_statuses:
|
||||||
|
description:
|
||||||
|
- The types of monitor statuses for which re-notification messages are sent.
|
||||||
|
choices:
|
||||||
|
- alert
|
||||||
|
- warn
|
||||||
|
- no data
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
version_added: 7.1.0
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
@ -175,6 +201,10 @@ EXAMPLES = '''
|
||||||
type: "metric alert"
|
type: "metric alert"
|
||||||
name: "Test monitor"
|
name: "Test monitor"
|
||||||
state: "present"
|
state: "present"
|
||||||
|
renotify_interval: 30
|
||||||
|
renotify_occurrences: 1
|
||||||
|
renotify_statuses: ["warn"]
|
||||||
|
notification_preset_name: "show_all"
|
||||||
query: "datadog.agent.up.over('host:host1').last(2).count_by_status()"
|
query: "datadog.agent.up.over('host:host1').last(2).count_by_status()"
|
||||||
notification_message: "Host [[host.name]] with IP [[host.ip]] is failing to report to datadog."
|
notification_message: "Host [[host.name]] with IP [[host.ip]] is failing to report to datadog."
|
||||||
api_key: "9775a026f1ca7d1c6c5af9d94d9595a4"
|
api_key: "9775a026f1ca7d1c6c5af9d94d9595a4"
|
||||||
|
@ -254,6 +284,9 @@ def main():
|
||||||
id=dict(),
|
id=dict(),
|
||||||
include_tags=dict(required=False, default=True, type='bool'),
|
include_tags=dict(required=False, default=True, type='bool'),
|
||||||
priority=dict(type='int'),
|
priority=dict(type='int'),
|
||||||
|
notification_preset_name=dict(choices=['show_all', 'hide_query', 'hide_handles', 'hide_all']),
|
||||||
|
renotify_occurrences=dict(type='int'),
|
||||||
|
renotify_statuses=dict(type='list', elements='str', choices=['alert', 'warn', 'no data']),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -368,6 +401,9 @@ def install_monitor(module):
|
||||||
"new_host_delay": module.params['new_host_delay'],
|
"new_host_delay": module.params['new_host_delay'],
|
||||||
"evaluation_delay": module.params['evaluation_delay'],
|
"evaluation_delay": module.params['evaluation_delay'],
|
||||||
"include_tags": module.params['include_tags'],
|
"include_tags": module.params['include_tags'],
|
||||||
|
"notification_preset_name": module.params['notification_preset_name'],
|
||||||
|
"renotify_occurrences": module.params['renotify_occurrences'],
|
||||||
|
"renotify_statuses": module.params['renotify_statuses'],
|
||||||
}
|
}
|
||||||
|
|
||||||
if module.params['type'] == "service check":
|
if module.params['type'] == "service check":
|
||||||
|
|
Loading…
Reference in a new issue