SD-WAN 閘道 可依預期處理突增的流量以及突增的高 CPU。請監控閘道中處於 100% 旋轉狀態的 CPU 核心。但是,基於效能考慮,DPDK 核心會在輪詢模式下執行,因為這些核心預期會在輸送量高時佔用近 100% CPU。

您可以使用臨界值來監控閘道,這些臨界值提供警告或嚴重狀態,以便在潛在問題影響服務之前,指出這些問題。下表列出臨界值和建議的動作。

臨界值狀態 臨界值 建議的更正動作
DP 核心 非 DP 核心
警告 95% 80%

如果在 5 分鐘內持續超過臨界值:

  • 檢查每項程序的 CPU 使用率。
  • 再監控 10 分鐘。

如果在 5 分鐘內持續超過臨界值:

  • 收集閘道診斷服務包。
  • 向 VMware 提交支援案例。
嚴重 98% 90%

如果在 5 分鐘內持續超過臨界值:

  • 監控找出可能的嚴重封包捨棄問題 (可能表示超出容量)。

如果在一小時內持續觀察到該問題:

  • 如果在 5 分鐘間隔內持續觀察到超出容量,請增加閘道容量,並重新平衡以避免發生與容量有關的服務影響。
    備註: 在重新平衡閘道之前,請確認容量度量是在建議的限制內。如需容量度量的詳細資訊,請參閱 閘道元件的容量
以下是用於監控 CPU 使用率的範例 Python 指令碼:
備註: 您還可以使用 Telegraf 來監控 CPU 使用率。如需詳細資訊,請參閱 使用 Telegraf 監控閘道
#! /usr/bin/env python
"""
Check for CPUs spinning at 100%
"""
import re
import collections
import time
import sys
import json
import os
import subprocess
re_cpu = re.compile(r"^cpu\d+\s")
CPUStat = collections.namedtuple('CPUStat', ['user', 'nice', 'sys', 'idle'])
def get_stats():
        stats = open("/proc/stat").readlines()
        ret = {}
        for s in stats:
                if not re_cpu.search(s): continue
                s = s.split()
                ret[s[0]] = CPUStat(*[ int(v) for v in s[1:5]])
        return ret
def verify_dpdk_support():
    if os.path.isfile('/opt/vc/etc/dpdk.json'):
       with open("/opt/vc/etc/dpdk.json") as data:
           d=json.loads((data.read()))
       if "status" in  d.keys():
           return True if d['status'] is "Supported" else False
    else:
       return False
def another_verify_dpdk_support():
    if os.path.isfile('/opt/vc/bin/debug.py'):
        f=subprocess.check_output(["/opt/vc/bin/debug.py","--dpdk_ports_dump"])
        x=[r.split() for r in f.split('\n')]
	if len(x) <= 1:
		return False
	else:
                return True
    else:
	return False
dpdk_status=verify_dpdk_support() or another_verify_dpdk_support()
if __name__ == "__main__":
        try:
                stat1 = get_stats()
                time.sleep(3)
                stat2 = get_stats()
        except:
                print "UKNOWN - failed to get CPU stat: %s" % str(sys.exc_info()[1])
                sys.exit(3)
        busy_cpu_set = [ cpu for cpu in stat1 if (stat2[cpu].idle - stat1[cpu].idle)==0 ]
        if not busy_cpu_set:
                        print "OK - no spinning CPUs"
                        sys.exit(0)
        if dpdk_status == True:
           if "cpu1" in busy_cpu_set and len(busy_cpu_set) == 1:
                        print "OK - no spinning CPUs"
                        sys.exit(0)
           elif "cpu1" in busy_cpu_set:
                        busy_cpu_set.remove('cpu1')
                        print "CRITICAL - %s is at 100%%" % (",".join(busy_cpu_set))
                        sys.exit(2)
           else:
                        print busy_cpu_set,1
                        print "CRITICAL - %s is at 100%%" % (",".join(busy_cpu_set))
                        sys.exit(2)
        else:
                        print "CRITICAL - %s is at 100%%" % (",".join(busy_cpu_set))
                        sys.exit(2)