Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default blackbox.yml seems to throw an error with the Labels field. #1295

Open
Bilgecrank opened this issue Sep 13, 2024 · 2 comments
Open

Comments

@Bilgecrank
Copy link

BLUF: I have been following some of the tutorials in setting up the blackbox exporter through the use of the Docker image, but using the default config files seems to throw an error for the labels field. Removing the labels field seems to make it work, but this doesn't seem intended.

Host operating system:

Linux caxton 6.10.8-arch1-2.1-g14 #1 SMP PREEMPT_DYNAMIC Sat, 07 Sep 2024 06:01:43 +0000 x86_64 GNU/Linux

blackbox_exporter version:

Docker 0.25.0

What is the blackbox.yml module config.

The result of curl -o blackbox.yml https://raw.githubusercontent.com/prometheus/blackbox_exporter/master/blackbox.yml

modules:
  http_2xx:
    prober: http
    http:
      preferred_ip_protocol: "ip4"
  http_post_2xx:
    prober: http
    http:
      method: POST
  tcp_connect:
    prober: tcp
  pop3s_banner:
    prober: tcp
    tcp:
      query_response:
      - expect: "^+OK"
      tls: true
      tls_config:
        insecure_skip_verify: false
  grpc:
    prober: grpc
    grpc:
      tls: true
      preferred_ip_protocol: "ip4"
  grpc_plain:
    prober: grpc
    grpc:
      tls: false
      service: "service1"
  ssh_banner:
    prober: tcp
    tcp:
      query_response:
      - expect: "^SSH-2.0-"
      - send: "SSH-2.0-blackbox-ssh-check"
  ssh_banner_extract:
    prober: tcp
    timeout: 5s
    tcp:
      query_response:
      - expect: "^SSH-2.0-([^ -]+)(?: (.*))?$"
        labels:
        - name: ssh_version
          value: "${1}"
        - name: ssh_comments
          value: "${2}"
  irc_banner:
    prober: tcp
    tcp:
      query_response:
      - send: "NICK prober"
      - send: "USER prober prober prober :prober"
      - expect: "PING :([^ ]+)"
        send: "PONG ${1}"
      - expect: "^:[^ ]+ 001"
  icmp:
    prober: icmp
  icmp_ttl5:
    prober: icmp
    timeout: 5s
    icmp:
      ttl: 5

What is the prometheus.yml scrape config.

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["localhost:9090"]

  - job_name: "node"
    static_configs:
      - targets: ['prom-node:9100']
  - job_name: "postgres"
    static_configs:
      - targets: ['prom-postgres:9187']
  - job_name: "nginx"
    static_configs:
      - targets: ['host.docker.internal:9113']
  - job_name: "blackbox"
    static_configs:
      - targets: ['host.docker.internal:9115']

What did you do that produced an error?

Used the default config file supplied by blackbox tutorials.

What did you expect to see?

This is what I see when I remove the Labels section from the config.

ts=2024-09-13T15:12:55.318Z caller=main.go:88 level=info build_context="(go=go1.22.2, platform=linux/amd64, user=root@47d5b0d99f18, date=20240409-12:58:39, tags=unknown)"
ts=2024-09-13T15:12:55.318Z caller=main.go:100 level=info msg="Loaded config file"
ts=2024-09-13T15:12:55.318Z caller=tls_config.go:313 level=info msg="Listening on" address=[::]:9115
ts=2024-09-13T15:12:55.318Z caller=tls_config.go:316 level=info msg="TLS is disabled." http2=false address=[::]:9115

What did you see instead?

With the file as is.

ts=2024-09-13T15:05:39.872Z caller=main.go:87 level=info msg="Starting blackbox_exporter" version="(version=0.25.0, branch=HEAD, revision=ef3ff4fef195333fb8ee0039fb487b2f5007908f)"
ts=2024-09-13T15:05:39.872Z caller=main.go:88 level=info build_context="(go=go1.22.2, platform=linux/amd64, user=root@47d5b0d99f18, date=20240409-12:58:39, tags=unknown)"
ts=2024-09-13T15:05:39.872Z caller=main.go:91 level=error msg="Error loading config" err="error parsing config file: yaml: unmarshal errors:\n  line 42: field labels not found in type config.plain"
@shadow4040
Copy link

same problem here, after installing prometheus+blackbox from newest version. (Docker package version untouched)

@electron0zero
Copy link
Member

you are using the config from master with version: 0.25.0 of Blackbox exporter. config from the version 0.25.0 should work, please use the default config from https://github.com/prometheus/blackbox_exporter/blob/v0.25.0/blackbox.yml

labels was added in #1284, and is not released yet. the config from master should work if you build blackbox exporter from the master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants