Skip to content

Commit

Permalink
Update contenthealth check alarm shinesolutions#44
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch1986 committed May 21, 2018
1 parent af5a696 commit cd8fb38
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum InstanceTags {
AEM_AUTHOR_HOST("AuthorHost"),
SNAPSHOT_ID("SnapshotId"),
SNAPSHOT_TYPE("SnapshotType"),
STACK_PREFIX("StackPrefix"),
NAME("Name");

private final String tagName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ public class AemInstanceHelperService {

@Value("${aws.snapshot.tags}")
private List<String> tagsToApplyToSnapshot;

@Value("${aws.cloudformation.stackName.publishDispatcher}")
private String awsPublishDispatcherStackName;

@Resource
private EnvironmentValues envValues;
Expand Down Expand Up @@ -365,7 +362,7 @@ public void createContentHealthAlarmForPublisher(String instanceId) {
getContentHealthCheckAlarmName(instanceId),
"Content Health Alarm for Publish Instance " + instanceId,
instanceId,
awsPublishDispatcherStackName,
"AEM",
envValues.getTopicArn());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,17 @@ public String readFileFromS3(String s3Uri) throws IOException {
*/
public void createContentHealthCheckAlarm(String alarmName, String alarmDescription,
String publishInstanceId, String namespace, String topicArn) {
String publishStackPrefix = getTags(publishInstanceId).get(InstanceTags.STACK_PREFIX.getTagName());

amazonCloudWatchClient.putMetricAlarm(new PutMetricAlarmRequest()
.withAlarmName(alarmName)
.withAlarmDescription(alarmDescription)
.withDimensions(new Dimension()
.withName(InstanceTags.PAIR_INSTANCE_ID.getTagName())
.withValue(publishInstanceId))
.withValue(publishInstanceId),
new Dimension()
.withName(InstanceTags.STACK_PREFIX.getTagName())
.withValue(publishStackPrefix))
.withMetricName("contentHealthCheck")
.withNamespace(namespace)
.withPeriod(60)
Expand Down

0 comments on commit cd8fb38

Please sign in to comment.