password_file basic auth for scrape config

301 views
Skip to first unread message

Justin Thomas

unread,
Aug 13, 2020, 9:56:54 AM8/13/20
to Prometheus Users
The prometheus docs have the below:

# Sets the `Authorization` header on every scrape request with the
# configured username and password.
# password and password_file are mutually exclusive.
basic_auth:
  [ username: <string> ]
  [ password: <secret> ]
  [ password_file: <string> ]

What is the format of password_file?  I know you can create a file with htpasswd, but that has the hashed version of the password so would assume that isn't what the scrape config needs to make a request to a /metrics with basic auth.  Any examples around?

Julien Pivotto

unread,
Aug 13, 2020, 9:58:57 AM8/13/20
to Justin Thomas, Prometheus Users
On 13 Aug 06:56, Justin Thomas wrote:
> The prometheus docs have the below:
>
> # Sets the `Authorization` header on every scrape request with the
> # configured username and password.
> # password and password_file are mutually exclusive.
> basic_auth:
> [ username: <string> <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#string> ]
> [ password: <secret> <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#secret> ]
> [ password_file: <string> <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#string> ]
>
>
> What is the format of password_file? I know you can create a file with
> htpasswd, but that has the hashed version of the password so would assume
> that isn't what the scrape config needs to make a request to a /metrics
> with basic auth. Any examples around?

The file must just contain the password in plaintext.

>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/a0a2e662-ad1e-463b-91b0-2b541e1a36cao%40googlegroups.com.


--
Julien Pivotto
@roidelapluie

Justin Thomas

unread,
Aug 13, 2020, 11:42:54 AM8/13/20
to Prometheus Users
What about the username?  


On Thursday, August 13, 2020 at 6:58:57 AM UTC-7, Julien Pivotto wrote:
On 13 Aug 06:56, Justin Thomas wrote:
> The prometheus docs have the below:
>
> # Sets the `Authorization` header on every scrape request with the
> # configured username and password.
> # password and password_file are mutually exclusive.
> basic_auth:
>   [ username: <string> <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#string> ]
>   [ password: <secret> <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#secret> ]
>   [ password_file: <string> <https://prometheus.io/docs/prometheus/latest/configuration/configuration/#string> ]
>
>
> What is the format of password_file?  I know you can create a file with
> htpasswd, but that has the hashed version of the password so would assume
> that isn't what the scrape config needs to make a request to a /metrics
> with basic auth.  Any examples around?

The file must just contain the password in plaintext.

>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.

Julien Pivotto

unread,
Aug 13, 2020, 11:45:54 AM8/13/20
to Justin Thomas, Prometheus Users
It is the username string in the main config file.
> > an email to promethe...@googlegroups.com <javascript:>.
> > > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/prometheus-users/a0a2e662-ad1e-463b-91b0-2b541e1a36cao%40googlegroups.com.
> >
> >
> >
> > --
> > Julien Pivotto
> > @roidelapluie
> >
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/3202b4a9-b9ee-45e4-812e-af5f1e8c990ao%40googlegroups.com.


--
Julien Pivotto
@roidelapluie
Reply all
Reply to author
Forward
0 new messages