Fixed config:
```
config:
  modules:
    http_2xx:
      prober: http
      timeout: 5s
      http:
        valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
        follow_redirects: true
        preferred_ip_protocol: "ip4"
    http_basic_auth_password_file:
      prober: http
      timeout: 5s
      http:
        method: GET
        valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
        preferred_ip_protocol: "ip4"
        basic_auth:
          username: "admin"
          password_file: "/grafana-password/grafana-password.txt"
```

and
```
    additionalScrapeConfigs:
      - job_name: "grafana-login"
        scrape_interval: 5s
        enable_http2: false
        scheme: http
        metrics_path: "/probe"
        params:
          module: [ "http_basic_auth_password_file" ]
        relabel_configs:
          - source_labels: [ "__address__" ]
            target_label: "__param_target"
          - source_labels: [ "__param_target" ]
            target_label: "instance"
          - target_label: "__address__"
            replacement: "prometheus-blackbox-exporter:9115"
        static_configs:
          - targets:
              - http://grafana.apatsev.org.ru
```

пятница, 17 февраля 2023 г. в 02:24:07 UTC+6, Антон Пацев: 

> Hello!
> I try use password_file in prometheus-blackbox-exporter with 
> kube-prometheus-stack and get error. 
> ```
> Error loading config" err="error parsing config file: yaml: unmarshal 
> errors:\n  line 1: field http_basic_auth_password_file not found in type 
> config.plain
> ```
>
> grafana-password.txt contain:
> ```
> prom-operator
> ```
> values-kube-prometheus-stack.yaml have
> ```
>     additionalScrapeConfigs:
>       - job_name: "grafana-login"
>         metrics_path: "/"
>         params:
>           module: [ "http_basic_auth_password_file" ]
>         relabel_configs:
>           - source_labels: [ "__address__" ]
>             target_label: "__param_target"
>           - source_labels: [ "__param_target" ]
>             target_label: "instance"
>           - target_label: "__address__"
>             replacement: "prometheus-blackbox-exporter:9115"
>         static_configs:
>           - targets:
>               - grafana.apatsev.org.ru
> ```
>
> values-prometheus-blackbox-exporter.yaml have
> ```
> config:
>   modules:
>     http_2xx:
>       prober: http
>       timeout: 5s
>       http:
>         valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
>         follow_redirects: true
>         preferred_ip_protocol: "ip4"
>   http_basic_auth_password_file:
>     prober: http
>     timeout: 15s
>     http:
>       method: POST
> #      headers:
> #        Host: "grafana.apatsev.org.ru"
>       basic_auth:
>         username: "admin"
>         password_file: "/grafana-password"
>
> ## Additional secret mounts
> # Defines additional mounts with secrets. Secrets must be manually created 
> in the namespace.
> extraSecretMounts:
>    - name: grafana-password
>      mountPath: /grafana-password
>      secretName: grafana-password
>      readOnly: true
>      defaultMode: 420
> ```
> How fix ?
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/5ec9d535-6e1e-4d99-8751-1aec1a7e7915n%40googlegroups.com.

Reply via email to