Reg: change the device label for filesystem or netstat metrics.

11 views
Skip to first unread message

RAJESH DASARI

unread,
Apr 21, 2020, 5:53:58 AM4/21/20
to promethe...@googlegroups.com
Hi,

I have one instance of node_exporter is running on my machine. I have
enabled it to collect filesystem,netstat,netdev metrics.

curl http://pm:9090/api/v1/label/device/values
{"status":"success","data":["/dev/mapper/VG_System-diagnostics","/dev/mapper/VG_Log",
"Bridge","Ethernet1","Ethernet10","Ethernet11"]}

when I query for the values of device label i get filesystem devices
and also network devices. Is there any way to change the device label
for netstat or filesystem metrics, so that I query separately with
different label names to get filesystem and network devices.

Please suggest me on this.


Thanks,
Rajesh Dasari.

Brian Candler

unread,
Apr 21, 2020, 6:38:24 AM4/21/20
to Prometheus Users
Grafana provides this function:
label_values(metric, label)
to get the label values for a specific metric only, which sounds like what you need - just pick one metric which has the network devices, and one metric which has the filesystem devices.

Looking at the source code, behind the scenes it calls
/api/v1/series?match[]=<metricname>
and then gets all the unique values of the label of interest.  It's not quite as convenient as /api1/v1/label/<label>/values but easy enough to code.

You *could* change the label names at ingestion time, by copying to a new label and dropping the old label, but I strongly recommend against this.  It doesn't solve the problem in general - two different metrics may use the same label name for different purposes.  It will be confusing, since the metrics stored in the database are different to those exported.  Furthermore, you'll find yourself incompatible with any dashboards written to use the "correct" original label names.
Reply all
Reply to author
Forward
0 new messages