refactor: Added support for dskTable in UCD-SNMP-MIB (#4993)

This commit is contained in:
Neil Lathwood
2016-11-21 07:08:38 +00:00
committed by GitHub
parent bc15d74cf1
commit 42123010c8
5 changed files with 52 additions and 18 deletions

View File

@@ -0,0 +1,19 @@
<?php
$dsktable_array = snmpwalk_cache_oid($device, 'dskTable', null, 'UCD-SNMP-MIB');
$sql = "SELECT `storage_descr` FROM `storage` WHERE `device_id` = '".$device['device_id']."' AND `storage_type` != 'dsk'";
$tmp_storage = dbFetchColumn($sql);
if (is_array($dsktable_array)) {
foreach ($dsktable_array as $dsk) {
if (isset($dsk['dskPath'])) {
if (!in_array($dsk['dskPath'], $tmp_storage)) {
$dsk['dskTotal'] = $dsk['dskTotal'] * 1024;
$dsk['dskAvail'] = ($entry['dskAvail'] * 1024);
$dsk['dskUsed'] = $dsk['dskTotal'] - $dsk['dskAvail'];
discover_storage($valid_storage, $device, $dsk['dskIndex'], 'dsk', 'ucd-dsktable', $dsk['dskPath'], $dsk['dskTotal'], 1024, $dsk['dskUsed']);
}
}
}
}