Paul Heinrichs f22e1a6ba6 Improved support for cambium cmm and added cmm4 (#8737)
- Added port discovery for cmm3 (not available for cmm4, not that i could find)
- Added discovery for cmm4
- Added Power port cmm4
- Removed Processor bug by disabling processor on device.

I am unable to test CMM4 and may need someone to do so or review for possible errors.

Fixes Issues #8732, #8731

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
2018-07-07 13:56:54 +01:00

58 lines
2.1 KiB
PHP

<?php
/**
* cmm.inc.php
*
* LibreNMS CMM Ports include
*
* 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 2018 Paul Heinrichs
* @author Paul Heinrichs <pdheinrichs@gmail.com>
*/
$cmm_stats = snmpwalk_group($device, 'cmmSwitchTable', 'CMM3-MIB');
$cmm_stats = snmpwalk_group($device, 'cmmPortTable', 'CMM3-MIB', 1, $cmm_stats);
$required = [
'ifInOctets' => 'rxOctets',
'ifOutOctets' => 'txOctets',
'ifInUcastPkts' => 'rxUnicastPkts',
'ifOutUcastPkts' => 'txUnicastPkts',
'ifInErrors' => 'rxDropPkts',
'ifOutErrors' => 'txDropPkts',
'ifInBroadcastPkts' => 'rxBroadcastPkts',
'ifOutBroadcastPkts' => 'txBroadcastPkts',
'ifInMulticastPkts' => 'rxMulticastPkts',
'ifOutMulticastPkts' => 'txMulticastPkts'
];
$cmm_ports = [];
foreach ($cmm_stats as $index => $port) {
$cmm_port = [];
foreach ($required as $ifEntry => $IfxStat) {
$cmm_port[$ifEntry] = $cmm_stats[$index][$IfxStat];
}
$cmm_port['ifName'] = "CMM Port ". $port['portNumber'];
$cmm_port['ifDescr'] = "CMM Port ". $port['portNumber'];
$cmm_port['ifDuplex'] = ($cmm_stats[$index]['duplexStatus'] == 1 ? 'fullDuplex' : 'halfDuplex');
$cmm_port['ifSpeed'] = ($cmm_stats[$index]['linkSpeed'] == 1 ? '100000000' : '10000000');
$cmm_port['ifOperStatus'] = ($cmm_stats[$index]['linkStatus'] == 1 ? "up" : "down");
$cmm_port['ifType'] = 'ethernetCsmacd';
array_push($cmm_ports, $cmm_port);
}
$port_stats = array_replace_recursive($cmm_ports, $port_stats);