Skip to content

Commit

Permalink
fix Novel Netware memory/storage detection (missing storage for now, …
Browse files Browse the repository at this point in the history
…but atleast memory is in the memory section, not storage!)

git-svn-id: http://www.observium.org/svn/observer/trunk@2156 61d68cd4-352d-0410-923a-c4978735b2b8
  • Loading branch information
adama committed Apr 24, 2011
1 parent c7425e5 commit c5072e9
Show file tree
Hide file tree
Showing 4 changed files with 1,148 additions and 11 deletions.
25 changes: 22 additions & 3 deletions includes/discovery/mempools/hrstorage.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

global $valid_mempool;

$storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
$storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES:NetWare-Host-Ext-MIB");

if (is_array($storage_array))
{
Expand All @@ -16,7 +16,26 @@
$units = $storage['hrStorageAllocationUnits'];
$deny = 1;

if ($fstype == "hrStorageVirtualMemory" || $fstype == "hrStorageRam") { $deny = 0; }
switch($fstype)
{
case 'hrStorageVirtualMemory':
case 'hrStorageRam';
case 'nwhrStorageDOSMemory';
case 'nwhrStorageMemoryAlloc';
case 'nwhrStorageMemoryPermanent';
case 'nwhrStorageMemoryAlloc';
case 'nwhrStorageCacheBuffers';
case 'nwhrStorageCacheMovable';
case 'nwhrStorageCacheNonMovable';
case 'nwhrStorageCodeAndDataMemory';
case 'nwhrStorageDOSMemory';
case 'nwhrStorageIOEngineMemory';
case 'nwhrStorageMSEngineMemory';
case 'nwhrStorageUnclaimedMemory';
$deny = 0;
break;
}

if ($device['os'] == "routeros" && $descr == "main memory") { $deny = 0; }

if (strstr($descr, "MALLOC") || strstr($descr, "UMA")) { $deny = 1; } ## Ignore FreeBSD INSANITY
Expand All @@ -34,4 +53,4 @@
unset($storage_array);
}

?>
?>
5 changes: 3 additions & 2 deletions includes/discovery/storage.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

echo("Storage : ");

include("storage-hrstorage.inc.php");
include_dir("includes/discovery/storage");


### Remove storage which weren't redetected here

Expand All @@ -29,4 +30,4 @@
unset($valid_storage);
echo("\n");

?>
?>
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
<?php

$storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
$hrstorage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES:NetWare-Host-Ext-MIB");

if (is_array($storage_array))
global $valid_storage;

if (is_array($hrstorage_array))
{
echo("hrStorage : ");
foreach ($storage_array as $index => $storage)
foreach ($hrstorage_array as $index => $storage)
{
$fstype = $storage['hrStorageType'];
$descr = $storage['hrStorageDescr'];
$size = $storage['hrStorageSize'] * $storage['hrStorageAllocationUnits'];
$used = $storage['hrStorageUsed'] * $storage['hrStorageAllocationUnits'];
$units = $storage['hrStorageAllocationUnits'];

switch($fstype)
{
case 'hrStorageVirtualMemory':
case 'hrStorageRam';
case 'hrStorageOther';
case 'nwhrStorageDOSMemory';
case 'nwhrStorageMemoryAlloc';
case 'nwhrStorageMemoryPermanent';
case 'nwhrStorageMemoryAlloc';
case 'nwhrStorageCacheBuffers';
case 'nwhrStorageCacheMovable';
case 'nwhrStorageCacheNonMovable';
case 'nwhrStorageCodeAndDataMemory';
case 'nwhrStorageDOSMemory';
case 'nwhrStorageIOEngineMemory';
case 'nwhrStorageMSEngineMemory';
case 'nwhrStorageUnclaimedMemory';
$deny = 1;
break;
}


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 (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable'] && $fstype == "hrStorageRemovableDisk") { $deny = 1; if ($debug) echo("skip(removable)\n"); }
if (isset($config['ignore_mount_network']) && $config['ignore_mount_network'] && $fstype == "hrStorageNetworkDisk") { $deny = 1; if ($debug) echo("skip(network)\n"); }
if (isset($config['ignore_mount_optical']) && $config['ignore_mount_optical'] && $fstype == "hrStorageCompactDisc") { $deny = 1; if ($debug) echo("skip(cd)\n"); }
if ($fstype == "hrStorageVirtualMemory" || $fstype == "hrStorageRam" || $fstype == "hrStorageOther") { $deny = 1; }

if (!$deny && is_numeric($index))
{
Expand All @@ -31,9 +54,9 @@
#$storage_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("storage-hrstorage-" . $index . ".rrd");
#if (is_file($old_storage_rrd)) { rename($old_storage_rrd,$storage_rrd); }

unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $storage_array);
unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $hrstorage_array);

}
}

?>
?>
Loading

0 comments on commit c5072e9

Please sign in to comment.