charlie-haley / omada_exporter

Prometheus Exporter for TP-Link Omada Controller SDN.
MIT License
88 stars 14 forks source link

duplicate metrics for `omada_port_link_speed_mbps` #25

Closed charlie-haley closed 1 year ago

charlie-haley commented 2 years ago

omada_port_link_speed_mbps seems to have duplicate metrics, one has the vlan_id label set, one doesn't

RaymondMouthaan commented 2 years ago

hello Charlie-haley,

Nice job on the omada_exporter and the Grafana Dashboard 👍. After a few modifications to the dashboard it works, but I can get ports to work. For each device is shows No ports on device.. The prometheus query looks like omada_port_link_speed_mbps {switch_mac="$Device", vlan_id="", site="$Site"}, which is odd since $Device is the name of a device and not its Mac address. I've been trying to get its Mac address but I wasn't able to. Any ideas?

Cheers, Ray

charlie-haley commented 2 years ago

hello Charlie-haley,

Nice job on the omada_exporter and the Grafana Dashboard +1. After a few modifications to the dashboard it works, but I can get ports to work. For each device is shows No ports on device.. The prometheus query looks like omada_port_link_speed_mbps {switch_mac="$Device", vlan_id="", site="$Site"}, which is odd since $Device is the name of a device and not its Mac address. I've been trying to get its Mac address but I wasn't able to. Any ideas?

Cheers, Ray

Hi @RaymondMouthaan, what version of the exporter are you running? There was an issue with the switch_mac and ID being the wrong way around which was fixed fairly recently https://github.com/charlie-haley/omada_exporter/issues/21

Could you trying updating to the latest version (if you're not already) and using the latest dashboard JSON from the repo?

RaymondMouthaan commented 2 years ago

Hi @charlie-haley, I took the Grafana Dashboard example from the main branch and the latest docker image:

omada-exporter:
        image: chhaley/omada_exporter
charlie-haley commented 2 years ago

That's strange, $Device definitely should be the mac adresss of the device image

What's the device out of interest, is it a switch?

RaymondMouthaan commented 2 years ago

I've figured it out why it wasn't working, the device names are not mac addresses but real names instead.

For example: router, core-switch, office-switch, access-point etc

In the screenshot below, the devices marked in green do work, but the one in red does not.

Screenshot 2022-05-26 at 23 19 52

I guess switch_mac should match the Mac address of a device instead of its name, but I am not sure how to manage that.

Any ideas?

charlie-haley commented 2 years ago

I guess switch_mac should match the Mac address of a device instead of its name, but I am not sure how to manage that.

Any ideas?

I've just pushed a fix for this issue in PR https://github.com/charlie-haley/omada_exporter/pull/42, if you take the latest dashboard from the repo it should work. Thank you for raising this, let me know how you get on!

charlie-haley commented 1 year ago

This appears fixed now. There was also an issue with persisting metrics, the collector pattern has fixed this.