Files
librenms-librenms/includes/polling/storage/eql-storage.inc.php
Tony Murray edbb6ae0e3 refactor: Centralize MIB include directory specification (#4603)
* refactor: Centralize MIB include directory specification
The default is now:
```
$config['mib_dir'].'/mibdirname:'.$config['mib_dir']
```
This means we exclude OS mibs and only use ours  (we could prepend `+` if we want to include os mibs.
All snmp calls should only include the name of the subdirectory under the mibs directory.

* Remove d_echo from Proc
Fix snmpsim tests.
2016-09-28 14:19:28 +01:00

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 = array();
$storage_cache20 = array();
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)(end($arrindex))+0;
}
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)(end($arrindex))+0;
}
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']);