Hi,

I am trying to create an alert for stopped containers.

If I am using the exact container name I have no problem:

 -* alert: ContainerKilled*
*    expr:  absent(container_start_time_seconds{name="be-dev-4"})*
*    for: 15m*
*    labels:*
*      severity: 'warning'*
*    annotations:*
*      summary: 'Container killed'*
*      description: 'A container{{ $labels.name }} has disappeared'*

However, if i am trying to use regexp for the container name (as I have a 
few containers with this suffix) , then it fails whatever I try - 
If I use this, then no alert is sent:
 * - alert: ContainerKilled*
*    expr:  absent(container_start_time_seconds{** name=~".*dev-4"})*
*    for: 15m*
*    labels:*
*      severity: 'warning'*

*    annotations:*
*      summary: 'Container killed'*
*      description: 'A container{{ $labels.name }} has disappeared'*

If I use this, then alert is sent, but without the stopped container name:
 - alert: ContainerKilled2
    expr:  absent(container_start_time_seconds{*name=~".*dev-4"}*)
    for: 15m
    labels:
      severity: 'warning'
    annotations:
      summary: 'Container killed'
      *description: 'A container has disappeared {{ $labels.instance }} of 
job {{ $labels.job }}'*

Any idea how to alert then with a regexp, *and *the container name?

Thanks

-- 
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/24fe1ee7-3275-4747-93b9-9f0f51821533n%40googlegroups.com.

Reply via email to