Monitoring - amybuck/SONiC-NAS GitHub Wiki
The SONiC NAS Host-Adapter supports network monitoring features, such as sFlow and port mirroring, to monitor and capture network traffic in the system. It also provides tools to collect port and VLAN statistics and port media information.
Port Mirroring
Mirroring copies packets from a mirroring source port to a mirroring destination port. In local port mirroring, packets are forwarded from a source port to a destination port on the same system.
In remote port mirroring, mirrored packets are forwarded using a dedicated L2 VLAN.
User application can provision mirroring capabilities using the SONiC Object Library API:
- Create a mirroring session
- Update a mirroring session
- Delete a mirroring session
See SONiC Object Library Application Examples for information on how to program port mirroring using the SONiC Object Library API.
NOTE: The SONiC NAS Host-Adapter does not support Linux modeling of port mirroring.
sFlow
sFlow monitors network traffic by sampling incoming and outgoing packets on physical ports. User applications can provision sFlow functionality using the SONiC Object Library API:
- Enable packet sampling on a physical port
- Disable packet sampling on a physical port
- Set the sampling interval rate
- Forward the sampled packet to an IP address/port
See SONiC Object Library Application Examples for information on how to program sFlow using the SONiC Object Library API.
NOTE: The SONiC NAS Host-Adapter does not support Linux modeling of sFlow.
Statistics
Use the sonic-show-stats
and sonic-ethtool
commands to display statistical information about ports/VLANs, and installed transceivers.
sonic-show-stats if_stat [iface_name] {filter_list}
— Displays port statistics for all (or a specified) Linux interfaces which map to physical ports. Enter a filter_list valuesonic-show-stats vlan_stat [vlan_ifname] {filter_list}
— Displays statistics from all (or a specified) VLANs. Enter a filter_list value to display specified statistics.sonic-show-stats clear [iface_name]
— Deletes port statistics for all (or a specified) Linux interfaces. The sonic-show-stats command does not support deleting VLAN statistics.sonic-ethtool [-v | -e | -s | -S]
— Retrieves statistics and media information from a Linux interface with maps to a physical port. The command output is a subset of thesonic-show-stats
command for the same physical port interface.- -v — Version information
- -e — EEPROM media information
- -s — Port speed, duples, and auto-negotation settings
- -S — Port statistics
View Statistics for Linux Interface e101-001-0
$ sonic-show-stats if_stat e101-001-0
Key:
base-stats/interface/ip/in-discards = 0
base-stats/interface/ether-octets = 13442942147
base-stats/interface/ether-out/pkts-64-octets = 0
base-stats/interface/ether-collisions = 0
...
base-stats/interface/if-in-multicast-pkts = 0
base-stats/interface/ether-in/pkts-64-octets = 0
base-stats/interface/ether-in/pkts-512-to-1023-octets = 0
View Statistics for VLAN Linux Bridge Interface Br1
$ sonic-show-stats vlan_stat br1
Key:
base-stats/vlan/time-stamp: 1455586573
base-stats/vlan/in-octets: 16381983058
base-stats/vlan/in-pkts: 16101053
base-stats/vlan/out-octets: 55146334258
base-stats/vlan/out-pkts: 67419926
Delete Statistics for Port that Maps to e101-001-0
$ sonic-show-stats clear e101-001-0
Success
View Port Statistics
$ sonic-ethtool -S e101-001-0
Statistics for interface e101-001-0
Ether statistics:
rx_bytes: 9185614848
rx_no_errors: 0
tx_no_errors: 9003181
tx_total_collision: 0
rx_undersize_packets: 0
rx_jabbers: 0
rx_fragments: 0
rx_align_errors: 0
rx_discards: 0
rx_mcast_packets: 35445
View Media (Transceiver) Statistics for e101-001-0
$ sonic-ethtool -e e101-001-0
Show media info for e101-001-0
if_index is 17
Key: 2.19.1245389.1245248.1245249.1245250.
base-pas/media/rate-identifier = 0
base-pas/media/oper-status = 0
base-pas/media/category = 3
base-pas/media/voltage-state = 1
base-pas/media/bias-low-warning-threshold =
base-pas/media/vendor-pn = 568400002
base-pas/media/current-temperature = ??
base-pas/media/insertion-cnt = 0
base-pas/media/voltage-low-warning-threshold =
base-pas/media/cc_ext = 162
base-pas/media/length-om2 = 0
base-pas/media/length-om3 = 0
base-pas/media/rx-power-low-alarm-threshold =
base-pas/media/length-om1 = 0
base-pas/media/vendor-id = AP
base-pas/media/media-category/sfp-plus/br-max = 0
base-pas/media/connector = 33
base-pas/media/ext-transceiver = 0
base-pas/media/vendor-Specific =
ffffffffffffff00000000000000000000000000000000000000000000000000
base-pas/media/media-category/sfp-plus/br-min = 0
base-pas/media/encoding = 0
base-pas/media/tx-power-high-warning-threshold =
base-pas/media/vendor-name = Amphenol
base-pas/media/rx-power-low-warning-threshold =
base-pas/media/slot = 1
base-pas/media/port = 1
base-pas/media/vendor-rev = 4700
base-pas/media/slot = 1
base-pas/media/port = 1
base-pas/media/tx-power-low-alarm-threshold =
base-pas/media/bias-low-alarm-threshold =
base-pas/media/capability = 6
base-pas/media/media-category/sfp-plus/sff-8472-compliance = 0
base-pas/media/diag-mon-type = 0
base-pas/media/temp-state = 1
base-pas/media/type = 43
base-pas/media/media-category/qsfp-plus/wavelength-tolerance = 0
base-pas/media/ext-identifier = 0
base-pas/media/temp-low-warning-threshold =
base-pas/media/voltage-high-warning-threshold =
base-pas/media/temp-high-alarm-threshold =
base-pas/media/length-sfm = 0
base-pas/media/rate-select-state = 0
base-pas/media/rx-power-measurement-type = 0
base-pas/media/wavelength = 0
base-pas/media/cc_base = 54
base-pas/media/temp-low-alarm-threshold =
base-pas/media/tx-power-low-warning-threshold =
base-pas/media/insertion-timestamp = 0
base-pas/media/current-voltage =
base-pas/media/bias-high-alarm-threshold =
base-pas/media/high-power-mode = 1
base-pas/media/br-nominal = 0
base-pas/media/options = 0
base-pas/media/rx-power-high-warning-threshold =
base-pas/media/date-code = 3131303632322000
base-pas/media/present = 1
base-pas/media/transceiver = 0000000000000000205c
base-pas/media/length-cable = 2
base-pas/media/voltage-high-alarm-threshold =
base-pas/media/identifier = 12
base-pas/media/voltage-low-alarm-threshold =
base-pas/media/dell-qualified = 0
base-pas/media/length-sfm-km = 0
base-pas/media/rx-power-high-alarm-threshold =
base-pas/media/admin-status = 0
base-pas/media/serial-number = APF11240020140
base-pas/media/tx-power-high-alarm-threshold =
base-pas/media/temp-high-warning-threshold =
base-pas/media/bias-high-warning-threshold =
base-pas/media/enhanced-options = 0
base-pas/media/media-category/qsfp-plus/max-case-temp = 70