@renovosolutions/cdk-library-cloudwatch-alarms
Version:
AWS CDK Construct Library to automatically create CloudWatch Alarms for resources in a CDK app based on resource type.
249 lines (248 loc) • 8.99 kB
TypeScript
import { IAspect, aws_elasticloadbalancingv2 as elbv2, aws_cloudwatch as cloudwatch, Duration } from 'aws-cdk-lib';
import { Construct, IConstruct } from 'constructs';
import { AlarmBaseProps } from './common';
/**
* The recommended metrics for NetworkLoadBalancer alarms.
*/
export declare enum NetworkLoadBalancerRecommendedAlarmsMetrics {
/**
* The number of reset (RST) packets sent from the load balancer.
*/
TCP_ELB_RESET_COUNT = "TcpElbResetCount",
/**
* The number of reset (RST) packets generated by the targets.
*/
TCP_TARGET_RESET_COUNT = "TcpTargetResetCount"
}
/**
* The common optional configuration for the alarms.
*/
export interface NetworkLoadBalancerAlarmBaseConfig extends AlarmBaseProps {
/**
* The period over which the specified statistic is applied.
*
* @default Duration.minutes(1)
*/
readonly period?: Duration;
}
/**
* The common properties for the NetworkLoadBalancer alarms.
*/
export interface NetworkLoadBalancerAlarmProps {
/**
* The NetworkLoadBalancer to monitor.
*/
readonly loadBalancer: elbv2.NetworkLoadBalancer;
}
/**
* Configuration for the TcpElbResetCount alarm.
*/
export interface NetworkLoadBalancerTcpElbResetCountAlarmConfig extends NetworkLoadBalancerAlarmBaseConfig {
/**
* The value against which the specified statistic is compared.
* You should set this threshold based on the acceptable number of TCP resets from the load balancer.
*
* @default 0
*/
readonly threshold?: number;
/**
* The number of periods over which data is compared to the specified threshold.
*
* @default 3
*/
readonly evaluationPeriods?: number;
/**
* The number of data points that must be breaching to trigger the alarm.
*
* @default 3
*/
readonly datapointsToAlarm?: number;
/**
* The alarm name.
*
* @default - loadBalancerName + ' - TcpElbResetCount'
*/
readonly alarmName?: string;
/**
* The description of the alarm.
*
* @default - This alarm is used to detect when the load balancer is sending TCP reset packets.
* A high number of resets can indicate connectivity issues between the load balancer and clients.
*/
readonly alarmDescription?: string;
}
/**
* The properties for the NetworkLoadBalancerTcpElbResetCountAlarm construct.
*/
export interface NetworkLoadBalancerTcpElbResetCountAlarmProps extends NetworkLoadBalancerAlarmProps, NetworkLoadBalancerTcpElbResetCountAlarmConfig {
}
/**
* This alarm is used to detect when the load balancer is sending TCP reset packets.
*
* A high number of resets can indicate connectivity issues between the load balancer and clients.
*
* The alarm is triggered when the number of TCP resets from the load balancer is greater than threshold.
*/
export declare class NetworkLoadBalancerTcpElbResetCountAlarm extends cloudwatch.Alarm {
constructor(scope: IConstruct, id: string, props: NetworkLoadBalancerTcpElbResetCountAlarmProps);
}
/**
* Configuration for the TcpTargetResetCount alarm.
*/
export interface NetworkLoadBalancerTcpTargetResetCountAlarmConfig extends NetworkLoadBalancerAlarmBaseConfig {
/**
* The value against which the specified statistic is compared.
* You should set this threshold based on the acceptable number of TCP resets from targets.
*
* @default 0
*/
readonly threshold?: number;
/**
* The number of periods over which data is compared to the specified threshold.
*
* @default 3
*/
readonly evaluationPeriods?: number;
/**
* The number of data points that must be breaching to trigger the alarm.
*
* @default 3
*/
readonly datapointsToAlarm?: number;
/**
* The alarm name.
*
* @default - loadBalancerName + ' - TcpTargetResetCount'
*/
readonly alarmName?: string;
/**
* The description of the alarm.
*
* @default - This alarm is used to detect when the targets are sending TCP reset packets.
* A high number of resets can indicate connectivity issues between the load balancer and targets.
*/
readonly alarmDescription?: string;
}
/**
* The properties for the NetworkLoadBalancerTcpTargetResetCountAlarm construct.
*/
export interface NetworkLoadBalancerTcpTargetResetCountAlarmProps extends NetworkLoadBalancerAlarmProps, NetworkLoadBalancerTcpTargetResetCountAlarmConfig {
}
/**
* This alarm is used to detect when the targets are sending TCP reset packets.
*
* A high number of resets can indicate connectivity issues between the load balancer and targets.
*
* The alarm is triggered when the number of TCP resets from targets is greater than threshold.
*/
export declare class NetworkLoadBalancerTcpTargetResetCountAlarm extends cloudwatch.Alarm {
constructor(scope: IConstruct, id: string, props: NetworkLoadBalancerTcpTargetResetCountAlarmProps);
}
/**
* Configurations for the recommended alarms for a NetworkLoadBalancer.
*
* Default actions are overridden by the actions specified in the
* individual alarm configurations.
*/
export interface NetworkLoadBalancerRecommendedAlarmsConfig {
/**
* The default action to take when an alarm is triggered.
*
* @default - None
*/
readonly defaultAlarmAction?: cloudwatch.IAlarmAction;
/**
* The default action to take when an alarm enters the ok state.
*
* @default - None
*/
readonly defaultOkAction?: cloudwatch.IAlarmAction;
/**
* The default action to take when an alarm has insufficient data.
*
* @default - None
*/
readonly defaultInsufficientDataAction?: cloudwatch.IAlarmAction;
/**
* How to handle missing data for this alarm.
*
* @default TreatMissingData.MISSING
*/
readonly treatMissingData?: cloudwatch.TreatMissingData;
/**
* Alarm metrics to exclude from the recommended alarms.
*
* @default - None
*/
readonly excludeAlarms?: NetworkLoadBalancerRecommendedAlarmsMetrics[];
/**
* The resources to exclude from the recommended alarms.
*
* Use a resources id to exclude a specific resource.
*/
readonly excludeResources?: string[];
/**
* The configuration for the TcpElbResetCount alarm.
*/
readonly configTcpElbResetCountAlarm?: NetworkLoadBalancerTcpElbResetCountAlarmConfig;
/**
* The configuration for the TcpTargetResetCount alarm.
*/
readonly configTcpTargetResetCountAlarm?: NetworkLoadBalancerTcpTargetResetCountAlarmConfig;
}
/**
* Properties for the NetworkLoadBalancerRecommendedAlarms construct.
*/
export interface NetworkLoadBalancerRecommendedAlarmsProps extends NetworkLoadBalancerRecommendedAlarmsConfig {
/**
* The NetworkLoadBalancer to monitor.
*/
readonly loadBalancer: elbv2.NetworkLoadBalancer;
}
/**
* A construct that creates the recommended alarms for a NetworkLoadBalancer.
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elb-metricscollected.html
*/
export declare class NetworkLoadBalancerRecommendedAlarms extends Construct {
/**
* The TcpElbResetCount alarm.
*/
readonly alarmTcpElbResetCount?: NetworkLoadBalancerTcpElbResetCountAlarm;
/**
* The TcpTargetResetCount alarm.
*/
readonly alarmTcpTargetResetCount?: NetworkLoadBalancerTcpTargetResetCountAlarm;
constructor(scope: Construct, id: string, props: NetworkLoadBalancerRecommendedAlarmsProps);
}
/**
* An extension for the NetworkLoadBalancer construct that provides methods
* to create recommended alarms.
*/
export declare class NetworkLoadBalancer extends elbv2.NetworkLoadBalancer {
constructor(scope: Construct, id: string, props: elbv2.NetworkLoadBalancerProps);
/**
* Creates an alarm that monitors the TCP reset count from the load balancer.
*/
alarmTcpElbResetCount(props?: NetworkLoadBalancerTcpElbResetCountAlarmConfig): NetworkLoadBalancerTcpElbResetCountAlarm;
/**
* Creates an alarm that monitors the TCP reset count from targets.
*/
alarmTcpTargetResetCount(props?: NetworkLoadBalancerTcpTargetResetCountAlarmConfig): NetworkLoadBalancerTcpTargetResetCountAlarm;
/**
* Creates the recommended alarms for the NetworkLoadBalancer.
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elb-metricscollected.html
*/
applyRecommendedAlarms(props: NetworkLoadBalancerRecommendedAlarmsConfig): NetworkLoadBalancerRecommendedAlarms;
}
/**
* Configures the recommended alarms for a NetworkLoadBalancer.
*
* @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/elb-metricscollected.html
*/
export declare class NetworkLoadBalancerRecommendedAlarmsAspect implements IAspect {
private readonly props;
constructor(props: NetworkLoadBalancerRecommendedAlarmsConfig);
visit(node: IConstruct): void;
}