Skip to content

Instantly share code, notes, and snippets.

@theherodied
Last active March 16, 2018 17:25
Show Gist options
  • Save theherodied/de8c264c39b8b5e906f2931a8da01aaf to your computer and use it in GitHub Desktop.
Save theherodied/de8c264c39b8b5e906f2931a8da01aaf to your computer and use it in GitHub Desktop.
Librenms Nimble Files
<?php
use LibreNMS\Config;
$nimble_storage = snmpwalk_cache_oid($device, 'volEntry', null, 'NIMBLE-MIB');
if (is_array($nimble_storage)) {
echo 'volEntry ';
foreach ($nimble_storage as $index => $storage) {
$units = 1024*1024;
$fstype = $storage['volOnline'];
$descr = $storage['volName'];
$size = $storage['volSizeLow'] * $units;
$used = $storage['volUsageLow'] * $units;
if (is_numeric($index)) {
discover_storage($valid_storage, $device, $index, $fstype, 'nimbleos', $descr, $size, $units, $used);
}
unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $hrstorage_array);
}
}
<?php
if (!is_array($storage_cache['nimbleos'])) {
$storage_cache['nimbleos'] = snmpwalk_cache_oid($device, 'volEntry', null, 'NIMBLE-MIB');
d_echo($storage_cache);
}
$entry = $storage_cache['nimbleos'][$storage[storage_index]];
$storage['units'] = 1024*1024;
$storage['size'] = ($entry['volSizeLow'] * $storage['units']);
$storage['used'] = ($entry['volUsageLow'] * $storage['units']);
$storage['free'] = ($storage['size'] - $storage['used']);
Librenms Pull Request
https://github.com/librenms/librenms/pull/8405
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment