Closed deem1978 closed 2 months ago
I noticed something strange, if I change the condition block in order to apply the average filter:
locals {
module_resource_tags = {
environment = replace(basename(abspath(path.root)), "_", "-")
owner = "aa",
terraform = "true"
}
resource_tags = local.module_resource_tags
}
resource "opentelekomcloud_ces_alarmrule" "high_cpu_usage_test" {
alarm_name = "${var.instance_name}_high_cpu_usage"
alarm_level = var.alarm_level
alarm_enabled = var.alarm_enabled
alarm_action_enabled = var.alarm_action_enabled
metric {
namespace = var.metric_namespace
metric_name = var.metric_name
dimensions {
name = var.dimension_name
value = "${var.instance_id}"
}
}
condition {
period = 1
filter = "average"
comparison_operator = ">"
value = var.high_cpu_usage_threshold
unit = "%"
count = 5
alarm_frequency = 300
}
alarm_actions {
type = "notification"
notification_list = [opentelekomcloud_smn_topic_v2.alerts.id]
}
ok_actions {
type = "notification"
notification_list = [opentelekomcloud_smn_topic_v2.alerts.id]
}
}
# alerting channel
resource "opentelekomcloud_smn_topic_v2" "alerts" {
name = "${var.instance_name}_alerts"
display_name = "Alerting topic for Team A&A RDS ${var.instance_name}"
tags = local.resource_tags
}
resource "opentelekomcloud_smn_subscription_v2" "alerts" {
topic_urn = opentelekomcloud_smn_topic_v2.alerts.id
endpoint = var.alerts_endpoint_email
protocol = "email"
}
than the metric name is completely absent, and instead of "avarage" it display "raw data":
Hi @deem1978, i will create bug in internal jira, sorry but ces api is really raw, some parts described in doc not works at all. i can't help at this time. Probably v2.0 will released soon, with necessary fixes.
Internal issue: https://jira.tsi-dev.otc-service.com/browse/BM-5382
Hi @anton-sidelnikov and thank you for reply, but do you see some configuration/definition or design error in my config? I mean if not, then ok I agree with you, the CES is really buggy, but it should be not (IMHO) released as "usable" resource if it is impossible to use it...
I just found out today that the problem was the dimension name: by setting it to
dimension_name = "rds_cluster_id"
everything works as it should.
I find it out because I have imported the manually created alert in my state, then running
terraform plan
showed me that this parameter was different, in my state was "rds_instance_id" but on the real alarm on the infrastructure was ""rds_cluster_id". So I changed the value to all my alarms and everything started to work.
As far as I have seen, this value is nowhere reported in the documentation.
Hi @deem1978 , hm, great, thanks for investigation. I hope qa guys will fix docu soon.
I didn't find errors in your configurations looks good.
Hello, I really hope that someone can help me and tell me what I do wrong because I really do not understand. This is my file structure:
So I have the module terraform-otc-rds who deploy RDS instances, here are defined some general parameter. At the same directory level I have the module cloud-eye where I define some general parameter for alerting too. Than I have a subdirectory projects: here I define a subdirectory environments (dev, stage, prod) where I define environment specific values for RDS and Cloud Eye and at the same directory level as the projects one I have another subdirectory modules where I define project specific values for RDS and Cloud-Eye.
This is modules/cloud-eye/main.tf:
modules/cloud-eye/variables.tf:
projects/ems_core/modules/cloud_eye/main.tf:
projects/ems_core/modules/cloud_eye/variables.tf:
projects/ems_core/environments/dev/main.tf:
The alert, the topic and the subscription are created but no alarm trigger. I have created manually an alarm (that trigger) with the same values and there is some difference as far as I can see. alarm with terraform: the ID is correct but no instance name and ip are there: Under "Monitored Object => Add Object" there is no istance:
Same alert created manually (that one works):
Could someone be so kind to have a look into my issue and explain me where I am wrong? Thanks in advance, David