github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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  
    38    silenced {
    39      "*" = 0
    40    }
    41  
    42    tags = ["foo:bar", "baz"]
    43  }
    44  ```
    45  
    46  ## Argument Reference
    47  
    48  The following arguments are supported:
    49  
    50  * `type` - (Required) The type of the monitor, chosen from:
    51      * `metric alert`
    52      * `service check`
    53      * `event alert`
    54      * `query alert`
    55  * `name` - (Required) Name of Datadog monitor
    56  * `query` - (Required) The monitor query to notify on with syntax varying depending on what type of monitor
    57      you are creating. See [API Reference](http://docs.datadoghq.com/api) for options.
    58  * `message` - (Required) A message to include with notifications for this monitor.
    59      Email notifications can be sent to specific users by using the same '@username' notation as events.
    60  * `escalation_message` - (Optional) A message to include with a re-notification. Supports the '@username'
    61      notification allowed elsewhere.
    62  * `thresholds` - (Optional)
    63      * Metric alerts:
    64      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.
    65      Example usage:
    66          ```
    67          thresholds {
    68              critical = 90
    69              warning  = 80
    70          }
    71          ```
    72      * Service checks:
    73      A dictionary of thresholds by status. Because service checks can have multiple thresholds, we don't define them directly in the query.
    74      Default values:
    75          ```
    76          thresholds {
    77              ok       = 1
    78              critical = 1
    79              warning  = 1
    80          }
    81          ```
    82  
    83  * `notify_no_data` (Optional) A boolean indicating whether this monitor will notify when data stops reporting. Defaults
    84      to true.
    85  * `new_host_delay` (Optional) Time (in seconds) to allow a host to boot and
    86      applications to fully start before starting the evaluation of monitor
    87      results. Should be a non negative integer. Defaults to 300.
    88  * `no_data_timeframe` (Optional) The number of minutes before a monitor will notify when data stops reporting. Must be at
    89      least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. Default: 2x timeframe for
    90      metric alerts, 2 minutes for service checks.
    91  * `renotify_interval` (Optional) The number of minutes after the last notification before a monitor will re-notify
    92      on the current status. It will only re-notify if it's not resolved.
    93  * `notify_audit` (Optional) A boolean indicating whether tagged users will be notified on changes to this monitor.
    94      Defaults to false.
    95  * `timeout_h` (Optional) The number of hours of the monitor not reporting data before it will automatically resolve
    96      from a triggered state. Defaults to false.
    97  * `include_tags` (Optional) A boolean indicating whether notifications from this monitor will automatically insert its
    98      triggering tags into the title. Defaults to true.
    99  * `require_full_window` (Optional) A boolean indicating whether this monitor needs a full window of data before it's evaluated.
   100      We highly recommend you set this to False for sparse metrics, otherwise some evaluations will be skipped.
   101      Default: True for "on average", "at all times" and "in total" aggregation. False otherwise.
   102  * `locked` (Optional) A boolean indicating whether changes to to this monitor should be restricted to the creator or admins. Defaults to False.
   103  * `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
   104  * `silenced` (Optional) Each scope will be muted until the given POSIX timestamp or forever if the value is 0.
   105      To mute the alert completely:
   106  
   107          silenced {
   108            '*' =  0
   109          }
   110  
   111      To mute role:db for a short time:
   112  
   113          silenced {
   114            'role:db' = 1412798116
   115          }
   116  
   117  ## Attributes Reference
   118  
   119  The following attributes are exported:
   120  
   121  * `id` - ID of the Datadog monitor
   122  
   123  ## Import
   124  
   125  Monitors can be imported using their numeric ID, e.g.
   126  
   127  ```
   128  $ terraform import datadog_monitor.bytes_received_localhost 2081
   129  ```