コード例 #1
0
def test_start_apc_agent():
    # start the testagent (APC walk)
    # TimeTicks does not work - Replaced TimeTicks value by INTEGER
    # some of the values are not from a walk - I modified them to have the return values I need (critical etc.)
    # For now left out external temperature sensor oids as no data in snmpwalk
    # apc_oid_environment_temperature     = apc_oid_base + ".1.1.10.2.3.2.1.4.1"
    # apc_oid_environment_temperature_unit= apc_oid_base + ".1.1.10.2.3.2.1.5"
    # TODO add this data

    walk =  '''
        1.3.6.1.4.1.318.1.1.1.2.1.1.0 = INTEGER: 2
        1.3.6.1.4.1.318.1.1.1.2.1.2.0 = INTEGER: 60000
        1.3.6.1.4.1.318.1.1.1.2.2.1.0 = INTEGER: 80
        1.3.6.1.4.1.318.1.1.1.2.2.2.0 = INTEGER: 26
        1.3.6.1.4.1.318.1.1.1.2.2.3.0 = INTEGER: 120000
        1.3.6.1.4.1.318.1.1.1.2.2.4.0 = INTEGER: 1
        1.3.6.1.4.1.318.1.1.1.3.2.1.0 = INTEGER: 113
        1.3.6.1.4.1.318.1.1.1.3.2.2.0 = INTEGER: 115
        1.3.6.1.4.1.318.1.1.1.3.2.3.0 = INTEGER: 113
        1.3.6.1.4.1.318.1.1.1.3.2.4.0 = INTEGER: 49
        1.3.6.1.4.1.318.1.1.1.4.2.1.0 = INTEGER: 230
        1.3.6.1.4.1.318.1.1.1.4.2.2.0 = INTEGER: 49
        1.3.6.1.4.1.318.1.1.1.4.2.3.0 = INTEGER: 18
        1.3.6.1.4.1.318.1.1.1.4.2.4.0 = INTEGER: 1
        1.3.6.1.4.1.318.1.1.1.4.2.6.0 = INTEGER: 3
        1.3.6.1.4.1.318.1.1.1.4.2.8.0 = INTEGER: 123
        1.3.6.1.4.1.318.1.1.1.7.2.3.0 = INTEGER: 3
        1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1.0 = INTEGER: 25
        1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.0 = INTEGER: 1
        '''   
    testagent.register_snmpwalk_ouput(walk)
    testagent.start_server()
