initial commit; version 22.5.12042

This commit is contained in:
2022-12-12 23:28:25 -05:00
commit af1b03d79f
17653 changed files with 22692970 additions and 0 deletions

View File

@ -0,0 +1,148 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
// CISCO-FLASH-MIB::ciscoFlashDevicesSupported.0 = Gauge32: 7
$ciscoFlashDevicesSupported = snmp_get($device, "ciscoFlashDevicesSupported.0", "-Ovq", 'CISCO-FLASH-MIB'); // Number of Flash devices supported by the system
if ((int)$ciscoFlashDevicesSupported > 0)
{
$ciscoFlashDeviceTable = snmpwalk_cache_oid($device, 'ciscoFlashDeviceTable', NULL, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
//$ciscoFlashDeviceTable = snmpwalk_cache_oid($device, 'ciscoFlashDeviceName', NULL, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
if ($GLOBALS['snmp_status'])
{
// Disable retries
$device_tmp = $device;
//$device_tmp['snmp_retries'] = 1;
//$device_tmp['snmp_nobulk'] = TRUE;
$has_hc = FALSE;
foreach ($ciscoFlashDeviceTable as $flash)
{
if (isset($flash['ciscoFlashDeviceSizeExtended']))
{
$has_hc = TRUE;
break;
}
}
// Fetch only required oids, do not use walk!
//$oids = array('ciscoFlashDeviceDescr', 'ciscoFlashDeviceRemovable', 'ciscoFlashDevicePartitions', 'ciscoFlashDeviceSizeExtended');
//foreach ($oids as $oid)
//{
// $ciscoFlashDeviceTable = snmpwalk_cache_oid($device_tmp, $oid, $ciscoFlashDeviceTable, 'CISCO-FLASH-MIB:OLD-CISCO-CHASSIS-MIB');
// if ($oid == 'ciscoFlashDeviceSizeExtended')
// {
// $has_hc = $GLOBALS['snmp_status'];
// }
//}
print_debug_vars($ciscoFlashDeviceTable);
sleep(5); // Yes, really.. sleep here, because cisco freeze
//$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, 'ciscoFlashPartitionTable', NULL, 'CISCO-FLASH-MIB');
$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, 'ciscoFlashPartitionName', NULL, 'CISCO-FLASH-MIB');
/*
if ($has_hc)
{
$oids = array('ciscoFlashPartitionSizeExtended', 'ciscoFlashPartitionFreeSpaceExtended');
} else {
$oids = array('ciscoFlashPartitionSize', 'ciscoFlashPartitionFreeSpace');
}
foreach ($oids as $oid)
{
sleep(3); // Yes, really.. sleep here, because cisco freeze
$ciscoFlashPartitionTable = snmpwalk_cache_twopart_oid($device_tmp, $oid, $ciscoFlashPartitionTable, 'CISCO-FLASH-MIB');
}
*/
print_debug_vars($ciscoFlashPartitionTable);
/* Now this module run as last, sleep and disable mib not required
if ($GLOBALS['snmp_error_code'] == 1002)
{
// We get timeout error here, f* cisco with your shit ;)
// Additional sleep here and completely disable this mib now, for do not use it next time...
sleep(5);
set_entity_attrib('device', $device, 'mib_' . 'CISCO-FLASH-MIB', "0"); /// FIXME. Note for myself, replace later with set_device_mib_disable(), not released yet
log_event('Note, polling/discovery by MIB "' . 'CISCO-FLASH-MIB' . '" disabled, due to produced many Timeout errors. You can enable it again in device "Properties -> MIBs" page.', $device, 'device', $device['device_id'], 'warning');
}
sleep(5); // Yes, really.. sleep here, because cisco freeze and next discovery module return empty
*/
}
foreach ($ciscoFlashDeviceTable as $flash_index => $flash)
{
/*
CISCO-FLASH-MIB::ciscoFlashDeviceSize.6 = Gauge32: 2048425984 bytes
CISCO-FLASH-MIB::ciscoFlashDeviceSize.7 = Gauge32: 0 bytes
CISCO-FLASH-MIB::ciscoFlashDevicePartitions.6 = Gauge32: 1
CISCO-FLASH-MIB::ciscoFlashDevicePartitions.7 = Gauge32: 0
CISCO-FLASH-MIB::ciscoFlashDeviceName.6 = STRING: disk0
CISCO-FLASH-MIB::ciscoFlashDeviceName.7 = STRING: disk1
CISCO-FLASH-MIB::ciscoFlashDeviceDescr.6 = STRING: Disk 0 Flash
CISCO-FLASH-MIB::ciscoFlashDeviceDescr.7 = STRING: Disk 1 Flash
CISCO-FLASH-MIB::ciscoFlashDeviceRemovable.6 = INTEGER: true(1)
CISCO-FLASH-MIB::ciscoFlashDeviceRemovable.7 = INTEGER: true(1)
*/
$fstype = $flash['ciscoFlashDeviceRemovable'] === 'true' ? 'ciscoFlashRemovable' : 'ciscoFlash';
if (isset($flash['ciscoFlashDeviceSizeExtended']) && $flash['ciscoFlashDeviceSizeExtended'] > 0)
{
$hc = 1;
} else {
$hc = 0;
}
// Do not skip removable for Cisco devices
//if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable'] && $fstype == "ciscoFlashRemovable") { print_debug("Skipped removable: $descr"); continue; }
if (!$flash['ciscoFlashDeviceSize']) { continue; } // Skip currently not exist flash disks
foreach ($ciscoFlashPartitionTable[$flash_index] as $partition_index => $partition)
{
/*
CISCO-FLASH-MIB::ciscoFlashPartitionSize.6.1 = Gauge32: 2048425984 bytes
CISCO-FLASH-MIB::ciscoFlashPartitionFreeSpace.6.1 = Gauge32: 1380122624 bytes
*/
$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

View File

@ -0,0 +1,30 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 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

View File

@ -0,0 +1,52 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
$mib = 'GPFS-MIB';
$cache_discovery['gpfs-mib'] = snmpwalk_cache_oid($device, "gpfsFileSystemStatusTable", array(), $mib);
if (safe_count($cache_discovery['gpfs-mib'])) {
echo(" $mib ");
/*
Available data:
Array
(
[gpfsFileSystemName] => scratch_gs
[gpfsFileSystemStatus] => recovered
[gpfsFileSystemXstatus] => OFW
[gpfsFileSystemTotalSpaceL] => 1946157056
[gpfsFileSystemTotalSpaceH] => 94
[gpfsFileSystemNumTotalInodesL] => 402653184
[gpfsFileSystemNumTotalInodesH] => 0
[gpfsFileSystemFreeSpaceL] => 37208064
[gpfsFileSystemFreeSpaceH] => 26
[gpfsFileSystemNumFreeInodesL] => 326910126
[gpfsFileSystemNumFreeInodesH] => 0
)
*/
foreach ($cache_discovery['gpfs-mib'] as $index => $storage)
{
$fstype = "gpfs";
$descr = "/".$storage['gpfsFileSystemName'];
$hc = 1;
$size = snmp_size64_high_low($storage['gpfsFileSystemTotalSpaceH'], $storage['gpfsFileSystemTotalSpaceL']) * 1024;
$free = snmp_size64_high_low($storage['gpfsFileSystemFreeSpaceH'], $storage['gpfsFileSystemFreeSpaceL']) * 1024;
$used = $size - $free;
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, 1024, $size, $used, array('storage_hc' => $hc));
unset($deny, $fstype, $descr, $size, $used, $free, $percent, $hc);
}
unset($index, $storage);
}

View File

@ -0,0 +1,146 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
// Note. $cache_discovery['ucd-snmp-mib'] - is cached 'UCD-SNMP-MIB::dskEntry' (see ucd-snmp-mib.inc.php in current directory)
$hrStorage = snmp_cache_table($device, "hrStorageEntry", [], "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
$dsk_done = [];
if (!safe_empty($hrStorage)) {
foreach ($hrStorage as $index => $storage) {
$hc = 0;
$mib = 'HOST-RESOURCES-MIB';
$fstype = $storage['hrStorageType'];
$descr = $storage['hrStorageDescr'];
$units = $storage['hrStorageAllocationUnits'];
switch($fstype) {
case 'hrStorageVirtualMemory':
case 'hrStorageRam':
case 'hrStorageOther':
case 'hrStorageTypes.20':
case 'nwhrStorageDOSMemory':
case 'nwhrStorageMemoryAlloc':
case 'nwhrStorageMemoryPermanent':
case 'nwhrStorageCacheBuffers':
case 'nwhrStorageCacheMovable':
case 'nwhrStorageCacheNonMovable':
case 'nwhrStorageCodeAndDataMemory':
case 'nwhrStorageIOEngineMemory':
case 'nwhrStorageMSEngineMemory':
case 'nwhrStorageUnclaimedMemory':
print_debug("skip(memory)");
continue 2;
case 'hrStorageRemovableDisk':
if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable']) {
print_debug("skip(removable)");
continue 2;
}
break;
case 'hrStorageNetworkDisk':
if (isset($config['ignore_mount_network']) && $config['ignore_mount_network']) {
print_debug("skip(network)");
continue 2;
}
break;
case 'hrStorageCompactDisc':
if (isset($config['ignore_mount_optical']) && $config['ignore_mount_optical']) {
print_debug("skip(cd)");
continue 2;
}
break;
}
// Another 'hack' for isilon devices with very big array size
if ($descr === '/ifs' && is_device_mib($device, 'ISILON-MIB')) {
// Remove from polling by HOST-RESOURCES-MIB
continue;
}
//32bit counters
$size = snmp_dewrap32bit($storage['hrStorageSize']) * $units;
$used = snmp_dewrap32bit($storage['hrStorageUsed']) * $units;
$path = rewrite_storage($descr);
// Find index from 'UCD-SNMP-MIB::dskTable'
foreach ($cache_discovery['ucd-snmp-mib'] as $dsk) {
if ($dsk['dskPath'] === $path) {
// Using 64bit counters if available
if (isset($dsk['dskTotalLow'])) {
$dsk['units'] = 1024;
$dsk['size'] = snmp_size64_high_low($dsk['dskTotalHigh'], $dsk['dskTotalLow']);
$dsk['size'] *= $dsk['units'];
if (($dsk['size'] - $size) > $units) {
// Use 64bit counters only if dskTotal bigger then hrStorageSize
// This is try.. if, if, if and more if
$hc = 1;
$mib = 'UCD-SNMP-MIB';
$index = $dsk['dskIndex'];
$fstype = $dsk['dskDevice'];
$descr = $dsk['dskPath'];
$units = $dsk['units'];
$size = $dsk['size'];
$used = snmp_size64_high_low($dsk['dskUsedHigh'], $dsk['dskUsedLow']);
$used *= $units;
}
}
break;
}
}
if (is_numeric($index)) {
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, [ 'storage_hc' => $hc ]);
$dsk_done[$descr] = $descr;
}
unset($fstype, $descr, $size, $used, $units, $path, $dsk, $hc);
}
}
if (!safe_empty($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) {
// Skip already discovered
if (in_array($dsk['dskPath'], $dsk_done, TRUE)) { continue; }
$hc = 0;
$fstype = $dsk['dskDevice'];
$descr = $dsk['dskPath'];
$units = 1024;
// 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 (is_numeric($index)) {
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, [ 'storage_hc' => $hc ]);
}
unset($fstype, $descr, $size, $used, $units, $hc);
}
}
// EOF

