2018-05-09 17:02:33 +00:00
{
prometheusAlerts+:: {
groups+: [
{
name: 'prometheus',
rules: [
{
2018-11-19 11:22:55 +00:00
alert: 'PrometheusBadConfig',
2018-05-09 17:02:33 +00:00
expr: |||
2019-06-28 14:46:19 +00:00
# Without max_over_time, failed scrapes could create false negatives, see
# https://www.robustperception.io/alerting-on-gauges-in-prometheus-2-0 for details.
max_over_time(prometheus_config_last_reload_successful{%(prometheusSelector)s}[5m]) == 0
2018-05-09 17:02:33 +00:00
||| % $._config,
2019-06-28 14:46:19 +00:00
'for': '10m',
2018-05-09 17:02:33 +00:00
labels: {
severity: 'critical',
},
annotations: {
2019-06-27 21:50:26 +00:00
summary: 'Failed Prometheus configuration reload.',
description: 'Prometheus %(prometheusName)s has failed to reload its configuration.' % $._config,
2018-05-09 17:02:33 +00:00
},
},
2023-06-07 12:28:13 +00:00
{
alert: 'PrometheusSDRefreshFailure',
expr: |||
increase(prometheus_sd_refresh_failures_total{%(prometheusSelector)s}[10m]) > 0
||| % $._config,
'for': '20m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Failed Prometheus SD refresh.',
description: 'Prometheus %(prometheusName)s has failed to refresh SD with mechanism {{$labels.mechanism}}.' % $._config,
},
},
2024-06-18 11:38:20 +00:00
{
alert: 'PrometheusKubernetesListWatchFailures',
expr: |||
increase(prometheus_sd_kubernetes_failures_total{%(prometheusSelector)s}[5m]) > 0
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Requests in Kubernetes SD are failing.',
description: 'Kubernetes service discovery of Prometheus %(prometheusName)s is experiencing {{ printf "%%.0f" $value }} failures with LIST/WATCH requests to the Kubernetes API in the last 5 minutes.' % $._config,
},
},
2018-05-09 17:02:33 +00:00
{
2018-11-19 11:22:55 +00:00
alert: 'PrometheusNotificationQueueRunningFull',
2018-05-09 17:02:33 +00:00
expr: |||
2019-06-28 14:46:19 +00:00
# Without min_over_time, failed scrapes could create false negatives, see
# https://www.robustperception.io/alerting-on-gauges-in-prometheus-2-0 for details.
2019-06-26 18:31:05 +00:00
(
predict_linear(prometheus_notifications_queue_length{%(prometheusSelector)s}[5m], 60 * 30)
2018-11-19 11:22:55 +00:00
>
2019-06-28 14:46:19 +00:00
min_over_time(prometheus_notifications_queue_capacity{%(prometheusSelector)s}[5m])
2019-06-26 18:31:05 +00:00
)
2018-05-09 17:02:33 +00:00
||| % $._config,
2018-11-19 11:22:55 +00:00
'for': '15m',
2018-05-09 17:02:33 +00:00
labels: {
2018-11-19 11:22:55 +00:00
severity: 'warning',
},
annotations: {
2019-06-27 21:50:26 +00:00
summary: 'Prometheus alert notification queue predicted to run full in less than 30m.',
description: 'Alert notification queue of Prometheus %(prometheusName)s is running full.' % $._config,
2018-11-19 11:22:55 +00:00
},
},
{
2019-06-27 21:50:26 +00:00
alert: 'PrometheusErrorSendingAlertsToSomeAlertmanagers',
2018-11-19 11:22:55 +00:00
expr: |||
2019-06-26 18:31:05 +00:00
(
rate(prometheus_notifications_errors_total{%(prometheusSelector)s}[5m])
2018-11-19 11:22:55 +00:00
/
2019-06-27 21:50:26 +00:00
rate(prometheus_notifications_sent_total{%(prometheusSelector)s}[5m])
2019-06-26 18:31:05 +00:00
)
* 100
2019-06-27 21:50:26 +00:00
> 1
2018-11-19 11:22:55 +00:00
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
2018-05-09 17:02:33 +00:00
},
annotations: {
2024-11-20 11:58:03 +00:00
summary: 'More than 1% of alerts sent by Prometheus to a specific Alertmanager were affected by errors.',
description: '{{ printf "%%.1f" $value }}%% of alerts sent by Prometheus %(prometheusName)s to Alertmanager {{$labels.alertmanager}} were affected by errors.' % $._config,
2018-05-09 17:02:33 +00:00
},
},
2018-11-19 11:22:55 +00:00
{
alert: 'PrometheusNotConnectedToAlertmanagers',
expr: |||
2019-06-28 14:46:19 +00:00
# Without max_over_time, failed scrapes could create false negatives, see
# https://www.robustperception.io/alerting-on-gauges-in-prometheus-2-0 for details.
max_over_time(prometheus_notifications_alertmanagers_discovered{%(prometheusSelector)s}[5m]) < 1
2018-11-19 11:22:55 +00:00
||| % $._config,
'for': '10m',
labels: {
severity: 'warning',
},
annotations: {
2019-06-27 21:50:26 +00:00
summary: 'Prometheus is not connected to any Alertmanagers.',
description: 'Prometheus %(prometheusName)s is not connected to any Alertmanagers.' % $._config,
2018-11-19 11:22:55 +00:00
},
},
{
alert: 'PrometheusTSDBReloadsFailing',
expr: |||
2019-06-26 21:22:16 +00:00
increase(prometheus_tsdb_reloads_failures_total{%(prometheusSelector)s}[3h]) > 0
2018-11-19 11:22:55 +00:00
||| % $._config,
2019-06-26 21:22:16 +00:00
'for': '4h',
2018-11-19 11:22:55 +00:00
labels: {
severity: 'warning',
},
annotations: {
2019-06-27 21:50:26 +00:00
summary: 'Prometheus has issues reloading blocks from disk.',
description: 'Prometheus %(prometheusName)s has detected {{$value | humanize}} reload failures over the last 3h.' % $._config,
2018-11-19 11:22:55 +00:00
},
},
{
alert: 'PrometheusTSDBCompactionsFailing',
expr: |||
2019-06-26 21:22:16 +00:00
increase(prometheus_tsdb_compactions_failed_total{%(prometheusSelector)s}[3h]) > 0
2018-11-19 11:22:55 +00:00
||| % $._config,
2019-06-26 21:22:16 +00:00
'for': '4h',
2018-11-19 11:22:55 +00:00
labels: {
severity: 'warning',
},
annotations: {
2019-06-27 21:50:26 +00:00
summary: 'Prometheus has issues compacting blocks.',
description: 'Prometheus %(prometheusName)s has detected {{$value | humanize}} compaction failures over the last 3h.' % $._config,
2018-11-19 11:22:55 +00:00
},
},
{
alert: 'PrometheusNotIngestingSamples',
expr: |||
2020-08-24 14:48:06 +00:00
(
2024-01-31 14:02:49 +00:00
sum without(type) (rate(prometheus_tsdb_head_samples_appended_total{%(prometheusSelector)s}[5m])) <= 0
2020-08-24 14:48:06 +00:00
and
(
sum without(scrape_job) (prometheus_target_metadata_cache_entries{%(prometheusSelector)s}) > 0
or
sum without(rule_group) (prometheus_rule_group_rules{%(prometheusSelector)s}) > 0
)
)
2018-11-19 11:22:55 +00:00
||| % $._config,
'for': '10m',
labels: {
severity: 'warning',
},
2018-11-19 12:23:42 +00:00
annotations: {
2019-06-27 21:50:26 +00:00
summary: 'Prometheus is not ingesting samples.',
description: 'Prometheus %(prometheusName)s is not ingesting samples.' % $._config,
2018-11-19 11:22:55 +00:00
},
},
{
2019-06-27 21:50:26 +00:00
alert: 'PrometheusDuplicateTimestamps',
2018-11-19 11:22:55 +00:00
expr: |||
2019-06-27 21:50:26 +00:00
rate(prometheus_target_scrapes_sample_duplicate_timestamp_total{%(prometheusSelector)s}[5m]) > 0
2018-11-19 11:22:55 +00:00
||| % $._config,
'for': '10m',
labels: {
severity: 'warning',
},
annotations: {
2019-06-28 15:37:49 +00:00
summary: 'Prometheus is dropping samples with duplicate timestamps.',
2019-09-24 15:44:27 +00:00
description: 'Prometheus %(prometheusName)s is dropping {{ printf "%%.4g" $value }} samples/s with different values but duplicated timestamp.' % $._config,
2019-06-27 21:50:26 +00:00
},
},
{
alert: 'PrometheusOutOfOrderTimestamps',
expr: |||
rate(prometheus_target_scrapes_sample_out_of_order_total{%(prometheusSelector)s}[5m]) > 0
||| % $._config,
'for': '10m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Prometheus drops samples with out-of-order timestamps.',
2019-09-24 15:44:27 +00:00
description: 'Prometheus %(prometheusName)s is dropping {{ printf "%%.4g" $value }} samples/s with timestamps arriving out of order.' % $._config,
2018-05-09 17:02:33 +00:00
},
},
{
2018-11-19 11:22:55 +00:00
alert: 'PrometheusRemoteStorageFailures',
2018-05-09 17:02:33 +00:00
expr: |||
2019-06-26 18:31:05 +00:00
(
2021-01-31 20:07:49 +00:00
(rate(prometheus_remote_storage_failed_samples_total{%(prometheusSelector)s}[5m]) or rate(prometheus_remote_storage_samples_failed_total{%(prometheusSelector)s}[5m]))
2019-06-26 18:31:05 +00:00
/
(
2021-01-31 20:07:49 +00:00
(rate(prometheus_remote_storage_failed_samples_total{%(prometheusSelector)s}[5m]) or rate(prometheus_remote_storage_samples_failed_total{%(prometheusSelector)s}[5m]))
2019-06-26 18:31:05 +00:00
+
2021-01-31 20:07:49 +00:00
(rate(prometheus_remote_storage_succeeded_samples_total{%(prometheusSelector)s}[5m]) or rate(prometheus_remote_storage_samples_total{%(prometheusSelector)s}[5m]))
2019-06-26 18:31:05 +00:00
)
)
* 100
> 1
2018-05-09 17:02:33 +00:00
||| % $._config,
'for': '15m',
labels: {
severity: 'critical',
},
annotations: {
2019-06-27 21:50:26 +00:00
summary: 'Prometheus fails to send samples to remote storage.',
2020-04-08 19:56:00 +00:00
description: 'Prometheus %(prometheusName)s failed to send {{ printf "%%.1f" $value }}%% of the samples to {{ $labels.remote_name}}:{{ $labels.url }}' % $._config,
2018-05-09 17:02:33 +00:00
},
},
2019-02-12 15:22:58 +00:00
{
alert: 'PrometheusRemoteWriteBehind',
expr: |||
2019-06-28 14:46:19 +00:00
# Without max_over_time, failed scrapes could create false negatives, see
# https://www.robustperception.io/alerting-on-gauges-in-prometheus-2-0 for details.
2019-06-26 18:31:05 +00:00
(
2019-06-28 14:46:19 +00:00
max_over_time(prometheus_remote_storage_highest_timestamp_in_seconds{%(prometheusSelector)s}[5m])
2020-11-17 12:29:49 +00:00
- ignoring(remote_name, url) group_right
2019-06-28 14:46:19 +00:00
max_over_time(prometheus_remote_storage_queue_highest_sent_timestamp_seconds{%(prometheusSelector)s}[5m])
2019-06-26 18:31:05 +00:00
)
> 120
2019-02-12 15:22:58 +00:00
||| % $._config,
'for': '15m',
labels: {
severity: 'critical',
},
annotations: {
2019-06-27 21:50:26 +00:00
summary: 'Prometheus remote write is behind.',
2020-04-08 19:56:00 +00:00
description: 'Prometheus %(prometheusName)s remote write is {{ printf "%%.1f" $value }}s behind for {{ $labels.remote_name}}:{{ $labels.url }}.' % $._config,
2019-02-12 15:22:58 +00:00
},
},
2019-08-03 00:39:32 +00:00
{
alert: 'PrometheusRemoteWriteDesiredShards',
expr: |||
# Without max_over_time, failed scrapes could create false negatives, see
# https://www.robustperception.io/alerting-on-gauges-in-prometheus-2-0 for details.
(
max_over_time(prometheus_remote_storage_shards_desired{%(prometheusSelector)s}[5m])
2019-10-28 20:36:10 +00:00
>
2019-08-03 00:39:32 +00:00
max_over_time(prometheus_remote_storage_shards_max{%(prometheusSelector)s}[5m])
)
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Prometheus remote write desired shards calculation wants to run more than configured max shards.',
2020-04-08 19:56:00 +00:00
description: 'Prometheus %(prometheusName)s remote write desired shards calculation wants to run {{ $value }} shards for queue {{ $labels.remote_name}}:{{ $labels.url }}, which is more than the max of {{ printf `prometheus_remote_storage_shards_max{instance="%%s",%(prometheusSelector)s}` $labels.instance | query | first | value }}.' % $._config,
2019-08-03 00:39:32 +00:00
},
},
2018-05-09 17:02:33 +00:00
{
2018-11-19 11:22:55 +00:00
alert: 'PrometheusRuleFailures',
2018-05-09 17:02:33 +00:00
expr: |||
2019-06-27 21:50:26 +00:00
increase(prometheus_rule_evaluation_failures_total{%(prometheusSelector)s}[5m]) > 0
2018-05-09 17:02:33 +00:00
||| % $._config,
2019-06-26 21:22:16 +00:00
'for': '15m',
2018-05-09 17:02:33 +00:00
labels: {
severity: 'critical',
},
annotations: {
2019-06-28 15:37:49 +00:00
summary: 'Prometheus is failing rule evaluations.',
2019-06-27 21:50:26 +00:00
description: 'Prometheus %(prometheusName)s has failed to evaluate {{ printf "%%.0f" $value }} rules in the last 5m.' % $._config,
},
},
{
alert: 'PrometheusMissingRuleEvaluations',
expr: |||
increase(prometheus_rule_group_iterations_missed_total{%(prometheusSelector)s}[5m]) > 0
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
2019-06-28 15:37:49 +00:00
summary: 'Prometheus is missing rule evaluations due to slow rule group evaluation.',
2019-06-27 21:50:26 +00:00
description: 'Prometheus %(prometheusName)s has missed {{ printf "%%.0f" $value }} rule group evaluations in the last 5m.' % $._config,
2018-05-09 17:02:33 +00:00
},
},
2020-07-30 12:20:24 +00:00
{
alert: 'PrometheusTargetLimitHit',
expr: |||
increase(prometheus_target_scrape_pool_exceeded_target_limit_total{%(prometheusSelector)s}[5m]) > 0
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Prometheus has dropped targets because some scrape configs have exceeded the targets limit.',
description: 'Prometheus %(prometheusName)s has dropped {{ printf "%%.0f" $value }} targets because the number of targets exceeded the configured target_limit.' % $._config,
},
},
2021-05-06 08:56:21 +00:00
{
alert: 'PrometheusLabelLimitHit',
expr: |||
increase(prometheus_target_scrape_pool_exceeded_label_limits_total{%(prometheusSelector)s}[5m]) > 0
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Prometheus has dropped targets because some scrape configs have exceeded the labels limit.',
description: 'Prometheus %(prometheusName)s has dropped {{ printf "%%.0f" $value }} targets because some samples exceeded the configured label_limit, label_name_length_limit or label_value_length_limit.' % $._config,
},
},
2021-11-26 14:39:42 +00:00
{
alert: 'PrometheusScrapeBodySizeLimitHit',
expr: |||
increase(prometheus_target_scrapes_exceeded_body_size_limit_total{%(prometheusSelector)s}[5m]) > 0
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Prometheus has dropped some targets that exceeded body size limit.',
2022-03-30 07:35:03 +00:00
description: 'Prometheus %(prometheusName)s has failed {{ printf "%%.0f" $value }} scrapes in the last 5m because some targets exceeded the configured body_size_limit.' % $._config,
2021-11-26 14:39:42 +00:00
},
},
2022-03-23 13:44:42 +00:00
{
alert: 'PrometheusScrapeSampleLimitHit',
expr: |||
increase(prometheus_target_scrapes_exceeded_sample_limit_total{%(prometheusSelector)s}[5m]) > 0
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Prometheus has failed scrapes that have exceeded the configured sample limit.',
2022-03-30 07:35:03 +00:00
description: 'Prometheus %(prometheusName)s has failed {{ printf "%%.0f" $value }} scrapes in the last 5m because some targets exceeded the configured sample_limit.' % $._config,
2022-03-23 13:44:42 +00:00
},
},
2021-05-28 21:50:59 +00:00
{
alert: 'PrometheusTargetSyncFailure',
expr: |||
increase(prometheus_target_sync_failed_total{%(prometheusSelector)s}[30m]) > 0
||| % $._config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'Prometheus has failed to sync targets.',
description: '{{ printf "%%.0f" $value }} targets in Prometheus %(prometheusName)s have failed to sync because invalid configuration was supplied.' % $._config,
},
},
2022-06-23 12:54:11 +00:00
{
alert: 'PrometheusHighQueryLoad',
expr: |||
2022-07-15 08:59:34 +00:00
avg_over_time(prometheus_engine_queries{%(prometheusSelector)s}[5m]) / max_over_time(prometheus_engine_queries_concurrent_max{%(prometheusSelector)s}[5m]) > 0.8
2022-06-23 12:54:11 +00:00
||| % $._config,
'for': '15m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Prometheus is reaching its maximum capacity serving concurrent requests.',
description: 'Prometheus %(prometheusName)s query API has less than 20%% available capacity in its query engine for the last 15 minutes.' % $._config,
},
},
2020-11-10 23:14:54 +00:00
] + if $._config.prometheusHAGroupLabels == '' then self.rulesWithoutHA else self.rulesWithHA,
rulesWithoutHA:: [
{
alert: 'PrometheusErrorSendingAlertsToAnyAlertmanager',
expr: |||
min without (alertmanager) (
2020-12-03 19:59:53 +00:00
rate(prometheus_notifications_errors_total{%(prometheusSelector)s,alertmanager!~`%(nonNotifyingAlertmanagerRegEx)s`}[5m])
2020-11-10 23:14:54 +00:00
/
2020-12-03 19:59:53 +00:00
rate(prometheus_notifications_sent_total{%(prometheusSelector)s,alertmanager!~`%(nonNotifyingAlertmanagerRegEx)s`}[5m])
2020-11-10 23:14:54 +00:00
)
* 100
> 3
||| % $._config,
'for': '15m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'Prometheus encounters more than 3% errors sending alerts to any Alertmanager.',
description: '{{ printf "%%.1f" $value }}%% minimum errors while sending alerts from Prometheus %(prometheusName)s to any Alertmanager.' % $._config,
},
},
],
rulesWithHA:: [
{
alert: 'PrometheusErrorSendingAlertsToAnyAlertmanager',
expr: |||
min by (%(prometheusHAGroupLabels)s) (
2020-12-03 19:59:53 +00:00
rate(prometheus_notifications_errors_total{%(prometheusSelector)s,alertmanager!~`%(nonNotifyingAlertmanagerRegEx)s`}[5m])
2020-11-10 23:14:54 +00:00
/
2020-12-03 19:59:53 +00:00
rate(prometheus_notifications_sent_total{%(prometheusSelector)s,alertmanager!~`%(nonNotifyingAlertmanagerRegEx)s`}[5m])
2020-11-10 23:14:54 +00:00
)
* 100
> 3
||| % $._config,
'for': '15m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'Each Prometheus server in an HA group encounters more than 3% errors sending alerts to any Alertmanager.',
description: '{{ printf "%%.1f" $value }}%% minimum errors while sending alerts from any Prometheus server in HA group %(prometheusHAGroupName)s to any Alertmanager.' % $._config,
},
},
{
alert: 'PrometheusHAGroupNotIngestingSamples',
expr: |||
max by (%(prometheusHAGroupLabels)s) (
rate(prometheus_tsdb_head_samples_appended_total{%(prometheusSelector)s}[5m])
and
(
sum without(scrape_job) (prometheus_target_metadata_cache_entries{%(prometheusSelector)s}) > 0
or
sum without(rule_group) (prometheus_rule_group_rules{%(prometheusSelector)s}) > 0
)
)
<= 0
||| % $._config,
'for': '10m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'A whole Prometheus HA group is not ingesting samples.',
description: 'None of the Prometheus instances in HA group %(prometheusHAGroupName)s is ingesting any samples.' % $._config,
},
},
// Both the following critical alerts, PrometheusHAGroupDown and
// PrometheusHAGroupCrashlooping, fire if a whole HA group is
// unhealthy. It is implied that a generic warning alert is in place
// for individual instances being down or crashlooping.
{
alert: 'PrometheusHAGroupDown',
expr: |||
(
count by (%(prometheusHAGroupLabels)s) (
avg_over_time(up{%(prometheusSelector)s}[5m]) < 0.5
)
/
count by (%(prometheusHAGroupLabels)s) (
up{%(prometheusSelector)s}
)
)
> 0.5
||| % $._config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'More than half of the Prometheus instances within the same HA group are down.',
description: '{{ $value | humanizePercentage }} of Prometheus instances within the %(prometheusHAGroupName)s HA group have been up for less than half of the last 5m.' % $._config,
},
},
{
alert: 'PrometheusHAGroupCrashlooping',
expr: |||
2021-06-16 09:33:02 +00:00
(
prometheus_tsdb_clean_start{%(prometheusSelector)s} == 0
and
2021-11-26 14:39:42 +00:00
(
2021-06-16 09:33:02 +00:00
count by (%(prometheusHAGroupLabels)s) (
2021-11-08 23:05:15 +00:00
changes(process_start_time_seconds{%(prometheusSelector)s}[1h]) > 1
2021-11-26 14:39:42 +00:00
)
/
2021-06-16 09:33:02 +00:00
count by (%(prometheusHAGroupLabels)s) (
up{%(prometheusSelector)s}
)
)
> 0.5
)
or
2020-11-10 23:14:54 +00:00
(
count by (%(prometheusHAGroupLabels)s) (
2021-11-17 23:09:47 +00:00
changes(process_start_time_seconds{%(prometheusSelector)s}[30m]) > 4
2020-11-10 23:14:54 +00:00
)
/
count by (%(prometheusHAGroupLabels)s) (
up{%(prometheusSelector)s}
)
)
> 0.5
||| % $._config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'More than half of the Prometheus instances within the same HA group are crashlooping.',
2021-11-18 19:28:38 +00:00
description: '{{ $value | humanizePercentage }} of Prometheus instances within the %(prometheusHAGroupName)s HA group have had at least 5 total restarts in the last 30m or 2 unclean restarts in the last 1h.' % $._config,
2020-11-10 23:14:54 +00:00
},
},
2018-05-09 17:02:33 +00:00
],
},
],
},
}