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 reports incorrect line numbers #2857

Closed
wwalker opened this Issue Jun 16, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@wwalker
Copy link

wwalker commented Jun 16, 2017

What did you do?

ran promtool against a file with avg(...[5m]). The time range is invalid for avg().

What did you expect to see?

Checking /etc/prometheus/alerting.rules
  FAILED: parse error at line 3, char 167: expected type vector in aggregation expression, got matrix

What did you see instead? Under which circumstances?

Checking /etc/prometheus/alerting.rules
  FAILED: parse error at line 175, char 2: expected type vector in aggregation expression, got matrix

NOTE: The file is 174 lines long

Environment
Ubuntu 16.04

  • System information:

    Linux 3.13.0-95-generic x86_64

  • Promtool version:

    wwalker@test-prom-01:~$ promtool version
    promtool, version 1.3.0 (branch: master, revision: 18254a1)
    build user: root@d363f050a0e0
    build date: 20161101-17:06:27
    go version: go1.7.3

  • Alertmanager configuration file:

a smaller example with the same failure. The erro is on line 3 at char 95

wwalker@serenity:~$ wc alerting.rules
 19 115 775 alerting.rules
wwalker@serenity:~$ promtool check-rules alerting.rules
Checking alerting.rules
  FAILED: parse error at line 20, char 2: expected type vector in aggregation expression, got matrix
# Alert if 25% of the workers are down
ALERT WorkersDown2
  IF avg_over_time(up{job='node',role='worker'}[5m]) == 0 and avg(up{job='node',role='worker'}[5m]) < 0.80
  FOR 5m
  LABELS { severity = "critical", name = "WorkersDown" }
  ANNOTATIONS {
    summary = "multiple workers {{ $labels.instance }} down",
    description = "{{ $labels.instance }} of job {{ $labels.job }} have been down for more than 5 minutes."
  }

# Alert for any instance that is unreachable for >5 minutes.
ALERT InstanceDown
  IF up{job='node'} == 0
  FOR 5m
  LABELS { severity = "critical", name = "InstanceDown" }
  ANNOTATIONS {
    summary = "Instance {{ $labels.instance }} down",
    description = "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."
  }
  • Logs:
none applicable
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jun 16, 2017

Sounds like a dupe of #2014

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.