View File

@ -0,0 +1,30 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 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'] = snmp_get_multi_oid($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

View File

@ -0,0 +1,98 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
*
*/
$cache_discovery['netapp-mib'] = snmpwalk_cache_oid($device, "dfEntry", array(), 'NETAPP-MIB');
if (safe_count($cache_discovery['netapp-mib'])) {
/*
Available data:
array(40) {
["dfIndex"]=> "3"
["dfFileSys"]=> "/vol/vol0/"
["dfKBytesTotal"]=> "158387408"
["dfKBytesUsed"]=> "7600652"
["dfKBytesAvail"]=> "150786756"
["dfPerCentKBytesCapacity"]=> "5"
["dfInodesUsed"]=> "9405"
["dfInodesFree"]=> "14517028"
["dfPerCentInodeCapacity"]=> "0"
["dfMountedOn"]=> "/vol/vol0/"
["dfMaxFilesAvail"]=> "14526433"
["dfMaxFilesUsed"]=> "9405"
["dfMaxFilesPossible"]=> "39596840"
["dfHighTotalKBytes"]=> "0"
["dfLowTotalKBytes"]=> "158387408"
["dfHighUsedKBytes"]=> "0"
["dfLowUsedKBytes"]=> "7600652"
["dfHighAvailKBytes"]=> "0"
["dfLowAvailKBytes"]=> "150786756"
["dfStatus"]=> "mounted"
["dfMirrorStatus"]=> "invalid"
["dfPlexCount"]=> "0"
["dfType"]=> "flexibleVolume"
["dfHighSisSharedKBytes"]=> "0"
["dfLowSisSharedKBytes"]=> "0"
["dfHighSisSavedKBytes"]=> "0"
["dfLowSisSavedKBytes"]=> "0"
["dfPerCentSaved"]=> "0"
["df64TotalKBytes"]=> "158387408"
["df64UsedKBytes"]=> "7600644"
["df64AvailKBytes"]=> "150786764"
["df64SisSharedKBytes"]=> "0"
["df64SisSavedKBytes"]=> "0"
["df64CompressSaved"]=> "0"
["dfCompressSavedPercent"]=> "0"
["df64DedupeSaved"]=> "0"
["dfDedupeSavedPercent"]=> "0"
["df64TotalSaved"]=> "0"
["dfTotalSavedPercent"]=> "0"
["df64TotalReservedKBytes"]=> "263724"
}
*/
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'];
}
$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

