25 changes: 25 additions & 0 deletions includes/discovery/sensors/current/zynos.inc.php
@@ -0,0 +1,25 @@
<?php
$multiplier = 1;
$divisor = 10000;
$divisor_alarm = 10000;
foreach ($pre_cache['zynos_zyxelTransceiverDdmiTable'] as $index => $entry) {
if ( $entry['zyTransceiverDdmiType'] == 3 && is_numeric($entry['zyTransceiverDdmiCurrent']) && $entry['zyTransceiverDdmiCurrent'] != 0) {
$index_actual = substr( $index, 0, 3);
$oid = '.1.3.6.1.4.1.890.1.15.3.84.1.2.1.6.' . $index;
$dbquery = dbFetchRows("SELECT `ifIndex`, `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
$index_actual,
$device['device_id']
));
$limit_low = $entry['zyTransceiverDdmiAlarmMin'] / $divisor_alarm;
$warn_limit_low = $entry['zyTransceiverDdmiWarnMin'] / $divisor_alarm;
$limit = $entry['zyTransceiverDdmiAlarmMax'] / $divisor_alarm;
$warn_limit = $entry['zyTransceiverDdmiWarnMax'] / $divisor_alarm;
$current = $entry['zyTransceiverDdmiCurrent'] / $divisor;
$entPhysicalIndex = $index_actual;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = makeshortif($dbresult['ifIndex']) . ' Port Bias Current';
discover_sensor($valid['sensor'], 'current', $device, $oid, 'zyTransceiverDdmiCurrent.' . $index, 'zynos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}
}
45 changes: 45 additions & 0 deletions includes/discovery/sensors/dbm/zynos.inc.php
@@ -0,0 +1,45 @@
<?php
$multipler = 1;
$divisor = 100;
$divisor_alarm = 100;
foreach ($pre_cache['zynos_zyxelTransceiverDdmiTable'] as $index => $entry) {
if ( $entry['zyTransceiverDdmiType'] == 4 && is_numeric($entry['zyTransceiverDdmiCurrent']) && $entry['zyTransceiverDdmiCurrent'] != 0) {
$index_actual = substr( $index, 0, 3);
$oid = '.1.3.6.1.4.1.890.1.15.3.84.1.2.1.6.' . $index;
$dbquery = dbFetchRows("SELECT `ifIndex`, `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
$index_actual,
$device['device_id']
));
$limit_low = $entry['zyTransceiverDdmiAlarmMin'] / $divisor_alarm;
$warn_limit_low = $entry['zyTransceiverDdmiWarnMin'] / $divisor_alarm;
$limit = $entry['zyTransceiverDdmiAlarmMax'] / $divisor_alarm;
$warn_limit = $entry['zyTransceiverDdmiWarnMax'] / $divisor_alarm;
$current = $entry['zyTransceiverDdmiCurrent'] / $divisor;
$entPhysicalIndex = $index_actual;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = makeshortif($dbresult['ifIndex']) . ' Port Tx Power';
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'zyTransceiverDdmiCurrent.' . $index, 'zynos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}
if ( $entry['zyTransceiverDdmiType'] == 5 && is_numeric($entry['zyTransceiverDdmiCurrent']) && $entry['zyTransceiverDdmiCurrent'] != 0) {
$index_actual = substr( $index, 0, 3);
$oid = '.1.3.6.1.4.1.890.1.15.3.84.1.2.1.6.' . $index;
$dbquery = dbFetchRows("SELECT `ifIndex`, `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
$index_actual,
$device['device_id']
));
$limit_low = $entry['zyTransceiverDdmiAlarmMin'] / $divisor_alarm;
$warn_limit_low = $entry['zyTransceiverDdmiWarnMin'] / $divisor_alarm;
$limit = $entry['zyTransceiverDdmiAlarmMax'] / $divisor_alarm;
$warn_limit = $entry['zyTransceiverDdmiWarnMax'] / $divisor_alarm;
$current = $entry['zyTransceiverDdmiCurrent'] / $divisor;
$entPhysicalIndex = $index_actual;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = makeshortif($dbresult['ifIndex']) . ' Port Rx Power';
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'zyTransceiverDdmiCurrent.' . $index, 'zynos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}
}

26 changes: 26 additions & 0 deletions includes/discovery/sensors/pre-cache/zynos.inc.php
@@ -0,0 +1,26 @@
<?php
/**
* zynos.inc.php
*
* LibreNMS sensors pre-cache discovery module for ZyXEL ZyNOS
*
* 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 2019 Paul Parsons
* @author Paul Parsons <p.parsons@b4rn.org.uk>
*/
echo 'zyxelTransceiverDdmiTable ';
$pre_cache['zynos_zyxelTransceiverDdmiTable'] = snmpwalk_cache_oid($device, 'zyxelTransceiverDdmiTable', array(), 'ZYXEL-TRANSCEIVER-MIB', null, '-OeQUs');
25 changes: 25 additions & 0 deletions includes/discovery/sensors/temperature/zynos.inc.php
@@ -0,0 +1,25 @@
<?php
$multiplier = 1;
$divisor = 100;
$divisor_alarm = 100;
foreach ($pre_cache['zynos_zyxelTransceiverDdmiTable'] as $index => $entry) {
if ( $entry['zyTransceiverDdmiType'] == 1 && is_numeric($entry['zyTransceiverDdmiCurrent']) && $entry['zyTransceiverDdmiCurrent'] != 0) {
$index_actual = substr( $index, 0, 3);
$oid = '.1.3.6.1.4.1.890.1.15.3.84.1.2.1.6.' . $index;
$dbquery = dbFetchRows("SELECT `ifIndex`, `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
$index_actual,
$device['device_id']
));
$limit_low = $entry['zyTransceiverDdmiAlarmMin'] / $divisor_alarm;
$warn_limit_low = $entry['zyTransceiverDdmiWarnMin'] / $divisor_alarm;
$limit = $entry['zyTransceiverDdmiAlarmMax'] / $divisor_alarm;
$warn_limit = $entry['zyTransceiverDdmiWarnMax'] / $divisor_alarm;
$current = $entry['zyTransceiverDdmiCurrent'] / $divisor;
$entPhysicalIndex = $index_actual;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = makeshortif($dbresult['ifIndex']) . ' Port';
discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'zyTransceiverDdmiCurrent.' . $index, 'zynos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}
}
25 changes: 25 additions & 0 deletions includes/discovery/sensors/voltage/zynos.inc.php
@@ -0,0 +1,25 @@
<?php
$multiplier = 1;
$divisor = 100;
$divisor_alarm = 100;
foreach ($pre_cache['zynos_zyxelTransceiverDdmiTable'] as $index => $entry) {
if ( $entry['zyTransceiverDdmiType'] == 2 && is_numeric($entry['zyTransceiverDdmiCurrent']) && $entry['zyTransceiverDdmiCurrent'] != 0) {
$index_actual = substr( $index, 0, 3);
$oid = '.1.3.6.1.4.1.890.1.15.3.84.1.2.1.6.' . $index;
$dbquery = dbFetchRows("SELECT `ifIndex`, `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", array(
$index_actual,
$device['device_id']
));
$limit_low = $entry['zyTransceiverDdmiAlarmMin'] / $divisor_alarm;
$warn_limit_low = $entry['zyTransceiverDdmiWarnMin'] / $divisor_alarm;
$limit = $entry['zyTransceiverDdmiAlarmMax'] / $divisor_alarm;
$warn_limit = $entry['zyTransceiverDdmiWarnMax'] / $divisor_alarm;
$current = $entry['zyTransceiverDdmiCurrent'] / $divisor;
$entPhysicalIndex = $index_actual;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = makeshortif($dbresult['ifIndex']) . ' Voltage';
discover_sensor($valid['sensor'], 'voltage', $device, $oid, 'zyTransceiverDdmiCurrent.' . $index, 'zynos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
}
}
}