Skip to content

Commit

Permalink
Added SNR Sensor to CMTS Arris (librenms#8840)
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
TheGreatDoc authored and mattie47 committed Jul 2, 2018
1 parent 1ad59ae commit 4fc89c5
Show file tree
Hide file tree
Showing 5 changed files with 2,977 additions and 0 deletions.
2 changes: 2 additions & 0 deletions includes/definitions/cmts.yaml
Expand Up @@ -2,6 +2,8 @@ os: cmts
text: 'Arris CMTS'
type: network
icon: arris
mib_dir:
- arris
over:
- { graph: device_bits, text: 'Device Traffic' }
- { graph: device_processor, text: 'CPU Usage' }
Expand Down
34 changes: 34 additions & 0 deletions includes/discovery/sensors/pre-cache/cmts.inc.php
@@ -0,0 +1,34 @@
<?php
/**
* cmts.inc.php
*
* LibreNMS os sensor pre-cache module for Arris CMTS
*
* 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 TheGreatDoc
* @author TheGreatDoc
* Based on Neil Lathwood Cisco EPC files
*/

echo 'ifName ';
$pre_cache['cmts_ifName'] = snmpwalk_cache_oid($device, 'ifName', array(), 'DOCS-IF-MIB');

echo 'ifAlias ';
$pre_cache['cmts_ifAlias'] = snmpwalk_cache_oid($device, 'ifAlias', array(), 'DOCS-IF-MIB');

echo 'docsIfSignalQualityTable ';
$pre_cache['cmts_docsIfSignalQualityTable'] = snmpwalk_cache_oid($device, 'docsIfSignalQualityTable', array(), 'DOCS-IF-MIB');
37 changes: 37 additions & 0 deletions includes/discovery/sensors/snr/cmts.inc.php
@@ -0,0 +1,37 @@
<?php
/**
* cmts.inc.php
*
* LibreNMS snr discovery module for Arris CMTS
*
* 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 TheGreatDoc
* @author TheGreatDoc
* Based on Neil Lathwood Cisco EPC files
*/

foreach ($pre_cache['cmts_docsIfSignalQualityTable'] as $index => $data) {
if (is_numeric($data['docsIfSigQSignalNoise'])) {
$descr = "Channel {$pre_cache['cmts_ifAlias'][$index]['ifAlias']} - {$pre_cache['cmts_ifName'][$index]['ifName']}";
$oid = '.1.3.6.1.2.1.10.127.1.1.4.1.5.' . $index;
$divisor = 10;
$value = $data['docsIfSigQSignalNoise'];
if (preg_match("/.0$/", $pre_cache['cmts_ifName'][$index]['ifName'])) {
discover_sensor($valid['sensor'], 'snr', $device, $oid, 'docsIfSigQSignalNoise.'.$index, 'cmts', $descr, $divisor, '1', null, null, null, null, $value);
}
}
}

0 comments on commit 4fc89c5

Please sign in to comment.