mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix EdgeCore ifOperStatus does not follow the Cisco convention
* Since EdgeCore use "lowerLayerDown" in ifOperStatus when port is unplugged * On the other way, Cisco use briefly "down". * So change "lowerLayerDown" to "down" to workaround the bug that will make port always show as up/up
This commit is contained in:
@@ -320,6 +320,10 @@ if ($device['os'] == 'junos') {
|
||||
require_once 'ports/junos-vcp.inc.php';
|
||||
}
|
||||
|
||||
if ($device['os'] == 'edgecos') {
|
||||
require_once 'ports/edgecos.inc.php';
|
||||
}
|
||||
|
||||
if (Config::get('enable_ports_adsl')) {
|
||||
$device['xdsl_count'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `device_id` = ? AND `ifType` in ('adsl','vdsl')", [$device['device_id']]);
|
||||
}
|
||||
|
33
includes/polling/ports/edgecos.inc.php
Normal file
33
includes/polling/ports/edgecos.inc.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* edgecos.inc.php
|
||||
*
|
||||
* LibreNMS Edgecos Ports fix
|
||||
*
|
||||
* Fix the problem that EdgeCore did not follow the ifOperStatus convention
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @package LibreNMS
|
||||
* @link http://librenms.org
|
||||
* @copyright 2019 Ming-Han Yang
|
||||
* @author Ming-Han Yang <soto2080edu@g.ncu.edu.tw>
|
||||
*/
|
||||
foreach ($port_stats as & $port) {
|
||||
if ($port['ifOperStatus'] == 'lowerLayerDown') {
|
||||
$port['ifOperStatus'] = 'down';
|
||||
}
|
||||
}
|
||||
unset($port);
|
||||
d_echo($port_stats);
|
Reference in New Issue
Block a user