Пример #1
0
def test_psu_multi():
    nexsan_psu_multi = ET.fromstring('''
      <nexsan_op_status version="2" status="experimental">
        <nexsan_env_status version="3" status="experimental">
          <enclosure id="1">
            <psu id="2">
              <state good="yes" power_watt="546">OK</state>
              <temperature_deg_c good="yes">41</temperature_deg_c>
              <blower_rpm id="3" good="yes">4444</blower_rpm>
            </psu>
            <psu id="9">
              <state good="yes" power_watt="100">OK</state>
              <temperature_deg_c good="yes">41</temperature_deg_c>
              <blower_rpm id="3" good="yes">4444</blower_rpm>
            </psu>
          </enclosure>
        </nexsan_env_status>
      </nexsan_op_status>
    ''')
    c = nexsan.Collector(nexsan_psu_multi)
    mf = getmf(c.collect(), 'nexsan_env_psu_power_good')
    assert [
        ('nexsan_env_psu_power_good', {
            'psu': '2',
            'enclosure': '1'
        }, 1),
        ('nexsan_env_psu_power_good', {
            'psu': '9',
            'enclosure': '1'
        }, 1),
    ] == mf.samples
Пример #2
0
def test_pod_multi():
    nexsan_psu_multi = ET.fromstring('''
      <nexsan_op_status version="2" status="experimental">
        <nexsan_env_status version="3" status="experimental">
          <enclosure id="5">
            <pod id="4">
              <voltage id="Exp A 1V2" good="yes">1.20</voltage>
            </pod>
            <pod id="5">
              <voltage id="Exp A 1V2" good="yes">1.20</voltage>
            </pod>
          </enclosure>
        </nexsan_env_status>
      </nexsan_op_status>
        ''')
    c = nexsan.Collector(nexsan_psu_multi)
    mf = getmf(c.collect(), 'nexsan_env_pod_voltage_good')
    assert [
        ('nexsan_env_pod_voltage_good', {
            'pod': '4',
            'enclosure': '5',
            'voltage': 'Exp A 1V2'
        }, 1),
        ('nexsan_env_pod_voltage_good', {
            'pod': '5',
            'enclosure': '5',
            'voltage': 'Exp A 1V2'
        }, 1),
    ] == mf.samples
Пример #3
0
def test_perf_memory_usage_ratio(nexsan_perf):
    c = nexsan.Collector(nexsan_perf)
    mf = getmf(c.collect(), 'nexsan_perf_memory_usage_percent')
    assert 'gauge' == mf.type
    assert [('nexsan_perf_memory_usage_percent', {
        'controller': '2'
    }, 38)] == mf.samples
Пример #4
0
def test_controller_multi():
    nexsan_psu_multi = ET.fromstring('''
      <nexsan_op_status version="2" status="experimental">
        <nexsan_env_status version="3" status="experimental">
          <enclosure id="1">
            <controller id="2">
              <voltage id="CPU" good="yes">1.18</voltage>
            </controller>
            <controller id="4">
              <voltage id="CPU" good="yes">3.2</voltage>
            </controller>
          </enclosure>
        </nexsan_env_status>
      </nexsan_op_status>
        ''')
    c = nexsan.Collector(nexsan_psu_multi)
    mf = getmf(c.collect(), 'nexsan_env_controller_voltage_good')
    assert [
        ('nexsan_env_controller_voltage_good', {
            'controller': '2',
            'enclosure': '1',
            'voltage': 'CPU'
        }, 1),
        ('nexsan_env_controller_voltage_good', {
            'controller': '4',
            'enclosure': '1',
            'voltage': 'CPU'
        }, 1),
    ] == mf.samples
Пример #5
0
def test_maid_good_1(nexsan_maid):
    c = nexsan.Collector(nexsan_maid)
    mf = getmf(c.collect(), 'nexsan_maid_good')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_maid_good', {}, 1),
    ] == mf.samples
Пример #6
0
def test_maid_good_1(nexsan_maid):
    nexsan_maid.find('.//maid_stats_status').attrib['good'] = 'no'
    c = nexsan.Collector(nexsan_maid)
    mf = getmf(c.collect(), 'nexsan_maid_good')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_maid_good', {}, 0),
    ] == mf.samples
