简介
本文档介绍如何从4300系列中读取集成多业务路由器(ISR)上的中央处理器(CPU)使用情况。
先决条件
要求
Cisco 建议您了解以下主题:
使用的组件
本文档中的信息基于硬件和软件版本:
- ISR4321/K9
- ISR4331/K9
- ISR4351/K9
- 03.16.01a.S // 15.5(3)S1a
- 03.16.04b.S // 15.5(3)S4b
- 16.9.7
- 16.12.4
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
架构
Cisco ISR 4000系列平台运行Cisco IOS XE,它采用分布式软件架构,运行Linux内核,其中Cisco IOS®作为多个Linux进程之一运行。 Cisco IOS作为守护程序运行,称为Cisco IOS守护程序(IOSd)。
Cisco IOSd上的CPU使用情况
要监控IOSd上的CPU使用情况,请运行show process cpu 命令:
#show process cpu
CPU utilization for five seconds: 1%/0%; one minute: 1%; five minutes: 0%
PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process
1 2 8 250 0.00% 0.00% 0.00% 0 Chunk Manager
2 5 18 277 0.07% 0.00% 0.00% 0 Load Meter
3 0 2 0 0.00% 0.00% 0.00% 0 DiagCard4/-1
4 0 1 0 0.00% 0.00% 0.00% 0 Retransmission o
5 0 1 0 0.00% 0.00% 0.00% 0 IPC ISSU Dispatc
输出显示CPU使用率的两个值,第一个值是CPU的总使用率,第二个值是发送到IOSd的中断造成的CPU使用率:
CPU总量与中断造成的CPU数量之差是进程消耗的CPU值;为了证实添加最近五秒的所有进程使用率:
- 进程的CPU使用率= 1% - 0% = 1% =命令上列出的所有进程CPU使用率
要在顶部显示占用最多CPU的进程,请运行show process cpu sorted命令:
#show process cpu sorted
CPU utilization for five seconds: 1%/0%; one minute: 0%; five minutes: 0%
PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process
64 103 10 10300 0.33% 0.02% 0.00% 0 Licensing Auto U
83 26 231 112 0.27% 0.00% 0.00% 0 PuntInject Keepa
235 555 48176 11 0.11% 0.09% 0.07% 0 Inline Power
1 2 8 250 0.00% 0.00% 0.00% 0 Chunk Manager
注意:添加所有进程可以导致浮点值,IOSd会将结果舍入为下一个整数。
按流量划分的CPU使用率
ISR4300系列设计通过称为QuantumFlow处理器(QFP)的元素来转发流量。
注意:QFP在ASR1K上是一个或多个物理芯片,在ISR4400上,相同功能在Cavium Octeon协处理器上完成,在ISR4300上,该功能在主Intel CPU的特定内核上完成。您可以将ISR4300系列上的QFP视为转发数据包的软件。
要确定数据流消耗的CPU大小,您可以运行show platform hardware qfp active datapath utilization命令:
#show platform hardware qfp active datapath utilization
CPP 0: Subdev 0 5 secs 1 min 5 min 60 min
Input: Priority (pps) 0 0 0 0
(bps) 0 0 0 0
Non-Priority (pps) 3 2 2 1
(bps) 1448 992 992 568
Total (pps) 3 2 2 1
(bps) 1448 992 992 568
Output: Priority (pps) 0 0 0 0
(bps) 0 0 0 0
Non-Priority (pps) 3 2 2 1
(bps) 12216 8024 8024 4576
Total (pps) 3 2 2 1
(bps) 12216 8024 8024 4576
Processing: Load (pct) 0 0 0 1
命令列出优先级数据包和非优先级数据包的输入和输出CPU使用情况,信息以每秒数据包(PPS)和每秒位数(BPS)显示,最后一行显示由于数据包转发百分比(PCT)值造成的CPU负载总量。
已安装CPU核心
ISR4300系列安装了不同数量的CPU内核,这取决于型号;要确定安装在您设备上的内核数量,请运行show processes cpu platform命令:
#show processes cpu platform
CPU utilization for five seconds: 30%, one minute: 29%, five minutes: 29%
Core 0: CPU utilization for five seconds: 13%, one minute: 13%, five minutes: 13%
Core 1: CPU utilization for five seconds: 2%, one minute: 3%, five minutes: 3%
Core 2: CPU utilization for five seconds: 0%, one minute: 0%, five minutes: 0%
Core 3: CPU utilization for five seconds: 99%, one minute: 99%, five minutes: 99%
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
1 0 0% 0% 0% S 1863680 init
2 0 0% 0% 0% S 0 kthreadd
或者,运行show platform software status control-processor命令:
#show platform software status control-processor
<output omitted>
Per-core Statistics
CPU0: CPU Utilization (percentage of time spent)
User: 4.80, System: 10.30, Nice: 0.00, Idle: 84.50
IRQ: 0.40, SIRQ: 0.00, IOwait: 0.00
CPU1: CPU Utilization (percentage of time spent)
User: 2.00, System: 3.40, Nice: 0.00, Idle: 94.59
IRQ: 0.00, SIRQ: 0.00, IOwait: 0.00
CPU2: CPU Utilization (percentage of time spent)
User: 0.50, System: 0.00, Nice: 0.00, Idle: 99.49
IRQ: 0.00, SIRQ: 0.00, IOwait: 0.00
CPU3: CPU Utilization (percentage of time spent)
User: 24.72, System: 75.27, Nice: 0.00, Idle: 0.00
IRQ: 0.00, SIRQ: 0.00, IOwait: 0.00
另一方面,运行show platform software status control-processor brief命令,以下任一命令均会显示安装的内核数量:
#show platform software status control-processor brief
<output omitted>
CPU Utilization
Slot CPU User System Nice Idle IRQ SIRQ IOwait
RP0 0 4.30 9.80 0.00 85.90 0.00 0.00 0.00
1 0.79 0.99 0.00 98.20 0.00 0.00 0.00
2 0.50 0.00 0.00 99.50 0.00 0.00 0.00
3 24.60 75.40 0.00 0.00 0.00 0.00 0.00
CPU核心分布
ISR4300系列的设计产生了用于数据包处理的特定内核。核心4至7保留用于ISR4331和4351上的数据包处理,而核心2和3用于ISR4321。
在由于性能原因包括Cisco IOS XE版本16.5.x之前,分层队列框架(HQF)具有线程始终热旋转和高CPU使用率运行的特点,无论机箱中有何种配置,也不管经过系统的流量是多少。在ISR4300平台上,由于主CPU上运行的是QFP软件,因此一个或多个内核的CPU使用率可能会很高。
但是,在添加了Cisco IOS XE版本16.6.x之后,实施了一项更改,以便这些平台不会使线程产生热旋转。在这种情况下,CPU利用率更多通过核心分配。
要显示热旋转使用情况,请在Cisco IOS XE 16.6.x之前运行show processes cpu platform sorted命令:
#show processes cpu platform sorted
CPU utilization for five seconds: 28%, one minute: 29%, five minutes: 29%
Core 0: CPU utilization for five seconds: 12%, one minute: 13%, five minutes: 14%
Core 1: CPU utilization for five seconds: 2%, one minute: 3%, five minutes: 3%
Core 2: CPU utilization for five seconds: 0%, one minute: 0%, five minutes: 0%
Core 3: CPU utilization for five seconds: 99%, one minute: 99%, five minutes: 99% <<< hot-spin
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
2541 1955 99% 99% 99% S 1073807360 qfp-ucode-utah <<< high CPU process
1551 929 7% 7% 7% S 2038525952 fman_fp_image
在8核架构上,在Cisco IOS XE 16.6.x之前,您会看到相同的结果,其中不同的核心采用热旋转:
#show processes cpu platform sorted
CPU utilization for five seconds: 15%, one minute: 14%, five minutes: 15%
Core 0: CPU utilization for five seconds: 6%, one minute: 4%, five minutes: 8%
Core 1: CPU utilization for five seconds: 1%, one minute: 0%, five minutes: 2%
Core 2: CPU utilization for five seconds: 9%, one minute: 10%, five minutes: 7%
Core 3: CPU utilization for five seconds: 1%, one minute: 2%, five minutes: 1%
Core 4: CPU utilization for five seconds: 1%, one minute: 1%, five minutes: 1%
Core 5: CPU utilization for five seconds: 0%, one minute: 0%, five minutes: 0%
Core 6: CPU utilization for five seconds: 99%, one minute: 99%, five minutes: 99% <<< hot-spin
Core 7: CPU utilization for five seconds: 0%, one minute: 0%, five minutes: 0%
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
3432 2779 99% 99% 99% S 1086341120 qfp-ucode-utah <<< high CPU process
2612 1893 7% 7% 7% S 2038697984 fman_fp_image
26114 25132 4% 5% 5% R 42803200 hman
在添加思科IOS XE 16.6.x之后,您可以看到核心2和核心3之间的负载分配:
------------------ show process cpu platform sorted ------------------
CPU utilization for five seconds: 31%, one minute: 32%, five minutes: 29%
Core 0: CPU utilization for five seconds: 3%, one minute: 3%, five minutes: 3%
Core 1: CPU utilization for five seconds: 3%, one minute: 2%, five minutes: 2%
Core 2: CPU utilization for five seconds: 39%, one minute: 41%, five minutes: 34% <<< load distributed
Core 3: CPU utilization for five seconds: 84%, one minute: 83%, five minutes: 79% <<< load distributed
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
26939 26344 127% 126% 116% S 1195311104 qfp-ucode-utah <<< high CPU process
在包括Cisco IOS XE 16.6.x之后,上述输出仍然适用,但内核4至7除外:
------------------ show process cpu platform sorted ------------------
CPU utilization for five seconds: 30%, one minute: 24%, five minutes: 27%
Core 0: CPU utilization for five seconds: 41%, one minute: 13%, five minutes: 13%
Core 1: CPU utilization for five seconds: 23%, one minute: 11%, five minutes: 13%
Core 2: CPU utilization for five seconds: 19%, one minute: 10%, five minutes: 12%
Core 3: CPU utilization for five seconds: 38%, one minute: 12%, five minutes: 12%
Core 4: CPU utilization for five seconds: 28%, one minute: 26%, five minutes: 28% <<< load distributed
Core 5: CPU utilization for five seconds: 53%, one minute: 40%, five minutes: 37% <<< load distributed
Core 6: CPU utilization for five seconds: 18%, one minute: 16%, five minutes: 17% <<< load distributed
Core 7: CPU utilization for five seconds: 93%, one minute: 81%, five minutes: 81% <<< load distributed
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
26049 25462 164% 165% 170% S 394128 qfp-ucode-utah <<< high CPU process
注意:如果您怀疑核心CPU使用率有问题,请创建技术支持中心(TAC)案例以获得帮助并确认设备稳定性。
监控CPU的最佳实践
最好使用特定命令来获取数据路径利用率或IOSd利用率,核心显示命令的结果可能导致误报警报。
用于监控数据路径利用率的命令为:
- show platform hardware qfp active datapath utilization
用于监控IOSd使用情况的命令是:
使用以下任一对象标识符(OID)通过简单网络管理协议(SNMP)监控IOSd CPU使用情况: