diff --git a/src/prometheus_alert_rules/ssacli.yaml b/src/prometheus_alert_rules/ssacli.yaml index 5f44c85..731aff5 100644 --- a/src/prometheus_alert_rules/ssacli.yaml +++ b/src/prometheus_alert_rules/ssacli.yaml @@ -27,7 +27,7 @@ groups: LABELS = {{ $labels }} - alert: SsaCLIControllerNotOK - expr: ssacli_controller_info{status != "OK", status!="NOT CONFIGURED"} == 1 + expr: ssacli_controller_info{status!~"^(OK|NOT CONFIGURED)$"} == 1 for: 0m labels: severity: critical diff --git a/tests/unit/test_alert_rules/test_ssacli.yaml b/tests/unit/test_alert_rules/test_ssacli.yaml index a54846b..ccbe7ab 100644 --- a/tests/unit/test_alert_rules/test_ssacli.yaml +++ b/tests/unit/test_alert_rules/test_ssacli.yaml @@ -71,6 +71,19 @@ tests: LABELS = map[__name__:ssacli_controller_info instance:ubuntu-2 part:Cache Status status:DOWN] + - interval: 1m + input_series: + - series: 'ssacli_controller_info{instance="ubuntu-2", part="Cache Status", status="NOT CONFIGURED"}' + values: '1x15' + - series: 'ssacli_controller_info{instance="ubuntu-3", part="Cache Status", status="OK"}' + values: '1x15' + alert_rule_test: + - eval_time: 0m + alertname: SsaCLIControllerNotOK + # Expect no alerts when status is NOT CONFIGURED or OK + exp_alerts: [] + + - interval: 1m input_series: - series: 'ssacli_command_success{instance="ubuntu-3"}'