@navigraph/cdk-alarms
v0.2.1
Published
CDK Alarms
Downloads
142
Readme
CDK Alarms
Set up Cloud watch alarms and send notifications on the specified topic.
Setup
$ npm i @navigraph/cdk-alarms
import { NavigraphAlarm, NavigraphElbAlarm, NavigraphRdsAlarm } from '@navigraph/cdk-alarms';
// ...
const topic = new Topic(this, 'ErrorNotificationTopic');
NavigraphAlarm
Base alarm used for standard metrics or complex ones including mathExpression
.
Example
new NavigraphAlarm(this, 'ErrorLogAlarm', {
alarmName: 'error-log-rate',
topic,
metricName: 'ERROR_LOG_METRIC',
namespace: 'production-application-X',
});
NavigraphElbAlarm
Helper for ELB alarms.
Example
new NavigraphElbAlarm(this, 'Http500ElbAlarm', {
alarmName: 'elb-http-500',
topic,
metricName: 'HTTPCode_Backend_5XX',
loadbalancerName: 'theLoadBalancerName',
threshold: 1,
statistic: 'max',
treatMissingData: TreatMissingData.NOT_BREACHING,
reportOk: false,
});
NavigraphAlbAlarm
Helper for ALB alarms.
Example
new NavigraphAlbAlarm(this, 'Http500AlbAlarm', {
alarmName: 'elb-http-500',
topic,
metricName: 'HTTPCode_Target_5XX_Count',
loadbalancerName: 'theLoadBalancerName',
targetgroupName: 'theTargetGroupName',
threshold: 10,
evaluationPeriod: 5,
statistic: 'sum',
treatMissingData: TreatMissingData.NOT_BREACHING,
});
NavigraphRdsAlarm
Helper for RDS alarms.
Example
new NavigraphRdsAlarm(this, 'CommitLatencyAlarm', {
alarmName: 'postgres-commit-latency',
topic,
dbClusterName: 'theDbClusterName',
metricName: 'CommitLatency',
threshold: 1, // ms
});
NavigraphEcsServiceAlarm
Helper for ECS service alarms.
new NavigraphEcsServiceAlarm(this, 'CPUUtilizationAlarm', {
alarmName: 'cpu-utilization-alarm',
topic,
serviceName: 'theFargateEcsService',
metricName: 'CPUUtilization',
threshold: 60
});