def test_trustedfilter_ps_acoff():
    walk =  '''
    .1.3.6.1.4.1.2566.107.41.1.0 = INTEGER: 1
    .1.3.6.1.4.1.2566.107.31.2.1.0 = INTEGER: 80
    .1.3.6.1.4.1.2566.107.31.2.2.0 = INTEGER: 4
    .1.3.6.1.4.1.2566.107.31.2.3.0 = INTEGER: 4
    .1.3.6.1.4.1.2566.107.31.2.4.0 = INTEGER: 1
    .1.3.6.1.4.1.2566.107.31.2.5.0 = INTEGER: 1
    .1.3.6.1.4.1.2566.107.31.2.7.0 = INTEGER: 1
    .1.3.6.1.4.1.2566.107.31.2.8.0 = INTEGER: 1
    '''
    testagent.register_snmpwalk_ouput(walk)
    p=subprocess.Popen("python health_monitoring_plugins/check_snmp_trusted_filter/check_snmp_trusted_filter.py -H localhost:1234",
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    assert p.stdout.read() == (
        "Critical - Filter Status. Power Supply 1: AC off. Power Supply 2: AC off | 'logfill'=80%%;;;;\n"
        "Power Supply 1: AC off\n"
        "Power Supply 2: AC off\n"
        "Fan 1: ok\n"
        "Fan 2: ok\n"
        "Battery: ok\n"
        "Temperature: ok\n"
        "Fill Level internal log: 80%\n"
        "Activity State: standby\n")
    testagent.unregister_all()
コード例 #3
0
def test_all_good():
    walk =  '''.1.3.6.1.4.1.5835.5.2.5700.1.3.3.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.5700.1.3.1.1.3.1 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.11.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.12.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.6.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.2.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.1.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.10.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.5.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.8.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.7.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.500.1.6.11.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.500.1.6.12.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.500.1.6.17.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.3500.1.1.1.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.4600.1.1.2.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.4600.1.1.1.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.9.2.0 = INTEGER: 251
               .1.3.6.1.4.1.5835.5.2.100.1.9.1.0 = INTEGER: 21'''
    testagent.register_snmpwalk_ouput(walk)
    p=subprocess.Popen("health_monitoring_plugins/check_newtecmodem/check_newtecmodem.py -H 127.0.0.1:1234 -m MDM6000",
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    assert p.stdout.read() == "Newtec MDM6000 | 'power_v'=251;;;; 'temp_deg_c'=21;;;;\n"
    p=subprocess.Popen("health_monitoring_plugins/check_newtecmodem/check_newtecmodem.py -H 127.0.0.1:1234 -m MDM9000",
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    assert p.stdout.read() == "Newtec MDM9000 | 'power_v'=251;;;; 'temp_deg_c'=21;;;;\n"
コード例 #4
0
def test_start_apc_agent():
    # start the testagent (APC walk)
    # TimeTicks does not work - Replaced TimeTicks value by INTEGER
    # some of the values are not from a walk - I modified them to have the return values I need (critical etc.)
    # For now left out external temperature sensor oids as no data in snmpwalk
    # apc_oid_environment_temperature     = apc_oid_base + ".1.1.10.2.3.2.1.4.1"
    # apc_oid_environment_temperature_unit= apc_oid_base + ".1.1.10.2.3.2.1.5"
    # TODO add this data

    walk = '''
        1.3.6.1.4.1.318.1.1.1.2.1.1.0 = INTEGER: 2
        1.3.6.1.4.1.318.1.1.1.2.1.2.0 = INTEGER: 60000
        1.3.6.1.4.1.318.1.1.1.2.2.1.0 = INTEGER: 80
        1.3.6.1.4.1.318.1.1.1.2.2.2.0 = INTEGER: 26
        1.3.6.1.4.1.318.1.1.1.2.2.3.0 = INTEGER: 120000
        1.3.6.1.4.1.318.1.1.1.2.2.4.0 = INTEGER: 1
        1.3.6.1.4.1.318.1.1.1.3.2.1.0 = INTEGER: 113
        1.3.6.1.4.1.318.1.1.1.3.2.2.0 = INTEGER: 115
        1.3.6.1.4.1.318.1.1.1.3.2.3.0 = INTEGER: 113
        1.3.6.1.4.1.318.1.1.1.3.2.4.0 = INTEGER: 49
        1.3.6.1.4.1.318.1.1.1.4.2.1.0 = INTEGER: 230
        1.3.6.1.4.1.318.1.1.1.4.2.2.0 = INTEGER: 49
        1.3.6.1.4.1.318.1.1.1.4.2.3.0 = INTEGER: 18
        1.3.6.1.4.1.318.1.1.1.4.2.4.0 = INTEGER: 1
        1.3.6.1.4.1.318.1.1.1.4.2.6.0 = INTEGER: 3
        1.3.6.1.4.1.318.1.1.1.4.2.8.0 = INTEGER: 123
        1.3.6.1.4.1.318.1.1.1.7.2.3.0 = INTEGER: 3
        1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1.0 = INTEGER: 25
        1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.0 = INTEGER: 1
        '''
    testagent.register_snmpwalk_ouput(walk)
    testagent.start_server()
コード例 #5
0
def test_some_alarms():
    testagent.unregister_all()
    walk = '''.1.3.6.1.4.1.5835.5.2.5700.1.3.3.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.5700.1.3.1.1.3.1 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.11.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.10.12.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.6.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.10.2.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.1.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.10.10.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.5.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.10.8.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.7.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.500.1.6.11.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.500.1.6.12.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.500.1.6.17.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.3500.1.1.1.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.4600.1.1.2.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.4600.1.1.1.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.9.2.0 = INTEGER: 251
               .1.3.6.1.4.1.5835.5.2.100.1.9.1.0 = INTEGER: 21'''
    testagent.register_snmpwalk_ouput(walk)
    p = subprocess.Popen(
        "health_monitoring_plugins/check_newtecmodem/check_newtecmodem.py -H 127.0.0.1:1234 -m MDM6000",
        shell=True,
        stdout=subprocess.PIPE,
        env=context.testenv)
    p.wait()
    assert p.returncode == 2
    assert p.stdout.read() == (
        "Newtec MDM6000. Status: 7 alarms active. | 'power_v'=2.51;;;; 'temp_deg_c'=21.0;;;;\n"
        "Alarm: Antenna non-functional\n"
        "Alarm: Frontpanel communication failed\n"
        "Alarm: General device failure\n"
        "Alarm: License file non-existent or wrongly signed\n"
        "Alarm: Software upgrade failed\n"
        "Alarm: Failure is detected on data ethernet interface\n"
        "Alarm: Fan failure\n")
    p = subprocess.Popen(
        "health_monitoring_plugins/check_newtecmodem/check_newtecmodem.py -H 127.0.0.1:1234 -m MDM9000",
        shell=True,
        stdout=subprocess.PIPE,
        env=context.testenv)
    p.wait()
    assert p.returncode == 2
    assert p.stdout.read() == (
        "Newtec MDM9000. Status: 9 alarms active. | 'power_v'=2.51;;;; 'temp_deg_c'=21.0;;;;\n"
        "Alarm: Antenna non-functional\n"
        "Alarm: Hardware malfunction\n"
        "Alarm: Frontpanel communication failed\n"
        "Alarm: General device failure\n"
        "Alarm: License file non-existent or wrongly signed\n"
        "Alarm: Software upgrade failed\n"
        "Alarm: Failure is detected on data ethernet interface\n"
        "Alarm: Fan failure\n"
        "Alarm: Converter not working due to hardware failures\n")
コード例 #6
0
def test_battery_test_detail(capsys):
    a_check_type = "BATTERY_TEST_DETAIL"

    testagent.unregister_all()
    # upsTestResultsDetail
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.4.0 = STRING: "Testdetails"''')
    test_util.check_value_without_thresholds(
        eaton_ups_check_plugin_path, a_check_type, "OK",
        "Details of last UPS diagnostic test: Testdetails")
コード例 #7
0
def test_alarms(capsys):
    a_check_type = "ALARMS"
    # upsAlarmsPresent
    testagent.unregister_all()
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.6.1.0 = INTEGER: 0''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "OK",
                                             "active alarms = 0")

    testagent.unregister_all()
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.6.1.0 = INTEGER: 1''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "Critical",
                                             "active alarms = 1")
コード例 #8
0
def test_some_alarms():
    testagent.unregister_all()
    walk =  '''.1.3.6.1.4.1.5835.5.2.5700.1.3.3.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.5700.1.3.1.1.3.1 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.11.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.10.12.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.6.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.10.2.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.1.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.10.10.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.5.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.10.8.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.7.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.500.1.6.11.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.500.1.6.12.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.500.1.6.17.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.3500.1.1.1.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.4600.1.1.2.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.4600.1.1.1.0 = INTEGER: 1
               .1.3.6.1.4.1.5835.5.2.100.1.9.2.0 = INTEGER: 251
               .1.3.6.1.4.1.5835.5.2.100.1.9.1.0 = INTEGER: 21'''
    testagent.register_snmpwalk_ouput(walk)
    p=subprocess.Popen("health_monitoring_plugins/check_newtecmodem/check_newtecmodem.py -H 127.0.0.1:1234 -m MDM6000",
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    assert p.stdout.read() == (
        "Newtec MDM6000. 7 alarms active | 'power_v'=251;;;; 'temp_deg_c'=21;;;;\n"
        "Alarm: Antenna non-functional\n"
        "Alarm: Frontpanel communication failed\n"
        "Alarm: General device failure\n"
        "Alarm: License file non-existent or wrongly signed\n"
        "Alarm: Software upgrade failed\n"
        "Alarm: Failure is detected on data ethernet interface\n"
        "Alarm: Fan failure\n")
    p=subprocess.Popen("health_monitoring_plugins/check_newtecmodem/check_newtecmodem.py -H 127.0.0.1:1234 -m MDM9000",
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    assert p.stdout.read() == (
        "Newtec MDM9000. 9 alarms active | 'power_v'=251;;;; 'temp_deg_c'=21;;;;\n"
        "Alarm: Antenna non-functional\n"
        "Alarm: Hardware malfunction\n"
        "Alarm: Frontpanel communication failed\n"
        "Alarm: General device failure\n"
        "Alarm: License file non-existent or wrongly signed\n"
        "Alarm: Software upgrade failed\n"
        "Alarm: Failure is detected on data ethernet interface\n"
        "Alarm: Fan failure\n"
        "Alarm: Converter not working due to hardware failures\n")
コード例 #9
0
def test_all_good():
    walk =  '''.1.3.6.1.4.1.29890.1.6.2.4.3.8.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.9.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.5.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.6.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.4.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.7.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.1.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.1.0 = INTEGER: 100
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.2.0 = INTEGER: 120
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.3.0 = INTEGER: 250
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.4.0 = INTEGER: 250
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.5.0 = INTEGER: 330
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.6.0 = INTEGER: 500
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.7.0 = INTEGER: 900
               .1.3.6.1.4.1.29890.1.8.1.4.3.7.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.8.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.4.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.5.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.9.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.10.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.1.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.6.2.6.2.0 = STRING: "0000 0010"
               .1.3.6.1.4.1.29890.1.6.2.6.3.0 = STRING: "0000 0001"
               .1.3.6.1.4.1.29890.1.8.1.6.1.0 = INTEGER: 0'''
    testagent.register_snmpwalk_ouput(walk)
    p=subprocess.Popen(("health_monitoring_plugins/check_microwavemodem/check_microwavemodem.py -H 127.0.0.1:1234 -m SK-IP"),
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    p.wait()
    assert p.returncode == 2
    assert p.stdout.read() == (
        "WORK Microwave SK-IP Modem. System status: 1 error(s). Demodulator status: 1 warning(s). | "
        "'volt_dmd7'=9.0;;;; 'temp_demod_deg_c'=40.0;;;; 'volt_dmd5'=3.3;;;; 'volt_dmd4'=2.5;;;; "
        "'temp_demod_psu_deg_c'=40.0;;;; 'volt_dmd2'=1.2;;;; 'volt_dmd1'=1.0;;;; 'volt_dmd6'=5.0;;;; "
        "'temp_cpu2_deg_c'=40.0;;;; 'temp_ctl1_deg_c'=40.0;;;; 'temp_ctl2_deg_c'=40.0;;;; 'volt_dmd3'=2.5;;;; "
        "'temp_frontpanel_deg_c'=40.0;;;; 'temp_cpu1_deg_c'=40.0;;;;\n"
        "System: Mod. communication alarm\n"
        "Demodulator: FIFO full warning\n")
    p=subprocess.Popen(("health_monitoring_plugins/check_microwavemodem/check_microwavemodem.py -H 127.0.0.1:1234 -m AX-60"),
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    p.wait()
    assert p.returncode == 0
    assert p.stdout.read() == (
        "WORK Microwave AX-60 Modem. Global status: Ok. | 'temp_cpu_board_deg_c'=40.0;;;; "
        "'temp_cpu_deg_c'=40.0;;;; 'temp_demodulator_deg_c'=40.0;;;; 'temp_device_deg_c'=40.0;;;; "
        "'temp_bridge_chip_deg_c'=40.0;;;; 'temp_demodulator_board_deg_c'=40.0;;;; 'temp_bridge_board_deg_c'=40.0;;;;\n")
コード例 #10
0
def test_all_good():
    walk =  '''.1.3.6.1.4.1.29890.1.6.2.4.3.8.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.9.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.5.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.6.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.4.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.7.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.3.1.0 = INTEGER: 40
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.1.0 = INTEGER: 100
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.2.0 = INTEGER: 120
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.3.0 = INTEGER: 250
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.4.0 = INTEGER: 250
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.5.0 = INTEGER: 330
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.6.0 = INTEGER: 500
               .1.3.6.1.4.1.29890.1.6.2.4.4.2.7.0 = INTEGER: 900
               .1.3.6.1.4.1.29890.1.8.1.4.3.7.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.8.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.4.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.5.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.9.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.10.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.8.1.4.3.1.0 = INTEGER: 40000
               .1.3.6.1.4.1.29890.1.6.2.6.2.0 = INTEGER: 0
               .1.3.6.1.4.1.29890.1.6.2.6.3.0 = INTEGER: 0
               .1.3.6.1.4.1.29890.1.8.1.6.1.0 = INTEGER: 0'''
    testagent.register_snmpwalk_ouput(walk)
    p=subprocess.Popen(("health_monitoring_plugins/check_microwavemodem/check_microwavemodem.py -H 127.0.0.1:1234 -m SK-IP"),
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    assert p.stdout.read() == (
        "WORK Microwave SK-IP Modem. System status: Ok. Demodulator status: Ok. | "
        "'volt_dmd7'=9.0;;;; 'temp_demod_deg_c'=40.0;;;; 'volt_dmd5'=3.3;;;; 'volt_dmd4'=2.5;;;; "
        "'temp_demod_psu_deg_c'=40.0;;;; 'volt_dmd2'=1.2;;;; 'volt_dmd1'=1.0;;;; "
        "'volt_dmd6'=5.0;;;; 'temp_cpu2_deg_c'=40.0;;;; 'temp_ctl1_deg_c'=40.0;;;; "
        "'temp_ctl2_deg_c'=40.0;;;; 'volt_dmd3'=2.5;;;; 'temp_frontpanel_deg_c'=40.0;;;; "
        "'temp_cpu1_deg_c'=40.0;;;;\n")
    p=subprocess.Popen(("health_monitoring_plugins/check_microwavemodem/check_microwavemodem.py -H 127.0.0.1:1234 -m AX-60"),
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    assert p.stdout.read() == (
        "WORK Microwave AX-60 Modem. Global status: Ok. | 'temp_cpu_board_deg_c'=40.0;;;; "
        "'temp_cpu_deg_c'=40.0;;;; 'temp_demodulator_deg_c'=40.0;;;; 'temp_device_deg_c'=40.0;;;; "
        "'temp_bridge_chip_deg_c'=40.0;;;; 'temp_demodulator_board_deg_c'=40.0;;;; ''=40.0;;;;\n")
コード例 #11
0
def test_battery_fault_warning(capsys):
    a_check_type = "BATTERY_FAULT_WARNING"

    testagent.unregister_all()
    # upsmgBatteryFaultBattery
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.9.0 = INTEGER: 2''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "OK",
                                             "Battery is not in fault state")

    testagent.unregister_all()
    # upsmgBatteryFaultBattery
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.9.0 = INTEGER: 1''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "Critical",
                                             "Battery is in fault state")

    testagent.unregister_all()
    # upsmgBatteryFaultBattery
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.9.0 = INTEGER: 3''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "Critical",
                                             "Unknown battery state")
コード例 #12
0
def test_battery_replacement_warning(capsys):
    a_check_type = "BATTERY_REPLACEMENT_WARNING"

    testagent.unregister_all()
    # upsmgBatteryReplacement
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.11.0 = INTEGER: 2''')
    test_util.check_value_without_thresholds(
        eaton_ups_check_plugin_path, a_check_type, "OK",
        "Battery does not need to be replaced")

    testagent.unregister_all()
    # upsmgBatteryReplacement
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.11.0 = INTEGER: 1''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "Critical",
                                             "Battery needs to be replaced")

    testagent.unregister_all()
    # upsmgBatteryReplacement
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.11.0 = INTEGER: 3''')
    test_util.check_value_without_thresholds(
        eaton_ups_check_plugin_path, a_check_type, "Critical",
        "Unknown battery replacement state")
コード例 #13
0
def test_all_good():
    walk = '''.1.3.6.1.4.1.5835.5.2.5700.1.3.3.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.5700.1.3.1.1.3.1 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.11.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.12.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.6.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.2.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.1.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.10.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.5.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.8.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.10.7.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.500.1.6.11.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.500.1.6.12.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.500.1.6.17.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.3500.1.1.1.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.4600.1.1.2.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.4600.1.1.1.0 = INTEGER: 0
               .1.3.6.1.4.1.5835.5.2.100.1.9.2.0 = INTEGER: 251
               .1.3.6.1.4.1.5835.5.2.100.1.9.1.0 = INTEGER: 21'''
    testagent.register_snmpwalk_ouput(walk)
    p = subprocess.Popen(
        "health_monitoring_plugins/check_newtecmodem/check_newtecmodem.py -H 127.0.0.1:1234 -m MDM6000",
        shell=True,
        stdout=subprocess.PIPE,
        env=context.testenv)
    p.wait()
    assert p.returncode == 0
    assert p.stdout.read(
    ) == "Newtec MDM6000. Status: OK. | 'power_v'=2.51;;;; 'temp_deg_c'=21.0;;;;\n"
    p = subprocess.Popen(
        "health_monitoring_plugins/check_newtecmodem/check_newtecmodem.py -H 127.0.0.1:1234 -m MDM9000",
        shell=True,
        stdout=subprocess.PIPE,
        env=context.testenv)
    p.wait()
    assert p.returncode == 0
    assert p.stdout.read(
    ) == "Newtec MDM9000. Status: OK. | 'power_v'=2.51;;;; 'temp_deg_c'=21.0;;;;\n"
コード例 #14
0
def test_start_eaton_agent():
    # start the testagent (Eaton walk)
    # Gauge32 are not working - So I replaced them by INTEGER
    # some of the values are not from a walk - I modified them to have the return values I need (critical etc.)
    #
    # TODO Open issues
    # - SNMP Walk does not contain data for OID iso.3.6.1.4.1.534.1.6.1.0
    # as there was no remote temperature sensor connected to the device.
    # Manually added oid and value

    # upsSecondsOnBattery
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.2.2.0 = INTEGER: 60''')
    # upsEstimatedMinutesRemaining
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.2.3.0 = INTEGER: 30''')
    # upsInputFrequency
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.3.3.1.2.1 = INTEGER: 500
        iso.3.6.1.2.1.33.1.3.3.1.2.2 = INTEGER: 500
        iso.3.6.1.2.1.33.1.3.3.1.2.3 = INTEGER: 500''')
    # upsInputVoltage
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.3.3.1.3.1 = INTEGER: 230
        iso.3.6.1.2.1.33.1.3.3.1.3.2 = INTEGER: 230
        iso.3.6.1.2.1.33.1.3.3.1.3.3 = INTEGER: 230
        iso.3.6.1.2.1.33.1.3.3.1.3.4 = INTEGER: 400
        iso.3.6.1.2.1.33.1.3.3.1.3.5 = INTEGER: 400
        iso.3.6.1.2.1.33.1.3.3.1.3.6 = INTEGER: 400       
        ''')
    # upsOutputVoltage
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.4.4.1.2.1 = INTEGER: 229
        iso.3.6.1.2.1.33.1.4.4.1.2.2 = INTEGER: 229
        iso.3.6.1.2.1.33.1.4.4.1.2.3 = INTEGER: 229
        iso.3.6.1.2.1.33.1.4.4.1.2.4 = INTEGER: 229
        iso.3.6.1.2.1.33.1.4.4.1.2.5 = INTEGER: 229
        iso.3.6.1.2.1.33.1.4.4.1.2.6 = INTEGER: 229
        ''')
    # upsOutputCurrent
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.4.4.1.3.1 = INTEGER: 20
        iso.3.6.1.2.1.33.1.4.4.1.3.2 = INTEGER: 20
        iso.3.6.1.2.1.33.1.4.4.1.3.3 = INTEGER: 20''')
    # upsOutputPower
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.4.4.1.4.1 = INTEGER: 536
        iso.3.6.1.2.1.33.1.4.4.1.4.2 = INTEGER: 536
        iso.3.6.1.2.1.33.1.4.4.1.4.3 = INTEGER: 536''')
    # upsOutputPercentLoad
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.4.4.1.5.1 = INTEGER: 19
        iso.3.6.1.2.1.33.1.4.4.1.5.2 = INTEGER: 19
        iso.3.6.1.2.1.33.1.4.4.1.5.3 = INTEGER: 19''')
    # upsAlarmsPresent
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.6.1.0 = INTEGER: 0''')
    # upsTestResultsSummary
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.3.0 = INTEGER: 1''')
    # upsTestResultsDetail
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.4.0 = STRING: ""''')
    # xupsBatCapacity
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.534.1.2.4.0 = INTEGER: 80''')
    # xupsEnvAmbientTemp
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.534.1.6.1.0 = INTEGER: 26''')
    # xupsEnvRemoteTemp
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.534.1.6.5.0 = INTEGER: 26''')
    # upsmgBatteryFaultBattery
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.9.0 = INTEGER: 2''')
    # upsmgBatteryReplacement
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.11.0 = INTEGER: 2''')
    # upsmgBatteryLowBattery
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.4.1.705.1.5.14.0 = INTEGER: 2''')

    testagent.start_server()
