Skip to content

datadog create-monitor

Create a monitor using the specified options

Description

Create a monitor using the specified options

Synopsis

datadog create-monitor
    [--site <site>]
    [--message <message>]
    [--name <name>]
    [--priority <priority>]
    --query <query>
    [--restricted_roles <restricted_roles>]
    [--tags <tags>]
    --type <type>

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

message - (string)

     A message to include with notifications for this monitor
     Example: --message "message-1"
     Default: _None_      Attributes: optional

name - (string)

     The monitor name
     Example: --name "name-1"
     Default: _None_      Attributes: optional

priority - (int)

     Integer from 1 (high) to 5 (low) indicating alert severity
     Example: --priority 1
     Default: _None_      Attributes: optional

query - (string)

     The monitor query
     Example: --query "query-1"
     Default: _None_      Attributes: required

restricted_roles - (string)

     A list of unique role identifiers to define which roles are allowed to edit the monitor
     Example: --restricted_roles "restricted_roles-1"
     Default: _None_      Attributes: optional, multiple allowed

tags - (string)

     Tags associated to your monitor
     Example: --tags "tags-1"
     Default: _None_      Attributes: optional, multiple allowed

type - (string)

     The type of the monitor
     Example: --type "type-1"
     Default: _None_      Attributes: required

     Validation:
         allowed values: composite, event alert, log alert, metric alert, process alert, query alert, rum alert, service check, synthetics alert, trace-analytics alert, slo alert, event-v2 alert, audit alert, ci-pipelines alert, ci-tests alert, error-tracking alert

Examples

Input:

!datadog create-monitor --query "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100" --type "query alert" --message "create moniotr" --name "testNames2" --tags "testta" --priority 3
Output:
ID      ORG-ID      NAME        MESSAGE         TYPE
78570   1300017267  testNames2  create moniotr  query alert

Access Control

To use this command, you need access to the following:

Field Value
Action "create"
Service Type "datadog"
Service Instance
Namespace
Object Type "monitor"
Object ID

Please see Access Control for details.