relabel actions are exclusive. Drop means keep everything but X. Keep means 
drop everything but X.

For your exact problem, there is already a node_exporter flag to handle 
this.

./node_exporter --collector.systemd.unit-include="(ssh|apache)"

This will also be more efficient because it it will only gather data about 
those two units.

On Monday, March 11, 2024 at 9:27:30 PM UTC+1 mel wrote:

> Hello I am using node_exporter and I am trying to drop all 
> node_systemd_unit_state metrics except for a handful of services like 
> (e.g.,) ssh and apache. How would I do this? I came up with the following, 
> but I don't think this is correct because it will drop other metrics as 
> well (metrics that are not related to systemd service)
>
> metric_relabel_configs:
>     - source_labels: [__name__, name]
>       regex: 'node_systemd_unit_state;(ssh|apache).*'
>       action: keep
>
> How do I drop all service metrics except for ssh and apache service?
>

-- 
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/b8105064-7a34-4dc2-8d72-3f6a96ea8854n%40googlegroups.com.

Reply via email to