check-health: guard against temperature spikes

Looks like devices out there suffer sensor issue or bug where
temperature value spikes and drops immediately:

https://forum.mikrotik.com/viewtopic.php?t=111030
https://forum.mikrotik.com/viewtopic.php?t=111109
https://forum.mikrotik.com/viewtopic.php?t=151242

... and possibly more.

Let's ignore these spikes, but at the same time increase the current
value to bring it into line - in case it's real.
This commit is contained in:
Christian Hesse 2020-11-19 21:23:27 +01:00
parent 88f9948c72
commit b97d5308b1

View file

@ -70,6 +70,12 @@
$LogPrintExit info ("No threshold given for " . $Name . ", assuming 50C.") false;
:set ($CheckHealthTemperature->$Name) 50;
}
:if ($Temperature > $CheckHealthLast->$Name + 20) do={
$LogPrintExit info ("The " . $Name . " spikes from " . $CheckHealthLast->$Name . \
"\C2\B0" . "C to " . $Temperature . "\C2\B0" . "C, ignoring.") false;
:set Temperature ($CheckHealthLast->$Name);
:set ($CheckHealthCurrent->$Name) ($CheckHealthLast->$Name + 3);
}
:if ($Temperature > $CheckHealthTemperature->$Name && \
$CheckHealthTemperatureNotified->$Name != true) do={
$SendNotification ([ $SymbolForNotification "fire" ] . "Health warning: " . $Name) \