Hi Christian,

Thank you for the helping hand .

My prometheus.yml file looks like this  :

global:
  external_labels:
     dc: europe
     replica: primary

alerting:
  alertmanagers:
    - static_configs:
      - targets:
        - am:9093
     relabel_configs:
     - action: drop
       source_labels: [replica]
       regex: (.*)

rule_configs:
  - prom_rules.yml

scrap_configs:

  - job_name: 'prometheus'

.
.
.

For other server, replica is secondary
I want to drop only label in alert manager , but it drops entire alert in
alert_manager.

In Alert-Manager , I see details in boxes like as given

dc=europe        instance=servername          replica=primary
dc=europe        instance=servername          replica=secondary

I want the output like below, to avoid duplicate entry from secondary server
dc=europe        instance=servername

Please suggest

Thanks

On Sat, Apr 4, 2020 at 3:04 AM Christian Hoffmann <
m...@hoffmann-christian.info> wrote:

> Hi Sunil,
>
> On 4/3/20 6:00 PM, Sagar wrote:
> > For more information , there are more global labels (such as
> > environment, cluster , etc) apart from replica .
> >
> > Do I need to remove other global variables and maintain only one label
> > as replica .
> You need to drop those labels which are used to distinguish different
> Prometheus instances which scrape the same targets.
>
> Some example:
> If you've got two Prometheus servers scraping all your database servers
> and are adding external labels such as cluster=database and replica=A
> for the one and replica=B for the other and if you've got another pair
> of Prometheus servers for your web servers with external labels
> cluster=web and replica=A and replica=B again, then you would only drop
> the replica label, not the cluster label.
>
> > I also tried with options given below ( from the link
> > : https://github.com/prometheus/prometheus/issues/3239 )
> >
> > |alerting: alert_relabel_configs:- action: drop source_labels:
> > [replica] regex: '1'|
> >
> > Please advise , thanks
> I don't think you should have regex: 1 here? Just drop the regex line so
> that it will default to '(.*)' which matches all values.
>
> If this doesn't help, can you share your actual config + the behaviour
> you are seeing?
>
> > Is it possible to query alertmanager alerts like metrics in prometheus ?
> > Like http:/server:9093/mertrics or something else .
> Alertmanager does have metrics, but it does not export alerts there.
> However, there is an API for reading them programatically.
>
>
> https://petstore.swagger.io/?url=https://raw.githubusercontent.com/prometheus/alertmanager/master/api/v2/openapi.yaml#/alert
>
>
> Kind regards,
> Christian
>

-- 
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/CANegE51_xR_HkC4GOG%2BNpJTWSJSy%2BWZ%3DpfO8DFXsKt2Ob_%2Br6w%40mail.gmail.com.

Reply via email to