I am new to Prometheus and its Alert Manager.

I am using this alertmanager.yml:

global:
  resolve_timeout: 5m

route:
  #group_by: ['alertname']
  group_wait: 1s
  group_interval: 1s
  repeat_interval: 1h
  receiver: 'web.hook'
receivers:
- name: 'web.hook'
  webhook_configs:
  - url: 'http://localhost:2222/alert'

My Prometheus rules.yml is:
groups:
  - name: default
    rules:
      - alert: RequestRate
        expr: rate(my_counter[1m]) > 0
        #for: 1s #this is optional.
        labels:
          severity: high
        annotations:
          summary: rate counter 1m more than 0

The relevant part in my node.js is simply: 
app.use( "/alert", (req, res) => {
    console.log("alert received")
    res.status(200).send("ok");
    return;
});

This is working as expected. AlertManager calls http://localhost:2222/alert 
and I got "alert received". But here's the thing, it calls two times - as 
expected, but the first time is when the alert goes off, but the second 
time is when the alert has been resolved. I do not know which is for "the 
alert goes off" and "resolve". I have checked in the req parameter, but I 
do not see anything that could be of use, unless I am missing something...

So:

1. how can we differentiate the "alert goes off" and the "alert has been 
resolved" in this case?

2. What is the "resolve" time? Immediately if the expr in rules.yml is 
false in the next evaluation_interval?

Regards,
Iono


-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/8c5291aa-ec6b-4fbe-abd2-a36ea6f1dd90n%40googlegroups.com.

Reply via email to