Enable intance plugins
This commit is contained in:
167
alarms.tf
Executable file
167
alarms.tf
Executable file
@@ -0,0 +1,167 @@
|
||||
resource "oci_monitoring_alarm" "cpu_consumption_compute_alarm" {
|
||||
compartment_id = var.ocid_compartment_app
|
||||
metric_compartment_id = var.ocid_compartment_app
|
||||
destinations = [var.topic_apps]
|
||||
display_name = "servers-cpu-consumption-${var.environment}"
|
||||
namespace = "oci_computeagent"
|
||||
query = "CpuUtilization[1m].mean() > 75"
|
||||
severity = "CRITICAL"
|
||||
is_enabled = true
|
||||
|
||||
alarm_summary = "Compute CPU utilization is above 75%."
|
||||
notification_title = "SEI Compute CPU Alert"
|
||||
body = "CPU utilization for instance {{dimensions.resourceDisplayName}} exceeded 75% for five minutes. Current metric value: {{metricValues}}."
|
||||
|
||||
is_notifications_per_metric_dimension_enabled = true
|
||||
message_format = "ONS_OPTIMIZED"
|
||||
metric_compartment_id_in_subtree = true
|
||||
notification_version = "1.X"
|
||||
pending_duration = "PT5M"
|
||||
repeat_notification_duration = "PT1H"
|
||||
resolution = "1m"
|
||||
rule_name = "high-cpu-consumption-alarm"
|
||||
}
|
||||
|
||||
resource "oci_monitoring_alarm" "memory_consumption_compute_alarm" {
|
||||
compartment_id = var.ocid_compartment_app
|
||||
metric_compartment_id = var.ocid_compartment_app
|
||||
destinations = [var.topic_apps]
|
||||
display_name = "servers-memory-consumption-${var.environment}"
|
||||
namespace = "oci_computeagent"
|
||||
query = "MemoryUtilization[1m].mean() > 80"
|
||||
severity = "CRITICAL"
|
||||
is_enabled = true
|
||||
|
||||
alarm_summary = "Compute memory utilization is above 80%."
|
||||
notification_title = "SEI Compute Memory Alert"
|
||||
body = "Memory utilization for instance {{dimensions.resourceDisplayName}} exceeded 80% for five minutes. Current metric value: {{metricValues}}."
|
||||
|
||||
is_notifications_per_metric_dimension_enabled = true
|
||||
message_format = "ONS_OPTIMIZED"
|
||||
metric_compartment_id_in_subtree = true
|
||||
notification_version = "1.X"
|
||||
pending_duration = "PT5M"
|
||||
repeat_notification_duration = "PT1H"
|
||||
resolution = "1m"
|
||||
rule_name = "high-memory-consumption-alarm"
|
||||
}
|
||||
|
||||
resource "oci_monitoring_alarm" "instance_health_alarm" {
|
||||
compartment_id = var.ocid_compartment_app
|
||||
metric_compartment_id = var.ocid_compartment_app
|
||||
destinations = [var.topic_apps]
|
||||
display_name = "servers-instances-status-${var.environment}"
|
||||
namespace = "oci_compute_infrastructure_health"
|
||||
query = "instance_status[1m].count() == 1"
|
||||
severity = "CRITICAL"
|
||||
is_enabled = true
|
||||
|
||||
alarm_summary = "A Compute instance is degraded."
|
||||
notification_title = "SEI Compute Instance Degraded"
|
||||
body = "SEI Apps instance {{dimensions.resourceDisplayName}} is degraded. Current metric value: {{metricValues}}."
|
||||
|
||||
is_notifications_per_metric_dimension_enabled = true
|
||||
message_format = "ONS_OPTIMIZED"
|
||||
metric_compartment_id_in_subtree = true
|
||||
notification_version = "1.X"
|
||||
pending_duration = "PT5M"
|
||||
repeat_notification_duration = "PT1H"
|
||||
resolution = "1m"
|
||||
rule_name = "instance-health-alarm"
|
||||
}
|
||||
|
||||
resource "oci_monitoring_alarm" "maintenance_instance_alarm" {
|
||||
compartment_id = var.ocid_compartment_app
|
||||
metric_compartment_id = var.ocid_compartment_app
|
||||
destinations = [var.topic_apps]
|
||||
display_name = "servers-maintenance-status-${var.environment}"
|
||||
namespace = "oci_compute_infrastructure_health"
|
||||
query = "maintenance_status[1m].count() == 1"
|
||||
severity = "CRITICAL"
|
||||
is_enabled = true
|
||||
|
||||
alarm_summary = "OCI scheduled maintenance is detected for a Compute instance."
|
||||
notification_title = "SEI Compute Maintenance Alert"
|
||||
body = "SEI Apps instance {{dimensions.resourceDisplayName}} will undergo scheduled maintenance by OCI. Current metric value: {{metricValues}}."
|
||||
|
||||
is_notifications_per_metric_dimension_enabled = true
|
||||
message_format = "ONS_OPTIMIZED"
|
||||
metric_compartment_id_in_subtree = true
|
||||
notification_version = "1.X"
|
||||
pending_duration = "PT5M"
|
||||
repeat_notification_duration = "PT1H"
|
||||
resolution = "1m"
|
||||
rule_name = "instance-maintenance"
|
||||
}
|
||||
|
||||
resource "oci_monitoring_alarm" "mysql_cpu_consumption" {
|
||||
compartment_id = var.ocid_compartment_database
|
||||
metric_compartment_id = var.ocid_compartment_database
|
||||
destinations = [var.topic_database]
|
||||
display_name = "mysql-consumption-cpu-${var.environment}"
|
||||
namespace = "oci_mysql_database"
|
||||
query = "CPUUtilization[1m].mean() > 75"
|
||||
severity = "CRITICAL"
|
||||
is_enabled = true
|
||||
|
||||
alarm_summary = "MySQL CPU utilization is above 75%."
|
||||
notification_title = "SEI MySQL CPU Alert"
|
||||
body = "MySQL instance {{dimensions.resourceDisplayName}} CPU utilization exceeded 75% for five minutes. Current metric value: {{metricValues}}."
|
||||
|
||||
is_notifications_per_metric_dimension_enabled = true
|
||||
message_format = "ONS_OPTIMIZED"
|
||||
metric_compartment_id_in_subtree = true
|
||||
notification_version = "1.X"
|
||||
pending_duration = "PT5M"
|
||||
repeat_notification_duration = "PT30M"
|
||||
resolution = "1m"
|
||||
rule_name = "mysql-cpu-consumption"
|
||||
}
|
||||
|
||||
resource "oci_monitoring_alarm" "mysql_memory_consumption" {
|
||||
compartment_id = var.ocid_compartment_database
|
||||
metric_compartment_id = var.ocid_compartment_database
|
||||
destinations = [var.topic_database]
|
||||
display_name = "mysql-consumption-memory-${var.environment}"
|
||||
namespace = "oci_mysql_database"
|
||||
query = "MemoryUtilization[1m].mean() > 75"
|
||||
severity = "CRITICAL"
|
||||
is_enabled = true
|
||||
|
||||
alarm_summary = "MySQL memory utilization is above 75%."
|
||||
notification_title = "SEI MySQL Memory Alert"
|
||||
body = "MySQL instance {{dimensions.resourceDisplayName}} memory utilization exceeded 75% for five minutes. Current metric value: {{metricValues}}."
|
||||
|
||||
is_notifications_per_metric_dimension_enabled = true
|
||||
message_format = "ONS_OPTIMIZED"
|
||||
metric_compartment_id_in_subtree = true
|
||||
notification_version = "1.X"
|
||||
pending_duration = "PT5M"
|
||||
repeat_notification_duration = "PT30M"
|
||||
resolution = "1m"
|
||||
rule_name = "mysql-memory-consumption"
|
||||
}
|
||||
|
||||
resource "oci_monitoring_alarm" "mysql_backup_fail" {
|
||||
compartment_id = var.ocid_compartment_database
|
||||
metric_compartment_id = var.ocid_compartment_database
|
||||
destinations = [var.topic_database]
|
||||
display_name = "mysql-backup-fail-${var.environment}"
|
||||
namespace = "oci_mysql_database"
|
||||
query = "BackupFailure[1m].mean() == 1"
|
||||
severity = "CRITICAL"
|
||||
is_enabled = true
|
||||
|
||||
alarm_summary = "A MySQL automatic backup failed."
|
||||
notification_title = "SEI MySQL Backup Failed"
|
||||
body = "The automatic backup scheduled for MySQL instance {{dimensions.resourceDisplayName}} failed. Current metric value: {{metricValues}}."
|
||||
|
||||
is_notifications_per_metric_dimension_enabled = true
|
||||
message_format = "ONS_OPTIMIZED"
|
||||
metric_compartment_id_in_subtree = true
|
||||
notification_version = "1.X"
|
||||
pending_duration = "PT5M"
|
||||
repeat_notification_duration = "PT30M"
|
||||
resolution = "1m"
|
||||
rule_name = "backup-mysql-fail"
|
||||
}
|
||||
Reference in New Issue
Block a user