github.com/pbthorste/terraform@v0.8.6-0.20170127005045-deb56bd93da2/website/source/docs/providers/datadog/r/monitor.html.markdown (about) 1 --- 2 layout: "datadog" 3 page_title: "Datadog: datadog_monitor" 4 sidebar_current: "docs-datadog-resource-monitor" 5 description: |- 6 Provides a Datadog monitor resource. This can be used to create and manage monitors. 7 --- 8 9 # datadog\_monitor 10 11 Provides a Datadog monitor resource. This can be used to create and manage Datadog monitors. 12 13 ## Example Usage 14 15 ``` 16 # Create a new Datadog monitor 17 resource "datadog_monitor" "foo" { 18 name = "Name for monitor foo" 19 type = "metric alert" 20 message = "Monitor triggered. Notify: @hipchat-channel" 21 escalation_message = "Escalation message @pagerduty" 22 23 query = "avg(last_1h):avg:aws.ec2.cpu{environment:foo,host:foo} by {host} > 2" 24 25 thresholds { 26 ok = 0 27 warning = 1 28 critical = 2 29 } 30 31 notify_no_data = false 32 renotify_interval = 60 33 34 notify_audit = false 35 timeout_h = 60 36 include_tags = true 37 silenced { 38 "*" = 0 39 } 40 tags = ["foo:bar", "baz"] 41 } 42 ``` 43 44 ## Argument Reference 45 46 The following arguments are supported: 47 48 * `type` - (Required) The type of the monitor, chosen from: 49 * `metric alert` 50 * `service check` 51 * `event alert` 52 * `query alert` 53 * `name` - (Required) Name of Datadog monitor 54 * `query` - (Required) The monitor query to notify on with syntax varying depending on what type of monitor 55 you are creating. See [API Reference](http://docs.datadoghq.com/api) for options. 56 * `message` - (Required) A message to include with notifications for this monitor. 57 Email notifications can be sent to specific users by using the same '@username' notation as events. 58 * `escalation_message` - (Optional) A message to include with a re-notification. Supports the '@username' 59 notification allowed elsewhere. 60 * `thresholds` - (Optional) 61 * Metric alerts: 62 A dictionary of thresholds by threshold type. Currently we have two threshold types for metric alerts: critical and warning. Critical is defined in the query, but can also be specified in this option. Warning threshold can only be specified using the thresholds option. 63 Example usage: 64 ``` 65 thresholds { 66 critical = 90 67 warning = 80 68 } 69 ``` 70 * Service checks: 71 A dictionary of thresholds by status. Because service checks can have multiple thresholds, we don't define them directly in the query. 72 Default values: 73 ``` 74 thresholds { 75 ok = 1 76 critical = 1 77 warning = 1 78 } 79 ``` 80 81 * `notify_no_data` (Optional) A boolean indicating whether this monitor will notify when data stops reporting. Defaults 82 to true. 83 * `no_data_timeframe` (Optional) The number of minutes before a monitor will notify when data stops reporting. Must be at 84 least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. Default: 2x timeframe for 85 metric alerts, 2 minutes for service checks. 86 * `renotify_interval` (Optional) The number of minutes after the last notification before a monitor will re-notify 87 on the current status. It will only re-notify if it's not resolved. 88 * `notify_audit` (Optional) A boolean indicating whether tagged users will be notified on changes to this monitor. 89 Defaults to false. 90 * `timeout_h` (Optional) The number of hours of the monitor not reporting data before it will automatically resolve 91 from a triggered state. Defaults to false. 92 * `include_tags` (Optional) A boolean indicating whether notifications from this monitor will automatically insert its 93 triggering tags into the title. Defaults to true. 94 * `require_full_window` (Optional) A boolean indicating whether this monitor needs a full window of data before it's evaluated. 95 We highly recommend you set this to False for sparse metrics, otherwise some evaluations will be skipped. 96 Default: True for "on average", "at all times" and "in total" aggregation. False otherwise. 97 * `locked` (Optional) A boolean indicating whether changes to to this monitor should be restricted to the creator or admins. Defaults to False. 98 * `tags` (Optional) A list of tags to associate with your monitor. This can help you categorize and filter monitors in the manage monitors page of the UI. Note: it's not currently possible to filter by these tags when querying via the API 99 * `silenced` (Optional) Each scope will be muted until the given POSIX timestamp or forever if the value is 0. 100 To mute the alert completely: 101 102 silenced { 103 '*' = 0 104 } 105 106 To mute role:db for a short time: 107 108 silenced { 109 'role:db' = 1412798116 110 } 111 112 ## Attributes Reference 113 114 The following attributes are exported: 115 116 * `id` - ID of the Datadog monitor 117 118 ## Import 119 120 Monitors can be imported using their numeric ID, e.g. 121 122 ``` 123 $ terraform import datadog_monitor.bytes_received_localhost 2081 124 ```