ngosang / restic-exporter

Prometheus exporter for the Restic backup system
MIT License
79 stars 17 forks source link

Basic Auth support #3

Open v4rakh opened 1 year ago

v4rakh commented 1 year ago

Hi, thanks for providing this. Would it be possible to have basic auth support in and being able to set user and pass via env var?

ngosang commented 1 year ago

You mean in the /metrics endpoint?

v4rakh commented 1 year ago

Yes, exactly.

ngosang commented 1 year ago

The purpose of this exported is to be consumed by Prometheus. I never saw an exporter with basic auth and I think the prometheus client does not support it. If you are worried about unauthorized access to the endpoint, you can do it with network policies. If you are using Docker containers it's even easier. Anyway there is no much to be worried about, the info exposed is not sensitive.

Btw, new release is out => https://github.com/ngosang/restic-exporter/releases/tag/1.1.0

v4rakh commented 1 year ago

@ngosang The /metrics endpoint which is being scraped and the scraping being configured in the prometheus.yml allows to specify basic auth in that configuration. A lot of the exporters allow to secure the exposed metrics endpoint, like the default node-exporter or the node-systemd-exporter.

I'd imagine that it might be useful. Sure, I can solve it with network, but for a simple setup, maybe basic auth is just enough.

But OK, if that's nothing you'd consider, then there's nothing I can do. :-)

ngosang commented 1 year ago

You are right. It's supported by the python client library and Prometheus. I didn't know about that. I'm not interested in implement this feature but I can accept PRs. Example code => https://github.com/prometheus/client_python#handlers-for-authentication