magnificent-lifeguard-15082
05/26/2022, 12:32 PMbrave-angle-33257
05/26/2022, 4:18 PMmagnificent-lifeguard-15082
05/26/2022, 4:18 PMbrave-angle-33257
05/26/2022, 4:19 PMjenkins_backup_alarm(actions?: string[]) {
var alarm_actions: any[] = [];
if (actions) {
for (let action of actions) {
alarm_actions.push(this.topics[action]);
}
}
var alarm_name = `${this.prefix}-jenkins-backup`;
var alarm = new aws.cloudwatch.MetricAlarm(alarm_name, {
namespace: `${this.company.toUpperCase()}/CUSTOM`,
name: alarm_name,
comparisonOperator: "LessThanThreshold",
threshold: 1,
statistic: "Maximum",
period: 86400,
evaluationPeriods: 1,
treatMissingData: "breaching",
metricName: "awsbackup-complete",
dimensions: {
environment: this.env.toLowerCase(),
region: this.region,
},
alarmActions: alarm_actions,
okActions: alarm_actions,
});
}
magnificent-lifeguard-15082
05/26/2022, 4:20 PMANOMALY_DETECTION_BAND(m1)
// alarm on 5xx error rise
new aws.cloudwatch.MetricAlarm(
resourceName(['api', '5xx'], service),
{
evaluationPeriods: 1,
metricQueries: [
{
id: 'e1',
returnData: true,
expression: 'ANOMALY_DETECTION_BAND(m1)',
label: 'Expected 5xx',
},
{
id: 'm1',
returnData: true,
metric: pulumi.output({
namespace: 'AWS/ApiGateway',
metricName: '5XXError',
unit: 'Count',
stat: 'Sum',
period: 300,
dimensions: { ApiName: api.name },
}),
},
],
thresholdMetricId: 'e1',
alarmActions: [opsTopic],
okActions: [opsTopic],
treatMissingData: 'ignore',
comparisonOperator: 'GreaterThanUpperThreshold',
},
{ parent: this }
)
brave-angle-33257
05/26/2022, 4:21 PM