mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Feature: Collect VRP Entity details in the Huawei MIB (#8888)
* Feature: Collect VRP Entity details in the Huawei MIB * Feature: Collect VRP Entity details in the Huawei MIB - Add Test Data * Renaming of the test file vrp_5720_vrf.snmprec * Added json test files * Update vrp_5720_vrf.snmprec * Update vrp_5720_vrf.snmprec * Update vrp_5720_vrf.json * Updated processor and mempool discovery to limit descr field * Updated test * Updated tests again * Updated json test data * Update vrp_ce12804-entity.json * Update vrp_ce12804-entity.json * Update vrp_5720_vrf.json
This commit is contained in:
@@ -23,7 +23,6 @@
|
|||||||
* @author Tony Murray <murraytony@gmail.com>
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace LibreNMS\Device;
|
namespace LibreNMS\Device;
|
||||||
|
|
||||||
use LibreNMS\Config;
|
use LibreNMS\Config;
|
||||||
@@ -147,6 +146,11 @@ class Processor extends Model implements DiscoveryModule, PollerModule, Discover
|
|||||||
$processors = $os->discoverProcessors();
|
$processors = $os->discoverProcessors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($processors as $processor) {
|
||||||
|
$processor->processor_descr = substr($processor->processor_descr, 0, 64);
|
||||||
|
$processors[] = $processor;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($processors) && is_array($processors)) {
|
if (isset($processors) && is_array($processors)) {
|
||||||
self::sync(
|
self::sync(
|
||||||
$os->getDeviceId(),
|
$os->getDeviceId(),
|
||||||
|
@@ -19,6 +19,12 @@ if ($device['os'] == 'junos') {
|
|||||||
$entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB');
|
$entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($device['os'] == 'vrp') {
|
||||||
|
echo ' hwEntityBoardType';
|
||||||
|
$entity_array = snmpwalk_cache_oid($device, 'hwEntityBoardType', $entity_array, 'ENTITY-MIB:HUAWEI-ENTITY-EXTENT-MIB');
|
||||||
|
echo ' hwEntityBomEnDesc';
|
||||||
|
$entity_array = snmpwalk_cache_oid($device, 'hwEntityBomEnDesc', $entity_array, 'ENTITY-MIB:HUAWEI-ENTITY-EXTENT-MIB');
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($entity_array as $entPhysicalIndex => $entry) {
|
foreach ($entity_array as $entPhysicalIndex => $entry) {
|
||||||
if ($device['os'] == 'junos') {
|
if ($device['os'] == 'junos') {
|
||||||
@@ -59,6 +65,23 @@ foreach ($entity_array as $entPhysicalIndex => $entry) {
|
|||||||
$entPhysicalAlias = $entry['tmnxHwAlias'];
|
$entPhysicalAlias = $entry['tmnxHwAlias'];
|
||||||
$entPhysicalAssetID = $entry['tmnxHwAssetID'];
|
$entPhysicalAssetID = $entry['tmnxHwAssetID'];
|
||||||
$entPhysicalIndex = str_replace('.', '', $entPhysicalIndex);
|
$entPhysicalIndex = str_replace('.', '', $entPhysicalIndex);
|
||||||
|
} elseif ($device['os'] == 'vrp') {
|
||||||
|
//Add some details collected in the VRP Entity Mib
|
||||||
|
$entPhysicalDescr = $entry['hwEntityBomEnDesc'];
|
||||||
|
$entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
|
||||||
|
$entPhysicalClass = $entry['entPhysicalClass'];
|
||||||
|
$entPhysicalName = $entry['entPhysicalName'];
|
||||||
|
$entPhysicalSerialNum = $entry['entPhysicalSerialNum'];
|
||||||
|
$entPhysicalModelName = $entry['hwEntityBoardType'];
|
||||||
|
$entPhysicalMfgName = $entry['entPhysicalMfgName'];
|
||||||
|
$entPhysicalVendorType = $entry['entPhysicalVendorType'];
|
||||||
|
$entPhysicalParentRelPos = $entry['entPhysicalParentRelPos'];
|
||||||
|
$entPhysicalHardwareRev = $entry['entPhysicalHardwareRev'];
|
||||||
|
$entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev'];
|
||||||
|
$entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev'];
|
||||||
|
$entPhysicalIsFRU = $entry['entPhysicalIsFRU'];
|
||||||
|
$entPhysicalAlias = $entry['entPhysicalAlias'];
|
||||||
|
$entPhysicalAssetID = $entry['entPhysicalAssetID'];
|
||||||
} else {
|
} else {
|
||||||
$entPhysicalDescr = $entry['entPhysicalDescr'];
|
$entPhysicalDescr = $entry['entPhysicalDescr'];
|
||||||
$entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
|
$entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
|
||||||
|
@@ -665,6 +665,9 @@ function discover_processor(&$valid, $device, $oid, $index, $type, $descr, $prec
|
|||||||
|
|
||||||
function discover_mempool(&$valid, $device, $index, $type, $descr, $precision = '1', $entPhysicalIndex = null, $hrDeviceIndex = null)
|
function discover_mempool(&$valid, $device, $index, $type, $descr, $precision = '1', $entPhysicalIndex = null, $hrDeviceIndex = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$descr = substr($descr, 0, 64);
|
||||||
|
|
||||||
d_echo("Discover Mempool: $index, $type, $descr, $precision, $entPhysicalIndex, $hrDeviceIndex\n");
|
d_echo("Discover Mempool: $index, $type, $descr, $precision, $entPhysicalIndex, $hrDeviceIndex\n");
|
||||||
|
|
||||||
// FIXME implement the mempool_perc, mempool_used, etc.
|
// FIXME implement the mempool_perc, mempool_used, etc.
|
||||||
|
37613
tests/data/vrp_5720_vrf.json
Normal file
37613
tests/data/vrp_5720_vrf.json
Normal file
File diff suppressed because it is too large
Load Diff
40
tests/data/vrp_ce12804-entity.json
Normal file
40
tests/data/vrp_ce12804-entity.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"os": {
|
||||||
|
"discovery": {
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"sysName": "<private>",
|
||||||
|
"sysObjectID": ".1.3.6.1.4.1.2011.2.239.1",
|
||||||
|
"sysDescr": "Huawei Versatile Routing Platform Software\nVRP (R) software, Version 8.150 (CE12800 V200R002C50SPC800) \r\nCopyright (C) 2012-2017 Huawei Technologies Co., Ltd. \r\nHUAWEICE12804",
|
||||||
|
"sysContact": null,
|
||||||
|
"version": null,
|
||||||
|
"hardware": null,
|
||||||
|
"features": null,
|
||||||
|
"location": null,
|
||||||
|
"os": "vrp",
|
||||||
|
"type": "network",
|
||||||
|
"serial": null,
|
||||||
|
"icon": "huawei.svg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"poller": {
|
||||||
|
"devices": [
|
||||||
|
{
|
||||||
|
"sysName": "<private>",
|
||||||
|
"sysObjectID": ".1.3.6.1.4.1.2011.2.239.1",
|
||||||
|
"sysDescr": "Huawei Versatile Routing Platform Software\nVRP (R) software, Version 8.150 (CE12800 V200R002C50SPC800) \r\nCopyright (C) 2012-2017 Huawei Technologies Co., Ltd. \r\nHUAWEICE12804",
|
||||||
|
"sysContact": "<private>",
|
||||||
|
"version": "8.150 (CE12800 V200R002C50SPC800)",
|
||||||
|
"hardware": "",
|
||||||
|
"features": null,
|
||||||
|
"location": "<private>",
|
||||||
|
"os": "vrp",
|
||||||
|
"type": "network",
|
||||||
|
"serial": null,
|
||||||
|
"icon": "huawei.svg"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22752
tests/snmpsim/vrp_5720_vrf.snmprec
Normal file
22752
tests/snmpsim/vrp_5720_vrf.snmprec
Normal file
File diff suppressed because it is too large
Load Diff
3651
tests/snmpsim/vrp_ce12804-entity.snmprec
Normal file
3651
tests/snmpsim/vrp_ce12804-entity.snmprec
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user