コード例 #15
0
def test_inlet_critical():    
    # For a Critical Inlet, we need to change the values of the corresponding OIDs
    testagent.unregister_all()
    walk =  '''iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.1 = INTEGER: 61
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.4 = INTEGER: 230
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.5 = INTEGER: 1357
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.6 = INTEGER: 1400
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.7 = INTEGER: 97
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.8 = INTEGER: 8574135
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.1 = INTEGER: 2
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.4 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.5 = INTEGER: 3
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.6 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.7 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.8 = INTEGER: 5
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.1 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.7 = INTEGER: 2
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.1 = INTEGER: 2
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.4 = INTEGER: 3
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.5 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.6 = INTEGER: 5
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.7 = INTEGER: 6
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.8 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.1 = INTEGER: 104
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.4 = INTEGER: 247
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.7 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.1 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.4 = INTEGER: 188
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.7 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.1 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.4 = INTEGER: 194
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.7 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.1 = INTEGER: 128
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.4 = INTEGER: 254
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.7 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.1 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.2 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.3 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.4 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.5 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.6 = STRING: "Switch Test 1"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.7 = STRING: "Switch Test 2"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.8 = STRING: "Switch Test 3"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.9 = STRING: "Switch Test 4"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.10 = STRING: "Switch Test 5"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.11 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.12 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.13 = STRING: "Switch C1"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.14 = STRING: "Switch C2"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.15 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.16 = STRING: "Switch 1"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.17 = STRING: "Switch 2"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.18 = STRING: "Switch 1"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.19 = STRING: "Switch 2"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.20 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.21 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.22 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.23 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.24 = STRING: ""
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.1.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.2.14 = INTEGER: 8
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.3.14 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.4.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.5.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.6.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.7.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.8.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.9.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.10.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.11.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.12.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.13.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.14.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.15.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.16.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.17.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.18.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.19.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.20.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.21.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.22.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.23.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.24.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.2 = STRING: "Tuerkontakt"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.3 = STRING: "External Sensor 3"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.4 = STRING: "On/Off 1"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.5 = STRING: "Temperature Rack 3"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.6 = STRING: "Humidity 1"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.7 = STRING: "Temperature 2"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.8 = STRING: "Air Pressure 1"
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.2 = INTEGER: 11
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.3 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.4 = INTEGER: 11
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.5 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.6 = INTEGER: 6
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.7 = INTEGER: 3
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.8 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.2 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.3 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.4 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.5 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.6 = INTEGER: 9
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.7 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.8 = INTEGER: 11
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.5 = INTEGER: 215
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.6 = INTEGER: 45
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.7 = INTEGER: 221
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.8 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.5 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.7 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.8 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.2 = INTEGER: 14
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.3 = INTEGER: 14
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.4 = INTEGER: 14
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.5 = INTEGER: 10
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.6 = INTEGER: 11
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.7 = INTEGER: 10
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.8 = INTEGER: 13
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.5 = INTEGER: 150
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.6 = INTEGER: 10
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.7 = INTEGER: 150
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.5 = INTEGER: 180
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.6 = INTEGER: 15
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.7 = INTEGER: 200
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.5 = INTEGER: 310
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.6 = INTEGER: 80
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.7 = INTEGER: 320
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.8 = INTEGER: 1000
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.5 = INTEGER: 270
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.6 = INTEGER: 70
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.7 = INTEGER: 280
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.8 = INTEGER: 800'''
    testagent.register_snmpwalk_ouput(walk)

    # Inlet Critical
    p = subprocess.Popen("health_monitoring_plugins/check_snmp_raritan/check_snmp_raritan.py -H 127.0.0.1:1234 -t inlet",
                       shell=True, stdout=subprocess.PIPE, env=context.testenv)
    assert p.stdout.read() == (
        "Critical - Inlet. 6.1 A is belowLowerCritical. 6.1 A. 230.0 V is belowLowerWarning. "
        "230.0 V. 1357.0 W. 1400.0 VA is aboveUpperWarning. 1400.0 VA. 0.97  is aboveUpperCritical. "
        "0.97. 8574135.0 Wh | 'Sensor 0 -A-'=6.1;0.0:10.4;0.0:12.8;; 'Sensor 1 -V-"
        "'=230.0;194.0:247.0;188.0:254.0;; "
        "'Sensor 2 -W-'=1357.0;0.0:0.0;0.0:0.0;; 'Sensor 3 -VA-'=1400.0;0.0:0.0;0.0:0.0;; "
        "'Sensor 4 --'=0.97;0.0:0.0;0.0:0.0;; 'Sensor 5 -Wh-'=8574135.0;0.0:0.0;0.0:0.0;;\n"
        "6.1 A: belowLowerCritical\n"
        "230.0 V: belowLowerWarning\n"
        "1357.0 W: normal\n"
        "1400.0 VA: aboveUpperWarning\n"
        "0.97 : aboveUpperCritical\n"
        "8574135.0 Wh: normal\n")
