Proxmox Backup Server Module API Explanation
The Proxmox Backup Server (PBS) module tracks backup snapshots count and deduplicated datastore capacities.
API Execution Logic
The module locates the service matching the identifier pbs. It loads the credentials (PBS_API_TOKEN and PBS_API_SECRET) and maps them to the Authorization: PBSAPIToken=[TOKEN]:[SECRET] header.
Multi-Endpoint Request Execution
To collect metrics across multiple backup datastores, the module executes a series of queries:
- Datastores List: It queries the endpoint
/api2/json/admin/datastoreto retrieve the list of configured datastores. - Datastore Status: For each datastore found, it queries
/api2/json/admin/datastore/[NAME]/statusto fetch capacity details (used and total bytes). - Snapshots Count: It queries
/api2/json/admin/datastore/[NAME]/snapshotsto list all backup snapshots.
Data Aggregation
- Primary Metric: The total count of backup snapshots across all datastores.
- Secondary Metric: The deduplicated backup repository size. The combined used bytes and total capacity are converted into a human-readable string (e.g.
245.3 GB / 1.5 TB) using a base-1024 formatter.
Caching Strategy
The PBS telemetry is cached for 60 seconds (TTL) with a stale window of 300 seconds. Timeouts are limited to 10 seconds per request.