greenpau / ovs_exporter

Prometheus Exporter for Open Virtual Switch (OVS)
Apache License 2.0
25 stars 17 forks source link

[FR] Add interface "name" to labels? #3

Open emiljoensson opened 2 years ago

emiljoensson commented 2 years ago

Is it possible to have labels, such as ovs_interface_tx_packets, to also include the "name" and not just "uuid"?

Reason is that uuid may change at any time (e.g KVM VM is edited/redefined), but the name can be used as unique and persistent identifier.

Just to be clear, with name I mean this field: ovs-vsctl -- --columns=name,_uuid list Interface

Thank you!!

greenpau commented 2 years ago

Is it possible to have labels, such as ovs_interface_tx_packets, to also include the "name" and not just "uuid"?

@emiljoensson , yes. It is done in this fashion.

https://github.com/greenpau/ovsdb/blob/c930a97327ebc4d887a94c58822da0baab57b734/transact_test.go#L36-L43

It uses Transact() function:

https://github.com/greenpau/ovsdb/blob/c930a97327ebc4d887a94c58822da0baab57b734/transact.go#L58-L88

pawelos99 commented 1 year ago

Hi, I was using this exporter quite successfully, so thanks for your work! Because of the way I was using it, I was also missing a feature where I can query statistics by interface name directly. Of course you can work it around in prometheus by using joins but direct access it much easier. I have added simple PR that is adding interface name label to each metric related to interface statistics. Thanks