Пример #7
0
def test_psu_temp_celsius(nexsan_psu):
    c = nexsan.Collector(nexsan_psu)
    mf = getmf(c.collect(), 'nexsan_env_psu_temp_celsius')
    assert 'gauge' == mf.type
    assert [('nexsan_env_psu_temp_celsius', {
        'psu': '2',
        'enclosure': '1'
    }, 41)] == mf.samples
Пример #8
0
def test_psu_power_watts(nexsan_psu):
    c = nexsan.Collector(nexsan_psu)
    mf = getmf(c.collect(), 'nexsan_env_psu_power_watts')
    assert 'gauge' == mf.type
    assert [('nexsan_env_psu_power_watts', {
        'psu': '2',
        'enclosure': '1'
    }, 546)] == mf.samples
Пример #9
0
def test_psu_temp_good_v1(nexsan_psu_v1):
    c = nexsan.Collector(nexsan_psu_v1)
    mf = getmf(c.collect(), 'nexsan_env_psu_temp_good')
    assert 'gauge' == mf.type
    assert [('nexsan_env_psu_temp_good', {
        'psu': '2',
        'enclosure': ''
    }, 1)] == mf.samples
Пример #10
0
def test_psu_temp_good_0(nexsan_psu):
    nexsan_psu.find('.//psu/temperature_deg_c').attrib['good'] = 'no'
    c = nexsan.Collector(nexsan_psu)
    mf = getmf(c.collect(), 'nexsan_env_psu_temp_good')
    assert 'gauge' == mf.type
    assert [('nexsan_env_psu_temp_good', {
        'psu': '2',
        'enclosure': '1'
    }, 0)] == mf.samples
Пример #11
0
def test_sys_details(nexsan_sys):
    c = nexsan.Collector(nexsan_sys)
    mf = getmf(c.collect(), 'nexsan_sys_details')
    assert 'gauge' == mf.type
    assert [('nexsan_sys_details', {
        'firmware_version': 'fff',
        'friendly_name': 'nnn',
        'system_id': 'iii',
        'system_name': 'sss'
    }, 1)] == mf.samples
Пример #12
0
def test_volume_weird(request):
    nexsan_volume_weird = ET.fromstring('''
      <nexsan_op_status version="2" status="experimental">
        <nexsan_volume_stats version="1" status="experimental">
          <volume id="209" name="###SNAPDATA###" array="24" serial_number="0x70C09A20"></volume>
        </nexsan_volume_stats>
      </nexsan_op_status>
    ''')
    c = nexsan.Collector(nexsan_volume_weird)
    for mf in c.collect():
        assert [] == mf.samples
Пример #13
0
def test_controller_temp_celsius_v1(nexsan_controller_v1):
    c = nexsan.Collector(nexsan_controller_v1)
    mf = getmf(c.collect(), 'nexsan_env_controller_temp_celsius')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_controller_temp_celsius', {
            'temp': '',
            'controller': '2',
            'enclosure': ''
        }, 44),
    ] == mf.samples
Пример #14
0
def test_controller_battery_charge_good_1_v1(nexsan_controller_v1):
    c = nexsan.Collector(nexsan_controller_v1)
    mf = getmf(c.collect(), 'nexsan_env_controller_battery_charge_good')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_controller_battery_charge_good', {
            'battery': '3',
            'controller': '2',
            'enclosure': ''
        }, 1),
    ] == mf.samples
Пример #15
0
def test_maid_efficiency_ratio(nexsan_maid):
    c = nexsan.Collector(nexsan_maid)
    mf = getmf(c.collect(), 'nexsan_maid_efficiency_ratio')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_maid_efficiency_ratio', {
            'group': 'g1'
        }, 0.3),
        ('nexsan_maid_efficiency_ratio', {
            'group': 'g2'
        }, 0.23),
    ] == mf.samples
