fix: Comware dBm Limits && Comware Sensor Descr (#7216)

This commit is contained in:
Søren Rosiak
2017-08-24 22:08:42 +02:00
committed by Tony Murray
parent e0d3083791
commit 701813f3ad
5 changed files with 38 additions and 37 deletions

View File

@@ -16,7 +16,7 @@ $multiplier = 1;
$divisor = 100000;
$divisor_alarm = 1000000;
foreach ($pre_cache['comware_oids'] as $index => $entry) {
if (is_numeric($entry['hh3cTransceiverBiasCurrent']) && $entry['hh3cTransceiverBiasCurrent'] != 2147483647) {
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'", array(
$index,
@@ -30,7 +30,7 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = $dbresult['ifDescr'] . ' Bias Current';
$descr = makeshortif($dbresult['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);
}
}

View File

@@ -15,40 +15,40 @@ echo 'Comware ';
$multiplier = 1;
$divisor = 100;
foreach ($pre_cache['comware_oids'] as $index => $entry) {
if (is_numeric($entry['hh3cTransceiverCurRXPower']) && $entry['hh3cTransceiverCurRXPower'] != 2147483647) {
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'", array(
$index,
$device['device_id']
));
$limit_low = uw_to_dbm($entry['hh3cTransceiverRcvPwrLoAlarm'] / 10);
$warn_limit_low = uw_to_dbm($entry['hh3cTransceiverRcvPwrLoWarn'] / 10);
$limit = uw_to_dbm($entry['hh3cTransceiverRcvPwrHiAlarm'] / 10);
$warn_limit = uw_to_dbm($entry['hh3cTransceiverRcvPwrHiWarn'] / 10);
$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);
$warn_limit = round(uw_to_dbm($entry['hh3cTransceiverRcvPwrHiWarn'] / 10), 2);
$current = $entry['hh3cTransceiverCurRXPower'] / $divisor;
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = $dbresult['ifDescr'] . ' Rx Power';
$descr = makeshortif($dbresult['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) {
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'", array(
$index,
$device['device_id']
));
$limit_low = uw_to_dbm($entry['hh3cTransceiverPwrOutLoAlarm'] / 10);
$warn_limit_low = uw_to_dbm($entry['hh3cTransceiverPwrOutLoWarn'] / 10);
$limit = uw_to_dbm($entry['hh3cTransceiverPwrOutHiAlarm'] / 10);
$warn_limit = uw_to_dbm($entry['hh3cTransceiverPwrOutHiWarn'] / 10);
$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);
$warn_limit = round(uw_to_dbm($entry['hh3cTransceiverPwrOutHiWarn'] / 10), 2);
$current = $entry['hh3cTransceiverCurTXPower'] / $divisor;
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = $dbresult['ifDescr'] . ' Tx Power';
$descr = makeshortif($dbresult['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);
}
}

View File

@@ -48,7 +48,7 @@ $multiplier = 1;
$divisor = 1;
$divisor_alarm = 1000;
foreach ($pre_cache['comware_oids'] as $index => $entry) {
if (is_numeric($entry['hh3cTransceiverTemperature']) && $entry['hh3cTransceiverTemperature'] != 2147483647) {
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'", array($index,$device['device_id']));
$limit_low = $entry['hh3cTransceiverTempLoAlarm'] / $divisor_alarm;
@@ -59,7 +59,7 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = $dbresult['ifDescr'] . ' Temperature';
$descr = makeshortif($dbresult['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);
}
}

View File

@@ -16,7 +16,7 @@ $multiplier = 1;
$divisor = 100;
$divisor_alarm = 10000;
foreach ($pre_cache['comware_oids'] as $index => $entry) {
if (is_numeric($entry['hh3cTransceiverVoltage']) && $entry['hh3cTransceiverVoltage'] != 2147483647) {
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'", array(
$index,
@@ -30,7 +30,7 @@ foreach ($pre_cache['comware_oids'] as $index => $entry) {
$entPhysicalIndex = $index;
$entPhysicalIndex_measured = 'ports';
foreach ($dbquery as $dbindex => $dbresult) {
$descr = $dbresult['ifDescr'] . ' Voltage';
$descr = makeshortif($dbresult['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);
}
}

View File

@@ -167,6 +167,7 @@ function makeshortif($if)
{
$rewrite_shortif = array(
'tengigabitethernet' => 'Te',
'ten-gigabitethernet' => 'Te',
'tengige' => 'Te',
'gigabitethernet' => 'Gi',
'fastethernet' => 'Fa',