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

"on ()" keyword ignored in alert IF statement when loaded from rules file #2082

Closed
brymatm opened this Issue Oct 13, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@brymatm
Copy link

brymatm commented Oct 13, 2016

What did you do?

I added lines similar to the following (one recording rule, multiple alerts) to my rules file and restarted my Prometheus server:

workhours=day_of_week() < bool 6 * hour() >= bool 13 * hour() < bool 22

ALERT rateAlert_server_datafeed
IF rate(server_datafeed[10m]) == 0 and on () workhours == 1
LABELS { topic = "datafeed", }
ANNOTATIONS {
summary = "Topic datafeed on {{ $labels.job }} has not received a message for at least 10 minutes",
subject = "No messages for topic datafeed on {{ $labels.job }}",
}

What did you expect to see?

On the Prometheus Status|Rules page I expected to see something like this:

workhours{} = day_of_week() < BOOL 6 * hour() >= BOOL 13 * hour() < BOOL 22
ALERT rateAlert_server_datafeed
IF rate(server_datafeed[10m]) == 0 and on () workhours == 1
LABELS {topic="datafeed"}
ANNOTATIONS {subject="No messages for topic datafeed on {{ $labels.job }}", summary="Topic datafeed on {{ $labels.job }} has not received a message for at least 10 minutes"}

What did you see instead? Under which circumstances?

On the Prometheus Status|Rules page I saw something like this with the IF statement missing the "on ()" keyword:

workhours{} = day_of_week() < BOOL 6 * hour() >= BOOL 13 * hour() < BOOL 22
ALERT rateAlert_server_datafeed
IF rate(server_datafeed[10m]) == 0 and workhours == 1
LABELS {topic="datafeed"}
ANNOTATIONS {subject="No messages for topic datafeed on {{ $labels.job }}", summary="Topic datafeed on {{ $labels.job }} has not received a message for at least 10 minutes"}

Environment

  • System information:

Linux 2.6.32-358.el6.x86_64 x86_64

  • Prometheus version:

prometheus, version 1.2.1 (branch: master, revision: dd66f2e)
build user: root@fd9b0daff6bd
build date: 20161010-15:58:23
go version: go1.7.1

  • Alertmanager version:
  • Prometheus configuration file:
  • Alertmanager configuration file:
  • Logs:
@grobie

This comment has been minimized.

Copy link
Member

grobie commented Oct 13, 2016

The issue is that the printer only shows vector matching related keywords if any matching labels are provided. I guess we'll need a way to indicate whether a field was set, bool pointers or an additional field come to my mind.

brian-brazil added a commit that referenced this issue Oct 19, 2016

brian-brazil added a commit that referenced this issue Oct 19, 2016

beorn7 added a commit that referenced this issue Oct 28, 2016

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 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 24, 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.