From 723bae7305e4461f48e4959609f9b29b1bc1f325 Mon Sep 17 00:00:00 2001 From: Keith Fiske Date: Fri, 26 Jul 2024 14:33:56 -0400 Subject: [PATCH 1/2] fix: fix handling of 3 number backrest version --- changelogs/fragments/420.yml | 2 ++ postgres_exporter/linux/queries_backrest.yml | 1 + 2 files changed, 3 insertions(+) create mode 100644 changelogs/fragments/420.yml diff --git a/changelogs/fragments/420.yml b/changelogs/fragments/420.yml new file mode 100644 index 0000000..7bdeb17 --- /dev/null +++ b/changelogs/fragments/420.yml @@ -0,0 +1,2 @@ +bugfixes: + - postgres_exporter - Fix query for pgBackRest monitoring to handle 3 number versions diff --git a/postgres_exporter/linux/queries_backrest.yml b/postgres_exporter/linux/queries_backrest.yml index 640e0fe..490f5b7 100644 --- a/postgres_exporter/linux/queries_backrest.yml +++ b/postgres_exporter/linux/queries_backrest.yml @@ -20,6 +20,7 @@ ccp_backrest_last_info: ) SELECT a.config_file , a.stanza + , split_part(a.backup_data->'backrest'->>'version', '.', 1) || lpad(split_part(a.backup_data->'backrest'->>'version', '.', 2), 2, '0') || lpad(coalesce(nullif(split_part(a.backup_data->'backrest'->>'version', '.', 3), ''), '00'), 2, '0') AS backrest_repo_version , a.backup_data->'backrest'->>'version' AS backrest_repo_version , a.backup_data->'database'->>'repo-key' AS repo , a.backup_data->>'type' AS backup_type From 4e20a4e3e9e1a8c6c1481e417221c9888fd4b512 Mon Sep 17 00:00:00 2001 From: Keith Fiske Date: Fri, 26 Jul 2024 14:48:33 -0400 Subject: [PATCH 2/2] fix: fix handling of 3 number backrest version --- postgres_exporter/linux/queries_backrest.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/postgres_exporter/linux/queries_backrest.yml b/postgres_exporter/linux/queries_backrest.yml index 490f5b7..5c997ba 100644 --- a/postgres_exporter/linux/queries_backrest.yml +++ b/postgres_exporter/linux/queries_backrest.yml @@ -21,7 +21,6 @@ ccp_backrest_last_info: SELECT a.config_file , a.stanza , split_part(a.backup_data->'backrest'->>'version', '.', 1) || lpad(split_part(a.backup_data->'backrest'->>'version', '.', 2), 2, '0') || lpad(coalesce(nullif(split_part(a.backup_data->'backrest'->>'version', '.', 3), ''), '00'), 2, '0') AS backrest_repo_version - , a.backup_data->'backrest'->>'version' AS backrest_repo_version , a.backup_data->'database'->>'repo-key' AS repo , a.backup_data->>'type' AS backup_type , a.backup_data->'info'->'repository'->>'delta' AS repo_backup_size_bytes