mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Reorder ifalias_null check to prevent var flapping
This needs to run before IF-MIB data update, and needs to check and set $this_port['ifAlias'] only as to not break the $data_oids loop.
This commit is contained in:
@@ -324,6 +324,12 @@ foreach ($ports as $port) {
|
|||||||
// FIXME use $q_bridge_mib[$this_port['ifIndex']] to see if it is a trunk (>1 array count)
|
// FIXME use $q_bridge_mib[$this_port['ifIndex']] to see if it is a trunk (>1 array count)
|
||||||
echo 'VLAN == '.$this_port['ifVlan'];
|
echo 'VLAN == '.$this_port['ifVlan'];
|
||||||
|
|
||||||
|
// When devices do not provide ifAlias data, populate with ifDescr data if configured
|
||||||
|
if (($this_port['ifAlias'] == '' || $this_port['ifAlias'] == NULL) && $config['os'][$device['os']]['ifalias_null'] == 1) {
|
||||||
|
$this_port['ifAlias'] = $this_port['ifDescr'];
|
||||||
|
d_echo('Using ifDescr due to ifAlias being NULL');
|
||||||
|
}
|
||||||
|
|
||||||
// Update IF-MIB data
|
// Update IF-MIB data
|
||||||
foreach ($data_oids as $oid) {
|
foreach ($data_oids as $oid) {
|
||||||
if ($port[$oid] != $this_port[$oid] && !isset($this_port[$oid])) {
|
if ($port[$oid] != $this_port[$oid] && !isset($this_port[$oid])) {
|
||||||
@@ -352,12 +358,6 @@ foreach ($ports as $port) {
|
|||||||
}
|
}
|
||||||
}//end foreach
|
}//end foreach
|
||||||
|
|
||||||
if (($port['update']['ifAlias'] == '' || $port['update']['ifAlias'] == NULL) && $config['os'][$device['os']]['ifalias_null'] == 1) {
|
|
||||||
$port['update']['ifAlias'] = $port['ifDescr'];
|
|
||||||
$this_port['ifAlias'] = $port['ifDescr'];
|
|
||||||
d_echo('Using ifDescr due to ifAlias being NULL');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse description (usually ifAlias) if config option set
|
// Parse description (usually ifAlias) if config option set
|
||||||
if (isset($config['port_descr_parser']) && is_file($config['install_dir'].'/'.$config['port_descr_parser'])) {
|
if (isset($config['port_descr_parser']) && is_file($config['install_dir'].'/'.$config['port_descr_parser'])) {
|
||||||
$port_attribs = array(
|
$port_attribs = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user