As Brian said, use alert relabel configs, which are global, or set the
datacenter as an external label (`external_labels` in the configuration
file).

/MR

On Wed, Sep 9, 2020 at 12:10 PM goel....@gmail.com <goel.uma...@gmail.com>
wrote:

> In the below code the highlighted part is hard coded. I am am not getting
> data-center as a label from Prometheus. I want to make it global as in
> there is no requirement to hard code this data-center label on every alert.
> With the above link it is not clear about the requirement. Can you please
> help here?
>
> groups:
>
>
> - name: Container-alerts
>   rules:
>   - alert: Container-killed
>     expr: (sum by(name, instance) (time() - container_last_seen{id!="/"}))
> > 30
>     for: 10s
>     labels:
>       datacenter: DC:Test
>
>       severity: warning
>     annotations:
>       summary: "Container killed (instance {{ $labels.instance }})"
>       description: "Container '{{ $labels.name }}' has disappeared from
> '{{ humanizeDuration $value }}' seconds on Node_ID: '{{ $labels.instance
> }}'"
> On Wednesday, 9 September 2020 at 16:14:25 UTC+5:30 b.ca...@pobox.com
> wrote:
>
>> To add labels to *every* alert sent from this prometheus instance, see
>> alert_relabel_configs:
>>
>> https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alert_relabel_configs
>>
>> --
> 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 prometheus-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/ab20e147-7073-4057-868f-f47dfca69d06n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/ab20e147-7073-4057-868f-f47dfca69d06n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAMV%3D_gZLOFePqdDzDy6MHs1ATBuTh8pjnpPuqEV8tp-Rr6z_Fw%40mail.gmail.com.

Reply via email to