Hello,
My name is Ivar and I work at Universitat Pompeu Fabra of Barcelona. I sent an email a few days ago asking about the API's options of NAV (no responses yet). Now I'm trying to get the link status of a switch using filters, but I have three questions.
- Is it possible to get this information using filters? My idea is to send a daily email with a list of the ports of a specific switch which has link status down through NAV's "Alert Profiles" tool.
- What is the difference between these two tabs?
[image: image.png]
[image: image.png]
- Is this second option checking if a port has an ethernet cable plugged to the ethernet card of a computer at that moment?
Thanks again
On Wed, 8 Feb 2023 10:40:44 +0100 "BERGELIN SABADELL, IVAR-ERIC" ivar.bergelin@upf.edu wrote:
Now I'm trying to get the link status of a switch using filters, but I have three questions.
- Is it possible to get this information using filters? My idea is to
send a daily email with a list of the ports of a specific switch which has link status down through NAV's "Alert Profiles" tool.
Sure. It might not be very "user-friendly", as NAV stores the raw ifOperState value from the IF-MIB (as defined by RFC2863 [1]), so this is also what is exposed in the API. The value is defined thus by the MIB:
ifOperStatus OBJECT-TYPE SYNTAX INTEGER { up(1), -- ready to pass packets down(2), testing(3), -- in some test mode unknown(4), -- status can not be determined -- for some reason. dormant(5), notPresent(6), -- some component is missing lowerLayerDown(7) -- down due to state of -- lower-layer interface(s) }
So to get all interfaces in NAV that are operationally down, query the API for `/api/1/interface/?ifoperstatus=2` (adding more filter as you see fit).
- What is the difference between these two tabs?
The first tab shows an overview of switch-port "activity". Activity is a combination of CAM and link data from the switch. If a switch port has an active link state right now, it will show up as currently active. If the link is down, CAM data history is used to indicate how many days ago a MAC address was seen to be active on this port.
A color spectrum is used to indicate the age of the last known activity. IIRC bright green means the port is active now, and the longer ago activity was seen, the more faded the color looks. Perhaps not very user-friendly to the color-blind, but the actual age in days should be available as a number if you hover the mouse above a port.
- Is this second option checking if a port has an ethernet cable
plugged to the ethernet card of a computer at that moment?
No, the second tab is just a listing of interfaces that are reported by the device as having a physical connector. I.e. these interfaces represent real-world physical ports; no virtual or higher-level interfaces are shown.
[1] https://datatracker.ietf.org/doc/rfc2863/