Cisco sensor discovery fixes (#11077)

* Sev and Rel terminology varies between devices

* Most temp sensors don't have low limits, so adding

* update test data

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
robwilkes 2020-04-24 13:30:27 +10:00 committed by GitHub
parent 3263839780
commit daebf8c765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 603 additions and 8 deletions

View File

@ -133,25 +133,36 @@ if ($device['os_group'] == 'cisco') {
if (is_array($t_oids[$index])) { if (is_array($t_oids[$index])) {
foreach ($t_oids[$index] as $t_index => $key) { foreach ($t_oids[$index] as $t_index => $key) {
// Critical Limit // Critical Limit
if ($key['entSensorThresholdSeverity'] == 'major' && $key['entSensorThresholdRelation'] == 'greaterOrEqual') { if (($key['entSensorThresholdSeverity'] == 'major' || $key['entSensorThresholdSeverity'] == 'critical') && ($key['entSensorThresholdRelation'] == 'greaterOrEqual' || $key['entSensorThresholdRelation'] == 'greaterThan')) {
$limit = ($key['entSensorThresholdValue'] * $multiplier / $divisor); $limit = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
} }
if ($key['entSensorThresholdSeverity'] == 'major' && $key['entSensorThresholdRelation'] == 'lessOrEqual') { if (($key['entSensorThresholdSeverity'] == 'major' || $key['entSensorThresholdSeverity'] == 'critical') && ($key['entSensorThresholdRelation'] == 'lessOrEqual' || $key['entSensorThresholdRelation'] == 'lessThan')) {
$limit_low = ($key['entSensorThresholdValue'] * $multiplier / $divisor); $limit_low = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
} }
// Warning Limit // Warning Limit
if ($key['entSensorThresholdSeverity'] == 'minor' && $key['entSensorThresholdRelation'] == 'greaterOrEqual') { if ($key['entSensorThresholdSeverity'] == 'minor' && ($key['entSensorThresholdRelation'] == 'greaterOrEqual' || $key['entSensorThresholdRelation'] == 'greaterThan')) {
$warn_limit = ($key['entSensorThresholdValue'] * $multiplier / $divisor); $warn_limit = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
} }
if ($key['entSensorThresholdSeverity'] == 'minor' && $key['entSensorThresholdRelation'] == 'lessOrEqual') { if ($key['entSensorThresholdSeverity'] == 'minor' && ($key['entSensorThresholdRelation'] == 'lessOrEqual' || $key['entSensorThresholdRelation'] == 'lessThan')) {
$warn_limit_low = ($key['entSensorThresholdValue'] * $multiplier / $divisor); $warn_limit_low = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
} }
}//end foreach }//end foreach
}//end if }//end if
// If temperature sensor, set low thresholds to -1 and -5. Many sensors don't return low thresholds, therefore LibreNMS takes the runtime low
// Also changing 0 values (not just null) as Libre loses these somewhere along the line and shows an empty value in the Web UI
if ($type == 'temperature') {
if ($warn_limit_low == 0) {
$warn_limit_low = -1;
}
if ($limit_low == 0) {
$limit_low = -5;
}
}
// End Threshold code // End Threshold code
$ok = true; $ok = true;

File diff suppressed because it is too large Load Diff