Created
May 24, 2019 11:43
-
-
Save lupupaulsv/f7c19cfc2d1822715e8a90bbe4374fd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### terraform alarms for schedulers | |
resource "aws_cloudwatch_metric_alarm" "memory-critical-scheduler-1" { | |
alarm_name = "exago-${var.environment}-scheduler-1-memory-critical" | |
alarm_description = "Exago ${var.environment} scheduler-1 memory is critical." | |
comparison_operator = "LessThanOrEqualToThreshold" | |
evaluation_periods = "2" | |
alarm_description = "This alarm is for critical scheduler memory usage" | |
alarm_actions = ["${var.sns_topics["sev1"]}"] | |
threshold = "262144000" | |
metric_query { | |
id = "m1" | |
metric { | |
metric_name = "mem_total" | |
namespace = "exago-schedulers" | |
period = "60" | |
stat = "Average" | |
dimensions = { | |
host = "ip-172-31-30-70.us-west-2.compute.internal" | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error: Error applying plan: | |
1 error(s) occurred: | |
* module.alarms.aws_cloudwatch_metric_alarm.memory-critical-scheduler-1: 1 error(s) occurred: | |
* aws_cloudwatch_metric_alarm.memory-critical-scheduler-1: Creating metric alarm failed: ValidationError: Exactly one element of the metrics list should return data. | |
status code: 400, request id: f8e3ff7e-7e17-11e9-a1de-eb8f55cf2e51 | |
Terraform does not automatically rollback in the face of errors. | |
Instead, your Terraform state file has been partially updated with | |
any resources that successfully completed. Please address the error | |
above and apply again to incrementally change your infrastructure. |
might need just to return one element and not the whole list. Don't see the metric list anywhere tho
alarm_actions = ["${var.sns_topics["sev1"]}"]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
perhaps this?
https://gist.github.com/lupupaulsv/f7c19cfc2d1822715e8a90bbe4374fd9#file-gistfile1-txt-L8