junos_exporter icon indicating copy to clipboard operation
junos_exporter copied to clipboard

fix interface speed 0 error

Open cwaynej opened this issue 1 year ago • 0 comments

When reading junos_interface_speed{} on 1000 Mbps interfaces, the string Mbps doesn't match mbps & there is a white space between 1000 and Mbps which would result in 10 000000

Example from a QFX5100

1000 Mbps

> show interfaces xe-0/0/47 extensive | display xml | grep speed 
            <speed>1000 Mbps</speed>
                <link-partner-speed>1000 Mbps</link-partner-speed>

Since we don't match mbps, speed := "0" remains true.

This PR lowers Mbps to mbps before comparing && replaces all whitespaces in the end.

This is my first PR to this repository. Please let me know if I might have missed any guidelines.

Thanks Chris

cwaynej avatar Mar 19 '24 21:03 cwaynej