#!/usr/bin/python


def inventory_cisco_vg_dialpeer(info):
    inventory = []
    for dptype, status, inCalls, outCalls, dialPeer in info:
        if status == '1':
            inventory.append((dialPeer, None))
    return inventory


def check_cisco_vg_dialpeer(item, _no_params, info):
    for dptype, status, inCalls, outCalls, dialPeer in info:
        if dialPeer == item:
            if status == '1':
                return (0, inCalls + " incoming calls, " + outCalls + " outgoing calls", [
                    ("inCalls", int(inCalls)),
                    ("outCalls", int(outCalls))])
            else:
                return (1, "Critical - dialpeer is " + status)
    return (3, "UNKNOWN - Dialpeer nof found")


check_info["cisco_vg_dialpeer"] = {
    'check_function':            check_cisco_vg_dialpeer,
    'inventory_function':        inventory_cisco_vg_dialpeer,
    'service_description':       'Dialpeer %s',
    'has_perfdata':              True,
}

snmp_info["cisco_vg_dialpeer"] = (
    ".1.3.6.1.4.1.9.9.63.1",
    ["2.1.1.3", "2.1.1.4", "3.8.4.1.1", "3.8.4.1.2", OID_END]
)