View File

@ -0,0 +1,49 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
$mib = 'NIMBLE-MIB';
//$cache_discovery[$mib]
$oids = snmpwalk_cache_oid($device, 'volName', array(), $mib);
if (count($oids))
{
foreach (array('volSizeLow', 'volSizeHigh', 'volUsageLow', 'volUsageHigh', 'volOnline') as $oid)
{
$oids = snmpwalk_cache_oid($device, $oid, $oids, $mib);
}
if (OBS_DEBUG > 1) { print_vars($oids); }
foreach ($oids as $index => $storage)
{
$hc = 1;
$fstype = 'volume';
$descr = $storage['volName'];
$units = 1048576; // Hardcode units. In MIB is written that bytes, but really Mbytes
// FIXME, probably need additional field for storages like OperStatus up/down
$ignore = in_array($storage['volOnline'], array('0', 'false')) ? 1 : 0;
$deny = FALSE;
$size = snmp_size64_high_low($storage['volSizeHigh'], $storage['volSizeLow']) * $units;
$used = snmp_size64_high_low($storage['volUsageHigh'], $storage['volUsageLow']) * $units;
if (!$deny && is_numeric($index))
{
discover_storage($valid['storage'], $device, $index, $fstype, $mib, $descr, $units, $size, $used, array('storage_hc' => $hc, 'storage_ignore' => $ignore));
}
}
}
unset($oids, $deny, $fstype, $descr, $size, $used, $units, $hc);
// EOF

View File

@ -0,0 +1,18 @@
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
*
*/
// NOTE. Here only walking, because needed additional checks by HOST-RESOURCES-MIB (see host-resources-mib.inc.php in current directory)
$cache_discovery['ucd-snmp-mib'] = snmpwalk_cache_oid($device, 'dskEntry', array(), 'UCD-SNMP-MIB');
// EOF