AWS CDK construct library for a CloudWatch Alarm for Elastic Load Balancing that fires on HTTPCode_ELB_5XX_Count excluding 500, 502, 503, and 504 (e.g. 501, 505, 561).
Metrics for concrete status codes such as 500 are provided (e.g. HTTPCode_ELB_500_Count). Therefore, it is useful to distinguish detection from them.
For more information, please see the following blog page. here.
The "ELB Other 5XX Alarm" by this construct uses the CloudWatch Composite Alarm.
The alarm rule for this composite alarm is as follows.
ALARM(HTTPCode_ELB_5XX_Count)
AND (
NOT (
ALARM(HTTPCode_ELB_500_Count)
OR ALARM(HTTPCode_ELB_502_Count)
OR ALARM(HTTPCode_ELB_503_Count)
OR ALARM(HTTPCode_ELB_504_Count)
)
)
This is actually implemented using a suppressor alarm.
npm install elb-other-5xx-alarm
import { ELBOther5XXAlarm } from 'elb-other-5xx-alarm';
new ELBOther5XXAlarm(this, 'ELBOther5XXAlarm', {
alarmName: 'my-alarm',
alarmActions: alarmActions, // e.g. [new SnsAction(new Topic(this, 'Topic', {}))]
loadBalancerFullName: alb.loadBalancerFullName, // e.g. 'app/alb/123456789'
period: Duration.seconds(60),
threshold: 1,
evaluationPeriods: 1,
});
import { ELBOther5XXAlarm } from 'elb-other-5xx-alarm'
new ELBOther5XXAlarm(scope: Construct, id: string, props: ELBOther5XXAlarmProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
ELBOther5XXAlarmProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: ELBOther5XXAlarmProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
public toString(): string
Returns a string representation of this construct.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
import { ELBOther5XXAlarm } from 'elb-other-5xx-alarm'
ELBOther5XXAlarm.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
elbOther5XXAlarm |
aws-cdk-lib.aws_cloudwatch.CompositeAlarm |
The composite alarm resource for HTTPCode_ELB_5XX_Count excluding 500, 502, 503, and 504. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly elbOther5XXAlarm: CompositeAlarm;
- Type: aws-cdk-lib.aws_cloudwatch.CompositeAlarm
The composite alarm resource for HTTPCode_ELB_5XX_Count excluding 500, 502, 503, and 504.
import { ELBOther5XXAlarmProps } from 'elb-other-5xx-alarm'
const eLBOther5XXAlarmProps: ELBOther5XXAlarmProps = { ... }
Name | Type | Description |
---|---|---|
alarmActions |
aws-cdk-lib.aws_cloudwatch.IAlarmAction[] |
Alarm actions using in this alarm. |
evaluationPeriods |
number |
The number of periods over which data is compared to the specified threshold. |
loadBalancerFullName |
string |
Full name of the target LoadBalancer. |
threshold |
number |
The value against which the specified statistic is compared. |
alarmDescription |
string |
Description for the alarm. |
alarmName |
string |
Name of the alarm. |
datapointsToAlarm |
number |
The number of datapoints that must be breaching to trigger the alarm. |
period |
aws-cdk-lib.Duration |
The period over which the specified statistic is applied. |
public readonly alarmActions: IAlarmAction[];
- Type: aws-cdk-lib.aws_cloudwatch.IAlarmAction[]
Alarm actions using in this alarm.
public readonly evaluationPeriods: number;
- Type: number
The number of periods over which data is compared to the specified threshold.
public readonly loadBalancerFullName: string;
- Type: string
Full name of the target LoadBalancer.
public readonly threshold: number;
- Type: number
The value against which the specified statistic is compared.
public readonly alarmDescription: string;
- Type: string
- Default: No description
Description for the alarm.
public readonly alarmName: string;
- Type: string
- Default: Automatically generated name
Name of the alarm.
public readonly datapointsToAlarm: number;
- Type: number
- Default:
evaluationPeriods
The number of datapoints that must be breaching to trigger the alarm.
This is used only if you are setting an "M out of N" alarm. In that case, this value is the M. For more information, see Evaluating an Alarm in the Amazon CloudWatch User Guide.
public readonly period: Duration;
- Type: aws-cdk-lib.Duration
- Default: Duration.minutes(5)
The period over which the specified statistic is applied.