On 18 Jun 10:24, Julian v.d Berkmortel wrote:
> Right now I'm scraping metrics from a Node Exporter. Some of the metrics 
> which the Node Exporters exports have a `mountpoint` label.
> 
> I'd like to drop time series that have this label and **do not** match a 
> regular expression. I tried using the `keep` action (as I'd like to keep 
> time series that **do** match this regular expression) but this also drops 
> all other metrics that do not have the `mountpoint` label.
> 
> "metric_relabel_configs:
>   - source_labels: ['mountpoint']
>     regex: '(\/home|\/var\/domains)\/something.*'
>     action: keep"

Can you try:

 metric_relabel_configs:
   - source_labels: ['mountpoint']
     regex: '((\/home|\/var\/domains)\/something.*)|'
     action: keep"

> 
> I tried using the `drop` action too but this requires me to inverse the 
> regular expression using a negative-lookahead (which isn't supported 
> because Prometheus is written in Go of course).
> 
> What are my options in this?
> 
> **Important,** I do not have control over the way the Node Exporter is 
> configured, thus I can't configure the Node Exporter itself to not export 
> metrics for some specific mountpoint (if this is even possible).
> 
> -- 
> 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/e2bf0768-8213-4c35-b0e0-4c03395ffdc6n%40googlegroups.com.


-- 
Julien Pivotto
@roidelapluie

-- 
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/20210618175736.GA961443%40oxygen.

Reply via email to