Sensor thresholds

I’m trying to work out if I’m misunderstanding things or if there’s a bug at work.

Have added a large number of cisco devices and almost all of them are alerting regularly on sensors being over or under limit.

None of the sensors values are anywhere near the high or low warning thresholds from the relevant Cisco Entity Mib, but they are exceeding the values show in the Device → Edit → Health page.

e.g.

A sample alert is:

#1: sensor_id => ‘4892’, sensor_oid => ‘.1.3.6.1.4.1.9.9.91.1.1.1.1.4.1338’, sensor_descr => 'Subslot 0/1 Transceiver 0 Tx Power ', sysObjectID => ‘enterprises.9.1.925’, sysDescr => ‘Cisco IOS Software, ASR1000 Software (X86_64_LINUX_IOSD-ADVENTERPRISEK9-M), Version 15.4(3)S6a, RELEASE SOFTWARE (fc2) Technical Support: Support - Cisco Support and Downloads – Documentation, Tools, Cases - Cisco Copyright (c) 1986-2016 by Cisco Systems, Inc. Compiled Tue 27-Sep-16 21:12 by mc’

Relevant capture from discovery.php:

entPhysicalDescr.1338 = subslot 0/1 transceiver 0 Tx Power Sensor
entPhysicalName.1338 = subslot 0/1 transceiver 0 Tx Power Sensor
entPhysicalClass.1338 = sensor
entPhysicalContainedIn.1338 = 1332
entPhysicalParentRelPos.1338 = 4
entSensorType.1338 = dBm
entSensorScale.1338 = units
entSensorValue.1338 = -24
entSensorMeasuredEntity.1338 = 0
entSensorPrecision.1338 = 1
entSensorThresholdSeverity.1338.1 = critical
entSensorThresholdSeverity.1338.2 = minor
entSensorThresholdSeverity.1338.3 = minor
entSensorThresholdSeverity.1338.4 = critical
entSensorThresholdRelation.1338.1 = greaterOrEqual
entSensorThresholdRelation.1338.2 = greaterOrEqual
entSensorThresholdRelation.1338.3 = lessOrEqual
entSensorThresholdRelation.1338.4 = lessOrEqual
entSensorThresholdValue.1338.1 = 20
entSensorThresholdValue.1338.2 = -10
entSensorThresholdValue.1338.3 = -73
entSensorThresholdValue.1338.4 = -103
[1338] => Array
(
[entSensorType] => dBm
[entSensorScale] => units
[entSensorValue] => -24
[entSensorMeasuredEntity] => 0
[entSensorPrecision] => 1
)

I see similar things for other devices and sensors. Every time I get an alert it’s within the entity-mib thresholds, but exceeds either the max or min value set in the device edit health page.

Just documenting my findings so far. Whatever gets passed to the discover_sensor function only has $low_warn_limit and $warn_limit (in the above example the values match the threshold values .2 and .3, -10 and -73 respectively. The $low_limit and $high_limit variables are null.

It then seems wrong to then generate values for $low_limit and $high_limit that are between the actual sensor reading and the warn limits. i.e. $low_limit is higher than $low_warn_limit and $high_limit is lower than $warn_limit.

sigh… obvious now I see it.

entSensorThresholdSeverity.1338.1 = critical
entSensorThresholdSeverity.1338.2 = minor
entSensorThresholdSeverity.1338.3 = minor
entSensorThresholdSeverity.1338.4 = critical

The code in cisco-entity-sensor.inc.php assumes that sensors only have a threshold severity of major or minor, so if the MIB uses a threshold severity of critical it just gets thrown away.

                    // Critical Limit
                    if ($key['entSensorThresholdSeverity'] == 'major' && $key['entSensorThresholdRelation'] == 'greaterOrEqual') {
                        $limit = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
                    }

                    if ($key['entSensorThresholdSeverity'] == 'major' && $key['entSensorThresholdRelation'] == 'lessOrEqual') {
                        $limit_low = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
                    }

                    // Warning Limit
                    if ($key['entSensorThresholdSeverity'] == 'minor' && $key['entSensorThresholdRelation'] == 'greaterOrEqual') {
                        $warn_limit = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
                    }

                    if ($key['entSensorThresholdSeverity'] == 'minor' && $key['entSensorThresholdRelation'] == 'lessOrEqual') {
                        $warn_limit_low = ($key['entSensorThresholdValue'] * $multiplier / $divisor);
                    }

and as I mentioned in my earlier post, in the absence of $limit or $limit_low discover_sensor routine seems to discard the $warn_limit and $warn_limit_low variables in favour of autogenerated numbers that aren’t necessarily appropriate.

I’m not at all familiar with php and don’t really know the best way forward on this, so I’m open to suggestions.

2 Likes

submit any changes here https://github.com/librenms/librenms

Yep, Seeing exactly the same thing. Not sure how to sort this one either.