Search in sources :

Example 11 with PutMetricAlarmRequest

use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class ElbAlarmSetup method createAlarms.

public void createAlarms(EnvironmentDescription ed) throws InterruptedException {
    String topicArn = resources.getStackInstanceNotificationTopicArn();
    LoadBalancer loadBalancer = getLoadBalancerFromEnvironmentName(ed.getEnvironmentName());
    List<PutMetricAlarmRequest> reqs = createAllPutMetricAlarmRequests(ed.getEnvironmentName(), loadBalancer.getName(), topicArn);
    for (PutMetricAlarmRequest req : reqs) {
        this.cloudWatchClient.putMetricAlarm(req);
    }
}
Also used : PutMetricAlarmRequest(com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest) LoadBalancer(com.amazonaws.services.elasticbeanstalk.model.LoadBalancer)

Example 12 with PutMetricAlarmRequest

use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project Synapse-Stack-Builder by Sage-Bionetworks.

the class ElbAlarmSetup method createUnhealthyInstancesPutMetricAlarmRequest.

public static PutMetricAlarmRequest createUnhealthyInstancesPutMetricAlarmRequest(String prefix, String loadBalancerName, String topicArn) {
    PutMetricAlarmRequest req = createDefaultPutMetricAlarmRequest(loadBalancerName, topicArn);
    req.setAlarmName(prefix + "-unlhealthy-instance-count-alarm");
    req.setStatistic(STATISTIC_MAX);
    req.setMetricName(METRIC_UNHEALTHY_COUNT);
    req.setComparisonOperator(ComparisonOperator.GreaterThanThreshold);
    req.setThreshold(new Double(0));
    req.setEvaluationPeriods(2);
    req.setPeriod(FIVE_MINUTES_IN_SECONDS);
    return req;
}
Also used : PutMetricAlarmRequest(com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest)

Example 13 with PutMetricAlarmRequest

use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project onebusaway-application-modules by camsys.

the class DatabaseAlarmsImpl method createRdsReadLatencyAlarm.

@Override
public void createRdsReadLatencyAlarm(String dbInstance) {
    PutMetricAlarmRequest putMetricAlarmRequest = getRDSMetricAlarmRequest(MetricName.ReadLatency, "RdsReadLatency", dbInstance);
    putMetricAlarmRequest.setAlarmActions(getCriticalAction());
    putMetricAlarmRequest.setUnit(StandardUnit.Count);
    putMetricAlarmRequest.setThreshold(_configService.getConfigurationValueAsDouble("alarm.dbReadLatency", 0.3d));
    _cloudWatchService.publishAlarm(putMetricAlarmRequest);
}
Also used : PutMetricAlarmRequest(com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest)

Example 14 with PutMetricAlarmRequest

use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project onebusaway-application-modules by camsys.

the class DatabaseAlarmsImpl method createRdsLowStorageAlarm.

@Override
public void createRdsLowStorageAlarm(String dbInstance) {
    PutMetricAlarmRequest putMetricAlarmRequest = getRDSMetricAlarmRequest(MetricName.FreeStorageSpace, "RdsLowStorageSpace", dbInstance);
    putMetricAlarmRequest.setAlarmActions(getCriticalAction());
    putMetricAlarmRequest.setUnit(StandardUnit.Count);
    putMetricAlarmRequest.setThreshold(_configService.getConfigurationValueAsDouble("alarm.dbFreeStorageSpace", 3000000000d));
    putMetricAlarmRequest.setComparisonOperator(ComparisonOperator.LessThanThreshold);
    _cloudWatchService.publishAlarm(putMetricAlarmRequest);
}
Also used : PutMetricAlarmRequest(com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest)

Example 15 with PutMetricAlarmRequest

use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project onebusaway-application-modules by camsys.

the class GtfsRtAlarmsImpl method createMessagesDelayedAlarm.

@Override
public void createMessagesDelayedAlarm() {
    PutMetricAlarmRequest putMetricAlarmRequest = getSQSMetricAlarmRequest(MetricName.NumberOfMessagesDelayed, getSqsQueue());
    putMetricAlarmRequest.setAlarmActions(getCriticalAction());
    putMetricAlarmRequest.setInsufficientDataActions(getCriticalAction());
    putMetricAlarmRequest.setThreshold(_configService.getConfigurationValueAsDouble("alarm.sqsNumMessagesDelayed", 1d));
    _cloudWatchService.publishAlarm(putMetricAlarmRequest);
}
Also used : PutMetricAlarmRequest(com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest)

Aggregations

PutMetricAlarmRequest (com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest)60 Test (org.junit.Test)9 Dimension (com.amazonaws.services.cloudwatch.model.Dimension)5 ArrayList (java.util.ArrayList)4 AmazonCloudWatch (com.amazonaws.services.cloudwatch.AmazonCloudWatch)1 DescribeAlarmsResult (com.amazonaws.services.cloudwatch.model.DescribeAlarmsResult)1 PutMetricAlarmResult (com.amazonaws.services.cloudwatch.model.PutMetricAlarmResult)1 LoadBalancer (com.amazonaws.services.elasticbeanstalk.model.LoadBalancer)1 DBInstance (com.amazonaws.services.rds.model.DBInstance)1 LinkedList (java.util.LinkedList)1