From 2ee33004c1fefb2509a37dcf5b1cd3db59b7a17e Mon Sep 17 00:00:00 2001 From: jneo8 Date: Thu, 23 Nov 2023 17:55:54 +0800 Subject: [PATCH] fix(alert): Add alert IPMIDCMIPowerConsumptionPercentageOutstanding Change alert IPMIDCMIPowerConsumptionOutstanding to IPMIDCMIPowerConsumptionPercentageOutstanding --- src/prometheus_alert_rules/ipmi_dcmi.yaml | 10 +++++----- .../unit/test_alert_rules/test_ipmi_dcmi.yaml | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/prometheus_alert_rules/ipmi_dcmi.yaml b/src/prometheus_alert_rules/ipmi_dcmi.yaml index d9059975..94b12676 100644 --- a/src/prometheus_alert_rules/ipmi_dcmi.yaml +++ b/src/prometheus_alert_rules/ipmi_dcmi.yaml @@ -14,14 +14,14 @@ groups: VALUE = {{ $value }} LABELS = {{ $labels }} - - alert: IPMIDCMIPowerConsumptionOutstanding - expr: ipmi_dcmi_power_cosumption_watts >= 200 + - alert: IPMIDCMIPowerConsumptionPercentageOutstanding + expr: ipmi_dcmi_power_consumption_percentage >= 0.8 for: 5m labels: severity: warning annotations: - summary: IPMI DCMI power consumption is high. (instance {{ $labels.instance }}) + summary: IPMI DCMI power consumption percentage is high. (instance {{ $labels.instance }}) description: | - IPMI DCMI power consumption is high for over 5 minutes. - POWER_CONSUMPTiON_WATTS = {{ $value }} + IPMI DCMI power consumption percentage is high for over 5 minutes. + POWER_CONSUMPTION_PERCENTAGE = {{ $value }} LABELS = {{ $labels }} diff --git a/tests/unit/test_alert_rules/test_ipmi_dcmi.yaml b/tests/unit/test_alert_rules/test_ipmi_dcmi.yaml index a7cf356c..aefdbd80 100644 --- a/tests/unit/test_alert_rules/test_ipmi_dcmi.yaml +++ b/tests/unit/test_alert_rules/test_ipmi_dcmi.yaml @@ -14,10 +14,10 @@ tests: - series: ipmi_dcmi_power_cosumption_watts{instance="ubuntu-1"} values: '102x15' - - series: ipmi_dcmi_command_success{instance="ubuntu-2"} - values: '1x15' - - series: ipmi_dcmi_power_cosumption_watts{instance="ubuntu-2"} - values: '220x15' + - series: ipmi_dcmi_power_consumption_percentage{instance="ubuntu-2"} + values: '0.85x15' + - series: ipmi_dcmi_power_consumption_percentage{instance="ubuntu-3"} + values: '0.75x15' alert_rule_test: - eval_time: 0m @@ -34,14 +34,14 @@ tests: LABELS = map[__name__:ipmi_dcmi_command_success instance:ubuntu-0] - eval_time: 10m - alertname: IPMIDCMIPowerConsumptionOutstanding + alertname: IPMIDCMIPowerConsumptionPercentageOutstanding exp_alerts: - exp_labels: severity: warning instance: ubuntu-2 exp_annotations: - summary: IPMI DCMI power consumption is high. (instance ubuntu-2) + summary: IPMI DCMI power consumption percentage is high. (instance ubuntu-2) description: | - IPMI DCMI power consumption is high for over 5 minutes. - POWER_CONSUMPTiON_WATTS = 220 - LABELS = map[__name__:ipmi_dcmi_power_cosumption_watts instance:ubuntu-2] + IPMI DCMI power consumption percentage is high for over 5 minutes. + POWER_CONSUMPTION_PERCENTAGE = 0.85 + LABELS = map[__name__:ipmi_dcmi_power_consumption_percentage instance:ubuntu-2]