import { Construct } from 'constructs'; import { INotification } from './datadog-notification'; /** * Well known monitor types supported by Datadog. * * @see https://docs.datadoghq.com/monitors/types/ */ export declare enum DatadogMonitorQueryAlertType { AUDIT_ALERT = "audit alert", COMPOSITE = "composite", EVENT_ALERT = "event alert", EVENT_V_2_ALERT = "event-v2 alert", LOG_ALERT = "log alert", METRIC_ALERT = "metric alert", PROCESS_ALERT = "process alert", QUERY_ALERT = "query alert", SERVICE_CHECK = "service check", SYNTHETICS_ALERT = "synthetics alert", TRACE_ANALYTICS_ALERT = "trace-analytics alert", SLO_ALERT = "slo alert", RUM_ALERT = "rum alert", CI_PIPELINES_ALERT = "ci-pipelines alert", ERROR_TRACKING_ALERT = "error-tracking alert", CI_TESTS_ALERT = "ci-tests alert" } /** * Properties of {@link DatadogMonitor} */ export interface DatadogMonitorProps { /** * A name suffix to be appended to the monitors name. * * The monitor name is concatenated form ` ` */ readonly name: string; /** * The name of the service to which the monitor belongs. * * Used to generate the monitor name as well a apply the `service` tag. */ readonly serviceName: string; /** * The monitors type * * @see https://docs.datadoghq.com/monitors/types/ */ readonly monitorType: DatadogMonitorQueryAlertType; /** * The monitors search query * * @see https://docs.datadoghq.com/monitors/configuration/#define-the-search-query */ readonly query: string; /** * Convert the query string to lower case. This is useful for passing in AWS resource names into metric queries (metric names are automatically * lowercased in Datadog, but the monitor queries not). * Defaults to false. * * @see https://github.com/DataDog/datadog-cloudformation-resources/blob/master/datadog-monitors-monitor-handler/docs/cloudformationoptions.md#lowercasequery */ readonly lowercaseQuery?: boolean; /** * The message pattern for the monitor * * @see https://docs.datadoghq.com/monitors/configuration/#message */ readonly message: string; /** * To explicitly disable notifications use {@link NoNotification}. * * @defaultValue {@link DefaultSlackNotification} * * @see https://docs.datadoghq.com/monitors/notify */ readonly notification?: INotification; /** * The alert priority of the monitor * * @defaultValue 4 */ readonly priority?: number; /** * Specific options to override the default monitor options. */ readonly optionOverrides?: CfnDatadogMonitorOptions; /** * Tags to be appended to the monitor in addition to the RIO default tags */ readonly extraTags?: string[]; } /** * Well known renotification settings supported by Datadog. * * @see https://docs.datadoghq.com/monitors/notify/#renotify */ export declare enum RenotifyStatuses { ALERT = "alert", NO_DATA = "no data", WARN = "warn" } /** * Well known notification presets supported by Datadog. * * @see https://github.com/DataDog/datadog-cloudformation-resources/blob/master/datadog-monitors-monitor-handler/datadog-monitors-monitor.json */ export declare enum MonitorNotificationPreset { SHOW_ALL = "show_all", HIDE_QUERY = "hide_query", HIDE_HANDLES = "hide_handles", HIDE_ALL = "hide_all" } /** * Options for onMissingData supported by Datadog. * * @see https://github.com/DataDog/datadog-cloudformation-resources/blob/master/datadog-monitors-monitor-handler/datadog-monitors-monitor.json */ export declare enum MonitorOnMissingData { DEFAULT = "default", SHOW_NO_DATA = "show_no_data", SHOW_AND_NOTIFY_NO_DATA = "show_and_notify_no_data", RESOLVE = "resolve" } /** * Options to override for Datadog monitors in case more specific settings are required. * * {@link https://github.com/DataDog/datadog-cloudformation-resources/blob/master/datadog-monitors-monitor-handler/datadog-monitors-monitor.json} */ export interface CfnDatadogMonitorOptions { /** * Whether or not to include a sample of the logs */ readonly enableLogsSample?: boolean; /** * Whether or not to send a list of samples when the monitor triggers. * * This is only used by CI Test and Pipeline monitors. */ readonly enableSamples?: boolean; /** * Message to include with a re-notification when renotify_interval is set */ readonly escalationMessage?: string; /** * Time in seconds to delay evaluation * */ readonly evaluationDelay?: number; /** * 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?: string; /** * Whether or not to include triggering tags into notification title' * * @defaultValue true */ readonly includeTags?: boolean; /** * Whether or not changes to this monitor should be restricted to the creator or admins */ readonly locked?: boolean; /** * Number of locations allowed to fail before triggering alert */ readonly minLocationFailed?: number; /** * Time in seconds to allow a host to start reporting data before starting the evaluation of monitor results */ readonly newHostDelay?: number; /** * Number of minutes data stopped reporting before notifying */ readonly noDataTimeframe?: number; /** * Whether or not to notify tagged users when changes are made to the monitor */ readonly notifyAudit?: boolean; /** * 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 `notify_by` to `["cluster"]`. * Tags mentioned in `notify_by` 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 `notify_by` to `[*]` configures the monitor to notify as a simple-alert. */ readonly notifyBy?: string[]; /** * Whether or not to notify when data stops reporting * * @defaultValue false */ readonly notifyNoData?: boolean; /** * 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 only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors. */ readonly onMissingData?: MonitorOnMissingData; /** * Number of minutes after the last notification before the monitor re-notifies on the current status */ readonly renotifyInterval?: number; /** * Whether or not the monitor requires a full window of data before it is evaluated * * @defaultValue false */ readonly requireFullWindow?: boolean; /** * Configuration options for scheduling */ readonly schedulingOptions?: MonitorSchedulingOptions; /** * ID of the corresponding synthetics check */ readonly syntheticsCheckID?: number; readonly thresholds?: CfnDatadogMonitorThresholds; readonly thresholdWindows?: CfnDatadogMonitorThresholdWindows; /** * Number of hours of the monitor not reporting data before it automatically resolves */ readonly timeoutH?: number; /** * The number of times re-notification messages should be sent on the current status at the provided re-notification interval. */ readonly renotifyOccurrences?: number; /** * The types of monitor statuses for which re-notification messages are sent. */ readonly renotifyStatuses?: RenotifyStatuses[]; /** * How long the test should be in failure before alerting (integer, number of seconds, max 7200). */ readonly minFailureDuration?: number; /** * Controls which information should be added/lett out from the notification. * * @defaultValue {@link MonitorNotificationPreset.SHOW_ALL} */ readonly monitorNotificationPresetName?: MonitorNotificationPreset; /** * Time (in seconds) to skip evaluations for new groups. For example, this option can be used to skip evaluations for new hosts while they initialize. Must be a non negative integer. */ readonly newGroupDelay?: number; /** * List of requests that can be used in the monitor query. */ readonly variables?: object[]; } export interface CfnDatadogMonitorThresholds { /** * Threshold value for triggering an alert */ readonly critical?: number; /** * Threshold value for recovering from an alert state */ readonly criticalRecovery?: number; /** * Threshold value for recovering from an alert state */ readonly ok?: number; /** * Threshold value for triggering a warning */ readonly warning?: number; /** * Threshold value for recovering from a warning state */ readonly warningRecovery?: number; } export interface CfnDatadogMonitorThresholdWindows { /** * How long a metric must be anomalous before triggering an alert */ readonly triggerWindow?: string; /** * How long an anomalous metric must be normal before recovering from an alert state */ readonly recoveryWindow?: string; } /** * Configuration options for scheduling */ export interface MonitorSchedulingOptions { readonly evaluationWindow?: MonitorSchedulingOptionsEvaluationWindow; } /** * Configuration options for the evaluation window. * * If `hour_starts` is set, no other fields may be set. * Otherwise, `day_starts` and `month_starts` must be set together. */ export interface MonitorSchedulingOptionsEvaluationWindow { /** * The time of the day at which a one day cumulative evaluation window starts. * * Must be defined in UTC time in `HH:mm` format. */ readonly dayStarts?: string; /** * The day of the month at which a one month cumulative evaluation window starts */ readonly monthStarts?: number; /** * The minute of the hour at which a one hour cumulative evaluation window starts */ readonly hourStarts?: number; } /** * Wrapper around Datadog's CloudFormation `Datadog::Monitors::Monitor` with some RIO defaults applied. * * To use this the Datadog resources have to be {@link https://docs.datadoghq.com/integrations/guide/amazon_cloudformation/ * |enabled in the CloudFormation registry} of the corresponding AWS account. Usually this is done * automatically by the Datadog Integrations (account module AND ServiceCatalog) provided by CLAID. */ export declare class DatadogMonitor extends Construct { /** * Default priority of a monitor */ static readonly DEFAULT_PRIORITY = 4; readonly name: string; readonly priority: number; private readonly monitor; constructor(scope: Construct, id: string, props: DatadogMonitorProps); /** * Obtain the monitor_id as used in Datadog * See https://docs.datadoghq.com/api/latest/monitors/#get-a-monitors-details * * This allows referencing this monitor in other constructs/resources (e.g. SLOs) */ get monitorId(): string; private concatenateMessage; }