如何通过 Cisco Nexus 9508 交换机上的 CLI 检查接口统计信息?

网络工程 cisco-nexus
2022-03-02 02:49:17

假设由于某些原因我无法访问 Cisco APIC GUI,我需要检查脊/叶交换机物理接口的接口统计信息?我应该使用哪个命令?在发出“show interface x/x”之前我应该​​进入一些特殊的 CLI 模式吗?如何?

因为现在,如果我通过 ssh 登录到交换机,我会得到以下输出:

leaf# show interface status
URL: http://127.0.0.1:7777/api//class/nwIf.xml?&target-subtree-class=mgmtMgmtIf&query-target=subtree&order-by=nwIf.id|asc
Code: 403
Output: <?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="403" text="Need a valid webtoken cookie (named APIC-Cookie) or a signed request with signature in the cookie APIC-Request-Signature for all REST API requests"/></imdata>
Data Posted:
None
Error executing command, check logs for details
leaf# show logging
Incorrect command "show logging"
leaf#
leaf# ls
aci  bin  controller  debug  dev  etc  isan  lc  lib  mit  proc  sbin  sys  tmp  usr  var
leaf#
leaf# show ?
Incorrect command "show ?"
leaf#
2个回答

我认为您正在寻找show interface <slot/port>命令。这是从启用模式运行的。例如

switch# show interface e4/2
Ethernet4/2 is down (Link not connected)
  Dedicated Interface
  Hardware: 10/100/1000 Ethernet, address: 0018.bad8.80d1 (bia 0024.f71c.739d)
  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
  reliability 153/255, txload 1/255, rxload 1/255
  Encapsulation ARPA
  auto-duplex, auto-speed
  Beacon is turned off
  Auto-Negotiation is turned on
  Input flow-control is off, output flow-control is off
  Auto-mdix is turned on
  Switchport monitor is off
  EtherType is 0x8100
  Last link flapped 01:56:44
  Last clearing of "show interface" counters 1d04h
  30 seconds input rate 0 bits/sec, 0 packets/sec
  30 seconds output rate 0 bits/sec, 0 packets/sec
  Load-Interval #2: 5 minute (300 seconds)
    input rate 0 bps, 0 pps; output rate 0 bps, 0 pps
  L3 in Switched:
    ucast: 0 pkts, 0 bytes - mcast: 0 pkts, 0 bytes
  L3 out Switched:
    ucast: 0 pkts, 0 bytes - mcast: 0 pkts, 0 bytes
  RX
    4 unicast packets  2 multicast packets  0 broadcast packets
    6 input packets  730 bytes
    0 jumbo packets  0 storm suppression packets
    0 runts  0 giants  0 CRC  0 no buffer
    4 input error  0 short frame  0 overrun   0 underrun  0 ignored
    0 watchdog  0 bad etype drop  0 bad proto drop  0 if down drop
    0 input with dribble  0 input discard
    0 Rx pause
  TX
    0 unicast packets  4 multicast packets  0 broadcast packets
    4 output packets  916 bytes
    0 jumbo packets
    0 output error  0 collision  0 deferred  0 late collision
    0 lost carrier  0 no carrier  0 babble  0 output discard
    0 Tx pause
  10 interface resets

show interface各种 Cisco 文档中详细介绍了该命令的任何变体,例如Cisco NX-OS Interfaces Commands

好的,该错误消息实际上是一个已知的 Cisco 错误 CSCvi51338。如果命令由只读用户运行,它会弹出任何类型的“显示”命令。

并且要在 ACI 环境中检查主干/叶交换机上的物理接口统计信息,无需登录到本地设备 - 只需 ssh 到 APIC,然后发出“show version”命令就足够了,就像这样:

apic1# show version
 Role        Pod         Node        Name                      Version              
 ----------  ----------  ----------  ------------------------  -------------------- 
 controller  1           1           apic1                     3.1(1i)              
 leaf        1           101         leaf1                     n9000-13.1(1i)       
 leaf        1           102         leaf2                     n9000-13.1(1i)       
 leaf        1           103         leaf3                     n9000-13.1(1i)       
 leaf        1           104         leaf4                     n9000-13.1(1i)       
 spine       1           111         spine1                    n9000-13.1(1i)       
 spine       1           112         spine2                    n9000-13.1(1i)       

apic1# 

然后,您必须指定要检查的开关(及其接口)。假设我们要检查 Leaf1 上的接口 ethernet 1/50 - 然后我们发出这个命令并获取我们正在寻找的信息:

apic1# fabric 101 show interface ethernet 1/50
----------------------------------------------------------------
 Node 101 (leaf1)
----------------------------------------------------------------
Ethernet1/50 is down (sfp-missing)
admin state is up, Dedicated Interface
  Hardware: 1000/10000/100000/40000 Ethernet, address: 0000.0000.0000 (bia 00de.fbce.7012)
  MTU 9150 bytes, BW 0 Kbit, DLY 1 usec
  reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, medium is broadcast
  Port mode is routed
  full-duplex, 100 Gb/s
  FEC (forward-error-correction) : disable-fec
  Beacon is turned off
  Auto-Negotiation is turned on
  Input flow-control is off, output flow-control is off
  Auto-mdix is turned off
  Rate mode is dedicated
  Switchport monitor is off
  EtherType is 0x8100
  EEE (efficient-ethernet) : n/a
  Last link flapped never
  Last clearing of "show interface" counters never
  0 interface resets
  30 seconds input rate 0 bits/sec, 0 packets/sec
  30 seconds output rate 0 bits/sec, 0 packets/sec
  Load-Interval #2: 5 minute (300 seconds)
    input rate 0 bps, 0 pps; output rate 0 bps, 0 pps
  L3 in Switched:
    ucast: 0 pkts, 0 bytes - mcast: 0 pkts, 0 bytes
  L3 out Switched:
    ucast: 0 pkts, 0 bytes - mcast: 0 pkts, 0 bytes
  RX
    0 unicast packets  0 multicast packets  0 broadcast packets
    0 input packets  0 bytes
    0 jumbo packets  0 storm suppression bytes
    0 runts  0 giants  0 CRC  0 no buffer
    0 input error  0 short frame  0 overrun   0 underrun  0 ignored
    0 watchdog  0 bad etype drop  0 bad proto drop  0 if down drop
    0 input with dribble  0 input discard
    0 Rx pause
  TX
    0 unicast packets  0 multicast packets  0 broadcast packets
    0 output packets  0 bytes
    0 jumbo packets
    0 output error  0 collision  0 deferred  0 late collision
    0 lost carrier  0 no carrier  0 babble  0 output discard
    0 Tx pause


apic1#