in source/lib/deployment-helper/alarm_construct.ts [30:69]
constructor(scope: cdk.Construct, id: string, props: iAlarmProps) {
super(scope, id);
if (props.index === undefined)
{
props.index = 1
}
if (props.alarmName === undefined)
{
props.alarmName = "Synthetics-Alarm-" + props.canaryName + "-" + props.index
}
// Alarm State - the canary is "failed" when...
// --------------------------------------------
// If you choose to create alarms, they are created with the following
// name convention:Synthetics-Alarm-canaryName-index
let alarm = new cw.Alarm(this, "AppAlarm", {
alarmName: props.alarmName,
metric: new cw.Metric({
namespace: 'CloudWatchSynthetics',
metricName: 'SuccessPercent',
dimensions: { CanaryName: props.canaryName }
}),
threshold: props.threshold,
comparisonOperator: cw.ComparisonOperator.LESS_THAN_THRESHOLD,
evaluationPeriods: props.evalPeriods,
datapointsToAlarm: props.alarmPeriods,
alarmDescription: "Alarm when canary success is less than 100% on the most recent check."
});
const alarmResource = alarm.node.findChild('Resource') as cw.CfnAlarm;
alarmResource.cfnOptions.metadata = {
cfn_nag: {
rules_to_suppress: [{
id: 'W28',
reason: 'Static names chosen intentionally to provide fixed name structure required in the solution'
}]
}
};
}