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()
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")
Exemple #3
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")
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")
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")
Exemple #6
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")
Exemple #7
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")
def test_stop():
    # stop the testagent
    testagent.unregister_all()
    testagent.stop_server()
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")
Exemple #10
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")