Skip to content

Latest commit

 

History

History
300 lines (186 loc) · 9.84 KB

API.md

File metadata and controls

300 lines (186 loc) · 9.84 KB

ELB Other 5XX Alarm

What is

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.

CloudWatch Composite Alarm

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.

Usage

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,
});

API Reference

Constructs

ELBOther5XXAlarm

Initializers

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.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { ELBOther5XXAlarm } from 'elb-other-5xx-alarm'

ELBOther5XXAlarm.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

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.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


elbOther5XXAlarmRequired
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.


Structs

ELBOther5XXAlarmProps

Initializer

import { ELBOther5XXAlarmProps } from 'elb-other-5xx-alarm'

const eLBOther5XXAlarmProps: ELBOther5XXAlarmProps = { ... }

Properties

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.

alarmActionsRequired
public readonly alarmActions: IAlarmAction[];
  • Type: aws-cdk-lib.aws_cloudwatch.IAlarmAction[]

Alarm actions using in this alarm.


evaluationPeriodsRequired
public readonly evaluationPeriods: number;
  • Type: number

The number of periods over which data is compared to the specified threshold.


loadBalancerFullNameRequired
public readonly loadBalancerFullName: string;
  • Type: string

Full name of the target LoadBalancer.


thresholdRequired
public readonly threshold: number;
  • Type: number

The value against which the specified statistic is compared.


alarmDescriptionOptional
public readonly alarmDescription: string;
  • Type: string
  • Default: No description

Description for the alarm.


alarmNameOptional
public readonly alarmName: string;
  • Type: string
  • Default: Automatically generated name

Name of the alarm.


datapointsToAlarmOptional
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.

https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarm-evaluation


periodOptional
public readonly period: Duration;
  • Type: aws-cdk-lib.Duration
  • Default: Duration.minutes(5)

The period over which the specified statistic is applied.