community / community.general / 6.6.8 / module / datadog_monitor Manages Datadog monitors Authors: Sebastian Kornehl (@skornehl)community.general.datadog_monitor (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Manages monitors within Datadog.
Options as described on https://docs.datadoghq.com/api/.
The type C(event-v2) was added in community.general 4.8.0.
- name: Create a metric monitor community.general.datadog_monitor: type: "metric alert" name: "Test monitor" state: "present" 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." api_key: "9775a026f1ca7d1c6c5af9d94d9595a4" app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
- name: Deletes a monitor community.general.datadog_monitor: name: "Test monitor" state: "absent" api_key: "9775a026f1ca7d1c6c5af9d94d9595a4" app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
- name: Mutes a monitor community.general.datadog_monitor: name: "Test monitor" state: "mute" silenced: '{"*":None}' api_key: "9775a026f1ca7d1c6c5af9d94d9595a4" app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
- name: Unmutes a monitor community.general.datadog_monitor: name: "Test monitor" state: "unmute" api_key: "9775a026f1ca7d1c6c5af9d94d9595a4" app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
- name: Use datadoghq.eu platform instead of datadoghq.com community.general.datadog_monitor: name: "Test monitor" state: "absent" api_host: https://api.datadoghq.eu api_key: "9775a026f1ca7d1c6c5af9d94d9595a4" app_key: "87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
id: description: - The ID of the alert. - If set, will be used instead of the name to locate the alert. type: str name: description: - The name of the alert. required: true type: str tags: description: - A list of tags to associate with your monitor when creating or updating. - This can help you categorize and filter monitors. elements: str type: list type: choices: - metric alert - service check - event alert - event-v2 alert - process alert - log alert - query alert - trace-analytics alert - rum alert - composite description: - The type of the monitor. - The types C(query alert), C(trace-analytics alert) and C(rum alert) were added in community.general 2.1.0. - The type C(composite) was added in community.general 3.4.0. type: str query: description: - The monitor query to notify on. - Syntax varies depending on what type of monitor you are creating. type: str state: choices: - present - absent - mute - unmute description: - The designated state of the monitor. required: true type: str locked: default: false description: - Whether changes to this monitor should be restricted to the creator or admins. type: bool api_key: description: - Your Datadog API key. required: true type: str app_key: description: - Your Datadog app key. required: true type: str api_host: description: - The URL to the Datadog API. Default value is C(https://api.datadoghq.com). - This value can also be set with the C(DATADOG_HOST) environment variable. required: false type: str version_added: 0.2.0 version_added_collection: community.general priority: description: - Integer from 1 (high) to 5 (low) indicating alert severity. type: int version_added: 4.6.0 version_added_collection: community.general silenced: description: - Dictionary of scopes to silence, with timestamps or None. - Each scope will be muted until the given POSIX timestamp or forever if the value is None. type: dict timeout_h: description: - The number of hours of the monitor not reporting data before it will automatically resolve from a triggered state. type: str thresholds: description: - A dictionary of thresholds by status. - Only available for service checks and metric alerts. - Because each of them can have multiple thresholds, we do not define them directly in the query. - 'If not specified, it defaults to: C({''ok'': 1, ''critical'': 1, ''warning'': 1}).' type: dict include_tags: default: true description: - Whether notifications from this monitor automatically inserts its triggering tags into the title. type: bool version_added: 1.3.0 version_added_collection: community.general notify_audit: default: false description: - Whether tagged users will be notified on changes to this monitor. type: bool new_host_delay: description: - A positive integer representing the number of seconds to wait before evaluating the monitor for new hosts. - This gives the host time to fully initialize. type: str notify_no_data: default: false description: - Whether this monitor will notify when data stops reporting. type: bool evaluation_delay: description: - Time to delay evaluation (in seconds). - Effective for sparse values. type: str no_data_timeframe: description: - The number of minutes before a monitor will notify when data stops reporting. - Must be at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. - If not specified, it defaults to 2x timeframe for metric, 2 minutes for service. type: str renotify_interval: description: - The number of minutes after the last notification before a monitor will re-notify on the current status. - It will only re-notify if it is not resolved. type: str escalation_message: description: - A message to include with a re-notification. Supports the '@username' notification we allow elsewhere. - Not applicable if I(renotify_interval=None). type: str require_full_window: description: - Whether this monitor needs a full window of data before it gets evaluated. - We highly recommend you set this to False for sparse metrics, otherwise some evaluations will be skipped. type: bool notification_message: description: - A message to include with notifications for this monitor. - Email notifications can be sent to specific users by using the same '@username' notation as events. - Monitor message template variables can be accessed by using double square brackets, i.e '[[' and ']]'. type: str