import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Provides a Datadog monitor resource. This can be used to create and manage Datadog monitors. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as datadog from "@pulumi/datadog"; * * const foo = new datadog.Monitor("foo", { * name: "Name for monitor foo", * type: "metric alert", * message: "Monitor triggered. Notify: @hipchat-channel", * escalationMessage: "Escalation message @pagerduty", * query: "avg(last_1h):avg:aws.ec2.cpu{environment:foo,host:foo} by {host} > 4", * monitorThresholds: { * warning: "2", * critical: "4", * }, * includeTags: true, * tags: [ * "foo:bar", * "team:fooBar", * ], * }); * ``` * * ## Import * * The `pulumi import` command can be used, for example: * * ```sh * $ pulumi import datadog:index/monitor:Monitor bytes_received_localhost 2081 * ``` */ export declare class Monitor extends pulumi.CustomResource { /** * Get an existing Monitor resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: MonitorState, opts?: pulumi.CustomResourceOptions): Monitor; /** * Returns true if the given object is an instance of Monitor. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Monitor; /** * List of monitor assets (for example, runbooks, dashboards, workflows) tied to this monitor. */ readonly assets: pulumi.Output; /** * Indicates whether the monitor is in a draft or published state. When set to `draft`, the monitor appears as Draft and does not send notifications. When set to `published`, the monitor is active, and it evaluates conditions and sends notifications as configured. */ readonly draftStatus: pulumi.Output; /** * A boolean indicating whether or not to include a list of log values which triggered the alert. This is only used by log monitors. Defaults to `false`. */ readonly enableLogsSample: pulumi.Output; /** * Whether or not a list of samples which triggered the alert is included. This is only used by CI Test and Pipeline monitors. */ readonly enableSamples: pulumi.Output; /** * A message to include with a re-notification. Supports the `@username` notification allowed elsewhere. */ readonly escalationMessage: pulumi.Output; /** * (Only applies to metric alert) 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 `last5m` 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. */ readonly evaluationDelay: pulumi.Output; /** * A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. SLO, composite monitor). */ readonly forceDelete: pulumi.Output; /** * The time span after which groups with missing data are dropped from the monitor state. The minimum value is one hour, and the maximum value is 72 hours. Example values are: 60m, 1h, and 2d. This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors. */ readonly groupRetentionDuration: pulumi.Output; /** * Whether or not to trigger one alert if any source breaches a threshold. This is only used by log monitors. Defaults to `false`. */ readonly groupbySimpleMonitor: pulumi.Output; /** * A boolean indicating whether notifications from this monitor automatically insert its triggering tags into the title. */ readonly includeTags: pulumi.Output; /** * A message to include with notifications for this monitor. */ readonly message: pulumi.Output; /** * A mapping containing `recoveryWindow` and `triggerWindow` values, e.g. `last15m` . Can only be used for, and are required for, anomaly monitors. */ readonly monitorThresholdWindows: pulumi.Output; /** * Alert thresholds of the monitor. */ readonly monitorThresholds: pulumi.Output; /** * Name of Datadog monitor. */ readonly name: pulumi.Output; /** * The time (in seconds) to skip evaluations for new groups. * * `newGroupDelay` overrides `newHostDelay` if it is set to a nonzero value. */ readonly newGroupDelay: pulumi.Output; /** * **Deprecated**. See `newGroupDelay`. Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non-negative integer. This value is ignored for simple monitors and monitors not grouped by host. The only case when this should be used is to override the default and set `newHostDelay` to zero for monitors grouped by host. * * @deprecated Use `newGroupDelay` except when setting `newHostDelay` to zero. */ readonly newHostDelay: pulumi.Output; /** * The number of minutes before a monitor will notify when data stops reporting. * * We recommend at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. */ readonly noDataTimeframe: pulumi.Output; /** * Toggles the display of additional content sent in the monitor notification. */ readonly notificationPresetName: pulumi.Output; /** * A boolean indicating whether tagged users will be notified on changes to this monitor. Defaults to `false`. */ readonly notifyAudit: pulumi.Output; /** * Controls what granularity a monitor alerts on. Only available for monitors with groupings. For instance, a monitor grouped by `cluster`, `namespace`, and `pod` can be configured to only notify on each new `cluster` violating the alert conditions by setting `notifyBy` to `['cluster']`. Tags mentioned in `notifyBy` must be a subset of the grouping tags in the query. For example, a query grouped by `cluster` and `namespace` cannot notify on `region`. Setting `notifyBy` to `[*]` configures the monitor to notify as a simple-alert. */ readonly notifyBies: pulumi.Output; /** * A boolean indicating whether this monitor will notify when data stops reporting. */ readonly notifyNoData: pulumi.Output; /** * Controls how groups or monitors are treated if an evaluation does not return any data points. The default option results in different behavior depending on the monitor query type. For monitors using `Count` queries, an empty monitor evaluation is treated as 0 and is compared to the threshold conditions. For monitors using any query type other than `Count`, for example `Gauge`, `Measure`, or `Rate`, the monitor shows the last known status. This option is not available for Service Check, Composite, or SLO monitors. Valid values are: `showNoData`, `showAndNotifyNoData`, `resolve`, and `default`. */ readonly onMissingData: pulumi.Output; /** * Integer from 1 (high) to 5 (low) indicating alert severity. */ readonly priority: pulumi.Output; /** * The monitor query to notify on. Note this is not the same query you see in the UI and the syntax is different depending on the monitor type, please see the [API Reference](https://docs.datadoghq.com/api/v1/monitors/#create-a-monitor) for details. `terraform plan` will validate query contents unless `validate` is set to `false`. * * **Note:** APM latency data is now available as Distribution Metrics. Existing monitors have been migrated automatically but all terraformed monitors can still use the existing metrics. We strongly recommend updating monitor definitions to query the new metrics. To learn more, or to see examples of how to update your terraform definitions to utilize the new distribution metrics, see the [detailed doc](https://docs.datadoghq.com/tracing/guide/ddsketch_trace_metrics/). */ readonly query: pulumi.Output; /** * The number of minutes after the last notification before a monitor will re-notify on the current status. It will only re-notify if it's not resolved. */ readonly renotifyInterval: pulumi.Output; /** * The number of re-notification messages that should be sent on the current status. */ readonly renotifyOccurrences: pulumi.Output; /** * The types of statuses for which re-notification messages should be sent. */ readonly renotifyStatuses: pulumi.Output; /** * A boolean indicating whether this monitor needs a full window of data before it's evaluated. Datadog strongly recommends you set this to `false` for sparse metrics, otherwise some evaluations may be skipped. If there's a customSchedule set, `requireFullWindow` must be false and will be ignored. */ readonly requireFullWindow: pulumi.Output; /** * A list of unique role identifiers to define which roles are allowed to edit the monitor. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. Roles unique identifiers can be pulled from the [Roles API](https://docs.datadoghq.com/api/latest/roles/#list-roles) in the `data.id` field. * * @deprecated Use `datadog.RestrictionPolicy` resource to manage permission. */ readonly restrictedRoles: pulumi.Output; /** * Configuration options for scheduling. */ readonly schedulingOptions: pulumi.Output; /** * 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 */ readonly tags: pulumi.Output; /** * The number of hours of the monitor not reporting data before it automatically resolves from a triggered state. The minimum allowed value is 0 hours. The maximum allowed value is 24 hours. */ readonly timeoutH: pulumi.Output; /** * The type of the monitor. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API [documentation page](https://docs.datadoghq.com/api/v1/monitors/#create-a-monitor). Note: The monitor type cannot be changed after a monitor is created. */ readonly type: pulumi.Output; /** * If set to `false`, skip the validation call done during plan. */ readonly validate: pulumi.Output; readonly variables: pulumi.Output; /** * Create a Monitor resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: MonitorArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Monitor resources. */ export interface MonitorState { /** * List of monitor assets (for example, runbooks, dashboards, workflows) tied to this monitor. */ assets?: pulumi.Input[]>; /** * Indicates whether the monitor is in a draft or published state. When set to `draft`, the monitor appears as Draft and does not send notifications. When set to `published`, the monitor is active, and it evaluates conditions and sends notifications as configured. */ draftStatus?: pulumi.Input; /** * A boolean indicating whether or not to include a list of log values which triggered the alert. This is only used by log monitors. Defaults to `false`. */ enableLogsSample?: pulumi.Input; /** * Whether or not a list of samples which triggered the alert is included. This is only used by CI Test and Pipeline monitors. */ enableSamples?: pulumi.Input; /** * A message to include with a re-notification. Supports the `@username` notification allowed elsewhere. */ escalationMessage?: pulumi.Input; /** * (Only applies to metric alert) 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 `last5m` 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. */ evaluationDelay?: pulumi.Input; /** * A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. SLO, composite monitor). */ forceDelete?: pulumi.Input; /** * The time span after which groups with missing data are dropped from the monitor state. The minimum value is one hour, and the maximum value is 72 hours. Example values are: 60m, 1h, and 2d. This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors. */ groupRetentionDuration?: pulumi.Input; /** * Whether or not to trigger one alert if any source breaches a threshold. This is only used by log monitors. Defaults to `false`. */ groupbySimpleMonitor?: pulumi.Input; /** * A boolean indicating whether notifications from this monitor automatically insert its triggering tags into the title. */ includeTags?: pulumi.Input; /** * A message to include with notifications for this monitor. */ message?: pulumi.Input; /** * A mapping containing `recoveryWindow` and `triggerWindow` values, e.g. `last15m` . Can only be used for, and are required for, anomaly monitors. */ monitorThresholdWindows?: pulumi.Input; /** * Alert thresholds of the monitor. */ monitorThresholds?: pulumi.Input; /** * Name of Datadog monitor. */ name?: pulumi.Input; /** * The time (in seconds) to skip evaluations for new groups. * * `newGroupDelay` overrides `newHostDelay` if it is set to a nonzero value. */ newGroupDelay?: pulumi.Input; /** * **Deprecated**. See `newGroupDelay`. Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non-negative integer. This value is ignored for simple monitors and monitors not grouped by host. The only case when this should be used is to override the default and set `newHostDelay` to zero for monitors grouped by host. * * @deprecated Use `newGroupDelay` except when setting `newHostDelay` to zero. */ newHostDelay?: pulumi.Input; /** * The number of minutes before a monitor will notify when data stops reporting. * * We recommend at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. */ noDataTimeframe?: pulumi.Input; /** * Toggles the display of additional content sent in the monitor notification. */ notificationPresetName?: pulumi.Input; /** * A boolean indicating whether tagged users will be notified on changes to this monitor. Defaults to `false`. */ notifyAudit?: pulumi.Input; /** * Controls what granularity a monitor alerts on. Only available for monitors with groupings. For instance, a monitor grouped by `cluster`, `namespace`, and `pod` can be configured to only notify on each new `cluster` violating the alert conditions by setting `notifyBy` to `['cluster']`. Tags mentioned in `notifyBy` must be a subset of the grouping tags in the query. For example, a query grouped by `cluster` and `namespace` cannot notify on `region`. Setting `notifyBy` to `[*]` configures the monitor to notify as a simple-alert. */ notifyBies?: pulumi.Input[]>; /** * A boolean indicating whether this monitor will notify when data stops reporting. */ notifyNoData?: pulumi.Input; /** * Controls how groups or monitors are treated if an evaluation does not return any data points. The default option results in different behavior depending on the monitor query type. For monitors using `Count` queries, an empty monitor evaluation is treated as 0 and is compared to the threshold conditions. For monitors using any query type other than `Count`, for example `Gauge`, `Measure`, or `Rate`, the monitor shows the last known status. This option is not available for Service Check, Composite, or SLO monitors. Valid values are: `showNoData`, `showAndNotifyNoData`, `resolve`, and `default`. */ onMissingData?: pulumi.Input; /** * Integer from 1 (high) to 5 (low) indicating alert severity. */ priority?: pulumi.Input; /** * The monitor query to notify on. Note this is not the same query you see in the UI and the syntax is different depending on the monitor type, please see the [API Reference](https://docs.datadoghq.com/api/v1/monitors/#create-a-monitor) for details. `terraform plan` will validate query contents unless `validate` is set to `false`. * * **Note:** APM latency data is now available as Distribution Metrics. Existing monitors have been migrated automatically but all terraformed monitors can still use the existing metrics. We strongly recommend updating monitor definitions to query the new metrics. To learn more, or to see examples of how to update your terraform definitions to utilize the new distribution metrics, see the [detailed doc](https://docs.datadoghq.com/tracing/guide/ddsketch_trace_metrics/). */ query?: pulumi.Input; /** * The number of minutes after the last notification before a monitor will re-notify on the current status. It will only re-notify if it's not resolved. */ renotifyInterval?: pulumi.Input; /** * The number of re-notification messages that should be sent on the current status. */ renotifyOccurrences?: pulumi.Input; /** * The types of statuses for which re-notification messages should be sent. */ renotifyStatuses?: pulumi.Input[]>; /** * A boolean indicating whether this monitor needs a full window of data before it's evaluated. Datadog strongly recommends you set this to `false` for sparse metrics, otherwise some evaluations may be skipped. If there's a customSchedule set, `requireFullWindow` must be false and will be ignored. */ requireFullWindow?: pulumi.Input; /** * A list of unique role identifiers to define which roles are allowed to edit the monitor. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. Roles unique identifiers can be pulled from the [Roles API](https://docs.datadoghq.com/api/latest/roles/#list-roles) in the `data.id` field. * * @deprecated Use `datadog.RestrictionPolicy` resource to manage permission. */ restrictedRoles?: pulumi.Input[]>; /** * Configuration options for scheduling. */ schedulingOptions?: pulumi.Input; /** * 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 */ tags?: pulumi.Input[]>; /** * The number of hours of the monitor not reporting data before it automatically resolves from a triggered state. The minimum allowed value is 0 hours. The maximum allowed value is 24 hours. */ timeoutH?: pulumi.Input; /** * The type of the monitor. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API [documentation page](https://docs.datadoghq.com/api/v1/monitors/#create-a-monitor). Note: The monitor type cannot be changed after a monitor is created. */ type?: pulumi.Input; /** * If set to `false`, skip the validation call done during plan. */ validate?: pulumi.Input; variables?: pulumi.Input; } /** * The set of arguments for constructing a Monitor resource. */ export interface MonitorArgs { /** * List of monitor assets (for example, runbooks, dashboards, workflows) tied to this monitor. */ assets?: pulumi.Input[]>; /** * Indicates whether the monitor is in a draft or published state. When set to `draft`, the monitor appears as Draft and does not send notifications. When set to `published`, the monitor is active, and it evaluates conditions and sends notifications as configured. */ draftStatus?: pulumi.Input; /** * A boolean indicating whether or not to include a list of log values which triggered the alert. This is only used by log monitors. Defaults to `false`. */ enableLogsSample?: pulumi.Input; /** * Whether or not a list of samples which triggered the alert is included. This is only used by CI Test and Pipeline monitors. */ enableSamples?: pulumi.Input; /** * A message to include with a re-notification. Supports the `@username` notification allowed elsewhere. */ escalationMessage?: pulumi.Input; /** * (Only applies to metric alert) 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 `last5m` 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. */ evaluationDelay?: pulumi.Input; /** * A boolean indicating whether this monitor can be deleted even if it’s referenced by other resources (e.g. SLO, composite monitor). */ forceDelete?: pulumi.Input; /** * The time span after which groups with missing data are dropped from the monitor state. The minimum value is one hour, and the maximum value is 72 hours. Example values are: 60m, 1h, and 2d. This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors. */ groupRetentionDuration?: pulumi.Input; /** * Whether or not to trigger one alert if any source breaches a threshold. This is only used by log monitors. Defaults to `false`. */ groupbySimpleMonitor?: pulumi.Input; /** * A boolean indicating whether notifications from this monitor automatically insert its triggering tags into the title. */ includeTags?: pulumi.Input; /** * A message to include with notifications for this monitor. */ message: pulumi.Input; /** * A mapping containing `recoveryWindow` and `triggerWindow` values, e.g. `last15m` . Can only be used for, and are required for, anomaly monitors. */ monitorThresholdWindows?: pulumi.Input; /** * Alert thresholds of the monitor. */ monitorThresholds?: pulumi.Input; /** * Name of Datadog monitor. */ name: pulumi.Input; /** * The time (in seconds) to skip evaluations for new groups. * * `newGroupDelay` overrides `newHostDelay` if it is set to a nonzero value. */ newGroupDelay?: pulumi.Input; /** * **Deprecated**. See `newGroupDelay`. Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non-negative integer. This value is ignored for simple monitors and monitors not grouped by host. The only case when this should be used is to override the default and set `newHostDelay` to zero for monitors grouped by host. * * @deprecated Use `newGroupDelay` except when setting `newHostDelay` to zero. */ newHostDelay?: pulumi.Input; /** * The number of minutes before a monitor will notify when data stops reporting. * * We recommend at least 2x the monitor timeframe for metric alerts or 2 minutes for service checks. */ noDataTimeframe?: pulumi.Input; /** * Toggles the display of additional content sent in the monitor notification. */ notificationPresetName?: pulumi.Input; /** * A boolean indicating whether tagged users will be notified on changes to this monitor. Defaults to `false`. */ notifyAudit?: pulumi.Input; /** * Controls what granularity a monitor alerts on. Only available for monitors with groupings. For instance, a monitor grouped by `cluster`, `namespace`, and `pod` can be configured to only notify on each new `cluster` violating the alert conditions by setting `notifyBy` to `['cluster']`. Tags mentioned in `notifyBy` must be a subset of the grouping tags in the query. For example, a query grouped by `cluster` and `namespace` cannot notify on `region`. Setting `notifyBy` to `[*]` configures the monitor to notify as a simple-alert. */ notifyBies?: pulumi.Input[]>; /** * A boolean indicating whether this monitor will notify when data stops reporting. */ notifyNoData?: pulumi.Input; /** * Controls how groups or monitors are treated if an evaluation does not return any data points. The default option results in different behavior depending on the monitor query type. For monitors using `Count` queries, an empty monitor evaluation is treated as 0 and is compared to the threshold conditions. For monitors using any query type other than `Count`, for example `Gauge`, `Measure`, or `Rate`, the monitor shows the last known status. This option is not available for Service Check, Composite, or SLO monitors. Valid values are: `showNoData`, `showAndNotifyNoData`, `resolve`, and `default`. */ onMissingData?: pulumi.Input; /** * Integer from 1 (high) to 5 (low) indicating alert severity. */ priority?: pulumi.Input; /** * The monitor query to notify on. Note this is not the same query you see in the UI and the syntax is different depending on the monitor type, please see the [API Reference](https://docs.datadoghq.com/api/v1/monitors/#create-a-monitor) for details. `terraform plan` will validate query contents unless `validate` is set to `false`. * * **Note:** APM latency data is now available as Distribution Metrics. Existing monitors have been migrated automatically but all terraformed monitors can still use the existing metrics. We strongly recommend updating monitor definitions to query the new metrics. To learn more, or to see examples of how to update your terraform definitions to utilize the new distribution metrics, see the [detailed doc](https://docs.datadoghq.com/tracing/guide/ddsketch_trace_metrics/). */ query: pulumi.Input; /** * The number of minutes after the last notification before a monitor will re-notify on the current status. It will only re-notify if it's not resolved. */ renotifyInterval?: pulumi.Input; /** * The number of re-notification messages that should be sent on the current status. */ renotifyOccurrences?: pulumi.Input; /** * The types of statuses for which re-notification messages should be sent. */ renotifyStatuses?: pulumi.Input[]>; /** * A boolean indicating whether this monitor needs a full window of data before it's evaluated. Datadog strongly recommends you set this to `false` for sparse metrics, otherwise some evaluations may be skipped. If there's a customSchedule set, `requireFullWindow` must be false and will be ignored. */ requireFullWindow?: pulumi.Input; /** * A list of unique role identifiers to define which roles are allowed to edit the monitor. Editing a monitor includes any updates to the monitor configuration, monitor deletion, and muting of the monitor for any amount of time. Roles unique identifiers can be pulled from the [Roles API](https://docs.datadoghq.com/api/latest/roles/#list-roles) in the `data.id` field. * * @deprecated Use `datadog.RestrictionPolicy` resource to manage permission. */ restrictedRoles?: pulumi.Input[]>; /** * Configuration options for scheduling. */ schedulingOptions?: pulumi.Input; /** * 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 */ tags?: pulumi.Input[]>; /** * The number of hours of the monitor not reporting data before it automatically resolves from a triggered state. The minimum allowed value is 0 hours. The maximum allowed value is 24 hours. */ timeoutH?: pulumi.Input; /** * The type of the monitor. The mapping from these types to the types found in the Datadog Web UI can be found in the Datadog API [documentation page](https://docs.datadoghq.com/api/v1/monitors/#create-a-monitor). Note: The monitor type cannot be changed after a monitor is created. */ type: pulumi.Input; /** * If set to `false`, skip the validation call done during plan. */ validate?: pulumi.Input; variables?: pulumi.Input; }