{"id":41709111,"url":"https://github.com/woblerr/pgbackrest_exporter","last_synced_at":"2026-03-07T22:15:36.416Z","repository":{"id":38018618,"uuid":"376970390","full_name":"woblerr/pgbackrest_exporter","owner":"woblerr","description":"Prometheus exporter for pgBackRest.","archived":false,"fork":false,"pushed_at":"2026-02-27T16:11:32.000Z","size":6718,"stargazers_count":87,"open_issues_count":3,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-02-27T21:05:15.549Z","etag":null,"topics":["backup","collected-metrics","docker","exporter","metrics","pgbackrest","postgresql","prometheus","prometheus-exporter"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/woblerr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-06-14T22:21:19.000Z","updated_at":"2026-02-14T21:24:13.000Z","dependencies_parsed_at":"2024-05-08T21:27:04.218Z","dependency_job_id":"8fa2bf48-3805-41e0-8b09-bf16e651af3c","html_url":"https://github.com/woblerr/pgbackrest_exporter","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/woblerr/pgbackrest_exporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woblerr%2Fpgbackrest_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woblerr%2Fpgbackrest_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woblerr%2Fpgbackrest_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woblerr%2Fpgbackrest_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woblerr","download_url":"https://codeload.github.com/woblerr/pgbackrest_exporter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woblerr%2Fpgbackrest_exporter/sbom","scorecard":{"id":1238190,"data":{"date":"2025-07-07","repo":{"name":"github.com/woblerr/pgbackrest_exporter","commit":"8cee8b3a6c257f327e7553a75d59d1802e12fac8"},"scorecard":{"version":"v5.2.1-18-gbb9c347d","commit":"bb9c347dff6349d986baab6578a46d68a5524c62"},"score":4.6,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"16 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 1/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.20.0 not signed: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/219905584","Warn: release artifact v0.19.0 not signed: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/197998126","Warn: release artifact v0.18.2 not signed: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/192628795","Warn: release artifact v0.18.1 not signed: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/190722391","Warn: release artifact v0.18.0 not signed: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/170062602","Warn: release artifact v0.20.0 does not have provenance: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/219905584","Warn: release artifact v0.19.0 does not have provenance: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/197998126","Warn: release artifact v0.18.2 does not have provenance: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/192628795","Warn: release artifact v0.18.1 does not have provenance: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/190722391","Warn: release artifact v0.18.0 does not have provenance: https://api.github.com/repos/woblerr/pgbackrest_exporter/releases/170062602"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:178: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:184: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:192: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:199: update your workflow using https://app.stepsecurity.io/secureworkflow/woblerr/pgbackrest_exporter/build.yml/master?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:5","Warn: containerImage not pinned by hash: Dockerfile:19","Warn: containerImage not pinned by hash: Dockerfile.artifacts:1","Warn: containerImage not pinned by hash: Dockerfile.artifacts:6: pin your Docker image by updating alpine:3.20 to alpine:3.20@sha256:de4fe7064d8f98419ea6b49190df1abbf43450c1702eeb864fe9ced453c1cc5f","Warn: containerImage not pinned by hash: e2e_tests/Dockerfile:5","Warn: containerImage not pinned by hash: e2e_tests/Dockerfile:19","Warn: goCommand not pinned by hash: .github/workflows/build.yml:42","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   6 containerImage dependencies pinned","Info:   0 out of   1 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/build.yml:10"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2025-3488"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-09-26T15:29:20.362Z","repository_id":38018618,"created_at":"2025-09-26T15:29:20.363Z","updated_at":"2025-09-26T15:29:20.363Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30233433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","collected-metrics","docker","exporter","metrics","pgbackrest","postgresql","prometheus","prometheus-exporter"],"created_at":"2026-01-24T21:40:06.324Z","updated_at":"2026-03-07T22:15:36.392Z","avatar_url":"https://github.com/woblerr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgBackRest Exporter\n\n[![Actions Status](https://github.com/woblerr/pgbackrest_exporter/workflows/build/badge.svg)](https://github.com/woblerr/pgbackrest_exporter/actions)\n[![Coverage Status](https://coveralls.io/repos/github/woblerr/pgbackrest_exporter/badge.svg?branch=master)](https://coveralls.io/github/woblerr/pgbackrest_exporter?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/woblerr/pgbackrest_exporter)](https://goreportcard.com/report/github.com/woblerr/pgbackrest_exporter)\n\nPrometheus exporter for [pgBackRest](https://pgbackrest.org/).\n\nThe metrics are collected based on result of `pgbackrest info --output json` command. By default, the metrics are collected for all stanzas received by command. You can specify stanzas to collect metrics. You need to run exporter on the same host where pgBackRest was installed or inside Docker.\n\n## Grafana dashboard\n\nTo get a dashboard for visualizing the collected metrics, you can use a ready-made dashboard [pgBackRest Exporter Dashboard](https://grafana.com/grafana/dashboards/17709-pgbackrest-exporter-dashboard/) or make your own.\n\n## Collected metrics\n### Stanza metrics\n\n| Metric | Description |  Labels | Additional Info |\n| ----------- | ------------------ | ------------- | --------------- |\n| `pgbackrest_stanza_backup_compete_bytes` | completed size for backup in progress | stanza | |\n| `pgbackrest_stanza_backup_total_bytes` | total size for backup in progress | stanza | |\n| `pgbackrest_stanza_lock_status` | current stanza lock status | stanza | Values description:\u003cbr\u003e `0` - no active operation with stanza,\u003cbr\u003e `1` - one of the commands is running for stanza: backup, expire or stanza-*. |\n| `pgbackrest_stanza_status` | current stanza status | stanza | Values description:\u003cbr\u003e `0` - ok,\u003cbr\u003e `1` - missing stanza path,\u003cbr\u003e `2` - no valid backups,\u003cbr\u003e `3` - missing stanza data,\u003cbr\u003e `4` - different across repos,\u003cbr\u003e `5` - database mismatch across repos,\u003cbr\u003e `6` - requested backup not found,\u003cbr\u003e `99` - other. |\n\n### Repository metrics\n\n| Metric | Description |  Labels | Additional Info |\n| ----------- | ------------------ | ------------- | --------------- |\n| `pgbackrest_repo_status` | current repository status | cipher, repo_key, stanza | Values description:\u003cbr\u003e `0` - ok,\u003cbr\u003e `1` - missing stanza path,\u003cbr\u003e `2` - no valid backups,\u003cbr\u003e `3` - missing stanza data,\u003cbr\u003e `4` - different across repos,\u003cbr\u003e `5` - database mismatch across repos,\u003cbr\u003e `6` - requested backup not found,\u003cbr\u003e `99` - other |\n\n### Backup metrics\n\n| Metric | Description |  Labels | Additional Info |\n| ----------- | ------------------ | ------------- | --------------- |\n| `pgbackrest_backup_annotations` | number of annotations in backup | backup_name, backup_type, database_id, block_incr, repo_key, stanza | |\n| `pgbackrest_backup_databases` | number of databases in backup | backup_name, backup_type, block_incr, database_id, repo_key, stanza | |\n| `pgbackrest_backup_references` | number of references to other backups (backup reference list) | backup_name, backup_type, block_incr, database_id, ref_backup, repo_key, stanza | |\n| `pgbackrest_backup_duration_seconds` | backup duration in seconds | backup_name, backup_type, block_incr, database_id, repo_key, stanza, start_time, stop_time | |\n| `pgbackrest_backup_error_status` | backup error status | backup_name, backup_type, block_incr, database_id, repo_key, stanza | Values description:\u003cbr\u003e `0` - backup doesn't contain page checksum errors,\u003cbr\u003e `1` - backup contains one or more page checksum errors. To display the list of errors, you need manually run the command like `pgbackrest info --stanza stanza --set backup_name --repo repo_key`. |\n| `pgbackrest_backup_info` | backup info | backrest_ver, backup_name, backup_type, block_incr, database_id, lsn_start, lsn_stop, pg_version, prior, repo_key, stanza, wal_start, wal_stop | Values description:\u003cbr\u003e `1` - info about backup is exist. |\n| `pgbackrest_backup_delta_bytes` | amount of data in the database to actually backup | backup_name, backup_type, block_incr, database_id, repo_key, stanza | |\n| `pgbackrest_backup_size_bytes` | full uncompressed size of the database | backup_name, backup_type, block_incr, database_id, repo_key, stanza | |\n| `pgbackrest_backup_repo_delta_bytes` | compressed files size in backup | backup_name, backup_type, block_incr, database_id, repo_key, stanza | |\n| `pgbackrest_backup_repo_size_bytes` | full compressed files size to restore the database from backup | backup_name, backup_type, block_incr, database_id, repo_key, stanza | |\n| `pgbackrest_backup_repo_delta_map_bytes` | size of block incremental delta map | backup_name, backup_type, block_incr, database_id, repo_key, stanza | |\n| `pgbackrest_backup_repo_size_map_bytes` | size of block incremental map | backup_name, backup_type, block_incr, database_id, repo_key, stanza | |\n\n### Last backup metrics\n\n| Metric | Description |  Labels | Additional Info |\n| ----------- | ------------------ | ------------- | --------------- |\n| `pgbackrest_backup_since_last_completion_seconds` | seconds since the last completed full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_annotations` | number of annotations in the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_databases` | number of databases in the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_references` | number of references to other backups (backup reference list) in the last full, differential or incremental backup | backup_type, block_incr, ref_backup, stanza | |\n| `pgbackrest_backup_last_duration_seconds` | backup duration for the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_error_status` | error status in the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_delta_bytes` | amount of data in the database to actually backup in the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_size_bytes` | full uncompressed size of the database in the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_repo_delta_bytes` | compressed files size in the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_repo_size_bytes` | full compressed files size to restore the database from the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_repo_size_map_bytes` | size of block incremental map in the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n| `pgbackrest_backup_last_repo_delta_map_bytes` | size of block incremental delta map in the last full, differential or incremental backup | backup_type, block_incr, stanza | |\n\n### WAL metrics\n| Metric | Description |  Labels | Additional Info |\n| ----------- | ------------------ | ------------- | --------------- |\n| `pgbackrest_wal_archive_status` | current WAL archive status | database_id, pg_version, repo_key, stanza, wal_max, wal_min | Values description:\u003cbr\u003e `0` - any one of WALMin and WALMax have empty value, there is no correct information about WAL archiving,\u003cbr\u003e `1` - both WALMin and WALMax have no empty values, there is correct information about WAL archiving. |\n\n### pgBackRest metrics\n| Metric | Description |  Labels | Additional Info |\n| ----------- | ------------------ | ------------- | --------------- |\n| `pgbackrest_version_info` | information about pgBackRest version | | Values description:\u003cbr\u003e `0` - pgBackRest version information unavailable. |\n\n### Exporter metrics\n\n| Metric | Description |  Labels | Additional Info |\n| ----------- | ------------------ | ------------- | --------------- |\n| `pgbackrest_exporter_build_info` | information about pgBackRest exporter | branch, goarch, goos, goversion, revision, tags, version | |\n| `pgbackrest_exporter_status` | pgBackRest exporter get data status | stanza | Values description:\u003cbr\u003e `0` - errors occurred when fetching information from pgBackRest,\u003cbr\u003e `1` - information successfully fetched from pgBackRest. |\n\n### Additional description of metrics\n\nFor `pgbackrest_*_last_*` metrics for differential backups (`backup_type=\"diff\"`) the following logic is applied:\n* if the last backup was full, the metric will take full backup value;\n* otherwise, the value will be set.\n\nFor `pgbackrest_*_last_*` metrics for incremental backups (`backup_type=\"incr\"`) the following logic is applied:\n* if the last backup was full or differential, the metric will take full or differential backup value;\n* otherwise, the value will be set.\n\nFor `pgbackrest_exporter_status` metric the following logic is applied:\n* if the information is collected for all available stanzas, the `stanza` label value will be `all-stanzas`;\n* if the information is collected for all available stanzas except excluded, the `stanza` label value will be `all-stanzas-except-excluded`;\n* otherwise, the stanza name will be set.\n\nIf `pgbackrest_stanza_lock_status` metric is `1`, than one of the commands is running for stanza: `backup`, `expire` or `stanza-*`.\nWith a very high probability it is `backup/expire`.\n\nFor `pgBackRest \u003e= v2.48` it is possible to determine whether the backup is running:\n* if `pgbackrest_stanza_backup_compete_bytes` and `pgbackrest_stanza_backup_total_bytes` metric\ns are different from `0` and `pgbackrest_stanza_lock_status` metric is equal to `1`, then a backup is running;\n* if `pgbackrest_stanza_backup_compete_bytes` and `pgbackrest_stanza_backup_total_bytes` metric\ns are equal to `0` and `pgbackrest_stanza_lock_status` metric is equal to `1`, then one of the commands is running for stanza: `expire` or `stanza-*`. With a very high probability it is `expire`.\n\nFor `pgbackrest_version_info` metric the value is pgBackRest version in numeric format (e.g., `2057000` for version `2.57.0`).\n\n## Compatibility with pgBackRest versions\n\nThe number of collected metrics may vary depending on pgBackRest version. \n\nFor different versions, some metrics may not be collected or have insignificant label values:\n\n* `pgbackrest \u003c v2.55.0`\n    \n    The following metrics will always be `0`:\n    * `pgbackrest_version_info`.\n\n* `pgBackRest \u003c v2.48`\n    \n    The following metrics will always be `0`:\n    * `pgbackrest_stanza_backup_compete_bytes`,\n    * `pgbackrest_stanza_backup_total_bytes`.\n\n* `pgBackRest \u003e= v2.45`\n  \n    For `pgbackrest_backup_repo_size_bytes` metric the values will be `0` for block incremental backups.\n\n* `pgBackRest \u003c v2.44`\n\n    The following metrics will always be `0`: \n    * `pgbackrest_backup_repo_size_map_bytes`,\n    * `pgbackrest_backup_repo_delta_map_bytes`.\n\n    For `pgbackrest_backup_*` metrics the label will be `block_incr=\"n\"`.\n\n* `pgBackRest \u003c v2.41`\n\n    The following metrics will always be `0`: \n    * `pgbackrest_backup_databases`,\n    * `pgbackrest_backup_last_databases`,\n    * `pgbackrest_backup_annotations`,\n    * `pgbackrest_backup_last_annotations`.\n\n* `pgBackRest \u003c v2.38`\n\n    For `pgbackrest_backup_info` metric the labels will be `lsn_start=\"-\"` and `lsn_stop=\"-\"`.\n\n* `pgBackRest \u003c v2.36`\n\n    The following metrics will always be `0`:\n    * `pgbackrest_backup_error_status`.\n\n* `pgBackRest \u003c v2.32`\n\n    The following metrics will always be `0`:\n    * `pgbackrest_repo_status`.\n\n    For all metrics the label will be `repo_key=\"0\"`.\n\n## Getting Started\n### Building and running\n\n```bash\ngit clone https://github.com/woblerr/pgbackrest_exporter.git\ncd pgbackrest_exporter\nmake build\n./pgbackrest_exporter \u003cflags\u003e\n```\n\nAvailable configuration flags:\n\n```bash\n./pgbackrest_exporter --help\nusage: pgbackrest_exporter [\u003cflags\u003e]\n\n\nFlags:\n  -h, --[no-]help                Show context-sensitive help (also try --help-long and --help-man).\n      --web.telemetry-path=\"/metrics\"  \n                                 Path under which to expose metrics.\n      --web.listen-address=:9854 ...  \n                                 Addresses on which to expose metrics and web interface. Repeatable for multiple addresses. Examples: `:9100` or `[::1]:9100` for http, `vsock://:9100` for vsock\n      --web.config.file=\"\"       Path to configuration file that can enable TLS or authentication. See:\n                                 https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md\n      --collect.interval=600     Collecting metrics interval in seconds.\n      --backrest.config=\"\"       Full path to pgBackRest configuration file.\n      --backrest.config-include-path=\"\"  \n                                 Full path to additional pgBackRest configuration files.\n      --backrest.stanza-include=\"\" ...  \n                                 Specific stanza for collecting metrics. Can be specified several times.\n      --backrest.stanza-exclude=\"\" ...  \n                                 Specific stanza to exclude from collecting metrics. Can be specified several times.\n      --backrest.backup-type=\"\"  Specific backup type for collecting metrics. One of: [full, incr, diff].\n      --[no-]backrest.database-count  \n                                 Exposing the number of databases in backups.\n      --backrest.database-parallel-processes=1  \n                                 Number of parallel processes for collecting information about databases.\n      --[no-]backrest.database-count-latest  \n                                 Exposing the number of databases in the latest backups.\n      --[no-]backrest.reference-count  \n                                 Exposing the number of references to other backups (backup reference list).\n      --[no-]backrest.verbose-wal  \n                                 Exposing additional labels for WAL metrics.\n      --[no-]collector.pgbackrest  \n                                 Enable pgBackRest collector. When disabled, only pgBackRest version and exporter build info are collected.\n      --log.level=info           Only log messages with the given severity or above. One of: [debug, info, warn, error]\n      --log.format=logfmt        Output format of log messages. One of: [logfmt, json]\n      --[no-]version             Show application version.\n```\n\n#### Additional description of flags\n\nCustom `config` and/or custom `config-include-path` for `pgbackrest` command can be specified via `--backrest.config` and `--backrest.config-include-path` flags. Full paths must be specified.\u003cbr\u003e\nFor example, `--backrest.config=/tmp/pgbackrest.conf` and/or `--backrest.config-include-path=/tmp/pgbackrest/conf.d`.\n\nCustom `stanza` for collecting metrics can be specified via `--backrest.stanza-include` flag. You can specify several stanzas.\u003cbr\u003e\nFor example, `--backrest.stanza-include=demo1 --backrest.stanza-include=demo2`.\u003cbr\u003e\nFor this case, metrics will be collected only for `demo1` and `demo2` stanzas.\n\nCustom `stanza` to exclude from collecting metrics can be specified via `--backrest.stanza-exclude` flag. You can specify several stanzas.\u003cbr\u003e\nFor example, `--backrest.stanza-exclude=demo1 --backrest.stanza-exclude=demo2`.\u003cbr\u003e\nFor this case, metrics **will not be collected** for `demo1` and `demo2` stanzas.\u003cbr\u003e\nIf the same stanza is specified for include and exclude flags, then metrics for this stanza will not be collected. \nThe flag `--backrest.stanza-exclude` has a higher priority.\u003cbr\u003e\nFor example, `--backrest.stanza-include=demo1 --backrest.stanza-exclude=demo1`.\u003cbr\u003e\nFor this case, metrics **will not be collected** for `demo1` stanza.\u003cbr\u003e\nWhen flag `--backrest.stanza-exclude` is specified, the `pgbackrest_exporter_status` metric will have label `stanza=all-stanzas-except-excluded`.\n\nWhen flag `--backrest.verbose-wal` is specified - WALMin and WALMax are added as metric labels.\u003cbr\u003e\nThis creates new different time series on each WAL archiving.\n\nWhen `--log.level=debug` is specified - information of values and labels for metrics is printing to the log.\n\nThe flag `--web.config.file` allows to specify the path to the configuration for TLS and/or basic authentication.\u003cbr\u003e\nThe description of TLS configuration and basic authentication can be found at [exporter-toolkit/web](https://github.com/prometheus/exporter-toolkit/blob/v0.11.0/docs/web-configuration.md).\n\nCustom `backup type` for collecting metrics can be specified via `--backrest.backup-type` flag. Valid values: `full`, `incr` or `diff`.\u003cbr\u003e\nFor example, `--backrest.backup-type=full`.\u003cbr\u003e\nFor this case, metrics will be collected only for `full` backups.\u003cbr\u003e\nThis flag works for `pgBackRest \u003e= v2.38`.\u003cbr\u003e\nWhen parameter value is `incr` or `diff`, all `pgbackrest_backup_last_*` metrics will not be collected.\u003cbr\u003e\nWhen parameter value is `full`, the metrics will be as if the last backup was `full` (i.e. the same for `diff` and `incr`).\u003cbr\u003e\nFor earlier pgBackRest versions there will be an error like: `option 'type' not valid for command 'info'`.\n\nWhen flag `--backrest.database-count` is specified - information about the number of databases in backup is collected.\u003cbr\u003e\nThis flag works for `pgBackRest \u003e= v2.41`.\u003cbr\u003e\nFor earlier pgBackRest versions there will be an error like: `option 'set' is currently only valid for text output`.\u003cbr\u003e\nFor a significant numbers of stanzas and backups, this may require much more additional time to collect metrics. Each stanza requires pgBackRest execution for backups to get data.\n\nThe flag `--backrest.database-parallel-processes` allows to increase the number of parallel processes for collecting information about databases in backups.\u003cbr\u003e\nThis flag is valid only when the flag `--backrest.database-count` is specified.\n\nWhen flag `--backrest.database-count-latest` is specified - information about the number of databases in the last full, differential or incremental backup is collected.\u003cbr\u003e\nThis flag works for `pgBackRest \u003e= v2.41`.\u003cbr\u003e\nFor earlier pgBackRest versions there will be an error like: `option 'set' is currently only valid for text output`.\u003cbr\u003e\nFor a significant number of stanzas, this may require additional time to collect metrics. Each stanza requires pgBackRest execution for the last full, differential or incremental backups to get data.\n\nWhen the `--backrest.reference-count` flag is specified, information about the number of references to other backups (backup reference list) is collected.\u003cbr\u003e\nThe `pgbackrest_backup_references` metric can be a little annoying. This metric is hidden behind the flag. However, the `pgbackrest_backup_last_references` metric is always collected for the latest backups.\n\nWhen the `--no-collector.pgbackrest` flag is specified, only `pgbackrest_version_info` and `pgbackrest_exporter_build_info` metrics will be collected.\u003cbr\u003e\nThis is useful for lightweight monitoring for comparing pgBackRest versions in a large environment.\u003cbr\u003e\n\n### Building and running docker\n\nBy default, pgBackRest version is `2.57.0`. Another version can be specified via arguments.\nFor base image used [docker-pgbackrest](https://github.com/woblerr/docker-pgbackrest) image.\n\nEnvironment variables supported by this image:\n* all environment variables from [docker-pgbackrest](https://github.com/woblerr/docker-pgbackrest#docker-pgbackrest)  image;\n* `EXPORTER_TELEMETRY_PATH` - path under which to expose metrics, default `/metrics`;\n* `EXPORTER_PORT` - port for prometheus metrics to listen on, default `9854`;\n* `EXPORTER_CONFIG` - path to the configuration file for TLS and/or basic authentication, default `\"\"`;\n* `STANZA_INCLUDE` - specific stanza for collecting metrics, default `\"\"`;\n* `STANZA_EXCLUDE` - specific stanza to exclude from collecting metrics, default `\"\"`;\n* `COLLECT_INTERVAL` - collecting metrics interval in seconds, default `600`;\n* `BACKUP_TYPE` - specific backup type for collecting metrics, default `\"\"`;\n* `VERBOSE_WAL` - enabling additional labels for WAL metrics, default `false`;\n* `DATABASE_COUNT` - exposing the number of databases in backups, default `false`;\n* `DATABASE_PARALLEL_PROCESSES` - number of parallel processes for collecting information about databases in backups, default `1`;\n* `DATABASE_COUNT_LATEST` - exposing the number of databases in the latest backups, default `false`;\n* `COLLECTOR_PGBACKREST` - enable pgBackRest collector; when disabled, only pgBackRest version and exporter build info are collected, default `true`;\n\n#### Pull\n\nChange `tag` to the release number.\n\n* Docker Hub:\n\n```bash\ndocker pull woblerr/pgbackrest_exporter:tag\n```\n\n```bash\ndocker pull woblerr/pgbackrest_exporter:tag-alpine\n```\n\n* GitHub Registry:\n\n```bash\ndocker pull ghcr.io/woblerr/pgbackrest_exporter:tag\n```\n\n```bash\ndocker pull ghcr.io/woblerr/pgbackrest_exporter:tag-alpine\n```\n\n#### Build\n\n```bash\nmake docker\n```\n\n```bash\nmake docker-alpine\n```\n\nor for specific pgBackRest version\n\n```bash\ndocker build -f Dockerfile --build-arg BACKREST_VERSION=2.34 -t pgbackrest_exporter .\n```\n\n```bash\ndocker build -f Dockerfile --build-arg BACKREST_VERSION=2.34-alpine -t pgbackrest_exporter-alpine .\n```\n\n#### Run\n\nYou will need to mount the necessary directories or files inside the container.\n\nSimple run:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter \\\n    -p 9854:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\ \n    pgbackrest_exporter\n```\n\nWith some enviroment variables:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter \\\n    -e BACKREST_USER=postgres \\\n    -e BACKREST_UID=1001 \\\n    -e BACKREST_GROUP=postgres \\\n    -e BACKREST_GID=1001 \\\n    -e TZ=America/Chicago \\\n    -e COLLECT_INTERVAL=60 \\\n    -p 9854:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    pgbackrest_exporter\n```\n\nFor specific stanza:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter \\\n    -e STANZA_INCLUDE=demo \\\n    -p 9854:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    pgbackrest_exporter\n```\n\nIf you want to specify several stanzas for collecting metrics, \nyou can run containers on different ports:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter_demo1 \\\n    -e STANZA_INCLUDE=demo1 \\\n    -p 9854:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    pgbackrest_exporter\n\ndocker run -d \\\n    --name pgbackrest_exporter_demo2 \\\n    -e STANZA_INCLUDE=demo2 \\\n    -p 9855:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    pgbackrest_exporter\n```\n\nTo exclude specific stanza:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter \\\n    -e STANZA_EXCLUDE=demo \\\n    -p 9854:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    pgbackrest_exporter\n```\n\nFor specific backup type:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter \\\n    -e BACKUP_TYPE=full \\\n    -p 9854:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    pgbackrest_exporter\n```\n\nWith exposing the number of databases in backups:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter \\\n    -e DATABASE_COUNT=true \\\n    -p 9854:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    pgbackrest_exporter\n```\n\nWith exposing the number of databases in the latest backups:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter \\\n    -e DATABASE_COUNT_LATEST=true \\\n    -p 9854:9854 \\\n    -v  /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    pgbackrest_exporter\n```\n\nTo communicate with pgBackRest TLS server you need correct pgBackRest config, for example:\n\n```ini\n[demo]\npg1-path=/var/lib/postgresql/16/main\n\n[global]\nrepo1-host=backup\nrepo1-host-ca-file=/etc/pgbackrest/cert/pgbackrest-test-ca.crt\nrepo1-host-cert-file=/etc/pgbackrest/cert/pgbackrest-test-client.crt\nrepo1-host-key-file=/etc/pgbackrest/cert/pgbackrest-test-client.key\nrepo1-host-type=tls\nrepo1-retention-diff=2\nrepo1-retention-full=2\n```\n\nAnd run:\n\n```bash\ndocker run -d \\\n    --name pgbackrest_exporter \\\n    -e BACKREST_UID=1001 \\\n    -e BACKREST_GID=1001 \\\n    -p 9854:9854 \\\n    -v /etc/pgbackrest/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf \\\n    -v /etc/pgbackrest/cert:/etc/pgbackrest/cert \\\n    pgbackrest_exporter\n```\n\n### Running as systemd service\n\n* Register `pgbackrest_exporter` (already builded, if not - exec `make build` before) as a systemd service:\n\n```bash\nmake prepare-service\n```\n\nValidate prepared file `pgbackrest_exporter.service` and run:\n\n```bash\nsudo make install-service\n```\n\n* View service logs:\n\n```bash\njournalctl -u pgbackrest_exporter.service\n```\n\n* Delete systemd service:\n\n```bash\nsudo make remove-service\n```\n\n---\nManual register systemd service:\n\n```bash\ncp pgbackrest_exporter.service.template pgbackrest_exporter.service\n```\n\nIn file `pgbackrest_exporter.service` replace `{PATH_TO_FILE}` to full path to `pgbackrest_exporter`.\n\n```bash\nsudo cp pgbackrest_exporter.service /etc/systemd/system/pgbackrest_exporter.service\nsudo systemctl daemon-reload\nsudo systemctl enable pgbackrest_exporter.service\nsudo systemctl restart pgbackrest_exporter.service\nsystemctl -l status pgbackrest_exporter.service\n```\n\n### RPM/DEB packages\n\nYou can use the already prepared rpm/deb package to install the exporter. Only the pgbackrest_exporter binary  and the service file are installed by package.\n\nFor example:\n```bash\nrpm -ql pgbackrest_exporter\n\n/etc/systemd/system/pgbackrest_exporter.service\n/usr/bin/pgbackrest_exporter\n```\n\n### Running tests\n\nRun the unit tests:\n\n```bash\nmake test\n```\n\nRun the end-to-end tests:\n\n```bash\nmake test-e2e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoblerr%2Fpgbackrest_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoblerr%2Fpgbackrest_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoblerr%2Fpgbackrest_exporter/lists"}