Пример #16
0
def test_controller_battery_charge_good_1_v1(nexsan_controller_v1):
    nexsan_controller_v1.find(
        './/controller/battery[@id="3"]/charge_state').attrib['good'] = 'no'
    c = nexsan.Collector(nexsan_controller_v1)
    mf = getmf(c.collect(), 'nexsan_env_controller_battery_charge_good')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_controller_battery_charge_good', {
            'battery': '3',
            'controller': '2',
            'enclosure': ''
        }, 0),
    ] == mf.samples
Пример #17
0
def test_perf_read_blocks_total(nexsan_perf):
    c = nexsan.Collector(nexsan_perf)
    mf = getmf(c.collect(), 'nexsan_perf_read_blocks_total')
    assert 'counter' == mf.type
    assert [
        ('nexsan_perf_read_blocks_total', {
            'controller': '2',
            'port': 'Fibre - Host0'
        }, 1511750808555),
        ('nexsan_perf_read_blocks_total', {
            'controller': '2',
            'port': 'Fibre - Host1'
        }, 1291215959784),
    ] == mf.samples
Пример #18
0
def test_perf_read_ios_total(nexsan_perf):
    c = nexsan.Collector(nexsan_perf)
    mf = getmf(c.collect(), 'nexsan_perf_read_ios_total')
    assert 'counter' == mf.type
    assert [
        ('nexsan_perf_read_ios_total', {
            'controller': '2',
            'port': 'Fibre - Host0'
        }, 2483933528),
        ('nexsan_perf_read_ios_total', {
            'controller': '2',
            'port': 'Fibre - Host1'
        }, 2090888411),
    ] == mf.samples
Пример #19
0
def test_perf_write_blocks_total(nexsan_perf):
    c = nexsan.Collector(nexsan_perf)
    mf = getmf(c.collect(), 'nexsan_perf_write_blocks_total')
    assert 'counter' == mf.type
    assert [
        ('nexsan_perf_write_blocks_total', {
            'controller': '2',
            'port': 'Fibre - Host0'
        }, 265523917855),
        ('nexsan_perf_write_blocks_total', {
            'controller': '2',
            'port': 'Fibre - Host1'
        }, 203110373427),
    ] == mf.samples
Пример #20
0
def test_perf_lun_resets_total(nexsan_perf):
    c = nexsan.Collector(nexsan_perf)
    mf = getmf(c.collect(), 'nexsan_perf_lun_resets_total')
    assert 'counter' == mf.type
    assert [
        ('nexsan_perf_lun_resets_total', {
            'controller': '2',
            'port': 'Fibre - Host0'
        }, 17),
        ('nexsan_perf_lun_resets_total', {
            'controller': '2',
            'port': 'Fibre - Host1'
        }, 3),
    ] == mf.samples
Пример #21
0
def test_perf_write_bytes_per_second(nexsan_perf):
    c = nexsan.Collector(nexsan_perf)
    mf = getmf(c.collect(), 'nexsan_perf_write_bytes_per_second')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_perf_write_bytes_per_second', {
            'controller': '2',
            'port': 'Fibre - Host0'
        }, 10 * 1024 * 1024),
        ('nexsan_perf_write_bytes_per_second', {
            'controller': '2',
            'port': 'Fibre - Host1'
        }, 12 * 1024 * 1024),
    ] == mf.samples
Пример #22
0
def test_perf_write_ios_total(nexsan_perf):
    c = nexsan.Collector(nexsan_perf)
    mf = getmf(c.collect(), 'nexsan_perf_write_ios_total')
    assert 'counter' == mf.type
    assert [
        ('nexsan_perf_write_ios_total', {
            'controller': '2',
            'port': 'Fibre - Host0'
        }, 2118181371),
        ('nexsan_perf_write_ios_total', {
            'controller': '2',
            'port': 'Fibre - Host1'
        }, 1644606275),
    ] == mf.samples
Пример #23
0
def test_perf_array_load_ratio(nexsan_perf):
    c = nexsan.Collector(nexsan_perf)
    mf = getmf(c.collect(), 'nexsan_perf_load_ratio')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_perf_load_ratio', {
            'array': 'array1',
            'owner': '1'
        }, 0.18),
        ('nexsan_perf_load_ratio', {
            'array': 'array2',
            'owner': '0'
        }, 0.16),
    ] == mf.samples
