remote_write drop all metrics except x

31 views
Skip to first unread message

ryan woods

unread,
Jul 21, 2020, 4:34:18 AM7/21/20
to Prometheus Users
Hey guys,

Trying to drop all metrics except a select few at time of writing to remote storage, the config I'm using to do so is the below:

      remoteWrite:
        - url: 'http://prometheus-adapter.monitoring.svc.cluster.local:9201/write'
          write_relabel_configs:
            - source_labels: [__name__]
              regex: 'ceph.*'
              action: keep
            - source_labels: [__name__]
              regex: 'pg_.*'
              action: keep
            - source_labels: [__name__]
              regex: 'node.*'
              action: keep
            - source_labels: [__name__]
              regex: '.*'
              action: drop

As you can see from the above I'd like to keep all metrics matching 'ceph.*', 'pg_.*' & 'node.*' and drop everything else; except this doesn't seem to be working as it's dropping all metrics
 

Julien Pivotto

unread,
Jul 21, 2020, 4:42:57 AM7/21/20
to ryan woods, Prometheus Users
On 21 Jul 01:34, ryan woods wrote:
> Hey guys,
>
> Trying to drop all metrics except a select few at time of writing to remote
> storage, the config I'm using to do so is the below:
>
> remoteWrite:
> >
> > - url:
> >> 'http://prometheus-adapter.monitoring.svc.cluster.local:9201/write'
> >
> > write_relabel_configs:
> >

- source_labels: [__name__]
regex: 'ceph.*|pg_.*'|node.*'
action: keep

That should be enough.


--
Julien Pivotto
@roidelapluie

ryan woods

unread,
Jul 21, 2020, 4:51:13 AM7/21/20
to Julien Pivotto, Prometheus Users
Thanks I’ll give that a try. So out of curiosity why wouldn’t my config before work?

Sent from my iPhone

> On 21 Jul 2020, at 09:42, Julien Pivotto <roidel...@prometheus.io> wrote:

Brian Candler

unread,
Jul 21, 2020, 10:20:09 AM7/21/20
to Prometheus Users
Relabeling rules don't stop at the first match - they are all executed.
Reply all
Reply to author
Forward
0 new messages