Skip to content

Instantly share code, notes, and snippets.

@ram-devsecops
Created September 6, 2017 14:23
Show Gist options
  • Save ram-devsecops/c96b70ef9e29d745d5e2b7248955632c to your computer and use it in GitHub Desktop.
Save ram-devsecops/c96b70ef9e29d745d5e2b7248955632c to your computer and use it in GitHub Desktop.
Dimensions and Metrics
  • Auto Scaling
    • GroupMinSize
    • GroupMaxSize
    • GroupDesiredCapitity
    • GroupInServiceInstances
    • GroupPendingInstances
    • GroupStandbyInstances
    • GroupTerminatingInstances
    • GroupTotalInstances
  • CW Logs
    • IncomingLogEvents
    • ForwardedLogEvents
    • DeliveryErrors
    • DeliveryThrottling
  • EBS
    • Volume Read/Write Bytes
    • Volume Read/Write Ops
    • VolumeTotal Read/Write Time
    • VolumeIdleTime
    • VolumeQueueLength
    • VolumeThroughputPercentage
    • VolumeConsumedReadWriteOps
  • EC2
    • CPUUtilization
    • Disk Read/Write Ops
    • Disk Read/Write Bytes
    • Network In/Out
    • StatusCheckFailed
    • StatusCheckFailed_Instance
    • StatusCheckFailed_System
  • ELB
    • BackendConnectionErrors
    • HealthyHostCount
    • UnHealthyHostCount
    • HTTPCode_Backend_4XX
    • HTTPCode_Backend_5XX
    • HTTPCode_ELB_4XX
    • HTTPCode_ELB_5XX
    • Latency
    • RequestCount
    • SpilloverCount
    • SurgeQueueLength
  • Route53
    • ConnectionTime
    • HealthCheckPercentageHealthy
    • HealthCheckStatus
    • HealthCheckStatus
    • SSLHandshakeTime
    • TimeToFirstByte
  • SNS
    • NumberOfMessagesPublished
    • NumberOfNotificationsDelivered
    • NumberOfNotificationsFailed
    • SMSSuccessRate
  • S3
    • BucketSizeBytes
    • NumberOfObjects
# Courtesy of Marshall
# http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/elb-cloudwatch-metrics.html
resource "aws_cloudwatch_metric_alarm" "elb_healthy_host_count" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-healthy-host-count"
comparison_operator = "LessThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "HealthyHostCount"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Sum"
threshold = 3
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_unhealthy_host_count" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-unhealthy-host-count"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "UnHealthyHostCount"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Maximum"
threshold = 0
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_latency_avg" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-latency-avg"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "Latency"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Average"
threshold = 0.01
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_latency_max" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-latency-max"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "Latency"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Maximum"
threshold = 0.02
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_spillover_queue" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-spiilover-queue"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "SpilloverCount"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Sum"
threshold = 1
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_http_code_elb_4xx" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-http-code-elb-4xx"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "HTTPCode_ELB_4XX"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Sum"
threshold = 1
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_http_code_elb_5xx" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-http-code-elb-5xx"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "HTTPCode_ELB_5XX"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Sum"
threshold = 1
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_http_code_backend_3xx" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-http-code-backend-3xx"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "HTTPCode_Backend_3XX"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Sum"
threshold = 1
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_http_code_backend_4xx" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-http-code-backend-4xx"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "HTTPCode_ELB_4XX"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Sum"
threshold = 1
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_http_code_backend_5xx" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-http-code-backend-5xx"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "HTTPCode_ELB_5XX"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Sum"
threshold = 1
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
resource "aws_cloudwatch_metric_alarm" "elb_backend_connection_errors" {
actions_enabled = true
alarm_name = "chamber-of-secrets-dev-backend-connection-errors"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
insufficient_data_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
metric_name = "BackendConnectionErrors"
namespace = "AWS/ELB"
ok_actions = ["${compact(split(",", var.cw_alarm_actions))}"]
period = 300
statistic = "Sum"
threshold = 1
unit = ""
dimensions {
LoadBalancerName = "${aws_elb.consul.name}"
}
lifecycle {
create_before_destroy = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment