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
|
actions_enabled = var.actions-enabled
|
||||||
alarm_actions = [var.alarm-actions-standard]
|
alarm_actions = [var.alarm-actions-standard]
|
||||||
ok_actions = [var.alarm-actions-standard]
|
ok_actions = [var.alarm-actions-standard]
|
||||||
treat_missing_data = "notBreaching"
|
|
||||||
dimensions = {
|
dimensions = {
|
||||||
InstanceId = var.ec2-instance-id
|
InstanceId = var.ec2-instance-id
|
||||||
ImageId = data.aws_instance.ec2-instance.ami
|
ImageId = data.aws_instance.ec2-instance.ami
|
||||||
@ -104,17 +103,12 @@ resource "aws_cloudwatch_metric_alarm" "ec2-swap_free" {
|
|||||||
alarm_name = "${var.cw-alarm-prefix}:EC2:swap_free:${var.ec2-instance-id}"
|
alarm_name = "${var.cw-alarm-prefix}:EC2:swap_free:${var.ec2-instance-id}"
|
||||||
comparison_operator = "LessThanThreshold"
|
comparison_operator = "LessThanThreshold"
|
||||||
evaluation_periods = "2"
|
evaluation_periods = "2"
|
||||||
# metric_name = "swap_free"
|
|
||||||
# period = "900"
|
|
||||||
# statistic = "Average"
|
|
||||||
threshold = var.threshold-swap_free
|
threshold = var.threshold-swap_free
|
||||||
alarm_description = "EC2:swap_free"
|
alarm_description = "EC2:swap_free"
|
||||||
# namespace = "CWAgent"
|
|
||||||
insufficient_data_actions = []
|
insufficient_data_actions = []
|
||||||
actions_enabled = var.actions-enabled
|
actions_enabled = var.actions-enabled
|
||||||
alarm_actions = [var.alarm-actions-standard]
|
alarm_actions = [var.alarm-actions-standard]
|
||||||
ok_actions = [var.alarm-actions-standard]
|
ok_actions = [var.alarm-actions-standard]
|
||||||
treat_missing_data = "notBreaching"
|
|
||||||
metric_query {
|
metric_query {
|
||||||
id = "m1"
|
id = "m1"
|
||||||
metric {
|
metric {
|
||||||
@ -136,11 +130,6 @@ resource "aws_cloudwatch_metric_alarm" "ec2-swap_free" {
|
|||||||
return_data = "true"
|
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
|
tags = var.default-tags
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [tags]
|
ignore_changes = [tags]
|
||||||
@ -174,8 +163,6 @@ resource "aws_cloudwatch_metric_alarm" "ec2-disk_free" {
|
|||||||
InstanceId = var.ec2-instance-id
|
InstanceId = var.ec2-instance-id
|
||||||
ImageId = data.aws_instance.ec2-instance.ami
|
ImageId = data.aws_instance.ec2-instance.ami
|
||||||
InstanceType = data.aws_instance.ec2-instance.instance_type
|
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
|
device = data.external.disk-device.result.device
|
||||||
fstype = data.external.disk-device.result.fstype
|
fstype = data.external.disk-device.result.fstype
|
||||||
path = "/"
|
path = "/"
|
||||||
@ -214,3 +201,28 @@ resource "aws_cloudwatch_metric_alarm" "ec2-disk_inodes_free" {
|
|||||||
ignore_changes = [tags]
|
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]
|
||||||
|
}
|
||||||
|
}
|
@ -24,3 +24,4 @@ variable "threshold-mem_free" {}
|
|||||||
variable "threshold-swap_free" {}
|
variable "threshold-swap_free" {}
|
||||||
variable "threshold-disk_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