Prometheus
Scrape DownloadPulse's /api/metrics endpoint with Prometheus, using an Integration token when sign-in is on, and what each metric means.
- Desktop
- Server
On this page
DownloadPulse publishes Prometheus metrics at /api/metrics, in Prometheus’s text format. Point a Prometheus scrape job at it. When sign-in is on, give the scraper an Integration token. This page shows the scrape configuration and lists every metric.
Before you begin
Link to this section: Before you begin- The address. The metrics are at
/api/metricson the address where Prometheus reaches DownloadPulse.- Server: the container’s address, port
8095, for examplehttp://downloadpulse.lan:8095/api/metrics. - Desktop: the Local Port,
http://127.0.0.1:8095/api/metricsunless changed. It listens on this computer only, so Prometheus must run on the same computer.
- Server: the container’s address, port
- A credential, when sign-in is on. With Username & Password or OpenID Connect sign-in enabled,
/api/metricsneeds a credential like the rest of the API. Without one it answers401. With no sign-in, it answers without one.
Step 1: Issue a token for Prometheus
Link to this section: Step 1: Issue a token for Prometheus- Open Settings › Users & Access (Settings › Access & Integrations on a Standalone installation and the desktop app).
- In Integration Accounts, choose Add Integration Account and name it, for example
Prometheus. You can also use the default Automation account. - In its row, choose Issue Token, enter a Token Label such as
prometheus, and choose Issue Token. - Copy the token (
dp_…) from Copy Your New Token. It is shown once.
An Integration token can read the metrics and nothing that a monitoring tool doesn’t need: it cannot see Settings, the Downloads list or other accounts’ requests. For more on tokens, see API and tokens.
Server: where Username & Password sign-in is on, an Admin’s HTTP Basic credentials also work for
/api/metrics. A dedicated Integration token is the better choice: you can revoke it on its own, and it can do far less.
Note: DownloadPulse versions before accounts had a single global API token. It was retired. A Prometheus that still sends the old token is refused: give it an Integration token.
Step 2: Add the scrape job
Link to this section: Step 2: Add the scrape jobStore the token in a file that only Prometheus can read, for example /etc/prometheus/downloadpulse.token, containing just the token. Then add a job to prometheus.yml:
scrape_configs:
- job_name: downloadpulse
metrics_path: /api/metrics
authorization:
type: Bearer
credentials_file: /etc/prometheus/downloadpulse.token
static_configs:
- targets: ["downloadpulse.lan:8095"]For HTTPS, for example through a reverse proxy, add scheme: https and use the proxy’s host and port as the target.
If you prefer the token inline:
authorization:
type: Bearer
credentials: dp_REPLACE_WITH_TOKENWith no sign-in on DownloadPulse, leave out the authorization block.
Reload Prometheus so it picks up the new job.
Check it by hand
Link to this section: Check it by handcurl -H 'Authorization: Bearer dp_REPLACE_WITH_TOKEN' \
http://downloadpulse.lan:8095/api/metricsThe metrics
Link to this section: The metricsEvery metric is a gauge under the downloadpulse_ prefix. They describe DownloadPulse’s transfers in general; none is named after a particular service or engine.
| Metric | Meaning |
|---|---|
downloadpulse_transfers_total |
Number of transfers across all statuses |
downloadpulse_transfers_by_status{status="…"} |
Number of transfers in each status, one series per status that currently has transfers (for example completed, deleted) |
downloadpulse_active_downloads |
Transfers currently in the queued or downloading state |
downloadpulse_completed_downloads |
Transfers completed |
downloadpulse_error_transfers |
Transfers in the error state |
downloadpulse_pending_files |
Download files in the pending state, waiting for an available execution slot |
downloadpulse_sse_subscribers |
Number of open live-update connections (browser pages following DownloadPulse live) |
downloadpulse_downloaded_bytes_total |
Total bytes of completed transfers |
A sample answer:
# HELP downloadpulse_transfers_total Number of transfers across all statuses
# TYPE downloadpulse_transfers_total gauge
downloadpulse_transfers_total 24
downloadpulse_transfers_by_status{status="completed"} 4
downloadpulse_transfers_by_status{status="deleted"} 20
# HELP downloadpulse_active_downloads Transfers currently in queued or downloading state
# TYPE downloadpulse_active_downloads gauge
downloadpulse_active_downloads 0
# HELP downloadpulse_completed_downloads Total transfers completed
# TYPE downloadpulse_completed_downloads gauge
downloadpulse_completed_downloads 4
# HELP downloadpulse_error_transfers Transfers in error state
# TYPE downloadpulse_error_transfers gauge
downloadpulse_error_transfers 0
# HELP downloadpulse_pending_files Download files in pending state (waiting for an available execution slot)
# TYPE downloadpulse_pending_files gauge
downloadpulse_pending_files 0
# HELP downloadpulse_sse_subscribers Number of SSE connections
# TYPE downloadpulse_sse_subscribers gauge
downloadpulse_sse_subscribers 0
# HELP downloadpulse_downloaded_bytes_total Total bytes downloaded (completed transfers)
# TYPE downloadpulse_downloaded_bytes_total gauge
downloadpulse_downloaded_bytes_total 1483819529Reading the numbers
Link to this section: Reading the numbers- The counts come from DownloadPulse’s transfer records at the moment of the scrape.
downloadpulse_transfers_totalincludes every status,deletedamong them. downloadpulse_completed_downloadsanddownloadpulse_downloaded_bytes_totalcount the transfers whose status iscompletednow. Both are gauges, not counters: they can fall, for example after a database reset in Data & Maintenance, which erases downloads and their history.downloadpulse_active_downloadsis the sum of the queued and downloading transfers.
Tip: for figures over time (completions, speeds, services), see DownloadPulse’s own Statistics page. An Integration token can also read the aggregate
/api/stats, which dashboards such as Homepage use.
Troubleshooting
Link to this section: Troubleshooting| Symptom | What to check |
|---|---|
The target is down with 401 |
Sign-in is on and the scrape has no valid credential. Check the token, that it is not revoked, and that its Integration account is enabled. |
403 |
The credential is not allowed to read metrics, for example a ReadOnly User’s. Use an Integration token. |
| The target is unreachable (desktop) | The desktop app listens on 127.0.0.1 only. Run Prometheus on the same computer, and check the Local Port in Settings › Access & Integrations. |
| The target is unreachable (server) | Check the container’s port mapping. The container listens on 8095. |
503 with “prometheus-client is not installed” |
The installation is missing its metrics library. Add it to requirements.txt and rebuild, as the message says. |