use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project onebusaway-application-modules by camsys.
the class RealtimeAlarmsImpl method createRealtimeLocationsTotalPctAlarm.
@Override
public void createRealtimeLocationsTotalPctAlarm() {
PutMetricAlarmRequest putMetricAlarmRequest = getMetricAlarmRequest(MetricName.RealtimeLocationsTotalPct);
putMetricAlarmRequest.setAlarmActions(getNonCriticalAction());
putMetricAlarmRequest.setInsufficientDataActions(getNonCriticalAction());
putMetricAlarmRequest.setUnit(StandardUnit.Percent);
putMetricAlarmRequest.setThreshold(_configService.getConfigurationValueAsDouble("alarm.rtLocationsTotalPct", 10d));
_cloudWatchService.publishAlarm(putMetricAlarmRequest);
}
use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project onebusaway-application-modules by camsys.
the class WebappAlarmsImpl method createSmsApiAlarm.
@Override
public void createSmsApiAlarm() {
PutMetricAlarmRequest putMetricAlarmRequest = getMetricAlarmRequest(MetricName.SMSWebappErrorResponse);
putMetricAlarmRequest.setThreshold(1d);
putMetricAlarmRequest.setAlarmActions(getCriticalAction());
putMetricAlarmRequest.setUnit(StandardUnit.Count);
putMetricAlarmRequest.setThreshold(_configService.getConfigurationValueAsDouble("alarm.webSMSWebappError", 1d));
_cloudWatchService.publishAlarm(putMetricAlarmRequest);
}
use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project onebusaway-application-modules by camsys.
the class WebappAlarmsImpl method createStopMonitoringAlarm.
@Override
public void createStopMonitoringAlarm() {
PutMetricAlarmRequest putMetricAlarmRequest = getMetricAlarmRequest(MetricName.StopMonitoringErrorResponse);
putMetricAlarmRequest.setThreshold(1d);
putMetricAlarmRequest.setAlarmActions(getCriticalAction());
putMetricAlarmRequest.setUnit(StandardUnit.Count);
putMetricAlarmRequest.setThreshold(_configService.getConfigurationValueAsDouble("alarm.webStopMonitoringError", 1d));
_cloudWatchService.publishAlarm(putMetricAlarmRequest);
}
use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project onebusaway-application-modules by camsys.
the class WebappAlarmsImpl method createDesktopUiValidAlarm.
@Override
public void createDesktopUiValidAlarm() {
PutMetricAlarmRequest putMetricAlarmRequest = getMetricAlarmRequest(MetricName.DesktopUiValid);
putMetricAlarmRequest.setAlarmActions(getCriticalAction());
putMetricAlarmRequest.setUnit(StandardUnit.Count);
putMetricAlarmRequest.setThreshold(_configService.getConfigurationValueAsDouble("alarm.webDesktopUiValid", 1d));
_cloudWatchService.publishAlarm(putMetricAlarmRequest);
}
use of com.amazonaws.services.cloudwatch.model.PutMetricAlarmRequest in project aws-doc-sdk-examples by awsdocs.
the class PutMetricAlarm method main.
public static void main(String[] args) {
final String USAGE = "To run this example, supply an alarm name and instance id\n" + "Ex: DeleteAlarm <alarm-name> <instance-id>\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String alarmName = args[0];
String instanceId = args[1];
final AmazonCloudWatch cw = AmazonCloudWatchClientBuilder.defaultClient();
Dimension dimension = new Dimension().withName("InstanceId").withValue(instanceId);
PutMetricAlarmRequest request = new PutMetricAlarmRequest().withAlarmName(alarmName).withComparisonOperator(ComparisonOperator.GreaterThanThreshold).withEvaluationPeriods(1).withMetricName("CPUUtilization").withNamespace("AWS/EC2").withPeriod(60).withStatistic(Statistic.Average).withThreshold(70.0).withActionsEnabled(false).withAlarmDescription("Alarm when server CPU utilization exceeds 70%").withUnit(StandardUnit.Seconds).withDimensions(dimension);
PutMetricAlarmResult response = cw.putMetricAlarm(request);
System.out.printf("Successfully created alarm with name %s", alarmName);
}
Aggregations