Add alerts to apache mixin

This commit is contained in:
Vitaly Zhuravlev 2022-05-11 15:11:45 +04:00
parent 7de51eeedd
commit 321e3f3df4
3 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1,52 @@
{
prometheusAlerts+:: {
groups+: [
{
name: 'apache-http-alerts',
rules: [
{
alert: 'ApacheDown',
expr: 'apache_up == 0',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Apache is down.',
description: 'Apache is down on {{ $labels.instance }}.',
},
'for': '5m',
},
{
alert: 'ApacheRestart',
expr: 'apache_uptime_seconds_total / 60 < 1',
labels: {
severity: 'info',
},
annotations: {
summary: 'Apache restart.',
description: 'Apache has just been restarted.',
},
'for': '0',
},
{
alert: 'ApacheWorkersLoad',
expr: |||
(sum by (instance) (apache_workers{state="busy"}) / sum by (instance) (apache_scoreboard) ) * 100 > %(alertsWarningWorkersBusy)s
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Apache workers load is too high.',
description: |||
Apache workers in busy state approach the max workers count %(alertsWarningWorkersBusy)s%% workers busy on {{ $labels.instance }}.
The currect value is {{ $value }}%%.
||| % $._config,
},
},
],
},
],
},
}

View file

@ -4,5 +4,8 @@
dashboardPeriod: 'now-1h',
dashboardTimezone: 'default',
dashboardRefresh: '1m',
// for alerts
alertsWarningWorkersBusy: '80', // %
},
}

View file

@ -1,3 +1,3 @@
(import 'dashboards/apache-exporter-full.libsonnet') +
// (import 'alerts/alerts.libsonnet') +
(import 'alerts/alerts.libsonnet') +
(import 'config.libsonnet')