Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance MySQLDown alert #2186

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions roles/kube_prometheus_stack/files/jsonnet/mixins.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ local disabledAlerts = [
// * Dropped `CephPGImbalance`
// the balancer module takes care of this
'CephPGImbalance',

// * Dropped `MySQLDown` due to noisy alerts even
// the replication still more than minimum
'MySQLDown',
];

// NOTE(mnaser): This is the default mapping for severities:
Expand Down Expand Up @@ -141,6 +145,36 @@ local mixins = {
severity: 'warning',
},
},
{
alert: 'MysqlClusterDown',
'for': '5m',
expr: 'mysql_up == 0',
labels: { severity: 'info' },
annotations: {
summary: 'Percona XtraDB Cluster replica is down',
description: "{{ $labels.instance }} replica is down.",
},
},
{
alert: 'MysqlClusterDown',
'for': '5m',
expr: 'round(count(mysql_up==1) / count(mysql_up) * 100) <= 50',
labels: { severity: 'warning' },
annotations: {
summary: 'Percona XtraDB Cluster replicas are down',
description: "{{ $value }}% of replicas are online.",
},
},
{
alert: 'MysqlClusterDown',
'for': '1m',
expr: 'count(mysql_up==0) == count(mysql_up)',
labels: { severity: 'critical' },
annotations: {
summary: 'Percona XtraDB Cluster is down',
description: "All replicas are down.",
},
},
],
},
],
Expand Down
83 changes: 83 additions & 0 deletions roles/kube_prometheus_stack/files/jsonnet/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,86 @@ tests:
- eval_time: 5m
alertname: NodeTimeSkewDetected
exp_alerts: []

- interval: 1m
input_series:
- series: 'mysql_up{instance="percona-xtradb-pxc-0", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-1", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-2", job="pxc"}'
values: '1'
alert_rule_test:
- eval_time: 1m
alertname: MysqlClusterDown
exp_alerts: []

- interval: 1m
input_series:
- series: 'mysql_up{instance="percona-xtradb-pxc-0", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-1", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-2", job="pxc"}'
values: '0'
alert_rule_test:
- eval_time: 5m
alertname: MysqlClusterDown
exp_alerts:
- exp_labels:
severity: P5
instance: percona-xtradb-pxc-2
job: pxc
exp_annotations:
summary: Percona XtraDB Cluster replica is down
description: percona-xtradb-pxc-2 replica is down.

- interval: 1m
input_series:
- series: 'mysql_up{instance="percona-xtradb-pxc-0", job="pxc"}'
values: '1'
- series: 'mysql_up{instance="percona-xtradb-pxc-1", job="pxc"}'
values: '0'
- series: 'mysql_up{instance="percona-xtradb-pxc-2", job="pxc"}'
values: '0'
alert_rule_test:
- eval_time: 5m
alertname: MysqlClusterDown
exp_alerts:
- exp_labels:
severity: P3
exp_annotations:
summary: Percona XtraDB Cluster replicas are down
description: 33% of replicas are online.
- exp_labels:
severity: P5
instance: percona-xtradb-pxc-1
job: pxc
exp_annotations:
summary: Percona XtraDB Cluster replica is down
description: percona-xtradb-pxc-1 replica is down.
- exp_labels:
severity: P5
instance: percona-xtradb-pxc-2
job: pxc
exp_annotations:
summary: Percona XtraDB Cluster replica is down
description: percona-xtradb-pxc-2 replica is down.

- interval: 1m
input_series:
- series: 'mysql_up{instance="percona-xtradb-pxc-0", job="pxc"}'
values: '0'
- series: 'mysql_up{instance="percona-xtradb-pxc-1", job="pxc"}'
values: '0'
- series: 'mysql_up{instance="percona-xtradb-pxc-3", job="pxc"}'
values: '0'
alert_rule_test:
- eval_time: 1m
alertname: MysqlClusterDown
exp_alerts:
- exp_labels:
severity: P1
exp_annotations:
summary: Percona XtraDB Cluster is down
description: All replicas are down.
Loading