mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* port related errors * more fixes * fix storage count * add tests for php8 * style * only need not empty * aix fixes.... * storage WIP * fix aix discovering hrstorage fix db test adding .gitkeep fix os modules when discovery only * fix aos processors wrong oid * fix mempool number casting * fix aos7 cpu * use + 0 cast instead of floatval() * more verbose error on invalid json * remove invalid data in json * actually fix the json * correct json error fix * cast_number() function fix aruba-instant and aos6 bugs exposed by new function, probably more... * fix a-f fix inadequate sort for component data * fix global port poll time * fix mempools precent 0, route count, ntp const * fix schleifenbauer liberal current usage * further number casting refinement * vrp * fix tests * fix arbos * warn cleanups adjust to :: change * fix ciena-sds * fix drac * fix dell-rpdu anddlink * fix and improve arubaos better error when getting an array in Processor * fix atenpdu, add missing arubaos files * aruba-instant to yaml apparently I didn't need to do this, the diff just looks really odd It did add ranged sub-index replacements * docker app, was completely wrong... fixed * fix sentry4 divide by 0... * fixed root issue, remove check * nicer cidr in ipv6 code * remove bogus enuxus battery bank skip_values * Fix InfluxDB tests * remove extra import * fix other style issues. * influx "style" fixes
70 lines
2.1 KiB
PHP
70 lines
2.1 KiB
PHP
<?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.
|
|
*/
|
|
|
|
if (! is_array($storage_cache1['eql-storage'])) {
|
|
$storage_cache1['eql-storage'] = snmpwalk_cache_oid($device, 'EqliscsiVolumeEntry', null, 'EQLVOLUME-MIB', 'equallogic');
|
|
d_echo($storage_cache1);
|
|
}
|
|
|
|
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;
|
|
$storage_cache10 = [];
|
|
$storage_cache20 = [];
|
|
|
|
d_echo($storage);
|
|
|
|
foreach ($storage_cache1['eql-storage'] as $index => $ventry) {
|
|
if (! array_key_exists('eqliscsiVolumeName', $ventry)) {
|
|
continue;
|
|
}
|
|
if (is_int($index)) {
|
|
$iind = $index;
|
|
} else {
|
|
$arrindex = explode('.', $index);
|
|
$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) {
|
|
if (! array_key_exists('eqliscsiVolumeStatusAvailable', $vsentry)) {
|
|
continue;
|
|
}
|
|
if (is_int($index)) {
|
|
$iind = $index;
|
|
} else {
|
|
$arrindex = explode('.', $index);
|
|
$iind = (int) cast_number(end($arrindex));
|
|
}
|
|
if (is_int($iind)) {
|
|
$storage_cache20[$iind] = $vsentry;
|
|
}
|
|
}
|
|
d_echo($storage_cache20);
|
|
|
|
$entry1 = $storage_cache10[$storage['storage_index']];
|
|
$entry2 = $storage_cache20[$storage['storage_index']];
|
|
|
|
$storage['units'] = 1000000;
|
|
$storage['size'] = ($entry1['eqliscsiVolumeSize'] * $storage['units']);
|
|
$storage['used'] = ($entry2['eqliscsiVolumeStatusAllocatedSpace'] * $storage['units']);
|
|
$storage['free'] = ($storage['size'] - $storage['used']);
|