{
    "name"  : "审计进程CPU利用率检查",
    "problems" : {
        "cpu" : {
            "desc"      : "【问题】审计进程CPU利用率高。",
            "advice"    : "【建议】建议使用NPE模式与elog联动记录审计日志，NPE模式将不使用硬盘可以大幅提升设备的稳定性，EG转换为NPE模式的命令为no write-db enable，需要重启设备生效。"
        }
    }
}
---------------------------code-------------------------------
mode = get_device_model()

if mode.indexOf("eg2000x") != -1 || mode.indexOf("eg2000xe") != -1 || mode.indexOf("eg2000ue") != -1 :
    res = cli("show cpu | in flow audit")
    resArr = res.split(/\r?\n/)
    i = 1
    while i < (resArr.length - 1):
        resSingal = resArr[i]
        resSingal = resSingal.trim()
        resSingalArr = resSingal.split(/\S+/)
        j = 1
        while j < (resSingalArr.length - 1):
            cpu = resSingalArr[j]
            cpu = cpu.replace("%", "")   
            if cpu > 60 :
                add_problem("cpu")
                return "warn"
            end    
			j = j + 1        
        end
		i = i + 1
    end
    res = cli("show cpu | in nat log")
    resArr = res.split(/\r?\n/)
    i = 1
    while i < (resArr.length - 1):
        resSingal = resArr[i]
        resSingal = resSingal.trim()
        resSingalArr = resSingal.split(/\S+/)
        j = 1
        while j < (resSingalArr.length - 1):
            cpu = resSingalArr[j]
            cpu = cpu.replace("%", "")   
            if cpu > 60 :
                add_problem("cpu")
                return "warn"
            end   
			j = j + 1         
        end
		i = i + 1
    end
end

return "skip"