Rest-Server Metrics Prometheus Url

Hi guys,

i have a restic rest-server running and working with following config.

  • prometheus
  • private-repos
  • append-only

Additionally i generated a .htpasswd file and added the user ‘someuser’ to it.

On the remote server - which i want to backup - i have created a resticenv.sh with this content:

#!/usr/bin/bash
export RESTIC_REPOSITORY="rest:http://restserver.mydomain.com:12345/someuser/myrepo"
export RESTIC_PASSWORD="verysecurepass"
export RESTIC_REST_USERNAME=someuser
export RESTIC_REST_PASSWORD=securepass
export RESTIC_CACHE_DIR="/data/restic_cache/restic"

After i ran

source resticenv.sh

i was able to create a repository with:

restic init

So far so good.

i can run backups and check them with restic snapshots

so now i want to monitor the backups with Prometheus so a added a

The Prometheus entry:

  - job_name: 'restic_backup'
    metrics_path: '????'
    basic_auth:
      username: someuser
      password: "securepass"
    static_configs:
      - targets: ["restserver.mydomain.com:12345"]

What is the right path for the metrics?

From the docs i assumed it was /metrics or because of the ‘private-repos’ flag: /someuser/metrics

So i tried those and these are the results:

/metrics                  -> 401 Unauthorized
/someuser                 -> 401 Unauthorized
/someuser/metrics         -> 404 Not Found
/someuser/myrepo          -> 404 Not Found
/someuser/myrepo/metrics  -> 404 Not Found

i also tried with curl

curl -v -X GET -u someuser:securepass http://restserver.mydomain.com:12345{URLS_ABOVE}

What should be the right URL?

My Restic_Rest Password looks something like this: ApyKsyns4CiJgMVZOjHaLp@2R.
Could the “@” be a problem?
I tried changing the password to something simple (of course restarted the restic server) - but the responses are the same.

It’s been a long time since I set this up on my system; your prometheus entry looks similar to mine, but I didn’t specify a metrics path. I’ve pasted mine below for comparison in case that helps:

  - job_name: 'rest_server'
    scrape_interval: 5s
    # Uncomment these if you use auth and/or https
    basic_auth:
      username: user
      password: password
    #scheme: https
    static_configs:
      - targets: ['restic:8000']

According to the rest-server readme (GitHub - restic/rest-server: Rest Server is a high performance HTTP server that implements restic's REST backend API.), the metrics path should be /metrics, and the fact that you get a 401 unauthorised when trying to access it suggests that there is something at that url.

I wonder if it could be an authentication thing? It might be worth testing with --prometheus-no-auth to rule that out. Once you turn authentication off, you may be able to get more than just a 401 from the /metrics endpoint using curl.

Finally, it’s definitely worth looking at the example docker setup linked in the readme if you’ve not already seen that (rest-server/examples/compose-with-grafana/README.md at master · restic/rest-server · GitHub), I copied liberally from that when configuring mine.