Prometheus query for the monitoring the switch ports

347 views
Skip to first unread message

FRANCIS A

unread,
Nov 5, 2021, 7:55:23 AM11/5/21
to Prometheus Users
Hi All, 


Which metrics do we need to monitor for the switch port status ? 
1) ifconnector present
2)ifadminstatus
3)ifoperstatus

Also please suggest query for combining multiple ports, for an example 
ifOperStatus {instance="IPaddress",ifName="Gi0/6"}==1, if I wants to include multiple ports means where we need to include. 

Please suggest on this and Thanks in advance
 

Brian Candler

unread,
Nov 6, 2021, 12:06:19 PM11/6/21
to Prometheus Users
* ifAdminStatus tells you whether the port is administratively enabled (i.e. whether you have explicitly done "shutdown" or not)
* ifOperStatus tells you whether the link is running or not
* there's no physical "cable present" indication.  But if ifOperStatus is up, it implies that the cable is plugged in at both ends and link has been established.

You can match multiple interfaces like this:

ifOperStatus{instance="IPaddress",ifName=~"Gi0/{6,7,8}"}

This will return multiple timeseries.  You can check how many are up using count() or sum() over these timeseries:

count(ifOperStatus{instance="IPaddress",ifName=~"Gi0/{6,7,8}"} == 1)

Reply all
Reply to author
Forward
0 new messages