コード例 #1
0
        public async Task EnsureLengthAlarm(string queueName, int threshold,
                                            string alarmNameSuffix,
                                            string snsTopicArn, bool dryRun)
        {
            var alarmName = GetAlarmName(queueName, AwsMetrics.MessagesVisible, alarmNameSuffix);

            _tracker.Register(alarmName);

            var alarmNeedsUpdate = await InspectExistingAlarm(alarmName,
                                                              threshold, AwsConstants.FiveMinutesInSeconds, snsTopicArn);

            if (!alarmNeedsUpdate)
            {
                return;
            }

            if (dryRun)
            {
                _logger.Info($"Skipped due to dry run: Put queue length alarm {alarmName} at threshold {threshold}");
                return;
            }

            await PutQueueLengthAlarm(alarmName, queueName, snsTopicArn, threshold);
        }
コード例 #2
0
        private async Task CheckTableAlarm(string alarmName, string tableName, string metricName,
                                           double thresholdInUnits, int periodSeconds,
                                           string snsTopicArn, bool dryRun)
        {
            _tracker.Register(alarmName);

            var alarmNeedsUpdate = await InspectExistingAlarm(alarmName,
                                                              thresholdInUnits, periodSeconds, snsTopicArn);

            if (!alarmNeedsUpdate)
            {
                return;
            }

            if (dryRun)
            {
                _logger.Info($"Skipped due to dry run: Put table alarm {alarmName} at threshold {thresholdInUnits}");
                return;
            }

            await PutTableAlarm(alarmName, tableName, metricName, snsTopicArn,
                                thresholdInUnits, periodSeconds);
        }