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

alert condition using: time() not fired #1228

Closed
lethe3000 opened this Issue Nov 19, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@lethe3000
Copy link

lethe3000 commented Nov 19, 2015

Hi, I want to alert if a container which is disappear more than 5s,but I cannot make condition time() - container_last_seen > 5 fired.

ALERT ContainerDown
  IF time() - container_last_seen{name="nginx"} > 5
  FOR 1s
  SUMMARY "container{{$lables.name}} is down on {{$labels.instance}}"
  DESCRIPTION "container{{$labels.name}} down on {{$labels.instance}}"
  RUNBOOK ""

I stopped nginx container, and I executed below query, found that the value is greater than 5.

time() - container_last_seen{name="nginx"}

So I wonder that cannot use time() in alert conditions?

@matthiasr

This comment has been minimized.

Copy link
Contributor

matthiasr commented Nov 19, 2015

No, this should work fine. However, your label values differ – = wants an exact match, and I presume there is no container called "nginx" and thus there is nothing to return.

@lethe3000

This comment has been minimized.

Copy link
Author

lethe3000 commented Nov 20, 2015

thanks I think I shoud use =~ to match container name.

@lethe3000 lethe3000 closed this Nov 20, 2015

@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.