Files
librenms-librenms/includes/polling/mempools/pbn-mem.inc.php
Tony Murray edbb6ae0e3 refactor: Centralize MIB include directory specification (#4603)
* refactor: Centralize MIB include directory specification
The default is now:
```
$config['mib_dir'].'/mibdirname:'.$config['mib_dir']
```
This means we exclude OS mibs and only use ours  (we could prepend `+` if we want to include os mibs.
All snmp calls should only include the name of the subdirectory under the mibs directory.

* Remove d_echo from Proc
Fix snmpsim tests.
2016-09-28 14:19:28 +01:00

25 lines
831 B
PHP

<?php
echo 'PBN MemPool'.'\n';
if ($device['os'] == 'pbn') {
// find out wich build number we have
preg_match('/^.* Build (?<build>\d+)/', $device['version'], $version);
d_echo($version);
// specified MIB supported since build 16607
if ($version[build] >= 16607) {
$perc = snmp_get($device, 'nmsMemoryPoolUtilization.0', '-OUvQ', 'NMS-MEMORY-POOL-MIB', 'pbn');
$memory_available = snmp_get($device, 'nmsMemoryPoolTotalMemorySize.0', '-OUvQ', 'NMS-MEMORY-POOL-MIB', 'pbn');
$mempool['total'] = $memory_available;
if (is_numeric($perc)) {
$mempool['used'] = ($memory_available / 100 * $perc);
$mempool['free'] = ($memory_available - $mempool['used']);
}
echo "PERC " .$perc."%\n";
echo "Avail " .$mempool['total']."\n";
}
}