{
    "name"  : "接口MTU检查",
    "problems" : {
        "interfaceMTU" : {
            "desc"      : "【问题】接口（${0}）以${1}大小报文无法PING通114",
            "advice"    : "【建议】如果存在网络卡或业务异常可以尝试减小接口MTU. 针对物理口，配置方式为进入接口配置模块，通过命令ip mtu修改接口的ip mtu大小；如：\r\nRuijie(config)#interface gigabitEthernet 0/1\r\nRuijie(config-if-GigabitEthernet 0/1)#ip mtu 1400。\r\n针对拨号口，配置方式为进入接口配置模块，通过命令mtu修改拨号接口的mtu大小；如：\r\nRuijie(config)#interface dialer 1\r\nRuijie(config-if-GigabitEthernet 0/1)#mtu 1400"
        }
    }
}
---------------------------code-------------------------------
res = cli("show html inter info | in WAN")
resArr = res.split(/\r?\n/)
interfaceArr = []
i = 1
while i < (resArr.length - 1):
    resSignal = resArr[i]
    if resSignal.indexOf("down") == -1 && resSignal.indexOf("DOWN") == -1 :
        resSignal = resSignal.trim()
        resSignalArr = resSignal.split("#")
        interName = resSignalArr[0]
        interfaceArr.push(interName)
    end
    i = i + 1
end

interfaceMTUJson = {}
interfaceStr = ""
MTUStr = ""
isWarn = false
j = 0
while j < interfaceArr.length :
    cmd = "show inter " + interfaceArr[j] + " | in MTU"
    res = cli(cmd)
    resArr = res.split(/\r?\n/)
    resString = resArr[1]
    resString = resString.trim()
    MTU = resString.split(/\s+/)
    MTU = MTU[1]
    interName = interfaceArr[j]
    interfaceMTUJson[interName] = MTU
    cmd = "ping 114.114.114.114 length " + (MTU - 28) + " source " + interName + " df-bit"
    pingRes = cli(cmd)
    if pingRes.indexOf("Success rate is 0 percent") != -1 :
        interfaceStr = interfaceStr + interName
        MTUStr = MTUStr + " " + (MTU - 28)
        isWarn = true
    end
    j = j + 1
end

if isWarn:
    add_problem("interfaceMTU",[interfaceStr, MTUStr])
    return "warn"
end
return "success"