Alertmanager specfic labels define

Prometheus alertmanager is trying to manage the threshold. Since it is a distributed environment, there are several server instances. I have to receive the threshold of memory from the Web and apply it to the alarm manager rule. So I think I can use an external label, but it doesn’t work well.

First, I tried to define the external label by test and deliver it to the rule file, but it didn’t work well. I defined the external label m_ip in the prometheus.yaml file.

scrape_interval: 30s
evaluation_interval: 15s
m_ip: ‘’

And the label was set up in the alerting area.



  • source_labels: [m_ip]
    target_label: m_ip
    • static_configs:
      • targets:
        • alertmanager:9093

And the rule file is defined as follows, but the value is not applied.

expr: up{instance="{{ $labels.m_ip }}"} == 0

Is my method wrong when I have to receive a threshold from web and apply it to the expr statement?

What should I do at times like this? I ask for advice from experienced people.

1 Like