Thanks Brian and Mattias.

On Wednesday, 9 September 2020 at 20:43:44 UTC+5:30 [email protected] 
wrote:

> 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 [email protected] <[email protected]> 
> 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 [email protected] 
>> 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 [email protected].
>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/42d32ff1-9663-4909-91aa-6803719e67bfn%40googlegroups.com.

Reply via email to