Skip to content
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 basic support for MRV OptiDriver Optical Transport Platform #6656

Merged
merged 5 commits into from
May 18, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions includes/definitions/mrv-optidriver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
os: mrv-optidriver
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the best os name?

group: mrv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this? It's designed to bring a number of OS' together so polling can be done centrally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is removed, add:

mib_dir:
    - mrv

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laf I based that off of the pre-existing ./includes/definitions/mrvld.yaml, which denotes the mrv group. MRV has a larger suite of devices than just OptiDriver (OptiPacket, OptiSwitch), so I would guess that they could have definition OS types.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only needed if they share the same code which they don't appear to.

text: 'MRV OptiDriver'
type: network
icon: mrv
discovery:
- sysObjectId:
- .1.3.6.1.4.1.629.200.1.1.1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to change this to .1.3.6.1.4.1.629.200.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 1.1.1 is what's showing in the full snmpget of sysObjectID.

.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.629.200.1.1.1
SNMPv2-MIB::sysObjectID.0 = OID: NBS-CMMC-MIB::nbsCmmcObjects.1.1

Still want it shorted?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at our stats, nothing else uses it so yes it should be ok to be shortened.

- sysDescr:
- 'OD-NM OD'
68 changes: 68 additions & 0 deletions includes/discovery/sensors/dbm/mrv-optidriver.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

/*
* LibreNMS Interface Power dBm module for the MRV® OptiDriver® Optical Transport Platform
*
* © 2017 Chris A. Evans <thecityofguanyu@outlook.com>
*
* 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.
*/

echo 'MRV OptiDriver ';

$multiplier = 1;
$divisor = 1000;
$limit_low = -100;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these limits sane?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiplier and divisor are right, but those limits are definitely not sane. I'll see if I can find some documentation to set those accordingly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set them to null and we will calculate some values.

$warn_limit_low = -100;
$limit = 100;
$warn_limit = 100;

foreach ($pre_cache['mrv-optidriver_oids'] as $index => $entry) {
$oid = '.1.3.6.1.4.1.629.200.8.1.1.32.' . $index;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifName`= ? AND `device_id` = ?', array($index, $device['device_id'])) . ' Rx Power';
$currentrx = $entry['nbsCmmcPortRxPower'];
discover_sensor(
$valid['sensor'],
'dbm',
$device,
$oid,
'rx-' . $index,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to do 'nbsCmmcPortRxPower.'.$index,

'mrv-optidriver',
$descr,
$divisor,
$multiplier,
$limit_low,
$warn_limit_low,
$warn_limit,
$limit,
$currentrx,
'snmp'
);
}

foreach ($pre_cache['mrv-optidriver_oids'] as $index => $entry) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're already looping through this array above, you can probably do an if / elseif check to decide which value you want and consolidate the code down a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a similar existing file using an if / elif in this manner that I could reference? I'm struggle to figure out what the conditional would be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (is_numeric($entry['nbsCmmcPortRxPower']) { and if (is_numeric($entry['nbsCmmcPortTxPower']) { is what I have come up with thus far.

$oid = '.1.3.6.1.4.1.629.200.8.1.1.31.' . $index;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifName`= ? AND `device_id` = ?', array($index, $device['device_id'])) . ' Tx Power';
$currenttx = $entry['nbsCmmcPortTxPower'];
discover_sensor(
$valid['sensor'],
'dbm',
$device,
$oid,
'tx-' . $index,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to do 'nbsCmmcPortTxPower.'.$index,

'mrv-optidriver',
$descr,
$divisor,
$multiplier,
$limit_low,
$warn_limit_low,
$warn_limit,
$limit,
$currenttx,
'snmp'
);
}
16 changes: 16 additions & 0 deletions includes/discovery/sensors/pre-cache/mrv-optidriver.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/*
* LibreNMS Sensor pre-cache module for the MRV® OptiDriver® Optical Transport Platform
*
* © 2017 Chris A. Evans <thecityofguanyu@outlook.com>
*
* 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.
*/

echo 'nbsCmmcPortTable ';
$pre_cache['mrv-optidriver_oids'] = snmpwalk_cache_multi_oid($device, 'nbsCmmcPortTable', array(), 'NBS-CMMC-MIB');
Loading