Added new evaluation_delay parameter (#14433)
* Added new evaluation_delay field Added new evaluation_delay parameter to pass it through the datadog monitor api * Changed tests for new evaluation_delay field * changed documentation
This commit is contained in:
parent
e6ae7853c5
commit
cb590e516d
|
@ -85,6 +85,11 @@ func resourceDatadogMonitor() *schema.Resource {
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
|
"evaluation_delay": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
Optional: true,
|
||||||
|
},
|
||||||
"no_data_timeframe": {
|
"no_data_timeframe": {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -163,6 +168,9 @@ func buildMonitorStruct(d *schema.ResourceData) *datadog.Monitor {
|
||||||
if attr, ok := d.GetOk("new_host_delay"); ok {
|
if attr, ok := d.GetOk("new_host_delay"); ok {
|
||||||
o.SetNewHostDelay(attr.(int))
|
o.SetNewHostDelay(attr.(int))
|
||||||
}
|
}
|
||||||
|
if attr, ok := d.GetOk("evaluation_delay"); ok {
|
||||||
|
o.SetNewHostDelay(attr.(int))
|
||||||
|
}
|
||||||
if attr, ok := d.GetOk("no_data_timeframe"); ok {
|
if attr, ok := d.GetOk("no_data_timeframe"); ok {
|
||||||
o.NoDataTimeframe = datadog.NoDataTimeframe(attr.(int))
|
o.NoDataTimeframe = datadog.NoDataTimeframe(attr.(int))
|
||||||
}
|
}
|
||||||
|
@ -274,6 +282,7 @@ func resourceDatadogMonitorRead(d *schema.ResourceData, meta interface{}) error
|
||||||
d.Set("thresholds", thresholds)
|
d.Set("thresholds", thresholds)
|
||||||
|
|
||||||
d.Set("new_host_delay", m.Options.GetNewHostDelay())
|
d.Set("new_host_delay", m.Options.GetNewHostDelay())
|
||||||
|
d.Set("evaluation_delay", m.Options.GetNewHostDelay())
|
||||||
d.Set("notify_no_data", m.Options.GetNotifyNoData())
|
d.Set("notify_no_data", m.Options.GetNotifyNoData())
|
||||||
d.Set("no_data_timeframe", m.Options.NoDataTimeframe)
|
d.Set("no_data_timeframe", m.Options.NoDataTimeframe)
|
||||||
d.Set("renotify_interval", m.Options.GetRenotifyInterval())
|
d.Set("renotify_interval", m.Options.GetRenotifyInterval())
|
||||||
|
@ -340,6 +349,9 @@ func resourceDatadogMonitorUpdate(d *schema.ResourceData, meta interface{}) erro
|
||||||
if attr, ok := d.GetOk("new_host_delay"); ok {
|
if attr, ok := d.GetOk("new_host_delay"); ok {
|
||||||
o.SetNewHostDelay(attr.(int))
|
o.SetNewHostDelay(attr.(int))
|
||||||
}
|
}
|
||||||
|
if attr, ok := d.GetOk("evaluation_delay"); ok {
|
||||||
|
o.SetNewHostDelay(attr.(int))
|
||||||
|
}
|
||||||
if attr, ok := d.GetOk("no_data_timeframe"); ok {
|
if attr, ok := d.GetOk("no_data_timeframe"); ok {
|
||||||
o.NoDataTimeframe = datadog.NoDataTimeframe(attr.(int))
|
o.NoDataTimeframe = datadog.NoDataTimeframe(attr.(int))
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@ func TestAccDatadogMonitor_Basic(t *testing.T) {
|
||||||
"datadog_monitor.foo", "notify_no_data", "false"),
|
"datadog_monitor.foo", "notify_no_data", "false"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"datadog_monitor.foo", "new_host_delay", "600"),
|
"datadog_monitor.foo", "new_host_delay", "600"),
|
||||||
|
resource.TestCheckResourceAttr(
|
||||||
|
"datadog_monitor.foo", "evaluation_delay", "600"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"datadog_monitor.foo", "renotify_interval", "60"),
|
"datadog_monitor.foo", "renotify_interval", "60"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
|
@ -113,6 +115,8 @@ func TestAccDatadogMonitor_Updated(t *testing.T) {
|
||||||
"datadog_monitor.foo", "notify_no_data", "false"),
|
"datadog_monitor.foo", "notify_no_data", "false"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"datadog_monitor.foo", "new_host_delay", "600"),
|
"datadog_monitor.foo", "new_host_delay", "600"),
|
||||||
|
resource.TestCheckResourceAttr(
|
||||||
|
"datadog_monitor.foo", "evaluation_delay", "600"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"datadog_monitor.foo", "renotify_interval", "60"),
|
"datadog_monitor.foo", "renotify_interval", "60"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
|
@ -153,6 +157,8 @@ func TestAccDatadogMonitor_Updated(t *testing.T) {
|
||||||
"datadog_monitor.foo", "notify_no_data", "true"),
|
"datadog_monitor.foo", "notify_no_data", "true"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"datadog_monitor.foo", "new_host_delay", "900"),
|
"datadog_monitor.foo", "new_host_delay", "900"),
|
||||||
|
resource.TestCheckResourceAttr(
|
||||||
|
"datadog_monitor.foo", "evaluation_delay", "900"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"datadog_monitor.foo", "no_data_timeframe", "20"),
|
"datadog_monitor.foo", "no_data_timeframe", "20"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
|
@ -288,6 +294,7 @@ resource "datadog_monitor" "foo" {
|
||||||
notify_audit = false
|
notify_audit = false
|
||||||
timeout_h = 60
|
timeout_h = 60
|
||||||
new_host_delay = 600
|
new_host_delay = 600
|
||||||
|
evaluation_delay = 600
|
||||||
include_tags = true
|
include_tags = true
|
||||||
require_full_window = true
|
require_full_window = true
|
||||||
locked = false
|
locked = false
|
||||||
|
@ -386,6 +393,7 @@ resource "datadog_monitor" "foo" {
|
||||||
|
|
||||||
notify_no_data = true
|
notify_no_data = true
|
||||||
new_host_delay = 900
|
new_host_delay = 900
|
||||||
|
evaluation_delay = 900
|
||||||
no_data_timeframe = 20
|
no_data_timeframe = 20
|
||||||
renotify_interval = 40
|
renotify_interval = 40
|
||||||
escalation_message = "the situation has escalated! @pagerduty"
|
escalation_message = "the situation has escalated! @pagerduty"
|
||||||
|
|
|
@ -85,6 +85,10 @@ The following arguments are supported:
|
||||||
* `new_host_delay` (Optional) Time (in seconds) to allow a host to boot and
|
* `new_host_delay` (Optional) Time (in seconds) to allow a host to boot and
|
||||||
applications to fully start before starting the evaluation of monitor
|
applications to fully start before starting the evaluation of monitor
|
||||||
results. Should be a non negative integer. Defaults to 300.
|
results. Should be a non negative integer. Defaults to 300.
|
||||||
|
* `evaluation_delay` (Optional) Time (in seconds) to delay evaluation, as a non-negative integer.
|
||||||
|
For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00,
|
||||||
|
the monitor will evaluate data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled
|
||||||
|
metrics to ensure the monitor will always have data during evaluation.
|
||||||
* `no_data_timeframe` (Optional) The number of minutes before a monitor will notify when data stops reporting. Must be at
|
* `no_data_timeframe` (Optional) 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. Default: 2x timeframe for
|
least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. Default: 2x timeframe for
|
||||||
metric alerts, 2 minutes for service checks.
|
metric alerts, 2 minutes for service checks.
|
||||||
|
|
Loading…
Reference in New Issue