Fix handling of zero value for entSensorThresholdValue for dbm cisco sensor (#16336)

* add handling of zero value for entSensorThresholdValue for dbm sensor type

this addresses https://github.com/librenms/librenms/issues/16335
* Update cisco-entity-sensor.inc.php
* safe check for $key['entSensorThresholdValue']
* style
---------

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
This commit is contained in:
makriska 2024-09-03 21:39:05 +02:00 committed by GitHub
parent f89ed301d7
commit 4efad1ae69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10456 additions and 3 deletions

View File

@ -148,15 +148,15 @@ if ($device['os_group'] == 'cisco') {
if (isset($t_oids[$index]) && is_array($t_oids[$index])) {
foreach ($t_oids[$index] as $t_index => $key) {
// Skip invalid treshold values
if ($key['entSensorThresholdValue'] == '-32768') {
if (! isset($key['entSensorThresholdValue']) || $key['entSensorThresholdValue'] == '-32768') {
continue;
}
// Critical Limit
if (($key['entSensorThresholdSeverity'] == 'major' || $key['entSensorThresholdSeverity'] == 'critical') && ($key['entSensorThresholdValue'] != 0) && ($key['entSensorThresholdRelation'] == 'greaterOrEqual' || $key['entSensorThresholdRelation'] == 'greaterThan')) {
if (($key['entSensorThresholdSeverity'] == 'major' || $key['entSensorThresholdSeverity'] == 'critical') && ($key['entSensorThresholdRelation'] == 'greaterOrEqual' || $key['entSensorThresholdRelation'] == 'greaterThan')) {
$limit = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
}
if (($key['entSensorThresholdSeverity'] == 'major' || $key['entSensorThresholdSeverity'] == 'critical') && ($key['entSensorThresholdValue'] != 0) && ($key['entSensorThresholdRelation'] == 'lessOrEqual' || $key['entSensorThresholdRelation'] == 'lessThan')) {
if (($key['entSensorThresholdSeverity'] == 'major' || $key['entSensorThresholdSeverity'] == 'critical') && ($key['entSensorThresholdRelation'] == 'lessOrEqual' || $key['entSensorThresholdRelation'] == 'lessThan')) {
$limit_low = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff