{
    "name"  : "检测设备性能是否不足",
    "problems" : {
        "poorPerformance" : {
            "desc"      : "【问题】设备性能已达到最大",
            "advice"    : "【建议】当前设备性能不足，请确认内网是否存在攻击行为或联系400客服人工诊断"
        },
        "poorCPU" : {
            "desc"      : "【问题】当前部分进程过度消耗cpu资源",
            "advice"    : "【建议】请联系400客服进行人工服务"
        }
    }
}

---------------------------code-------------------------------
no_buff_arr = []
i = 0
while i < 5 :
    total_no_buffer_num = 0
    response = cli('show int | in no buff')
    reg = /\d+\sno\sbuffer/g
    result = response.match(reg)
    if result != null :
        foreach item in result :
            reg = /^(\d+)/
            no_buffer_num = item.match(reg)
            no_buffer_num = no_buffer_num[1]
            no_buffer_num = parse_int(no_buffer_num)
            total_no_buffer_num = total_no_buffer_num + no_buffer_num
        end
    end
    no_buff_arr.push(total_no_buffer_num)
    i = i + 1
    if i < 5 :
        sleep(3000)
    end
end

isPoorPerformance = true
i = 0
while i < 5 :
    current = no_buff_arr[i]
    if current < 10000 :
        isPoorPerformance = false
        break
    end
    if i < 4 :
        j = i + 1
        next = no_buff_arr[j]
        if current > next :
            isPoorPerformance = false
            break
        end
    end
    i = i + 1
end

if isPoorPerformance == true :
    add_problem('poorPerformance')
    return 'warn'
end

cpu_arr = []
i = 0
while i < 5 :
    cpu_useage = 0
    response = cli('show cpu | ex 0.00%   0.00%   0.00%')
    reg = /CPU\sutilization\sin\sfive\sseconds:\s+(\d+)\%/
    result = response.match(reg)
    if result != null :
        cpu_useage = result[1]
    end
    cpu_arr.push(cpu_useage)
    i = i + 1
    if i < 5 :
        sleep(3000)
    end
end

isPoorCPU = true
i = 0
while i < 5 :
    current = cpu_arr[i]
    if current < 85 :
        isPoorCPU = false
        break
    end
    i = i + 1
end

if isPoorCPU == true :
    add_problem('poorCPU')
    return 'warn'
end 

return 'success'