Skip to main content

notification_rules

Creates, updates, deletes, gets or lists a notification_rules resource.

Overview

Namenotification_rules
TypeResource
Iddatadog.monitoring.notification_rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe ID of the monitor notification rule. (example: 00000000-0000-1234-0000-000000000000)
attributesobjectAttributes of the monitor notification rule.
relationshipsobjectAll relationships associated with monitor notification rule.
typestringMonitor notification rule resource type. (default: monitor-notification-rule, example: monitor-notification-rule)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_monitor_notification_ruleselectrule_id, regionincludeReturns a monitor notification rule by rule_id.
get_monitor_notification_rulesselectregionpage, per_page, sort, filters, includeReturns a list of all monitor notification rules.
create_monitor_notification_ruleinsertregion, data__dataCreates a monitor notification rule.
update_monitor_notification_ruleupdaterule_id, region, data__dataUpdates a monitor notification rule by rule_id.
delete_monitor_notification_ruledeleterule_id, regionDeletes a monitor notification rule by rule_id.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstring(default: datadoghq.com)
rule_idstringID of the monitor notification rule to delete.
filtersstringJSON-encoded filter object. Supported keys: * text: Free-text query matched against rule name, tags, and recipients. * tags: Array of strings. Return rules that have any of these tags. * recipients: Array of strings. Return rules that have any of these recipients. (example: {"text":"error","tags":["env:prod","team:my-team"],"recipients":["slack-monitor-app","email@example.com"]})
includestringComma-separated list of resource paths for related resources to include in the response. Supported resource path is created_by.
pageinteger (int32)The page to start paginating from. If page is not specified, the argument defaults to the first page.
per_pageinteger (int32)The number of rules to return per page. If per_page is not specified, the argument defaults to 100.
sortstringString for sort order, composed of field and sort order separated by a colon, for example name:asc. Supported sort directions: asc, desc. Supported fields: name, created_at.

SELECT examples

Returns a monitor notification rule by rule_id.

SELECT
id,
attributes,
relationships,
type
FROM datadog.monitoring.notification_rules
WHERE rule_id = '{{ rule_id }}' -- required
AND region = '{{ region }}' -- required
AND include = '{{ include }}'
;

INSERT examples

Creates a monitor notification rule.

INSERT INTO datadog.monitoring.notification_rules (
data__data,
region
)
SELECT
'{{ data }}' /* required */,
'{{ region }}'
RETURNING
data,
included
;

UPDATE examples

Updates a monitor notification rule by rule_id.

UPDATE datadog.monitoring.notification_rules
SET
data__data = '{{ data }}'
WHERE
rule_id = '{{ rule_id }}' --required
AND region = '{{ region }}' --required
AND data__data = '{{ data }}' --required
RETURNING
data,
included;

DELETE examples

Deletes a monitor notification rule by rule_id.

DELETE FROM datadog.monitoring.notification_rules
WHERE rule_id = '{{ rule_id }}' --required
AND region = '{{ region }}' --required
;