mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
check-health: use $SendNotification2
This commit is contained in:
parent
71976f2eb9
commit
bf315c15f6
1 changed files with 14 additions and 14 deletions
28
check-health
28
check-health
|
@ -18,7 +18,7 @@
|
||||||
:global Identity;
|
:global Identity;
|
||||||
|
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
:global SendNotification;
|
:global SendNotification2;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
|
|
||||||
:local FormatVoltage do={
|
:local FormatVoltage do={
|
||||||
|
@ -42,10 +42,10 @@
|
||||||
[ :typeof $Voltage ] = "num") do={
|
[ :typeof $Voltage ] = "num") do={
|
||||||
:if ($CheckHealthLast->$Name * (100 + $CheckHealthVoltagePercent) < $Voltage * 100 || \
|
:if ($CheckHealthLast->$Name * (100 + $CheckHealthVoltagePercent) < $Voltage * 100 || \
|
||||||
$CheckHealthLast->$Name * 100 > $Voltage * (100 + $CheckHealthVoltagePercent)) do={
|
$CheckHealthLast->$Name * 100 > $Voltage * (100 + $CheckHealthVoltagePercent)) do={
|
||||||
$SendNotification ([ $SymbolForNotification "high-voltage-sign" ] . "Health warning: " . $Name) \
|
$SendNotification2 ({ subject=([ $SymbolForNotification "high-voltage-sign" ] . "Health warning: " . $Name); \
|
||||||
("The " . $Name . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \
|
message=("The " . $Name . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \
|
||||||
"old value: " . [ $FormatVoltage ($CheckHealthLast->$Name) ] . "\n" . \
|
"old value: " . [ $FormatVoltage ($CheckHealthLast->$Name) ] . "\n" . \
|
||||||
"new value: " . [ $FormatVoltage $Voltage ]);
|
"new value: " . [ $FormatVoltage $Voltage ]) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,13 +56,13 @@
|
||||||
[ :typeof $PSU ] = "str") do={
|
[ :typeof $PSU ] = "str") do={
|
||||||
:if ($CheckHealthLast->$Name = "ok" && \
|
:if ($CheckHealthLast->$Name = "ok" && \
|
||||||
$PSU != "ok") do={
|
$PSU != "ok") do={
|
||||||
$SendNotification ([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name) \
|
$SendNotification2 ({ subject=([ $SymbolForNotification "cross-mark" ] . "Health warning: " . $Name); \
|
||||||
("The power supply unit '" . $Name . "' on " . $Identity . " failed!");
|
message=("The power supply unit '" . $Name . "' on " . $Identity . " failed!") });
|
||||||
}
|
}
|
||||||
:if ($CheckHealthLast->$Name != "ok" && \
|
:if ($CheckHealthLast->$Name != "ok" && \
|
||||||
$PSU = "ok") do={
|
$PSU = "ok") do={
|
||||||
$SendNotification ([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name) \
|
$SendNotification2 ({ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
|
||||||
("The power supply unit '" . $Name . "' on " . $Identity . " recovered!");
|
message=("The power supply unit '" . $Name . "' on " . $Identity . " recovered!") });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,16 +81,16 @@
|
||||||
}
|
}
|
||||||
:if ($Temperature > $CheckHealthTemperature->$Name && \
|
:if ($Temperature > $CheckHealthTemperature->$Name && \
|
||||||
$CheckHealthTemperatureNotified->$Name != true) do={
|
$CheckHealthTemperatureNotified->$Name != true) do={
|
||||||
$SendNotification ([ $SymbolForNotification "fire" ] . "Health warning: " . $Name) \
|
$SendNotification2 ({ subject=([ $SymbolForNotification "fire" ] . "Health warning: " . $Name); \
|
||||||
("The " . $Name . " on " . $Identity . " is above threshold: " . \
|
message=("The " . $Name . " on " . $Identity . " is above threshold: " . \
|
||||||
$Temperature . "\C2\B0" . "C");
|
$Temperature . "\C2\B0" . "C") });
|
||||||
:set ($CheckHealthTemperatureNotified->$Name) true;
|
:set ($CheckHealthTemperatureNotified->$Name) true;
|
||||||
}
|
}
|
||||||
:if ($Temperature <= ($CheckHealthTemperature->$Name - $CheckHealthTemperatureDeviation) && \
|
:if ($Temperature <= ($CheckHealthTemperature->$Name - $CheckHealthTemperatureDeviation) && \
|
||||||
$CheckHealthTemperatureNotified->$Name = true) do={
|
$CheckHealthTemperatureNotified->$Name = true) do={
|
||||||
$SendNotification ([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name) \
|
$SendNotification2 ({ subject=([ $SymbolForNotification "white-heavy-check-mark" ] . "Health recovery: " . $Name); \
|
||||||
("The " . $Name . " on " . $Identity . " dropped below threshold: " . \
|
message=("The " . $Name . " on " . $Identity . " dropped below threshold: " . \
|
||||||
$Temperature . "\C2\B0" . "C");
|
$Temperature . "\C2\B0" . "C") });
|
||||||
:set ($CheckHealthTemperatureNotified->$Name) false;
|
:set ($CheckHealthTemperatureNotified->$Name) false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue