mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add build specific handling on cpu and mempool discoverx/polling
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
<?php
|
||||
if ($device['os'] == 'pbn') {
|
||||
|
||||
echo 'PBN-MEMORY-POOL: ';
|
||||
|
||||
$usage = snmp_get($device, 'NMS-MEMORY-POOL-MIB::nmsMemoryPoolUtilization.0', '-OvQ');
|
||||
// find out wich build number we have
|
||||
preg_match('/^.* Build (?<build>\d+)/', $device['version'], $version);
|
||||
d_echo($version);
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_mempool($valid_mempool, $device, 0, 'pbn-mem', 'Main Memory', '100', null, null);
|
||||
// specified MIB supported since build 16607
|
||||
if ($version[build] >= 16607) {
|
||||
|
||||
$usage = snmp_get($device, 'NMS-MEMORY-POOL-MIB::nmsMemoryPoolUtilization.0', '-OUvQ');
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_mempool($valid_mempool, $device, 0, 'pbn-mem', 'Main Memory', '100', null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
<?php
|
||||
if ($device['os'] == 'pbn') {
|
||||
echo 'PBN : ';
|
||||
|
||||
// find out wich build number we have
|
||||
preg_match('/^.* Build (?<build>\d+)/', $device['version'], $version);
|
||||
d_echo($version);
|
||||
|
||||
$descr = 'Processor';
|
||||
$usage = str_replace(' percent', '', snmp_get($device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min', '-OvQ'));
|
||||
// specified MIB supported since build 16607
|
||||
if ($version[build] >= 16607) {
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min', '0', 'pbn-cpu', $descr,
|
||||
'100', $usage, null, null);
|
||||
echo 'PBN : ';
|
||||
|
||||
$descr = 'Processor';
|
||||
$usage = snmp_get($device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min.1', '-OUvQ');
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min', '0', 'pbn-cpu', $descr, '100', $usage, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
<?php
|
||||
|
||||
echo 'PBN Secure MemPool'.'\n';
|
||||
echo 'PBN MemPool'.'\n';
|
||||
|
||||
if ($device['os'] == 'pbn') {
|
||||
$perc = snmp_get($device, "NMS-MEMORY-POOL-MIB::nmsMemoryPoolUtilization.0", '-OvQ');
|
||||
$memory_available = snmp_get($device, "NMS-MEMORY-POOL-MIB::nmsMemoryPoolTotalMemorySize.0", '-OvQ');
|
||||
$mempool['total'] = $memory_available;
|
||||
|
||||
// find out wich build number we have
|
||||
preg_match('/^.* Build (?<build>\d+)/', $device['version'], $version);
|
||||
d_echo($version);
|
||||
|
||||
if (is_numeric($perc)) {
|
||||
$mempool['used'] = ($memory_available / 100 * $perc);
|
||||
$mempool['free'] = ($memory_available - $mempool['used']);
|
||||
}
|
||||
// specified MIB supported since build 16607
|
||||
if ($version[build] >= 16607) {
|
||||
$perc = snmp_get($device, "NMS-MEMORY-POOL-MIB::nmsMemoryPoolUtilization.0", '-OUvQ');
|
||||
$memory_available = snmp_get($device, "NMS-MEMORY-POOL-MIB::nmsMemoryPoolTotalMemorySize.0", '-OUvQ');
|
||||
$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";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
<?php
|
||||
echo 'PBN CPU Usage';
|
||||
|
||||
if ($device['os'] == 'pbn') {
|
||||
$usage = str_replace(' percent', '', snmp_get($device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min', '-OvQ'));
|
||||
|
||||
echo 'PBN CPU Usage';
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
$proc = ($usage * 100);
|
||||
// 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) {
|
||||
|
||||
$usage = snmp_get($device, 'NMS-PROCESS-MIB::nmspmCPUTotal5min.1', '-OUvQ');
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
$proc = ($usage * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user