Difference between revisions of "Terraform resource: datadog monitor json"

From wikieduonline
Jump to navigation Jump to search
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
* https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/monitor_json
+
<code>[[datadog_monitor_json]]</code> ([https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/monitor_json terraform doc], [https://docs.datadoghq.com/monitors/configuration/?tab=thresholdalert Datadog doc])
  
 +
  "[[Datadog monitor types|type]]": "service check"
 +
 +
[[message]]
 +
 +
 +
    "[[query]]": "\"[[ntp.in_sync]]\".by(\"*\").last(2).count_by_status()",
 +
 +
 +
    "query": "[[logs]](\"service:YOURSERVICE status:YOURWARN @message:TEXT* MORETEXT\").index(\"*\").rollup(\"count\").last(\"5m\") > 0",
  
 
== Official example ==
 
== Official example ==
<pre>
 
resource "datadog_monitor_json" "monitor_json" {
 
  monitor = <<-EOF
 
{
 
    "name": "Example monitor - service check",
 
    "type": "service check",
 
    "query": "\"ntp.in_sync\".by(\"*\").last(2).count_by_status()",
 
    "message": "Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\n\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution.",
 
    "tags": [],
 
    "multi": true,
 
    "restricted_roles": null,
 
    "options": {
 
        "include_tags": true,
 
        "new_host_delay": 150,
 
        "notify_audit": false,
 
        "notify_no_data": false,
 
        "thresholds": {
 
            "warning": 1,
 
            "ok": 1,
 
            "critical": 1
 
        }
 
    },
 
    "priority": null,
 
    "classification": "custom"
 
}
 
EOF
 
}
 
</pre>
 
  
 +
resource "datadog_monitor_json" "monitor_json" {
 +
  monitor = <<-[[EOF]]
 +
{
 +
    "name": "Example monitor - service check",
 +
    "type": "service check",
 +
    "[[query]]": "\"ntp.in_sync\".by(\"*\").last(2).count_by_status()",
 +
    "message": "Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\n\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution.",
 +
    "[[tags]]": [],
 +
    "multi": true,
 +
    "restricted_roles": null,
 +
    "options": {
 +
        "include_tags": true,
 +
        "new_host_delay": 150,
 +
        "notify_audit": false,
 +
        "[[notify_no_data]]": false,
 +
        "thresholds": {
 +
            "warning": 1,
 +
            "ok": 1,
 +
            "critical": 1
 +
        }
 +
    },
 +
    "priority": null,
 +
    "classification": "custom"
 +
}
 +
EOF
 +
}
 +
 +
== Related ==
 +
* <code>[[datadog_monitor]]</code>
 +
* <code>"notification_preset_name" : "hide_all" </code>
  
 
== See also ==
 
== See also ==
 +
* {{datadog_monitor_json}}
 
* {{tf datadog}}
 
* {{tf datadog}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Latest revision as of 11:24, 7 November 2024

datadog_monitor_json (terraform doc, Datadog doc)

 "type": "service check"
message


   "query": "\"ntp.in_sync\".by(\"*\").last(2).count_by_status()",


   "query": "logs(\"service:YOURSERVICE status:YOURWARN @message:TEXT* MORETEXT\").index(\"*\").rollup(\"count\").last(\"5m\") > 0",

Official example[edit]

resource "datadog_monitor_json" "monitor_json" {
  monitor = <<-EOF
{
    "name": "Example monitor - service check",
    "type": "service check",
    "query": "\"ntp.in_sync\".by(\"*\").last(2).count_by_status()",
    "message": "Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\n\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution.",
    "tags": [],
    "multi": true,
    "restricted_roles": null,
    "options": {
        "include_tags": true,
        "new_host_delay": 150,
        "notify_audit": false,
        "notify_no_data": false,
        "thresholds": {
            "warning": 1,
            "ok": 1,
            "critical": 1
        }
    },
    "priority": null,
    "classification": "custom"
}
EOF
}

Related[edit]

See also[edit]

Advertising: