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

promtool return zero code on validation error (unmarshall errors) #10913

Closed
thrix opened this issue Jun 24, 2022 · 3 comments · Fixed by #10952
Closed

promtool return zero code on validation error (unmarshall errors) #10913

thrix opened this issue Jun 24, 2022 · 3 comments · Fixed by #10952

Comments

@thrix
Copy link

thrix commented Jun 24, 2022

What did you do?

$ promtool check config inputs/prometheus/prometheus.yml; echo $?
  FAILED: parsing YAML file /tmp/prometheus.yml: yaml: unmarshal errors:
  line 22: field relabel_configs not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
  line 23: field source_labels not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
  line 24: field target_label not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
  line 25: field source_labels not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
  line 26: field target_label not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
  line 27: field target_label not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }
  line 28: field replacement not found in type struct { Targets []string "yaml:\"targets\""; Labels model.LabelSet "yaml:\"labels\"" }

0

What did you expect to see?

Promtool fails with non-zero return code

What did you see instead? Under which circumstances?

Zero return code

System information

Linux 5.17.7-300.fc36.x86_64 x86_64

Prometheus version

promtool, version 2.36.2 (branch: HEAD, revision: d7e7b8e04b5ecdc1dd153534ba376a622b72741b)
  build user:       root@f051ce0d6050
  build date:       20220620-13:21:35
  go version:       go1.18.3
  platform:         linux/amd64

Prometheus configuration file

global:
  scrape_interval:     20s
  evaluation_interval: 5s

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

# Scrape configurations
scrape_configs:
  - job_name: "invalid"
    metrics_path: /probe
    params:
      module:
        - http_fuse
    static_configs:
      - targets:
        - https://someurl
        relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: blackbox-exporter:9115

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

@Equwece
Copy link

Equwece commented Jun 24, 2022

Hello, downgrading Prometheus to 2.36.0 solved this problem for me.

@Nexucis
Copy link
Member

Nexucis commented Jun 27, 2022

based on this PR #10840, I think you should enable the flag --lint-fatal and then it should rework as before.

@roidelapluie
Copy link
Member

Thanks for reporting this bug, it is solved in #10952

@prometheus prometheus locked as resolved and limited conversation to collaborators Dec 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants