Added VRP SFPs thresholds and map entPhysical to ifIndexes (#10363)

* gather SFPs thresholds and map entPhysical to ifIndexes

* Update entity-physical.inc.php

Comment and force TravisTests

* codeclimate

* Simplify ifIndex collection

* Always update ifIndex

* Missing pre-cache value for skip_value
This commit is contained in:
PipoCanaja
2019-07-15 01:37:01 +02:00
committed by Tony Murray
parent 902aedcd82
commit 837765fabe
3 changed files with 36 additions and 8 deletions

View File

@@ -21,6 +21,7 @@ modules:
data:
- oid:
- entPhysicalName
- hwEntityAdminStatus
- hwStackPortTable
temperature:
data:
@@ -63,6 +64,10 @@ modules:
oid: hwEntityOpticalRxPower
op: '<='
value: 0
-
oid: hwEntityAdminStatus
op: '='
value: 12
-
oid: hwOpticalModuleInfoTable
value: hwEntityOpticalTxPower
@@ -78,6 +83,10 @@ modules:
oid: hwEntityOpticalTxPower
op: '<='
value: 0
-
oid: hwEntityAdminStatus
op: '='
value: 12
-
oid: hwOpticalModuleInfoTable
value: hwEntityOpticalLaneRxPower
@@ -88,11 +97,17 @@ modules:
index: 'lane-rx-{{ $index }}'
divisor: 100
group: '{{ $entPhysicalName }}'
high_limit: hwEntityOpticalRxHighThreshold
low_limit: hwEntityOpticalRxLowThreshold
skip_values:
-
oid: hwEntityOpticalRxPower
op: '>'
value: 0
-
oid: hwEntityAdminStatus
op: '='
value: 12
-
oid: hwOpticalModuleInfoTable
value: hwEntityOpticalLaneTxPower
@@ -102,11 +117,17 @@ modules:
entPhysicalIndex_measured: ports
index: 'lane-tx-{{ $index }}'
group: '{{ $entPhysicalName }}'
high_limit: hwEntityOpticalTxHighThreshold
low_limit: hwEntityOpticalTxLowThreshold
skip_values:
-
oid: hwEntityOpticalTxPower
op: '>'
value: 0
-
oid: hwEntityAdminStatus
op: '='
value: 12
divisor: 100
voltage:
data:

View File

@@ -117,6 +117,7 @@ if ($device['os'] == 'saf-cfm') {
}
foreach ($entity_array as $entPhysicalIndex => $entry) {
unset($ifIndex);
if ($device['os'] == 'junos') {
// Juniper's MIB doesn't have the same objects as the Entity MIB, so some values
// are made up here.
@@ -190,6 +191,12 @@ foreach ($entity_array as $entPhysicalIndex => $entry) {
$entPhysicalIsFRU = $entry['entPhysicalIsFRU'];
$entPhysicalAlias = $entry['entPhysicalAlias'];
$entPhysicalAssetID = $entry['entPhysicalAssetID'];
//VRP devices seems to use LogicalEntity '1' instead of '0' like the default code checks.
//Standard code is still run after anyway.
if (isset($entry['1']['entAliasMappingIdentifier'])) {
$ifIndex = preg_replace('/ifIndex\.(\d+).*/', '$1', $entry['1']['entAliasMappingIdentifier']);
}
} else {
$entPhysicalDescr = array_key_exists('entPhysicalDescr', $entry) ? $entry['entPhysicalDescr'] : '';
$entPhysicalContainedIn = array_key_exists('entPhysicalContainedIn', $entry) ? $entry['entPhysicalContainedIn'] : '';
@@ -210,14 +217,13 @@ foreach ($entity_array as $entPhysicalIndex => $entry) {
if (isset($entity_array[$entPhysicalIndex]['0']['entAliasMappingIdentifier'])) {
$ifIndex = $entity_array[$entPhysicalIndex]['0']['entAliasMappingIdentifier'];
}
if (!strpos($ifIndex, 'fIndex') || $ifIndex == '') {
unset($ifIndex);
} else {
$ifIndex_array = explode('.', $ifIndex);
$ifIndex = $ifIndex_array[1];
unset($ifIndex_array);
if (!strpos($ifIndex, 'fIndex') || $ifIndex == '') {
unset($ifIndex);
} else {
$ifIndex_array = explode('.', $ifIndex);
$ifIndex = $ifIndex_array[1];
unset($ifIndex_array);
}
}
// List of real names for cisco entities

View File

@@ -783,6 +783,7 @@ function discover_entity_physical(&$valid, $device, $entPhysicalIndex, $entPhysi
'entPhysicalIsFRU' => $entPhysicalIsFRU,
'entPhysicalAlias' => $entPhysicalAlias,
'entPhysicalAssetID' => $entPhysicalAssetID,
'ifIndex' => $ifIndex,
);
dbUpdate($update_data, 'entPhysical', '`device_id`=? AND `entPhysicalIndex`=?', array($device['device_id'], $entPhysicalIndex));
}//end if