use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class RdsAlarmSetupTest method testHightWriteLatency.
@Test
public void testHightWriteLatency() {
PutMetricAlarmRequest expected = RdsAlarmSetup.createDefaultPutMetricRequest(dbInstance, topicArn);
expected.setAlarmName(databaseIdentifer + HIGH_WRITE_LATENCY);
expected.withStatistic("Average").withMetricName(METRIC_WRITE_LATENCY).withComparisonOperator(ComparisonOperator.GreaterThanOrEqualToThreshold).withThreshold(0.1).withEvaluationPeriods(1).withPeriod(FIVE_MINUTES_IN_SECONDS);
PutMetricAlarmRequest result = RdsAlarmSetup.createHighWriteLatency(dbInstance, topicArn);
assertEquals(expected, result);
}
use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class RdsAlarmSetupTest method testLowFreeStorage.
@Test
public void testLowFreeStorage() {
PutMetricAlarmRequest expected = RdsAlarmSetup.createDefaultPutMetricRequest(dbInstance, topicArn);
expected.setAlarmName(databaseIdentifer + LOW_FREE_STOREAGE_SPACE);
Double tenPercentGB = ((double) dbInstance.getAllocatedStorage()) * 0.1;
Double tenPercentBytes = tenPercentGB * Constants.BYTES_PER_GIGABYTE;
System.out.println("10% = " + tenPercentBytes + " bytes");
expected.withStatistic("Average").withMetricName(METRIC_FREE_STOREAGE_SPACE).withComparisonOperator(ComparisonOperator.LessThanOrEqualToThreshold).withThreshold(tenPercentBytes).withEvaluationPeriods(1).withPeriod(FIVE_MINUTES_IN_SECONDS);
PutMetricAlarmRequest result = RdsAlarmSetup.createLowFreeStorage(dbInstance, topicArn);
assertEquals(expected, result);
}
use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class RdsAlarmSetupTest method testCreateLowFreeableMemorySmallInstances.
@Test
public void testCreateLowFreeableMemorySmallInstances() {
// the free able memory alarm is a function of the instances size
Double totalMemory = Constants.getDatabaseClassMemrorySizeBytes(DATABASE_INSTANCE_CLASS_M1_SMALL);
System.out.println("Small memory total: " + totalMemory + " bytes");
PutMetricAlarmRequest expected = RdsAlarmSetup.createDefaultPutMetricRequest(dbInstance, topicArn);
expected.setAlarmName(databaseIdentifer + "-Low-Freeable-Memory");
Double eightPercent = totalMemory - (totalMemory * 0.8);
// Average FreeableMemory < 80% for 1 consecutive period of 5 minutes
expected.withStatistic("Average").withMetricName(METRIC_FREEABLE_MEMORY).withComparisonOperator(ComparisonOperator.LessThanThreshold).withThreshold(eightPercent).withEvaluationPeriods(1).withPeriod(FIVE_MINUTES_IN_SECONDS);
PutMetricAlarmRequest result = RdsAlarmSetup.createLowFreeableMemory(dbInstance, topicArn);
assertEquals(expected, result);
}
use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetupTest method testCreateUnhealthyInstancesPutMetricAlarmRequest.
@Test
public void testCreateUnhealthyInstancesPutMetricAlarmRequest() {
PutMetricAlarmRequest expectedReq = ElbAlarmTestHelper.getExpectedPutMetricAlarmRequest();
String loadBalancerName = "loadBalancer";
PutMetricAlarmRequest req = ElbAlarmSetup.createUnhealthyInstancesPutMetricAlarmRequest("prefix", loadBalancerName, resources.getStackInstanceNotificationTopicArn());
assertEquals(expectedReq, req);
}
use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class ElbAlarmSetupTest method testCreateDefaultPutMetricAlarmRequest.
// TODO: Add tests for error cases
@Test
public void testCreateDefaultPutMetricAlarmRequest() {
PutMetricAlarmRequest expectedReq = ElbAlarmTestHelper.getExpectedBasePutMetricAlarmRequest();
String loadBalancerName = "loadBalancer";
PutMetricAlarmRequest req = ElbAlarmSetup.createDefaultPutMetricAlarmRequest(loadBalancerName, resources.getStackInstanceNotificationTopicArn());
assertEquals(expectedReq, req);
}
Aggregations