コード例 #16
0
def test_start_snmp_simulation():
    # start the testagent (Raritan walk)
    # Gauge32 are not working - So I replaced them by INTEGER
    # some of the values are not from a walk - I modified them to have the return values I need (critical etc.)
    walk =  '''iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.1 = INTEGER: 61
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.4 = INTEGER: 230
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.5 = INTEGER: 1357
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.6 = INTEGER: 1400
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.7 = INTEGER: 97
                iso.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.8 = INTEGER: 8574135
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.1 = INTEGER: 2
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.4 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.5 = INTEGER: 3
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.6 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.7 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.8 = INTEGER: 5
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.1 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.7 = INTEGER: 2
                iso.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.1 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.4 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.5 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.6 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.7 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.2.3.1.3.1.1.8 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.1 = INTEGER: 104
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.4 = INTEGER: 247
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.7 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.1 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.4 = INTEGER: 188
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.7 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.1 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.4 = INTEGER: 194
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.7 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.1 = INTEGER: 128
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.4 = INTEGER: 254
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.5 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.7 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.1 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.2 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.3 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.4 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.5 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.6 = STRING: "Switch Test 1"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.7 = STRING: "Switch Test 2"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.8 = STRING: "Switch Test 3"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.9 = STRING: "Switch Test 4"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.10 = STRING: "Switch Test 5"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.11 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.12 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.13 = STRING: "Switch C1"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.14 = STRING: "Switch C2"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.15 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.16 = STRING: "Switch 1"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.17 = STRING: "Switch 2"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.18 = STRING: "Switch 1"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.19 = STRING: "Switch 2"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.20 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.21 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.22 = STRING: "Switch"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.23 = STRING: "frei"
                iso.3.6.1.4.1.13742.6.3.5.3.1.3.1.24 = STRING: ""
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.1.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.2.14 = INTEGER: 8
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.3.14 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.4.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.5.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.6.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.7.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.8.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.9.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.10.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.11.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.12.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.13.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.14.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.15.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.16.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.17.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.18.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.19.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.20.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.21.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.22.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.23.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.5.4.3.1.3.1.24.14 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.2 = STRING: "Tuerkontakt"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.3 = STRING: "External Sensor 3"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.4 = STRING: "On/Off 1"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.5 = STRING: "Temperature Rack 3"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.6 = STRING: "Humidity 1"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.7 = STRING: "Temperature 2"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.8 = STRING: "Air Pressure 1"
                iso.3.6.1.4.1.13742.6.3.6.3.1.4.1.9 = STRING: "Broken"
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.2 = INTEGER: 11
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.3 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.4 = INTEGER: 11
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.5 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.6 = INTEGER: 6
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.7 = INTEGER: 3
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.8 = INTEGER: 4
                iso.3.6.1.4.1.13742.6.5.5.3.1.3.1.9 = INTEGER: 999
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.2 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.3 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.4 = INTEGER: -1
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.5 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.6 = INTEGER: 9
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.7 = INTEGER: 7
                iso.3.6.1.4.1.13742.6.3.6.3.1.16.1.8 = INTEGER: 11
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.5 = INTEGER: 215
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.6 = INTEGER: 45
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.7 = INTEGER: 221
                iso.3.6.1.4.1.13742.6.5.5.3.1.4.1.8 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.5 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.6 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.7 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.6.3.1.17.1.8 = INTEGER: 1
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.2 = INTEGER: 14
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.3 = INTEGER: 14
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.4 = INTEGER: 14
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.5 = INTEGER: 10
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.6 = INTEGER: 11
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.7 = INTEGER: 10
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.8 = INTEGER: 13
                iso.3.6.1.4.1.13742.6.3.6.3.1.2.1.9 = INTEGER: 991
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.5 = INTEGER: 150
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.6 = INTEGER: 10
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.7 = INTEGER: 150
                iso.3.6.1.4.1.13742.6.3.6.3.1.31.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.5 = INTEGER: 180
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.6 = INTEGER: 15
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.7 = INTEGER: 200
                iso.3.6.1.4.1.13742.6.3.6.3.1.32.1.8 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.5 = INTEGER: 310
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.6 = INTEGER: 80
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.7 = INTEGER: 320
                iso.3.6.1.4.1.13742.6.3.6.3.1.33.1.8 = INTEGER: 1000
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.2 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.3 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.4 = INTEGER: 0
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.5 = INTEGER: 270
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.6 = INTEGER: 70
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.7 = INTEGER: 280
                iso.3.6.1.4.1.13742.6.3.6.3.1.34.1.8 = INTEGER: 800'''
    testagent.register_snmpwalk_ouput(walk)
    testagent.start_server()
