import * as cdk from "aws-cdk-lib"; import * as cloudwatch from "aws-cdk-lib/aws-cloudwatch"; import type * as ec2 from "aws-cdk-lib/aws-ec2"; import * as constructs from "constructs"; export interface DatabaseAlarmsProps { /** * The action to use for alarms sent to "alarms" Slack channel, * e.g., critical alerts. */ alarmAction: cloudwatch.IAlarmAction; /** * The action to use for alarms sent to "warning" Slack channel, * e.g., less critical alerts. */ warningAction: cloudwatch.IAlarmAction; instanceIdentifier: string; instanceType: ec2.InstanceType; allocatedStorage: cdk.Size; } export declare class DatabaseAlarms extends constructs.Construct { private readonly alarmAction; private readonly warningAction; private readonly databaseInstanceIdentifier; private readonly instanceType; private readonly allocatedStorage; constructor(scope: constructs.Construct, id: string, props: DatabaseAlarmsProps); /** * Sets up a CloudWatch Alarm that triggers if the CPU credit balance for * a burstable instance breach a certain threshold. * * NOTE: This alarm is only applicable for burstable instances, and a balance of 0 credits will only have performance * implications for T2 instances. T3 and T4g instances will instead cost more for prolonged high CPU utilization after * the balance is depleted. */ addCpuCreditsAlarm( /** * Configuration for an alarm. * * @default Configured with sane defaults. */ props?: { /** * An action to use for CloudWatch alarm state changes instead of the default action */ action?: cloudwatch.IAlarmAction; /** * The CloudWatch Alarm will change its state to ALARM if the number of CPU credits drops below this threshold. * * See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html#earning-CPU-credits for an overview of maximum CPU credits for various instance types. * * @default 10% of the maximum earned CPU credits for the instance type. */ threshold?: number; /** * @default true */ enableOkAlarm?: boolean; /** * Add extra information to the alarm description, like Runbook URL or steps to triage. */ appendToAlarmDescription?: string; }): void; /** * Sets up two CloudWatch Alarms for monitoring disk storage space: * 1) one that triggers if the available disk storage space is low. * 2) one that triggers if the available disk storage space is critically low. * * You may want to use different alarm actions for the two alarms, e.g., one can be * categorized as a "warning", while the other one can be considered an "alarm". */ addStorageSpaceAlarms(props?: { /** * Set to `false` to disable all storage space alarms (both low and critically low). * Individual alarms can still be disabled even when this is true. * @default true */ enabled?: boolean; lowStorageSpaceAlarm?: { /** * Set to `false` to disable the low storage space alarm. * @default true */ enabled?: boolean; /** * An action to use for CloudWatch alarm state changes instead of the default action */ action?: cloudwatch.IAlarmAction; /** * @default 25% of the allocated storage. */ threshold?: cdk.Size; /** * Whether to attach OK actions for this alarm. @default true */ enableOkAlarm?: boolean; }; /** * Configuration for critically low storage alarm. */ criticallyLowStorageSpaceAlarm?: { /** * Set to `false` to disable the critically low storage space alarm. * @default true */ enabled?: boolean; /** * An action to use for CloudWatch alarm state changes instead of the default action */ action?: cloudwatch.IAlarmAction; /** * @default 5% of the allocated storage. */ threshold?: cdk.Size; /** * Whether to attach OK actions for this alarm. @default true */ enableOkAlarm?: boolean; }; /** * Add extra information to the alarm description, like Runbook URL or steps to triage. */ appendToAlarmDescription?: string; }): void; /** * Sets up a CloudWatch Alarm that triggers if the average CPU utilization for * the RDS instance exceeds a given threshold. */ addCpuUtilizationAlarm( /** * Configuration for an alarm. * * @default Configured with sane defaults. */ props?: { /** * An action to use for CloudWatch alarm state changes instead of the default action */ action?: cloudwatch.IAlarmAction; /** * The threshold defined as a percentage that determines if CPU utilization should trigger an alarm or not. * @default 80 */ threshold?: number; /** * @default 5 */ evaluationPeriods?: number; /** * @default 2 minutes */ period?: cdk.Duration; /** * Whether to attach OK actions for this alarm. @default true */ enableOkAlarm?: boolean; /** * Add extra information to the alarm description, like Runbook URL or steps to triage. */ appendToAlarmDescription?: string; }): void; }