mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
b3019f7944
* Add DBm and State Sensors Added extra MIB files Added Dbm levels on ports Added Stacking State Sensors * Added include for zynos.inc.php File patch - includes/discovery/ports/zynos.inc.php * Create ZYXEL-STACKING-MIB Official Zyxel MIB * Create ZYXEL-TRANSCEIVER-MIB Official Zyxel MIB * Added test file zynos_xgs4600.json * Create zynos snmprec test file * CENSORED zynos_xgs4600.json * Created new polling file for Zynos ports Converts zynos SWP port style to be 1/1 style * Created new discovery for Zynos ports Changes zynos SWP ports to be 1/1 style during discovery * Fixing ci complaints in discovery/ports/zynos.inc.php * Fixing ci complaints in polling/ports/os/zynos.inc.php * fixing more ci complaints in discovery * Updated Zynos.snmprec * Updated zynos.json * Updated zynos.json * Removed ifDescr pre-cache * Removed pre-cache from zynos.yaml * Reverted zynos.snmprec * Restored zynos.json * Updated zynos polling to use zeropad * Updated zynos discovery to use zeropad * Updated zynos.yaml Updated zynos.yaml to include ifname: true to change port names and added '/^ZyXEL/' to sysDescr_regex * Update zynos.inc.php * Update zynos.inc.php * Update zynos_xgs4600.json * Update zynos_xgs4600.snmprec * Re-Generated Zynos.json * Fixed ifOperStatus in Zynos.json * Delete zynos.inc.php * Update ports.inc.php * Added new test data * Updated zyxel test data and discovery * Update ports.inc.php * Update zynos.snmprec * Updated zynos.json * Update Zynos.json * Fix StyleCI issues * Update zynos.json * Update zynos.json * Update zynos.json * Updated zynos mgs3712.json * Update zynos_mgs3712.json * Added back old SFP discovery -SFP Temperature -SFP Voltage
44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
<?php
|
|
/*
|
|
* 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. Please see LICENSE.txt at the top level of
|
|
* the source code distribution for details.
|
|
* @author LukeKelsall <[email protected]>
|
|
*/
|
|
|
|
//loop through ports
|
|
foreach ($port_stats as $index => $port) {
|
|
//Logically convert swp ports to human readable
|
|
//only convert swp ports
|
|
if (substr($port['ifName'], 0, 3) === 'swp') {
|
|
$portNum = preg_replace('/[a-z]+/', '', $port['ifName']);
|
|
if ($portNum < 50) {
|
|
$portNum++;
|
|
//Leading 0 for single digits
|
|
$ifName = '1/' . zeropad($portNum);
|
|
}
|
|
if ($portNum > 63 && $portNum < 128) {
|
|
$portNum = $portNum - 63;
|
|
//Leading 0 for single digits
|
|
$ifName = '2/' . zeropad($portNum);
|
|
}
|
|
if ($portNum > 127 && $portNum < 192) {
|
|
$portNum = $portNum - 127;
|
|
//Leading 0 for single digits
|
|
$ifName = '3/' . zeropad($portNum);
|
|
}
|
|
if ($portNum > 191) {
|
|
$portNum = $portNum - 191;
|
|
//Leading 0 for single digits
|
|
$ifName = '4/' . zeropad($portNum);
|
|
}
|
|
} else {
|
|
//Set port number to match current
|
|
$ifName = $port['ifName'];
|
|
}
|
|
//set the libre ifName value to new port name
|
|
$port_stats[$index]['ifName'] = $ifName;
|
|
}
|