コード例 #17
0
def test_battery_test_summary(capsys):
    a_check_type = "BATTERY_TEST_SUMMARY"

    testagent.unregister_all()
    # upsTestResultsSummary
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.3.0 = INTEGER: 1''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "OK", "pass")

    testagent.unregister_all()
    # upsTestResultsSummary
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.3.0 = INTEGER: 5''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "OK", "in progress")

    testagent.unregister_all()
    # upsTestResultsSummary
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.3.0 = INTEGER: 6''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "OK",
                                             "no test initiated")

    testagent.unregister_all()
    # upsTestResultsSummary
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.3.0 = INTEGER: 2''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "Warning",
                                             "warning")

    testagent.unregister_all()
    # upsTestResultsSummary
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.3.0 = INTEGER: 4''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "Warning",
                                             "aborted")

    testagent.unregister_all()
    # upsTestResultsSummary
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.3.0 = INTEGER: 3''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "Critical", "error")

    testagent.unregister_all()
    # upsTestResultsSummary
    testagent.register_snmpwalk_ouput(
        '''iso.3.6.1.2.1.33.1.7.3.0 = INTEGER: 7''')
    test_util.check_value_without_thresholds(eaton_ups_check_plugin_path,
                                             a_check_type, "Critical",
                                             "unknown SNMP value")