{
    "name"  : "接口未收到回应报文流量个数",
    "precondition" : [],
    "problems" : {
        "intf" : {
            "desc"      : "【问题】接口 ${0} 质量或者配置可能存在问题，该接口中存在${1}的流量没有收到回应报文",
            "advice"    : "【建议】"
        }
    }
}


---------------------------code-------------------------------

isProblemFound = false

wansDetail = get_share_value('wansDetail');
#set_share_value('wansDetail', wansDetail)
cmd = "show ip fpm statistics | include ctive"
res = cli(cmd)
reg = /.+:(\d+)/im
matchStr = reg.exec(res)
if matchStr != null:
    totalFlowNum = matchStr[1]
end
#print totalFlowNum
if totalFlowNum > 15000 :
    return 'success'
end
warningNum = totalFlowNum / 4;

cmd = "show ip fpm p 1 | include /unknow"
res = cli(cmd)
unKnowList = formatFpmUnknow(res)

intfUnknowNum = {}
foreach list in unKnowList :
    objId = list
    foreach int in wansDetail:
        if int.isUP && int.ip :
            intf = int.intf
            refAbj = int.refAbj
            foreach i in refAbj:
                if objId == i.id:
                    intfUnknowNum[intf] = intfUnknowNum[intf] || 0
                    intfUnknowNum[intf] = intfUnknowNum[intf] + 1
                end
            end
            
        end
    end
end

foreach n in intfUnknowNum:
    unknowNum = n;
    if unknowNum >= warningNum:
        isProblemFound = true
        str1= (unknowNum / totalFlowNum * 100)
        str = str1 + "%(" + unknowNum + "/"" + totalFlowNum 
        add_problem("intf",[intf, str])
    end
end


if isProblemFound == true:
    return 'warn'
else:
    return 'success'
end

