-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Example Alerts | ||
|
||
This document contains some example alerting rules you may want to configure. Both Grafana and Prometheus use PromQL for their alerting configuration so the examples provide the PromQL query as well as the cofiguration for the alert itself. You can cutomise these based on your needs. | ||
|
||
## Database Down | ||
|
||
Alerting when the instance is sending metrics but the database is down and has been down for 5 minutes | ||
|
||
``` | ||
alert: PostgresDatabaseDown | ||
expr: pg_up == 0 | ||
for: 5m | ||
labels: | ||
severity: critical | ||
annotations: | ||
summary: "PostgreSQL database is down" | ||
description: "The database has been down for more than 5 minutes on {{ $labels.instance }}" | ||
``` | ||
|
||
## Replication Lag | ||
|
||
Alerting when the replication lag is more than 10 minutes and has been increasing over the last 10 minutes | ||
|
||
``` | ||
alert: PostgresReplicationLagHigh | ||
expr: (physical_replication_lag_physical_replication_lag_seconds > 600) and (rate(physical_replication_lag_physical_replication_lag_seconds[10m]) > 0) | ||
for: 5m | ||
labels: | ||
severity: warning | ||
annotations: | ||
summary: "PostgreSQL replication lag is high and growing" | ||
description: "Replication lag is over 10 minutes and has been increasing for the last 10 minutes on {{ $labels.instance }}" | ||
``` | ||
|
||
## Database Size | ||
|
||
Alerting when the database size has increased by 20% or more in the last 12 hours | ||
|
||
``` | ||
alert: PostgresDatabaseSizeGrowth | ||
expr: (pg_database_size_mb - pg_database_size_mb offset 12h) / pg_database_size_mb offset 12h * 100 > 20 | ||
for: 5m | ||
labels: | ||
severity: warning | ||
annotations: | ||
summary: "PostgreSQL database size growth exceeds threshold" | ||
description: "Database {{ $labels.instance }} has grown by more than 20% in the last 12 hours on {{ $labels.instance }}" | ||
``` |