} } else { if (count($cache_discovery['ucd-snmp-mib'])) { // Discover 'UCD-SNMP-MIB' if 'HOST-RESOURCES-MIB' empty. $mib = 'UCD-SNMP-MIB'; echo " {$mib} "; foreach ($cache_discovery['ucd-snmp-mib'] as $index => $dsk) { $hc = 0; $fstype = $dsk['dskDevice']; $descr = $dsk['dskPath']; $units = 1024; $deny = FALSE; // Using 64bit counters if available if (isset($dsk['dskTotalLow'])) { $hc = 1; $size = $dsk['dskTotalHigh'] * 4294967296.0 + $dsk['dskTotalLow']; $size *= $units; $used = $dsk['dskUsedHigh'] * 4294967296.0 + $dsk['dskUsedLow']; $used *= $units; } else { $size = $dsk['dskTotal'] * $units; $used = $dsk['dskUsed'] * $units; } if (!$deny && is_numeric($index)) { discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, $hc); } unset($deny, $fstype, $descr, $size, $used, $units, $hc); } } } // EOF
} */ foreach ($cache_discovery['netapp-mib'] as $index => $storage) { $fstype = $storage['dfType']; $descr = $storage['dfFileSys']; if (!empty($storage['dfVserver'])) { // Add server info on cluster devices $descr .= ' - ' . $storage['dfVserver']; // CLEANME, remove in r7500, but not before CE 0.16.1 rename_rrd($device, 'storage-netapp-mib-' . $storage['dfFileSys'] . '.rrd', 'storage-netapp-mib-' . $descr . '.rrd'); } $deny = FALSE; if (!$deny) { if (is_numeric($storage['df64TotalKBytes'])) { $size = $storage['df64TotalKBytes'] * 1024; $used = $storage['df64UsedKBytes'] * 1024; $hc = 1; } else { $size = $storage['dfKBytesTotal'] * 1024; $used = $storage['dfKBytesUsed'] * 1024; $hc = 0; } if (is_numeric($index)) { discover_storage($valid['storage'], $device, $index, $fstype, 'NETAPP-MIB', $descr, 1024, $size, $used, array('storage_hc' => $hc)); } } unset($deny, $fstype, $descr, $size, $used, $free, $percent, $hc); } unset($index, $storage); } // EOF
* * 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. */ $eql_storage = snmpwalk_cache_oid($device, 'EqliscsiVolumeEntry', null, 'EQLVOLUME-MIB', $config['install_dir'] . '/mibs/equallogic'); if (is_array($eql_storage)) { echo 'EqliscsiVolumeEntry '; foreach ($eql_storage as $index => $storage) { $fstype = $storage['eqliscsiVolumeAdminStatus']; $descr = $storage['eqliscsiVolumeName']; $units = 1000000; $size = $storage['eqliscsiVolumeSize'] * $units; $used = $storage['eqliscsiVolumeStatusAllocatedSpace'] * $units; if (is_int($index)) { discover_storage($valid_storage, $device, $index, $fstype, 'eql-storage', $descr, $size, $units, $used); } else { // Trying to search the last '.' and take something after it as index $arrindex = explode(".", $index); $newindex = (int) end($arrindex) + 0; if (is_int($newindex)) { discover_storage($valid_storage, $device, $newindex, $fstype, 'eql-storage', $descr, $size, $units, $used); } } unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $hrstorage_array); } }
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ // Note, this mountpoint '/ifs' also discovered in HOST-RESOURCES-MIB, but ignored //ISILON-MIB::ifsTotalBytes.0 = Counter64: 71376260235264 //ISILON-MIB::ifsUsedBytes.0 = Counter64: 38523365810176 //ISILON-MIB::ifsAvailableBytes.0 = Counter64: 28651530510336 //ISILON-MIB::ifsFreeBytes.0 = Counter64: 32852894425088 $cache_discovery['ISILON-MIB'] = snmpget_cache_multi($device, 'ifsTotalBytes.0 ifsUsedBytes.0', array(), 'ISILON-MIB'); if (is_array($cache_discovery['ISILON-MIB'][0])) { $hc = 1; $size = $cache_discovery['ISILON-MIB'][0]['ifsTotalBytes']; $used = $cache_discovery['ISILON-MIB'][0]['ifsUsedBytes']; discover_storage($valid['storage'], $device, 0, 'volume', 'ISILON-MIB', '/ifs', 1, $size, $used, array('storage_hc' => $hc)); } // EOF
if ($debug) { echo "skip(cd)\n"; } } if (!$deny) { //32bit counters $size = snmp_dewrap32bit($storage['hrStorageSize']) * $units; $used = snmp_dewrap32bit($storage['hrStorageUsed']) * $units; // hrStorageDescr.8 = /mnt/Media, type: zfs, dev: Media // hrStorageDescr.31 = / list($path) = explode(',', $descr); // Find index from 'dskTable' foreach ($dsk_array as $dsk) { if ($dsk['dskPath'] === $path) { //Using 64bit counters if available if (isset($dsk['dskTotalLow'])) { $size = $dsk['dskTotalLow'] * 1024; $used = $dsk['dskUsedLow'] * 1024; } break; } } $percent = round($used / $size * 100); } if (!$deny && is_numeric($index)) { discover_storage($valid_storage, $device, $index, $fstype, "hrstorage", $descr, $size, $units, $used, $free, $percent); } unset($deny, $fstype, $descr, $size, $used, $units, $path, $dsk, $storage_rrd, $old_storage_rrd); } unset($hrstorage_array, $dsk_array); }
} foreach ($config['ignore_mount'] as $bi) { if ($bi == $descr) { $deny = 1; if ($debug) { echo "{$bi} == {$descr} \n"; } } } foreach ($config['ignore_mount_string'] as $bi) { if (strpos($descr, $bi) !== FALSE) { $deny = 1; if ($debug) { echo "strpos: {$descr}, {$bi} \n"; } } } foreach ($config['ignore_mount_regexp'] as $bi) { if (preg_match($bi, $descr) > "0") { $deny = 1; if ($debug) { echo "preg_match {$bi}, {$descr} \n"; } } } if (!$deny && is_numeric($index)) { discover_storage($valid_storage, $device, $index, $fstype, "netapp-storage", $descr, $size, $units, $used); } unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $hrstorage_array); } }
<?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']; $deny = ignore_storage($dsk['dskPath']); if ($deny != 1) { discover_storage($valid_storage, $device, $dsk['dskIndex'], 'dsk', 'ucd-dsktable', $dsk['dskPath'], $dsk['dskTotal'], 1024, $dsk['dskUsed']); } } } } }
unset($deny, $fstype, $descr, $size, $used, $units, $path, $dsk, $hc); } } else { if (count($cache_discovery['ucd-snmp-mib'])) { // Discover 'UCD-SNMP-MIB' if 'HOST-RESOURCES-MIB' empty. $mib = 'UCD-SNMP-MIB'; foreach ($cache_discovery['ucd-snmp-mib'] as $index => $dsk) { $hc = 0; $fstype = $dsk['dskDevice']; $descr = $dsk['dskPath']; $units = 1024; $deny = FALSE; // Using 64bit counters if available if (isset($dsk['dskTotalLow'])) { $hc = 1; $size = snmp_size64_high_low($dsk['dskTotalHigh'], $dsk['dskTotalLow']); $size *= $units; $used = snmp_size64_high_low($dsk['dskUsedHigh'], $dsk['dskUsedLow']); $used *= $units; } else { $size = $dsk['dskTotal'] * $units; $used = $dsk['dskUsed'] * $units; } if (!$deny && is_numeric($index)) { discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, array('storage_hc' => $hc)); } unset($deny, $fstype, $descr, $size, $used, $units, $hc); } } } // EOF
<?php $mib = 'EMBEDDED-NGX-MIB'; echo " {$mib} "; # lookup for storage data $entry = snmpwalk_cache_oid($device, 'swStorage', NULL, $mib, mib_dirs('checkpoint')); if (is_array($entry)) { $index = 0; $descr = "Config Storage"; $free = $entry[$index]['swStorageConfigFree'] * 1024; $total = $entry[$index]['swStorageConfigTotal'] * 1024; $used = $total - $free; discover_storage($valid['storage'], $device, $index, 'StorageConfig', $mib, $descr, 1024, $total, $used, 0); } unset($entry, $index, $descr, $total, $used, $free); // EOF
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ # lookup for storage data $entry = snmpwalk_cache_oid($device, 'swStorage', NULL, 'EMBEDDED-NGX-MIB'); if (is_array($entry)) { $index = 0; $descr = "Config Storage"; $free = $entry[$index]['swStorageConfigFree'] * 1024; $total = $entry[$index]['swStorageConfigTotal'] * 1024; $used = $total - $free; discover_storage($valid['storage'], $device, $index, 'StorageConfig', 'EMBEDDED-NGX-MIB', $descr, 1024, $total, $used); } unset($entry, $index, $descr, $total, $used, $free); // EOF
*/ $index = "{$flash_index}.{$partition_index}"; $descr = $flash['ciscoFlashDeviceDescr'] ? $flash['ciscoFlashDeviceDescr'] : $flash['ciscoFlashDeviceName']; // Clean some descriptions: // ciscoFlashDeviceDescr.2 = Cat4000 Private Flash Area (Not available for general use) list($descr) = explode(' (', $descr); if ($flash['ciscoFlashDevicePartitions'] > 1 || $partition['ciscoFlashPartitionName'][0] === '/') { $descr .= ' - ' . $partition['ciscoFlashPartitionName']; } /* if ($hc) { $size = $partition['ciscoFlashPartitionSizeExtended']; $free = $partition['ciscoFlashPartitionFreeSpaceExtended']; } else { $size = $partition['ciscoFlashPartitionSize']; $free = $partition['ciscoFlashPartitionFreeSpace']; } $used = $size - $free; */ // FIXME. Skip based on ciscoFlashPartitionStatus: readOnly, runFromFlash, readWrite //if ($partition['ciscoFlashPartitionStatus'] != 'readWrite') { continue; } //discover_storage($valid['storage'], $device, $index, $fstype, 'CISCO-FLASH-MIB', $descr, 1, $size, $used, array('storage_hc' => $hc)); discover_storage($valid['storage'], $device, $index, $fstype, 'CISCO-FLASH-MIB', $descr, 1, 1, 0, array('storage_hc' => $hc)); // Fake size/used - updated later by poller } } } unset($device_tmp, $flash, $flash_index, $partition, $partition_index, $index, $descr, $size, $used, $free, $hc); //I know, that this too long discovery, but it better than nothing // EOF