UPD: clean up code comments
This commit is contained in:
parent
a0cf9362d4
commit
ee09ad461c
@ -87,7 +87,6 @@ resource "aws_cloudwatch_metric_alarm" "ec2-mem_free" {
|
||||
actions_enabled = var.actions-enabled
|
||||
alarm_actions = [var.alarm-actions-standard]
|
||||
ok_actions = [var.alarm-actions-standard]
|
||||
treat_missing_data = "notBreaching"
|
||||
dimensions = {
|
||||
InstanceId = var.ec2-instance-id
|
||||
ImageId = data.aws_instance.ec2-instance.ami
|
||||
@ -101,20 +100,15 @@ resource "aws_cloudwatch_metric_alarm" "ec2-mem_free" {
|
||||
|
||||
resource "aws_cloudwatch_metric_alarm" "ec2-swap_free" {
|
||||
# zero is fine as most ec2 instances are deployed without any swap
|
||||
alarm_name = "${var.cw-alarm-prefix}:EC2:swap_free:${var.ec2-instance-id}"
|
||||
comparison_operator = "LessThanThreshold"
|
||||
evaluation_periods = "2"
|
||||
# metric_name = "swap_free"
|
||||
# period = "900"
|
||||
# statistic = "Average"
|
||||
threshold = var.threshold-swap_free
|
||||
alarm_description = "EC2:swap_free"
|
||||
# namespace = "CWAgent"
|
||||
alarm_name = "${var.cw-alarm-prefix}:EC2:swap_free:${var.ec2-instance-id}"
|
||||
comparison_operator = "LessThanThreshold"
|
||||
evaluation_periods = "2"
|
||||
threshold = var.threshold-swap_free
|
||||
alarm_description = "EC2:swap_free"
|
||||
insufficient_data_actions = []
|
||||
actions_enabled = var.actions-enabled
|
||||
alarm_actions = [var.alarm-actions-standard]
|
||||
ok_actions = [var.alarm-actions-standard]
|
||||
treat_missing_data = "notBreaching"
|
||||
metric_query {
|
||||
id = "m1"
|
||||
metric {
|
||||
@ -136,11 +130,6 @@ resource "aws_cloudwatch_metric_alarm" "ec2-swap_free" {
|
||||
return_data = "true"
|
||||
}
|
||||
|
||||
#dimensions = {
|
||||
# InstanceId = var.ec2-instance-id
|
||||
# ImageId = data.aws_instance.ec2-instance.ami
|
||||
# InstanceType = data.aws_instance.ec2-instance.instance_type
|
||||
#}
|
||||
tags = var.default-tags
|
||||
lifecycle {
|
||||
ignore_changes = [tags]
|
||||
@ -174,11 +163,9 @@ resource "aws_cloudwatch_metric_alarm" "ec2-disk_free" {
|
||||
InstanceId = var.ec2-instance-id
|
||||
ImageId = data.aws_instance.ec2-instance.ami
|
||||
InstanceType = data.aws_instance.ec2-instance.instance_type
|
||||
#device = length(data.external.disk-device.result.device) > 0 ? data.external.disk-device.result.device : "unknown"
|
||||
#fstype = length(data.external.disk-device.result.fstype) > 0 ? data.external.disk-device.result.fstype : "unknown"
|
||||
device = data.external.disk-device.result.device
|
||||
fstype = data.external.disk-device.result.fstype
|
||||
path = "/"
|
||||
device = data.external.disk-device.result.device
|
||||
fstype = data.external.disk-device.result.fstype
|
||||
path = "/"
|
||||
}
|
||||
tags = var.default-tags
|
||||
lifecycle {
|
||||
@ -213,4 +200,29 @@ resource "aws_cloudwatch_metric_alarm" "ec2-disk_inodes_free" {
|
||||
lifecycle {
|
||||
ignore_changes = [tags]
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_cloudwatch_metric_alarm" "ec2-processes_total" {
|
||||
alarm_name = "${var.cw-alarm-prefix}:EC2:processes_total:${var.ec2-instance-id}"
|
||||
comparison_operator = "GreaterThanThreshold"
|
||||
evaluation_periods = "2"
|
||||
metric_name = "processes_total"
|
||||
period = "900"
|
||||
statistic = "Average"
|
||||
threshold = var.threshold-processes_total
|
||||
alarm_description = "EC2:processes_total"
|
||||
namespace = "CWAgent"
|
||||
insufficient_data_actions = []
|
||||
actions_enabled = var.actions-enabled
|
||||
alarm_actions = [var.alarm-actions-urgent]
|
||||
ok_actions = [var.alarm-actions-urgent]
|
||||
dimensions = {
|
||||
InstanceId = var.ec2-instance-id
|
||||
ImageId = data.aws_instance.ec2-instance.ami
|
||||
InstanceType = data.aws_instance.ec2-instance.instance_type
|
||||
}
|
||||
tags = var.default-tags
|
||||
lifecycle {
|
||||
ignore_changes = [tags]
|
||||
}
|
||||
}
|
@ -23,4 +23,5 @@ variable "threshold-CPUUtilization" {}
|
||||
variable "threshold-mem_free" {}
|
||||
variable "threshold-swap_free" {}
|
||||
variable "threshold-disk_free" {}
|
||||
variable "threshold-disk_inodes_free" {}
|
||||
variable "threshold-disk_inodes_free" {}
|
||||
variable "threshold-processes_total" {}
|
Loading…
Reference in New Issue
Block a user