Пример #24
0
def test_pod_tray_blower_good(nexsan_pod):
    c = nexsan.Collector(nexsan_pod)
    mf = getmf(c.collect(), 'nexsan_env_pod_tray_blower_good')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_pod_tray_blower_good', {
            'pod': '4',
            'enclosure': '5',
            'blower': '1'
        }, 1),
        ('nexsan_env_pod_tray_blower_good', {
            'pod': '4',
            'enclosure': '5',
            'blower': '8'
        }, 0),
    ] == mf.samples
Пример #25
0
def test_pod_front_blower_rpm(nexsan_pod):
    c = nexsan.Collector(nexsan_pod)
    mf = getmf(c.collect(), 'nexsan_env_pod_front_blower_rpm')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_pod_front_blower_rpm', {
            'pod': '4',
            'enclosure': '5',
            'blower': '3'
        }, 4163),
        ('nexsan_env_pod_front_blower_rpm', {
            'pod': '4',
            'enclosure': '5',
            'blower': '2'
        }, 4200),
    ] == mf.samples
Пример #26
0
def test_pod_temp_good(nexsan_pod):
    c = nexsan.Collector(nexsan_pod)
    mf = getmf(c.collect(), 'nexsan_env_pod_temp_good')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_pod_temp_good', {
            'pod': '4',
            'enclosure': '5',
            'temp': 'Expander A'
        }, 1),
        ('nexsan_env_pod_temp_good', {
            'pod': '4',
            'enclosure': '5',
            'temp': 'Expander B'
        }, 0),
    ] == mf.samples
Пример #27
0
def test_pod_voltage_good(nexsan_pod):
    c = nexsan.Collector(nexsan_pod)
    mf = getmf(c.collect(), 'nexsan_env_pod_voltage_good')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_pod_voltage_good', {
            'pod': '4',
            'enclosure': '5',
            'voltage': 'Exp A 1V2'
        }, 1),
        ('nexsan_env_pod_voltage_good', {
            'pod': '4',
            'enclosure': '5',
            'voltage': 'Exp B 1V2'
        }, 0),
    ] == mf.samples
Пример #28
0
def test_pod_voltage_volts(nexsan_pod):
    c = nexsan.Collector(nexsan_pod)
    mf = getmf(c.collect(), 'nexsan_env_pod_voltage_volts')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_pod_voltage_volts', {
            'pod': '4',
            'enclosure': '5',
            'voltage': 'Exp A 1V2'
        }, 1.2),
        ('nexsan_env_pod_voltage_volts', {
            'pod': '4',
            'enclosure': '5',
            'voltage': 'Exp B 1V2'
        }, 1.3),
    ]
Пример #29
0
def test_psu_temp_celsius_unknown_v1(request):
    nexsan_psu_temp_celsius_unknown_v1 = ET.fromstring('''
      <nexsan_op_status version="1" status="experimental">
        <nexsan_env_status version="1" status="experimental">
          <psu id="2">
            <state good="yes">OK</state>
            <temperature_deg_c good="yes">Unknown</temperature_deg_c>
            <blower_rpm id="3" good="yes">4444</blower_rpm>
          </psu>
        </nexsan_env_status>
      </nexsan_op_status>
    ''')
    c = nexsan.Collector(nexsan_psu_temp_celsius_unknown_v1)
    mf = getmf(c.collect(), 'nexsan_env_psu_temp_celsius')
    assert 'gauge' == mf.type
    assert [] == mf.samples
Пример #30
0
def test_controller_voltage_volts_v1(nexsan_controller_v1):
    c = nexsan.Collector(nexsan_controller_v1)
    mf = getmf(c.collect(), 'nexsan_env_controller_voltage_volts')
    assert 'gauge' == mf.type
    assert [
        ('nexsan_env_controller_voltage_volts', {
            'voltage': 'CPU',
            'controller': '2',
            'enclosure': ''
        }, 1.18),
        ('nexsan_env_controller_voltage_volts', {
            'voltage': '1V0',
            'controller': '2',
            'enclosure': ''
        }, 0.97),
    ] == mf.samples