A metrics which shows the detail of interfaces

111 views
Skip to first unread message

c207...@gmail.com

unread,
Aug 13, 2018, 6:42:14 AM8/13/18
to Prometheus Developers
Hi,
I have implemented a metrics for my own purpose. I'm wondering is this useful, and can I create a PR?
This metric shows the "device", "default", "ip_address", "type", "pci_id".
"device" is the interface name.
"default" means this interface is the default interface.
"type" shows what kind of the interface this one is (physical or virtual).

Sample:

node_network_interface{controller_revision_hash="1898389726",default="true",device="enp0s3",instance="10.0.2.15:9100",ip_address="10.0.2.15/24",job="kubernetes-pods",kubernetes_namespace="vortex",kubernetes_pod_name="node-exporter-69k6c",name="node-exporter",node="vortex-dev",pci_id="0000:00:03.0",pod_template_generation="1",type="physical"}

node_network_interface{controller_revision_hash="1898389726",default="false",device="cni0",instance="10.0.2.15:9100",ip_address="10.244.0.1/24",job="kubernetes-pods",kubernetes_namespace="vortex",kubernetes_pod_name="node-exporter-69k6c",name="node-exporter",node="vortex-dev",pod_template_generation="1",type="virtual"}

Ben Kochie

unread,
Aug 13, 2018, 7:20:39 AM8/13/18
to c207...@gmail.com, Prometheus Developers
This would be useful. I assume this comes from /sys.

The way we add this type of data would be to implement it in the Prometheus procfs[0] library, then add the metrics to the node exporter.

Maybe you can include information about how you gather this data?

We usually call these "info" metrics, and would be called "node_network_device_info".

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To post to this group, send email to prometheus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/ea07a989-594a-4f6a-8d3c-b21e1fe0cd00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

c207...@gmail.com

unread,
Aug 13, 2018, 7:33:29 AM8/13/18
to Prometheus Developers
Actually, not all the info are from /sys. You can see the code and comments here[0] (dpdk part can be discarded).
I can modify the metrics name, but is it necessary to use procfs library?

[0] https://github.com/linkernetworks/node-exporter/blob/master/node-exporter/netdev_iface_linux.go

Ben Kochie於 2018年8月13日星期一 UTC+8下午7時20分39秒寫道:

Ben Kochie

unread,
Aug 13, 2018, 8:18:40 AM8/13/18
to c207...@gmail.com, Prometheus Developers
Anything that reads from `/proc/` or `/sys/` needs to go through our procfs library. There is some legacy stuff in the node_exporter that doesn't, but we're trying to fix this.

Also, it looks like you're parsing the output of `lspci`. We have a policy that the node_exporter is not allowed to use `exec` to avoid forking any new processes.

Reply all
Reply to author
Forward
0 new messages