Hi Brian Candler,

Thanks for your response. I tried the below syntax, no errors in the
configuration but metrics are not getting dropped.
  remoteWrite:
    - url: "http://test.com/push";
      write_relabel_configs:
      - source_labels: [__name__]
        regex: "node_xfs.*"
        action: 'drop'

I also tried below syntax but getting error "parsing YAML file
/etc/config/prometheus.yml: yaml: unmarshal errors:\n  line 15: field
relabel_configs not found in type config.plain"

  remoteWrite:
    - url: "http://test.com/push";
relabel_configs:
- action: labeldrop
  regex: "node_context_switches_total|node_cooling.*"

Please let me know if i need to try anything different

On Wed, Jan 25, 2023 at 7:07 PM Brian Candler <b.cand...@pobox.com> wrote:

> Documentation:
>
> https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write
>
> https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
>
> An example (untested) to drop metrics "foo" and "bar" from remote write:
>
> remote_write:
>   - url: http://1.2.3.4/api/v1/write
>     write_relabel_configs:
>       - source_labels: [__name__]
>         regex: '(foo|bar)'
>         action: drop
>
> If you want any further help you'll need to explain what you're trying to
> do, show the config you made, and explain in what way it "didn't work"
> (e.g. did you get an error preventing prometheus from starting - in which
> case show the error; or it was accepted but didn't work in the way you were
> expecting -  if so explain what you were expecting)
>
> On Wednesday, 25 January 2023 at 11:04:23 UTC nitya...@gmail.com wrote:
>
>> Hi Brian Candler
>>
>> Can you please share the metrics drop syntax to define globally under
>> remote_write instead of under each job. I tried with different syntaxes but
>> didn't work
>>
>> Thanks
>>
>> On Mon, Jan 23, 2023, 9:07 PM Brian Candler <b.ca...@pobox.com> wrote:
>>
>>> Can you give an specific example of "same metrics are published on two
>>> different endpoints" ?
>>>
>>> You might mean:
>>> - two different metric names
>>> - the same metric name, but different labels
>>>
>>> And it might be that you're scraping the same target twice, or you're
>>> scraping one target but that target is (for some reason) returning
>>> duplicates in the scrape results.  Or you might have a more complex
>>> scenario, e.g. multiple prometheus servers scraping for redundancy, and
>>> then you're combining the results together somehow.
>>>
>>> > Is it possible to pick one endpoint and discard the other while
>>> writing a PromQL query ?
>>>
>>> Sure.  Just filter in the PromQL query.  For example, if you have
>>>
>>> foo{aaa="bbb",ccc="ddd"} 123.0
>>> foo{aaa="bbb",ccc="fff"} 123.0
>>>
>>> and you consider the one with ccc="fff" to be a "duplicate" metric, then
>>>
>>> foo{ccc!="fff"}
>>>
>>> might be what you want.
>>>
>>> Otherwise, you can avoid ingesting the duplicate metrics:
>>> - by not scraping the second set in the first place
>>> - if they all come from the same scrape, then using
>>> metric_relabel_configs to drop the metrics that you don't want to keep
>>>
>>> On Monday, 23 January 2023 at 14:40:40 UTC kishore...@gmail.com wrote:
>>>
>>>> Hi,
>>>> We have a situation where same metrics are published on two different
>>>> endpoints. Is it possible to pick one endpoint and discard the other while
>>>> writing a PromQL query ?
>>>> Is it possible to configure Prometheus to collect metrics from only one
>>>> endpoint?
>>>>
>>>> / Kishore
>>>>
>>>>
>>>> --
>>> 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-use...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/prometheus-users/c777e2ab-0089-4fa8-8fcd-efe49b95e2een%40googlegroups.com
>>> <https://groups.google.com/d/msgid/prometheus-users/c777e2ab-0089-4fa8-8fcd-efe49b95e2een%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/08b62d4f-ab0d-4bf8-ace0-bfc502fd724fn%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/08b62d4f-ab0d-4bf8-ace0-bfc502fd724fn%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/CALTDPVY2k9vTetpoSqmZXS_pNxbnFQ25uxSGJz72%3DALLnhTgRA%40mail.gmail.com.

Reply via email to