Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
2.1 KiB
PHP
Raw Permalink Normal View History

<?php
/*
* LibreNMS
*
* Copyright (c) 2016 Peter TKATCHENKO https://github.com/Peter2121/
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
2020-09-22 02:52:01 +02:00
if (! is_array($storage_cache1['eql-storage'])) {
$storage_cache1['eql-storage'] = snmpwalk_cache_oid($device, 'EqliscsiVolumeEntry', null, 'EQLVOLUME-MIB', 'equallogic');
d_echo($storage_cache1);
}
2020-09-22 02:52:01 +02:00
if (! is_array($storage_cache2['eql-storage'])) {
$storage_cache2['eql-storage'] = snmpwalk_cache_oid($device, 'EqliscsiVolumeStatusEntry', null, 'EQLVOLUME-MIB', 'equallogic');
d_echo($storage_cache2);
}
$iind = 0;
2020-09-22 02:52:01 +02:00
$storage_cache10 = [];
$storage_cache20 = [];
d_echo($storage);
foreach ($storage_cache1['eql-storage'] as $index => $ventry) {
2020-09-22 02:52:01 +02:00
if (! array_key_exists('eqliscsiVolumeName', $ventry)) {
continue;
}
if (is_int($index)) {
$iind = $index;
} else {
2020-09-22 02:52:01 +02:00
$arrindex = explode('.', $index);
2021-03-12 18:10:14 -06:00
$iind = (int) cast_number(end($arrindex));
}
if (is_int($iind)) {
$storage_cache10[$iind] = $ventry;
}
}
d_echo($storage_cache10);
foreach ($storage_cache2['eql-storage'] as $index => $vsentry) {
2020-09-22 02:52:01 +02:00
if (! array_key_exists('eqliscsiVolumeStatusAvailable', $vsentry)) {
continue;
}
if (is_int($index)) {
$iind = $index;
} else {
2020-09-22 02:52:01 +02:00
$arrindex = explode('.', $index);
2021-03-12 18:10:14 -06:00
$iind = (int) cast_number(end($arrindex));
}
if (is_int($iind)) {
$storage_cache20[$iind] = $vsentry;
}
}
d_echo($storage_cache20);
2018-07-13 17:08:00 -05:00
$entry1 = $storage_cache10[$storage['storage_index']];
$entry2 = $storage_cache20[$storage['storage_index']];
2016-08-04 09:15:00 -04:00
$storage['units'] = 1000000;
$storage['size'] = ($entry1['eqliscsiVolumeSize'] * $storage['units']);
$storage['used'] = ($entry2['eqliscsiVolumeStatusAllocatedSpace'] * $storage['units']);
$storage['free'] = ($storage['size'] - $storage['used']);