mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
[comware] dropped dbfetch from discovery/sensors (#13796)
* [comware] dropped dbfetch from discovery/sensors * ci * DeviceCache::getPrimary * remove unneeded model * Update includes/discovery/sensors/temperature/comware.inc.php Co-authored-by: Jellyfrog <[email protected]> Co-authored-by: Jellyfrog <[email protected]>
This commit is contained in:
co-authored by
Jellyfrog
parent
f7ca687ceb
commit
64b0c3faa3
@@ -8,8 +8,9 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
*
|
||||
* @author Peca Nesovanovic <[email protected]>
|
||||
*/
|
||||
echo 'Comware ';
|
||||
|
||||
$multiplier = 1;
|
||||
@@ -18,10 +19,6 @@ $divisor_alarm = 1000000;
|
||||
foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
if (is_numeric($entry['hh3cTransceiverBiasCurrent']) && $entry['hh3cTransceiverBiasCurrent'] != 2147483647 && isset($entry['hh3cTransceiverDiagnostic'])) {
|
||||
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.17.' . $index;
|
||||
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", [
|
||||
$index,
|
||||
$device['device_id'],
|
||||
]);
|
||||
$limit_low = $entry['hh3cTransceiverBiasLoAlarm'] / $divisor_alarm;
|
||||
$warn_limit_low = $entry['hh3cTransceiverBiasLoWarn'] / $divisor_alarm;
|
||||
$limit = $entry['hh3cTransceiverBiasHiAlarm'] / $divisor_alarm;
|
||||
@@ -29,8 +26,9 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
$current = $entry['hh3cTransceiverBiasCurrent'] / $divisor;
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
foreach ($dbquery as $dbindex => $dbresult) {
|
||||
$descr = makeshortif($dbresult['ifDescr']) . ' Bias Current';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index);
|
||||
if ($interface['ifAdminStatus'] == 'up') {
|
||||
$descr = makeshortif($interface['ifDescr']) . ' Bias Current';
|
||||
discover_sensor($valid['sensor'], 'current', $device, $oid, 'bias-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
*
|
||||
* @author Peca Nesovanovic <[email protected]>
|
||||
*/
|
||||
echo 'Comware ';
|
||||
|
||||
$multiplier = 1;
|
||||
@@ -17,7 +18,6 @@ $divisor = 100;
|
||||
foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
if (is_numeric($entry['hh3cTransceiverCurRXPower']) && $entry['hh3cTransceiverCurRXPower'] != 2147483647 && isset($entry['hh3cTransceiverDiagnostic'])) {
|
||||
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.12.' . $index;
|
||||
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", [$index, $device['device_id']]);
|
||||
$limit_low = round(uw_to_dbm($entry['hh3cTransceiverRcvPwrLoAlarm'] / 10), 2);
|
||||
$warn_limit_low = round(uw_to_dbm($entry['hh3cTransceiverRcvPwrLoWarn'] / 10), 2);
|
||||
$limit = round(uw_to_dbm($entry['hh3cTransceiverRcvPwrHiAlarm'] / 10), 2);
|
||||
@@ -25,15 +25,15 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
$current = $entry['hh3cTransceiverCurRXPower'] / $divisor;
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
foreach ($dbquery as $dbindex => $dbresult) {
|
||||
$descr = makeshortif($dbresult['ifDescr']) . ' Receive Power';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index);
|
||||
if ($interface['ifAdminStatus'] == 'up') {
|
||||
$descr = makeshortif($interface['ifDescr']) . ' Receive Power';
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($entry['hh3cTransceiverCurTXPower']) && $entry['hh3cTransceiverCurTXPower'] != 2147483647 && isset($entry['hh3cTransceiverDiagnostic'])) {
|
||||
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.9.' . $index;
|
||||
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", [$index, $device['device_id']]);
|
||||
$limit_low = round(uw_to_dbm($entry['hh3cTransceiverPwrOutLoAlarm'] / 10), 2);
|
||||
$warn_limit_low = round(uw_to_dbm($entry['hh3cTransceiverPwrOutLoWarn'] / 10), 2);
|
||||
$limit = round(uw_to_dbm($entry['hh3cTransceiverPwrOutHiAlarm'] / 10), 2);
|
||||
@@ -41,8 +41,9 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
$current = $entry['hh3cTransceiverCurTXPower'] / $divisor;
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
foreach ($dbquery as $dbindex => $dbresult) {
|
||||
$descr = makeshortif($dbresult['ifDescr']) . ' Transmit Power';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index);
|
||||
if ($interface['ifAdminStatus'] == 'up') {
|
||||
$descr = makeshortif($interface['ifDescr']) . ' Transmit Power';
|
||||
discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,16 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
*
|
||||
* @author Peca Nesovanovic <[email protected]>
|
||||
*/
|
||||
echo 'Comware ';
|
||||
|
||||
$entphydata = dbFetchRows("SELECT `entPhysicalIndex`, `entPhysicalClass`, `entPhysicalName` FROM `entPhysical` WHERE `device_id` = ? AND `entPhysicalClass` REGEXP 'module|sensor' ORDER BY `entPhysicalIndex`", [$device['device_id']]);
|
||||
$entphydata = DeviceCache::getPrimary()->entityPhysical()
|
||||
->whereIn('entPhysicalClass', ['module', 'sensor'])
|
||||
->orderBy('entPhysicalIndex')
|
||||
->get(['entPhysicalIndex', 'entPhysicalClass', 'entPhysicalName'])
|
||||
->toArray();
|
||||
|
||||
if (! empty($entphydata)) {
|
||||
$tempdata = snmpwalk_cache_multi_oid($device, 'hh3cEntityExtTemperature', [], 'HH3C-ENTITY-EXT-MIB');
|
||||
@@ -55,7 +60,6 @@ $divisor_alarm = 1000;
|
||||
foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
if (is_numeric($entry['hh3cTransceiverTemperature']) && $entry['hh3cTransceiverTemperature'] != 2147483647 && isset($entry['hh3cTransceiverDiagnostic'])) {
|
||||
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.15.' . $index;
|
||||
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", [$index, $device['device_id']]);
|
||||
$limit_low = $entry['hh3cTransceiverTempLoAlarm'] / $divisor_alarm;
|
||||
$warn_limit_low = $entry['hh3cTransceiverTempLoWarn'] / $divisor_alarm;
|
||||
$limit = $entry['hh3cTransceiverTempHiAlarm'] / $divisor_alarm;
|
||||
@@ -63,8 +67,9 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
$current = $entry['hh3cTransceiverTemperature'];
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
foreach ($dbquery as $dbindex => $dbresult) {
|
||||
$descr = makeshortif($dbresult['ifDescr']) . ' Module';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index);
|
||||
if ($interface['ifAdminStatus'] == 'up') {
|
||||
$descr = makeshortif($interface['ifDescr']) . ' Module';
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'temp-trans-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
*
|
||||
* @author Peca Nesovanovic <[email protected]>
|
||||
*/
|
||||
echo 'Comware ';
|
||||
|
||||
$multiplier = 1;
|
||||
@@ -18,7 +19,6 @@ $divisor_alarm = 10000;
|
||||
foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
if (is_numeric($entry['hh3cTransceiverVoltage']) && $entry['hh3cTransceiverVoltage'] != 2147483647 && isset($entry['hh3cTransceiverDiagnostic'])) {
|
||||
$oid = '.1.3.6.1.4.1.25506.2.70.1.1.1.16.' . $index;
|
||||
$dbquery = dbFetchRows("SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ? AND `ifAdminStatus` = 'up'", [$index, $device['device_id']]);
|
||||
$limit_low = $entry['hh3cTransceiverVccLoAlarm'] / $divisor_alarm;
|
||||
$warn_limit_low = $entry['hh3cTransceiverVccLoWarn'] / $divisor_alarm;
|
||||
$limit = $entry['hh3cTransceiverVccHiAlarm'] / $divisor_alarm;
|
||||
@@ -26,8 +26,9 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
|
||||
$current = $entry['hh3cTransceiverVoltage'] / $divisor;
|
||||
$entPhysicalIndex = $index;
|
||||
$entPhysicalIndex_measured = 'ports';
|
||||
foreach ($dbquery as $dbindex => $dbresult) {
|
||||
$descr = makeshortif($dbresult['ifDescr']) . ' Supply Voltage';
|
||||
$interface = get_port_by_index_cache($device['device_id'], $index);
|
||||
if ($interface['ifAdminStatus'] == 'up') {
|
||||
$descr = makeshortif($interface['ifDescr']) . ' Supply Voltage';
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, 'volt-' . $index, 'comware', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user