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

867 views
Skip to first unread message

Антон Пацев

unread,
Feb 16, 2023, 3:24:07 PM2/16/23
to Prometheus Users
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 ?

Антон Пацев

unread,
Feb 17, 2023, 12:53:26 AM2/17/23
to Prometheus Users
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, Антон Пацев:
Reply all
Reply to author
Forward
0 new messages