UPD: removed checks specified by customer, add checks from default CW agent config
This commit is contained in:
parent
a2800fafd3
commit
597aa0736f
@ -83,6 +83,7 @@ data "external" "ec2-os" {
|
||||
|
||||
# Linux specific checks
|
||||
# default cw agent uses mem_used_percent metric
|
||||
/*
|
||||
resource "aws_cloudwatch_metric_alarm" "ec2-mem_free" {
|
||||
count = data.external.ec2-os.result.os == "Linux" ? 1 : 0
|
||||
alarm_name = "${var.cw-alarm-prefix}:EC2:mem_free:${var.ec2-instance-id}"
|
||||
@ -108,6 +109,7 @@ resource "aws_cloudwatch_metric_alarm" "ec2-mem_free" {
|
||||
ignore_changes = [tags]
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
resource "aws_cloudwatch_metric_alarm" "ec2-mem_used_percent" {
|
||||
count = data.external.ec2-os.result.os == "Linux" ? 1 : 0
|
||||
@ -136,6 +138,7 @@ resource "aws_cloudwatch_metric_alarm" "ec2-mem_used_percent" {
|
||||
}
|
||||
|
||||
# default cw agent uses swap_used_percent metric
|
||||
/*
|
||||
resource "aws_cloudwatch_metric_alarm" "ec2-swap_free" {
|
||||
count = data.external.ec2-os.result.os == "Linux" ? 1 : 0
|
||||
# zero is fine as most ec2 instances are deployed without any swap
|
||||
@ -174,6 +177,7 @@ resource "aws_cloudwatch_metric_alarm" "ec2-swap_free" {
|
||||
ignore_changes = [tags]
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
data "external" "cw-dimensions" {
|
||||
program = ["bash", "${path.module}/get-cwagent-dimensions.sh"]
|
||||
@ -196,8 +200,8 @@ resource "aws_cloudwatch_metric_alarm" "ec2-swap_used_percent" {
|
||||
namespace = "CWAgent"
|
||||
insufficient_data_actions = []
|
||||
actions_enabled = var.actions-enabled
|
||||
alarm_actions = [var.sns-targets.alarm-actions-standard]
|
||||
ok_actions = [var.sns-targets.alarm-actions-standard]
|
||||
alarm_actions = [var.sns-targets.alarm-actions-urgent]
|
||||
ok_actions = [var.sns-targets.alarm-actions-urgent]
|
||||
dimensions = {
|
||||
InstanceId = var.ec2-instance-id
|
||||
ImageId = data.aws_instance.ec2-instance.ami
|
||||
@ -210,6 +214,7 @@ resource "aws_cloudwatch_metric_alarm" "ec2-swap_used_percent" {
|
||||
}
|
||||
|
||||
# default cw agent uses disk_used_percent metric
|
||||
/*
|
||||
resource "aws_cloudwatch_metric_alarm" "ec2-disk_free" {
|
||||
count = data.external.ec2-os.result.os == "Linux" && length(data.external.cw-dimensions.result) > 0 ? 1 : 0
|
||||
alarm_name = "${var.cw-alarm-prefix}:EC2:disk_free:${var.ec2-instance-id}"
|
||||
@ -232,6 +237,7 @@ resource "aws_cloudwatch_metric_alarm" "ec2-disk_free" {
|
||||
ignore_changes = [tags]
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
resource "aws_cloudwatch_metric_alarm" "ec2-disk_used_percent" {
|
||||
count = data.external.ec2-os.result.os == "Linux" && length(data.external.cw-dimensions.result) > 0 ? 1 : 0
|
||||
|
@ -6,11 +6,11 @@ variable sns-targets {}
|
||||
variable "default-tags" {}
|
||||
|
||||
variable "threshold-CPUUtilization" {}
|
||||
variable "threshold-mem_free" {}
|
||||
# variable "threshold-mem_free" {}
|
||||
variable "threshold-mem_used_percent" {}
|
||||
variable "threshold-swap_free" {}
|
||||
# variable "threshold-swap_free" {}
|
||||
variable "threshold-swap_used_percent" {}
|
||||
variable "threshold-disk_free" {}
|
||||
# variable "threshold-disk_free" {}
|
||||
variable "threshold-disk_used_percentage" {}
|
||||
variable "threshold-disk_inodes_free" {}
|
||||
variable "threshold-processes_total" {}
|
||||
|
Loading…
Reference in New Issue
Block a user