{
    "name"  : "pim6d进程",
    "problems" : {
        "pim6d" : {
            "desc"      : "【问题】pim6d进程CPU利用率高，可能原因大量未知组播报文送CPU",
            "advice"    : ["【建议】建议部署防组播源欺骗ACL:"
                          ,"\t允许所有的ICMP报文"
                          ,"\t运行合法组播源及组播目标"
                          ,"\t拒绝所有其他的组播流"
                          ,"\t运行所有IPV6报文"
                          ,"\t命令示例:"
                          ,"\t\tRuijie(config)#no logging console"
                          ,"\t或者"
                          ,"\t\tRuijie(config)# logging rate-limit all 10 except emergencies"]
        }
    }
}
---------------------------code-------------------------------
#pim6d

def callback(err, isHighRate) :
    if err :
        return 'skip'
    end
    if isHighRate :
        add_problem('pim6d')
        return 'warn'
    else :
        return 'success'
    end
end

def checkCpuRate(process) :
    cmdTemp = 'show cpu | in ' + process
    response = cli(cmdTemp)
    print response
    if response.search('Invalid input | Unknown command.') != -1 :
        add_reason('无效指令：show cpu | in ')
        return 'skip'    
    end
    reg = /\d+\s([^%]*)%/
    rate = response.match(reg)
	if rate == null:
		sreTemp = '不存在进程' + process
        add_reason(sreTemp)
        return 'skip'
	end
    if rate.length > 0 :
        rate = rate[1]  
    end
    print rate
    rate = parse_float(rate)
    if rate == "解析出错" :
        strTemp = '不存在进程' + process + '或者 cpu使用率解析失败'
        add_reason(strTemp)
        return 'skip'
    end
    if rate < 20 :
        result = callback(null, false)
        return result
    else :
        result = callback(null, true)
        return result
    end
end

result = checkCpuRate('pim6d')
return result
