When I tried with , tests: # MySQL Alert Tests - input_series: - series: mysql_up values: 0 - series: mysql_global_variables_innodb_replication_delay values: '1*5 0*15 -1*5'
I get parse error, Unit Testing: tests/infra_db_alerts-tests.yml FAILED: 1:50: parse error: unexpected character in series sequence: '*' On Tuesday, September 19, 2023 at 1:38:12 PM UTC-7 [email protected] wrote: > Thankyou Brian for helping.. > > I am passing multiple values as , values: '1 1 1 1 1 0 0 0 0 -1 -1 -1 -1 > -1 -1' Is this not correct? > > Alert rules file contains, > > > - alert: MySQLReplicationLag > expr: mysql_global_variables_innodb_replication_delay > 0 > for: 5m > labels: > severity: High > alert_owner: alerts-infra > annotations: > description: "There is a MySQL replication delay. \n" > > - alert: MySQLReplicationDown > expr: mysql_global_variables_innodb_replication_delay == -1 > for: 5m > labels: > severity: High > alert_owner: alerts-infra > annotations: > description: "MySQL replication is broken. \n" > > > On Tuesday, September 19, 2023 at 1:00:55 PM UTC-7 Brian Candler wrote: > >> You haven't included your alerting rules file. >> >> I also note you provide only one value for the mysql_up series. You might >> want something like "0x15" there. See: >> >> https://prometheus.io/docs/prometheus/latest/configuration/unit_testing_rules/#series >> >> On Tuesday, 19 September 2023 at 20:49:39 UTC+1 [email protected] >> wrote: >> >>> Hi, >>> I have below prometheus unit test >>> >>> I tried a lot of manipulations on input_series. But it is always >>> throwing failure. >>> It only evaluates the first value in the input series. >>> >>> >>> Unit Testing: tests/infra_db_alerts-tests.yml >>> FAILED: >>> alertname: MySQLReplicationDown, time: 10m, >>> exp:[ >>> 0: >>> Labels:{alert_owner="alerts-infra", >>> alertname="MySQLReplicationDown", severity="High"} >>> Annotations:{description="MySQL replication is broken. \n"} >>> ], >>> got:[] >>> >>> rule_files: >>> - ../rules/db_alerts.yml >>> >>> tests: >>> # MySQL Alert Tests >>> - input_series: >>> - series: mysql_up >>> values: 0 >>> - series: mysql_global_variables_innodb_replication_delay >>> values: '1 1 1 1 1 0 0 0 0 -1 -1 -1 -1 -1 -1' >>> >>> alert_rule_test: >>> - alertname: MySQLReplicationLag >>> eval_time: 5m >>> exp_alerts: >>> - exp_labels: >>> severity: High >>> alert_owner: alerts-infra >>> exp_annotations: >>> description: "There is a MySQL replication delay. \n" >>> >>> - alertname: MySQLReplicationDown >>> eval_time: 10m >>> exp_alerts: >>> - exp_labels: >>> severity: High >>> alert_owner: alerts-infra >>> exp_annotations: >>> description: "MySQL replication is broken. \n" >>> >>> -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/9ca76ca4-3adc-44d7-b258-c92e9732fd86n%40googlegroups.com.

