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 syntax detects errors #13963

Open
coderlzw-cn opened this issue Apr 20, 2024 · 1 comment
Open

promtool syntax detects errors #13963

coderlzw-cn opened this issue Apr 20, 2024 · 1 comment

Comments

@coderlzw-cn
Copy link

What did you do?

promtool check rules prometheus.yml

What did you expect to see?

v2.46.0 can directly use the default configuration detection is ok, what does the new version do

What did you see instead? Under which circumstances?

Checking prometheus.yml
FAILED:
prometheus.yml: yaml: unmarshal errors:
line 2: field global not found in type rulefmt.RuleGroups
line 8: field alerting not found in type rulefmt.RuleGroups
line 15: field rule_files not found in type rulefmt.RuleGroups
line 21: field scrape_configs not found in type rulefmt.RuleGroups

System information

docker

Prometheus version

prometheus, version 2.51.2 (branch: HEAD, revision: b4c0ab52c3e9b940ab803581ddae9b3d9a452337)
  build user:       root@273ef2abb52b
  build date:       20240410-14:05:54
  go version:       go1.22.2
  platform:         darwin/amd64
  tags:             netgo,builtinassets,stringlabels

Prometheus configuration file

No response

Alertmanager version

No response

Alertmanager configuration file

# 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"]

Logs

No response

@dgl
Copy link
Member

dgl commented Apr 21, 2024

check rules is designed for Prometheus rules. I think you’ve provided either a Prometheus config or an alertmanager config. Those need either promtool check config or amtool check-config.

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

2 participants