Skip to content

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:

  1. Dashboard Summary Query: A POST request is dispatched to /v1.Backrest/GetSummaryDashboard using Basic Authentication and a Content-Type: application/json header. The request body is sent as an empty JSON object ({}).
  2. Repository Processing: The response is parsed to extract the list of repositories from the repoSummaries array. The scanned bytes over the last 30 days are summed for all repositories.
  3. Snapshot Enumeration Query: For each repository found, a subsequent POST request is sent to /v1.Backrest/ListSnapshots containing the repoId in 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.