Added Patton SmartNode OS discovery and polling (#9901)

* Patton SmartNode OS discovery and polling

* mempools

* graphs overs

* []
This commit is contained in:
PipoCanaja
2019-03-06 04:35:58 +01:00
committed by Tony Murray
parent 8f6b58a90d
commit 9deb00f20c
9 changed files with 2585 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
mib: SMARTNODE-MIB
modules:
processors:
data:
-
oid: cpuTable
value: cpuWorkloadCurrent
num_oid: '.1.3.6.1.4.1.1768.100.70.10.2.1.2.{{ $index }}'
descr: '{{ $cpuDescr }} Processor'
index: 'cpu.{{ $index }}'
sensors:
temperature:
data:
-
oid: tempProbeTable
value: currentDegreesCelsius
num_oid: '.1.3.6.1.4.1.1768.100.70.30.2.1.2.{{ $index }}'
descr: '{{ $tempProbeDescr }}'
index: 'temp.{{ $index }}'
count:
data:
-
oid: gwTable
value: gwCurrentOngoingCalls
num_oid: '.1.3.6.1.4.1.1768.100.70.40.2.1.3.{{ $index }}'
descr: '{{ $gwDescr }} ongoing calls'
index: 'gw-{{ $index }}'
group: 'Ongoing calls'
-
oid: isdnPortTable
value: isdnPortCurrentOngoingCalls
num_oid: '.1.3.6.1.4.1.1768.100.70.50.2.1.3.{{ $index }}'
descr: '{{ $isdnPortDescr }} ongoing calls'
index: 'isdn-{{ $index }}'
group: 'Ongoing calls'

View File

@@ -0,0 +1,14 @@
os: patton-sn
group: patton
text: 'Patton SmartNode'
type: network
icon: patton
over:
- { graph: device_processor, text: 'Processor Usage' }
- { graph: device_mempool, text: 'Memory Usage' }
- { graph: device_count, text: 'Ongoing Calls' }
mib_dir:
- patton
discovery:
- sysObjectID:
- .1.3.6.1.4.1.1768.100

View File

@@ -0,0 +1,29 @@
<?php
// Patton SmartNode MemPools
if ($device['os'] == 'patton-sn') {
echo 'Patton SN : ';
$mempools_array = snmpwalk_cache_multi_oid($device, 'memAllocatedBytes', $mempools_array, 'SMARTNODE-MIB', 'patton');
$mempools_array = snmpwalk_cache_multi_oid($device, 'memFreeBytes', $mempools_array, 'SMARTNODE-MIB', 'patton');
$mempools_array = snmpwalk_cache_multi_oid($device, 'memDescr', $mempools_array, 'SMARTNODE-MIB', 'patton');
d_echo($mempools_array);
if (is_array($mempools_array)) {
foreach ($mempools_array as $index => $entry) {
if ($entry['memAllocatedBytes'] != 0 || $entry['memFreeBytes'] != 0) {
d_echo($index.' '.$entry['memDescr'].': '.$entry['memAllocatedBytes'].' allocated, '.$entry['memFreeBytes']." free\n");
//$usage_oid = '.1.3.6.1.4.1.2011.5.25.31.1.1.1.1.7.'.$index;
$descr = $entry['memDescr'];
$descr .= " Memory";
$usage = ($entry['memAllocatedBytes'] / ($entry['memAllocatedBytes'] + $entry['memFreeBytes']) * 100);
if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') {
discover_mempool($valid_mempool, $device, $index, 'patton-sn', $descr, '1', null, null);
}
} //end if
} //end foreach
} //end if
} //end if
unset($mempools_array);

View File

@@ -0,0 +1,28 @@
<?php
$oid = $mempool['mempool_index'];
d_echo('Patton SN Mempool');
if (!is_array($mempool_cache['patton-sn'])) {
d_echo('caching');
$mempool_cache['patton-sn'] = [];
$mempool_cache['patton-sn'] = snmpwalk_cache_multi_oid($device, 'memAllocatedBytes', $mempool_cache['patton-sn'], 'SMARTNODE-MIB', 'patton');
$mempool_cache['patton-sn'] = snmpwalk_cache_multi_oid($device, 'memFreeBytes', $mempool_cache['patton-sn'], 'SMARTNODE-MIB', 'patton');
d_echo($mempool_cache);
}
$entry = $mempool_cache['patton-sn'][$mempool['mempool_index']];
if ($entry['hwEntityMemSize'] < 0) {
$entry['hwEntityMemSize'] = ($entry['hwEntityMemSize'] * -1);
}
$mempool['total'] = $entry['memAllocatedBytes'] + $entry['memFreeBytes'] ;
$mempool['used'] = $entry['memAllocatedBytes'];
$mempool['free'] = $entry['memFreeBytes'];
$perc = $entry['used']/$entry['total'] * 100;
d_echo($mempool);

View File

@@ -0,0 +1,17 @@
<?php
//PATTON SmartNode
$oids = [
'hw_release' => '.1.3.6.1.4.1.1768.100.1.3.0',
'hw_version' => '.1.3.6.1.4.1.1768.100.1.4.0',
'product_name' => '.1.3.6.1.4.1.1768.100.1.6.0',
'serial' => '.1.3.6.1.4.1.1768.100.1.1.0',
'version' => '.1.3.6.1.4.1.1768.100.1.5.0'
];
$os_data = snmp_get_multi_oid($device, $oids);
foreach ($oids as $var => $oid) {
$$var = $os_data[$oid];
}
//Concatenate the hardware description
$hardware = $product_name . ', HwRel: ' . $hw_release . ', HwVer: ' . $hw_version;