New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more Procera interfaces #7422
Changes from 5 commits
202cd8f
c492e3d
5266857
6bc07a3
817edbc
5776e26
8bd869d
3bf34fc
1de9ce7
0a9f4b8
b272a86
f339612
5f0e419
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ processor_stacked: 1 | |
discovery: | ||
- sysObjectId: | ||
- .1.3.6.1.4.1.15397.2 | ||
mib_dir: | ||
- procera |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* procera.inc.php | ||
* | ||
* LibreNMS Procera 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 2017 Paul Heinrichs | ||
* @author Paul Heinrichs <pdheinrichs@gmail.com> | ||
*/ | ||
|
||
$packetlogic_stats = snmpwalk_cache_oid($device, 'netDeviceTable', array(), 'PACKETLOGIC-CHANNEL-MIB'); | ||
$packetlogic_info = snmpwalk_cache_oid($device, 'channelInfoTable', array(), 'PACKETLOGIC-CHANNEL-MIB'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you put both these in the same array it will make things easier for you below. Just send the array from the first walk to the second walk instead of array(). snmpwalk_group() is a newer function, but either is fine here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'd like to see the use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I attempted the snmpwalk_group(), I don't know if the oddly decimal labeled indexes are causing issues but here's what happened, also created some odd loop that created 6 more interfaces 😕 Did I use it wrong? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is odd @pheinrichs can you do that same thing with debug set so I can see the raw snmpwalk output? Also, don't mix them:
You can also try changing the depth value to see if the grouping is wrong. Try 0 and 2 (on both walks). Depth determines the cut off point for what parts to group together. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding the depth at 2 seems to be kind of working but still giving the array a sub array with an index of [.0] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, the snmp engine isn't returning it right. It is returning Maybe I can update the code to handle this as it might be common when walking tables of single values. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #7427 should fix this |
||
|
||
$channelTypes = array( | ||
array( | ||
'type' => 'channelExternal', | ||
'name' => 'External' | ||
), | ||
array( | ||
'type' => 'channelInternal', | ||
'name' => 'Internal' | ||
) | ||
); | ||
|
||
$required = array( | ||
'ifInOctets' => 'RxBytes', | ||
'ifOutOctets' => 'TxBytes', | ||
'ifInUcastPkts' => 'RxPackets', | ||
'ifOutUcastPkts' => 'TxPackets', | ||
'ifInErrors' => 'RxErrors', | ||
'ifOutErrors' => 'TxErrors', | ||
); | ||
|
||
foreach ($packetlogic_stats as $index => $port) { | ||
$procera_port = array(); | ||
foreach ($channelTypes as $cType) { | ||
foreach ($required as $ifEntry => $IfxStat) { | ||
$procera_port[$ifEntry] = $packetlogic_stats[$index][$cType['type'].$IfxStat]; | ||
} | ||
$procera_port['ifName'] = $packetlogic_info[$index]['channelName']. ' '.$cType['name']; | ||
$procera_port['ifDescr'] = $packetlogic_info[$index]['channelName']. ' '.$cType['name']; | ||
$procera_port['ifConnectorPresent'] = ($packetlogic_info[$index]['NegotiatedMedia'] != 'linkdown' ? "true" : "false"); | ||
$procera_port['ifOperStatus'] = ($packetlogic_info[$index]['channelActive'] === 'active' ? "up" : "down"); | ||
$procera_port['ifType'] = 'ethernetCsmacd'; | ||
array_push($port_stats, $procera_port); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will add it to the existing array, are these ports in addition to? If so, do we need anything like speed and things to be registered? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. channelInternalNegotiatedMedia should allow ifSpeed/ifDuplex to be filled in. But yes, please try to fill in as many fields from ifTable as possible. |
||
} | ||
} | ||
|
||
unset($packetlogic_info, $channelTypes, $packetlogic_stats, $procera_port); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MIB dirs matching the OS name are added by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that's convenient. I'll remove it, thanks Murrant.