-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from qonto/add-prometheus-unittests
Add prometheus unittests
- Loading branch information
Showing
34 changed files
with
806 additions
and
13 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
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
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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
tests | ||
prometheus_tests |
25 changes: 25 additions & 0 deletions
25
charts/prometheus-postgresql-alerts/prometheus_tests/PostgreSQLExporterDown.yml
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,25 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLExporterDown | ||
interval: 1m | ||
input_series: | ||
- series: 'up{instance="localhost:9187"}' | ||
values: '0x10' | ||
- series: 'postgres_exporter_build_info{instance="localhost:9187"}' | ||
values: '1x10' | ||
alert_rule_test: | ||
- alertname: PostgreSQLExporterDown | ||
eval_time: 5m | ||
exp_alerts: | ||
- exp_labels: | ||
instance: localhost:9187 | ||
severity: critical | ||
exp_annotations: | ||
summary: "Exporter is down" | ||
description: "localhost:9187 exporter is down" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLExporterDown" |
23 changes: 23 additions & 0 deletions
23
charts/prometheus-postgresql-alerts/prometheus_tests/PostgreSQLExporterErrors.yml
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,23 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLExporterErrors | ||
interval: 1m | ||
input_series: | ||
- series: 'pg_exporter_last_scrape_error{job="postgresql-exporter"}' | ||
values: 1+1x10 | ||
alert_rule_test: | ||
- alertname: PostgreSQLExporterErrors | ||
eval_time: 5m | ||
exp_alerts: | ||
- exp_labels: | ||
job: postgresql-exporter | ||
severity: critical | ||
exp_annotations: | ||
summary: "Exporter is reporting scraping errors" | ||
description: "postgresql-exporter is reporting scraping errors. Some metrics are not collected anymore" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLExporterErrors" |
20 changes: 20 additions & 0 deletions
20
...metheus-postgresql-alerts/prometheus_tests/PostgreSQLExporterMissingScrapeErrorMetric.yml
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,20 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLExporterMissingScrapeErrorMetric | ||
interval: 1m | ||
input_series: [] | ||
alert_rule_test: | ||
- alertname: PostgreSQLExporterMissingScrapeErrorMetric | ||
eval_time: 5m | ||
exp_alerts: | ||
- exp_labels: | ||
severity: critical | ||
exp_annotations: | ||
summary: "PostgreSQL exporter last scrape error metric is missing" | ||
description: "PostgreSQL exporter last scrape error metric is missing. Either the exporter is down or some metrics are not collected anymore" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLExporterMissingScrapeErrorMetric" |
23 changes: 23 additions & 0 deletions
23
charts/prometheus-postgresql-alerts/prometheus_tests/PostgreSQLExporterScrapingLimit.yml
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,23 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLExporterScrapingLimit | ||
interval: 1m | ||
input_series: | ||
- series: 'pg_exporter_last_scrape_duration_seconds{instance="localhost:9187"}' | ||
values: 40x10 | ||
alert_rule_test: | ||
- alertname: PostgreSQLExporterScrapingLimit | ||
eval_time: 5m | ||
exp_alerts: | ||
- exp_labels: | ||
instance: localhost:9187 | ||
severity: warning | ||
exp_annotations: | ||
summary: "Exporter scraping take long time" | ||
description: "localhost:9187 scraping take long time" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLExporterScrapingLimit" |
24 changes: 24 additions & 0 deletions
24
...rometheus-postgresql-alerts/prometheus_tests/PostgreSQLInactiveLogicalReplicationSlot.yml
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,24 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLInactiveLogicalReplicationSlot | ||
interval: 1m | ||
input_series: | ||
- series: 'pg_replication_slots_active{slot_type="logical", server="db1.unittest.eu-west-3.rds.amazonaws.com:5432", slot_name="unittest"}' | ||
values: 0x10 | ||
alert_rule_test: | ||
- alertname: PostgreSQLInactiveLogicalReplicationSlot | ||
eval_time: 10m | ||
exp_alerts: | ||
- exp_labels: | ||
server: db1.unittest.eu-west-3.rds.amazonaws.com:5432 | ||
slot_name: unittest | ||
severity: warning | ||
exp_annotations: | ||
summary: "Logical replication slot is inactive" | ||
description: "unittest on db1 is inactive" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLInactiveLogicalReplicationSlot" |
24 changes: 24 additions & 0 deletions
24
...ometheus-postgresql-alerts/prometheus_tests/PostgreSQLInactivePhysicalReplicationSlot.yml
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,24 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLInactivePhysicalReplicationSlot | ||
interval: 1m | ||
input_series: | ||
- series: 'pg_replication_slots_active{slot_type="physical", server="db1.unittest.eu-west-3.rds.amazonaws.com:5432", slot_name="unittest"}' | ||
values: 0x10 | ||
alert_rule_test: | ||
- alertname: PostgreSQLInactivePhysicalReplicationSlot | ||
eval_time: 10m | ||
exp_alerts: | ||
- exp_labels: | ||
server: db1.unittest.eu-west-3.rds.amazonaws.com:5432 | ||
slot_name: unittest | ||
severity: warning | ||
exp_annotations: | ||
summary: "Physical replication slot is inactive" | ||
description: "unittest on db1 is inactive" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLInactivePhysicalReplicationSlot" |
26 changes: 26 additions & 0 deletions
26
charts/prometheus-postgresql-alerts/prometheus_tests/PostgreSQLInvalidIndex.yml
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,26 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLInvalidIndex | ||
interval: 1m | ||
input_series: | ||
- series: 'pg_stat_user_indexes_idx_blks_hit{cluster="db1", datname="unittest", relname="test", indexrelname="idx_id", indisvalid="false"}' | ||
values: 1x60 | ||
alert_rule_test: | ||
- alertname: PostgreSQLInvalidIndex | ||
eval_time: 1h | ||
exp_alerts: | ||
- exp_labels: | ||
cluster: db1 | ||
datname: unittest | ||
relname: test | ||
indexrelname: idx_id | ||
severity: warning | ||
exp_annotations: | ||
summary: "idx_id is invalid" | ||
description: "idx_id of test table on unittest database on db1 is invalid" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLInvalidIndex" |
26 changes: 26 additions & 0 deletions
26
charts/prometheus-postgresql-alerts/prometheus_tests/PostgreSQLLongRunningQuery.yml
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,26 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLLongRunningQuery | ||
interval: 1m | ||
input_series: | ||
- series: 'pg_active_backend_duration_minutes{server="db1.unittest.eu-west-3.rds.amazonaws.com:5432",datname="unittest",usename="test",pid="1234"}' | ||
values: 40+1x10 | ||
alert_rule_test: | ||
- alertname: PostgreSQLLongRunningQuery | ||
eval_time: 1m | ||
exp_alerts: | ||
- exp_labels: | ||
server: db1.unittest.eu-west-3.rds.amazonaws.com:5432 | ||
datname: unittest | ||
usename: test | ||
severity: warning | ||
pid: 1234 | ||
exp_annotations: | ||
summary: "Long running query on unittest of db1" | ||
description: "test is running a long query on unittest of db1 with pid 1234" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLLongRunningQuery" |
25 changes: 25 additions & 0 deletions
25
charts/prometheus-postgresql-alerts/prometheus_tests/PostgreSQLMaxConnections.yml
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,25 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLMaxConnections | ||
interval: 1m | ||
input_series: | ||
- series: 'pg_stat_connections_count{server="db1.unittest.eu-west-3.rds.amazonaws.com:5432"}' | ||
values: 905x10 # 90.5 that are rendered as 90% | ||
- series: 'pg_settings_max_connections{server="db1.unittest.eu-west-3.rds.amazonaws.com:5432"}' | ||
values: 1000x10 | ||
alert_rule_test: | ||
- alertname: PostgreSQLMaxConnections | ||
eval_time: 10m | ||
exp_alerts: | ||
- exp_labels: | ||
server: db1.unittest.eu-west-3.rds.amazonaws.com:5432 | ||
severity: warning | ||
exp_annotations: | ||
summary: "db1 is close from the maximum database connections" | ||
description: "db1 uses 90% of the maximum database connections" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLMaxConnections" |
24 changes: 24 additions & 0 deletions
24
...s/prometheus-postgresql-alerts/prometheus_tests/PostgreSQLReplicationSlotStorageLimit.yml
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,24 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: PostgreSQLReplicationSlotStorageLimit | ||
interval: 1m | ||
input_series: | ||
- series: 'pg_replication_slots_available_storage_percent{server="db1.unittest.eu-west-3.rds.amazonaws.com:5432",slot_name="unittest"}' | ||
values: 15.8x10 | ||
alert_rule_test: | ||
- alertname: PostgreSQLReplicationSlotStorageLimit | ||
eval_time: 5m | ||
exp_alerts: | ||
- exp_labels: | ||
server: db1.unittest.eu-west-3.rds.amazonaws.com:5432 | ||
slot_name: unittest | ||
severity: warning | ||
exp_annotations: | ||
summary: "unittest on db1 is close to its storage limit" | ||
description: "unittest has 16% free disk storage space" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/postgresql/PostgreSQLReplicationSlotStorageLimit" |
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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
tests | ||
prometheus_tests |
25 changes: 25 additions & 0 deletions
25
charts/prometheus-rds-alerts/prometheus_tests/RDSCPUUtilization.yml
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,25 @@ | ||
rule_files: | ||
- rules.yml | ||
|
||
evaluation_interval: 1m | ||
|
||
tests: | ||
|
||
- name: RDSCPUUtilization | ||
interval: 1m | ||
input_series: | ||
- series: 'rds_cpu_usage_percent_average{aws_account_id="111111111111",aws_region="eu-west-3",dbidentifier="db1"}' | ||
values: '90x10' | ||
alert_rule_test: | ||
- alertname: RDSCPUUtilization | ||
eval_time: 10m | ||
exp_alerts: | ||
- exp_labels: | ||
aws_account_id: 111111111111 | ||
aws_region: eu-west-3 | ||
dbidentifier: db1 | ||
severity: warning | ||
exp_annotations: | ||
description: "db1 has 90% CPU used" | ||
summary: "db1 has high CPU utilization" | ||
runbook_url: "https://qonto.github.io/database-monitoring-framework/0.0.0/runbooks/rds/RDSCPUUtilization" |
Oops, something went wrong.