Backrest Module API Explanation
The Backrest module aggregates backup repository statistics, successful snapshot counts, and scanned volume sizes.
API Execution Logic
The module locates the service matching the identifier backrest. The target URL is parsed, and administrative credentials (BACKREST_USERNAME and BACKREST_PASSWORD) are loaded.
Multi-Step Request Execution
Because Backrest does not expose a single endpoint displaying aggregated snapshot details across multiple repositories, a multi-step query flow is executed:
- Dashboard Summary Query: A POST request is dispatched to
/v1.Backrest/GetSummaryDashboardusing Basic Authentication and aContent-Type: application/jsonheader. The request body is sent as an empty JSON object ({}). - Repository Processing: The response is parsed to extract the list of repositories from the
repoSummariesarray. The scanned bytes over the last 30 days are summed for all repositories. - Snapshot Enumeration Query: For each repository found, a subsequent POST request is sent to
/v1.Backrest/ListSnapshotscontaining therepoIdin the JSON body. This retrieves the list of active snapshots for that repository.
Data Parsing and Unit Conversion
- Primary Metric: The total count of snapshots aggregated across all repositories.
- Secondary Metric: The total volume of scanned bytes over the last 30 days. The bytes value is converted to a human-readable format using a threshold-based sizing utility (supporting TB, GB, MB, and KB divisions based on powers of 1024).
Caching Strategy
Due to the multi-query nature of this module, a cache TTL of 60 seconds and a max stale limit of 300 seconds are enforced. Request timeouts are limited to 10 seconds per API call.