diff -rN ./includes/discovery/mempools/ministorage.inc.php /opt/observium/includes/discovery/mempools/ministorage.inc.php
0a1,53
> <?php
> /** 
>  * Mempool support for Mini Snmpd
>  *
>  * From the wiki:
>  *
>  * "Mini SNMP Daemon is a minimal implementation of an SNMP daemon. It is targeted for usage in 
>  *  embedded systems with limited disk and memory resources. All configuration is done using 
>  *  commandline arguments. It supports basic CPU, memory, disk, and network interface statistics.
>  *
>  * The normal driver tries to read from hrStorageEntry, on Mini Snmpd devices, there is no such thing.
>  * This driver tries to fix that by reading the memory entry directly. It does only do that, when
>  * no hrStorageEntry is available.
>  *
>  * @see http://freecode.com/projects/minisnmpd
>  * @author Stephan van de Haar <observium@svdhaar.eu>
>  * @since 0.1 12-02-2014
>  * @license GPL
>  */
> 
> // fetch the storage entries as normal
> $storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES:NetWare-Host-Ext-MIB");
> 
> // if we cannot find any entries
> if (!is_array($storage_array))
> {
>   // try to fetch it from the memory part directly
>   $meminfo = snmpwalk_cache_oid($device, 'memory', NULL, 'UCD-SNMP-MIB');
> 
>   // now iterate over the nodes (we should find only one pool)
>   foreach ($meminfo as $index => $mem) {
> 
>       // we calculate like in the original file
>       // XXX: is size, used, percent, fstype really needed here? It is in the original code, so lets keep it here ..
> 
>       $units   = '1024'; // we have no information about this from mini snmpd, assume 1024
>       $size    = $mem['memTotalReal'] * $units;
>       $used    = ($mem['memTotalReal'] - $mem['memAvailReal']) * $units;
>       $percent = round($used / $size * 100);
> 
>       $fstype  = 'hrStorageFixedDisk';
>       $descr   = 'Memory usage #' . $index;
> 
>       // add the mem pool
>       discover_mempool($valid_mempool, $device, $index, "ministorage", $descr, $units, NULL, NULL);
> 
>       // and unset vars
>       unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $mem, $index);
>   }
>   // unset storage array
>   unset($storage_array, $meminfo);
> }
> ?>
diff -rN ./includes/discovery/storage/hrstorage.inc.php /opt/observium/includes/discovery/storage/hrstorage.inc.php
74a75
> var_dump($size);
diff -rN ./includes/discovery/storage/ministorage.inc.php /opt/observium/includes/discovery/storage/ministorage.inc.php
0a1,57
> <?php
> /**
>  * Storage support for Mini Snmpd
>  *
>  * From the wiki:
>  *
>  * "Mini SNMP Daemon is a minimal implementation of an SNMP daemon. It is targeted for usage in
>  *  embedded systems with limited disk and memory resources. All configuration is done using
>  *  commandline arguments. It supports basic CPU, memory, disk, and network interface statistics.
>  *
>  * The normal driver tries to read from hrStorageEntry, on Mini Snmpd devices, there is no such thing.
>  * This driver tries to fix that by reading the disk entries directly. It does only do that, when
>  * no hrStorageEntry is available.
>  *
>  * @see http://freecode.com/projects/minisnmpd
>  * @author Stephan van de Haar <observium@svdhaar.eu>
>  * @since 0.1 12-02-2014
>  * @license GPL
>  */
> 
> $hrstorage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES:NetWare-Host-Ext-MIB");
> 
> // if we cannot find a hrstorage entry, try find it in another way
> if (!is_array($hrstorage_array))
> {
>   // get the disk entries
>   $dsk_array = snmpwalk_cache_oid($device, 'dskEntry', NULL, 'UCD-SNMP-MIB');
> 
>   // if we find any
>   if (is_array($dsk_array)) {
>  
>       foreach($dsk_array as $dsk)
>       {
>           // we have no way to detect this using mini snmpd, assume 1024
>           $units = '1024';
> 
>           if (isset($dsk['dskTotal']))
>           {
>             // calculate disk usage
>             $size = $dsk['dskTotal'] * $units;
>             $used = $dsk['dskUsed'] * $units;
> 	    $percent = round($used / $size * 100);
>           }
>         // set some vars we need
> 	$index = $dsk['dskIndex'];
> 	$fstype = 'hrStorageFixedDisk';
> 	$descr = $dsk['dskPath'];
> 
>         // and add the storage device
>       	discover_storage($valid_storage, $device, $index, $fstype, "ministorage", $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);
> }
> 
> ?>
diff -rN ./includes/polling/mempools/ministorage.inc.php /opt/observium/includes/polling/mempools/ministorage.inc.php
0a1,49
> <?php
> /**
>  * Mempool support for Mini Snmpd
>  *
>  * From the wiki:
>  *
>  * "Mini SNMP Daemon is a minimal implementation of an SNMP daemon. It is targeted for usage in
>  *  embedded systems with limited disk and memory resources. All configuration is done using
>  *  commandline arguments. It supports basic CPU, memory, disk, and network interface statistics.
>  *
>  * The normal driver tries to read from hrStorageEntry, on Mini Snmpd devices, there is no such thing.
>  * This driver tries to fix that by reading the memory entry directly. It does only do that, when
>  * no hrStorageEntry is available.
>  *
>  * @see http://freecode.com/projects/minisnmpd
>  * @author Stephan van de Haar <observium@svdhaar.eu>
>  * @since 0.1 12-02-2014
>  * @license GPL
>  */
> 
> // HOST-RESOURCES-MIB - Memory Objects
> if (!is_array($storage_cache['hrstorage']))
> {
>   $storage_cache['hrstorage'] = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
>   if ($debug) { print_vars($storage_cache); }
> }
> else
> {
>   if ($debug) { echo("Cached!"); }
> }
> 
> // if we cannot find any mempools using hrstorage
> if (!is_array($storage_cache['hrstorage'])) {
> 
>   // fetch the mempools directly
>   $meminfo = snmpwalk_cache_oid($device, 'memory', NULL, 'UCD-SNMP-MIB');
> 
>   // iterator over the mempools, we should only find one normally
>   foreach ($meminfo as $index => $mem) {
>       // XXX: in the original file, entry was linked, do we need it?
>       $entry = $mem;
>       $mempool['units'] = 1024; // we have no information from mini snmpd, assume 1024
>       $mempool['total'] = $mem['memTotalReal'] * $mempool['units'];
>       $mempool['free']  = $mem['memAvailReal'] * $mempool['units'];
>       $mempool['used']  = $mempool['total'] - $mempool['free'];
>   }
> }
> 
> ?>
diff -rN ./includes/polling/storage-ministorage.inc.php /opt/observium/includes/polling/storage-ministorage.inc.php
0a1,50
> <?php
> /**
>  * Storage support for Mini Snmpd
>  *
>  * From the wiki:
>  *
>  * "Mini SNMP Daemon is a minimal implementation of an SNMP daemon. It is targeted for usage in
>  *  embedded systems with limited disk and memory resources. All configuration is done using
>  *  commandline arguments. It supports basic CPU, memory, disk, and network interface statistics.
>  *
>  * The normal driver tries to read from hrStorageEntry, on Mini Snmpd devices, there is no such thing.
>  * This driver tries to fix that by reading the disk entries directly. It does only do that, when
>  * no hrStorageEntry is available.
>  *
>  * @see http://freecode.com/projects/minisnmpd
>  * @author Stephan van de Haar <observium@svdhaar.eu>
>  * @since 0.1 12-02-2014
>  * @license GPL
>  */
> 
> // HOST-RESOURCES-MIB - Storage Objects
> if (!is_array($storage_cache['hrstorage']))
> {
>   $storage_cache['hrstorage'] = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
>   if ($debug) { print_vars($storage_cache); }
> }
> 
> // read the disk entries if not already done
> if (!is_array($storage_cache['dsk']))
> {
>   $storage_cache['dsk'] = snmpwalk_cache_oid($device, 'dskEntry', NULL, 'UCD-SNMP-MIB');
> }
> 
> // iterator over the disks we have just found
> foreach ($storage_cache['dsk'] as $dsk) {
> 	// XXX: needs review
> 	// somehow we cannot match on storage index, the index changes over time
> 	// to work around this issue, match on storage description as this seems more reliable
> 	if ($dsk['dskPath'] == $storage['storage_descr']) {
> 		$entry = $dsk;
> 	}
> }
> 
> // there is no way to detect this in mini snmpd, so assume 1024
> $storage['units'] = 1024;
> $storage['used']  = snmp_dewrap32bit($entry['dskUsed']) * $storage['units'];
> $storage['size']  = snmp_dewrap32bit($entry['dskTotal']) * $storage['units'];
> $storage['free']  = $storage['size'] - $storage['used'];
> 
> ?>