Ejemplo n.º 1
0
def main():
    """Plugin: check_asa_connections."""
    argparser = SnmpArguments(description)
    argparser.parser.add_argument("-w", help="Number of connections to report warning state", type=int)
    argparser.parser.add_argument("-c", help="Number of connections to report critical state", type=int)

    args = argparser.parser.parse_nelmon_args()
    snmp = NelmonSnmp(args)

    current_connections = O.cfwConnectionStatValue + ".40.6"
    connections = snmp.get_value(current_connections)

    if not args.c or not args.w:
        nelmon_exit(C.UNKNOWN, "Use -w or -c")

    if args.c <= connections:
        exit_code = C.CRITICAL
        exit_string = "%d connections" % connections
    elif args.w <= connections:
        exit_code = C.WARNING
        exit_string = "%d connections" % connections
    else:
        exit_code = C.OK
        exit_string = "%d connections" % connections

    if args.c and args.w:
        perf_data = "connections=%s;%s;%s" % (connections, args.w, args.c)
    else:
        perf_data = "connections=%s" % connections

    nelmon_exit(exit_code, exit_string, perf_data=perf_data)
Ejemplo n.º 2
0
def main():
    """Plugin: check_uptime."""
    argparser = SnmpArguments(description)
    args = argparser.parser.parse_nelmon_args()
    snmp = NelmonSnmp(args)
    uptime = snmp.get_value(O.sysUpTime + '.0')
    nelmon_exit(C.OK, uptime)
Ejemplo n.º 3
0
def main():
    """Plugin: check_asa_connections."""
    argparser = SnmpArguments(description)
    argparser.parser.add_argument(
        '-w', help='Number of connections to report warning state', type=int)
    argparser.parser.add_argument(
        '-c', help='Number of connections to report critical state', type=int)

    args = argparser.parser.parse_nelmon_args()
    snmp = NelmonSnmp(args)

    current_connections = O.cfwConnectionStatValue + ".40.6"
    connections = snmp.get_value(current_connections)

    if not args.c or not args.w:
        nelmon_exit(C.UNKNOWN, 'Use -w or -c')

    if args.c <= connections:
        exit_code = C.CRITICAL
        exit_string = "%d connections" % connections
    elif args.w <= connections:
        exit_code = C.WARNING
        exit_string = "%d connections" % connections
    else:
        exit_code = C.OK
        exit_string = "%d connections" % connections

    if args.c and args.w:
        perf_data = 'connections=%s;%s;%s' % (connections, args.w, args.c)
    else:
        perf_data = 'connections=%s' % connections

    nelmon_exit(exit_code, exit_string, perf_data=perf_data)
Ejemplo n.º 4
0
def main():
    """Plugin: check_uptime."""
    argparser = SnmpArguments(description)
    args = argparser.parser.parse_nelmon_args()
    snmp = NelmonSnmp(args)
    uptime = snmp.get_value(O.sysUpTime + '.0')
    nelmon_exit(C.OK, uptime)