mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-01 13:44:26 +02:00
check-health: make threshold for voltage configurable
This commit is contained in:
parent
09ce75c5b1
commit
f40bb2c8c8
5 changed files with 11 additions and 7 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
:global CheckHealthLast;
|
||||
:global CheckHealthTemperature;
|
||||
:global CheckHealthVoltagePercent;
|
||||
:global Identity;
|
||||
|
||||
:global SendNotification;
|
||||
|
@ -20,10 +21,10 @@
|
|||
:foreach Voltage in={ "psu1-voltage"; "psu2-voltage"; "voltage" } do={
|
||||
:if ([ :typeof ($CheckHealthLast->$Voltage) ] = "num" && \
|
||||
[ :typeof ($CheckHealthCurrent->$Voltage) ] = "num") do={
|
||||
:if ($CheckHealthLast->$Voltage * 115 / 100 < $CheckHealthCurrent->$Voltage || \
|
||||
$CheckHealthLast->$Voltage * 100 / 115 > $CheckHealthCurrent->$Voltage) do={
|
||||
:if ($CheckHealthLast->$Voltage * (100 + $CheckHealthVoltagePercent) / 100 < $CheckHealthCurrent->$Voltage || \
|
||||
$CheckHealthLast->$Voltage * 100 / (100 + $CheckHealthVoltagePercent) > $CheckHealthCurrent->$Voltage) do={
|
||||
$SendNotification ("Health warning: " . $Voltage) \
|
||||
("The " . $Voltage . " on " . $Identity . " jumped more than 15%.\n\n" . \
|
||||
("The " . $Voltage . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \
|
||||
"old value: " . [ $FormatVoltage ($CheckHealthLast->$Voltage) ] . "\n" . \
|
||||
"new value: " . [ $FormatVoltage ($CheckHealthCurrent->$Voltage) ]);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
# Make sure all configuration properties are up to date and this
|
||||
# value is in sync with value in script 'global-functions'!
|
||||
:global GlobalConfigVersion 9;
|
||||
:global GlobalConfigVersion 10;
|
||||
|
||||
# This is used for DNS and backup file.
|
||||
:global Domain "example.com";
|
||||
|
@ -44,13 +44,15 @@
|
|||
:global SafeUpdateUrl "";
|
||||
#:global SafeUpdateUrl "https://example.com/ros/safe-update/";
|
||||
|
||||
# These thresholds control when to send notification on temperature.
|
||||
# These thresholds control when to send health notification
|
||||
# on temperature and voltage.
|
||||
:global CheckHealthTemperature {
|
||||
temperature=50;
|
||||
cpu-temperature=70;
|
||||
board-temperature1=50;
|
||||
board-temperature2=50;
|
||||
}
|
||||
:global CheckHealthVoltagePercent 15;
|
||||
|
||||
# This controls what configuration is activated by bridge-port-to-default.
|
||||
:global BridgePortTo "default";
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
# Make sure all configuration properties are up to date and this
|
||||
# value is in sync with value in script 'global-functions'!
|
||||
:global GlobalConfigVersion 9;
|
||||
:global GlobalConfigVersion 10;
|
||||
|
||||
# The global-config script is updated by script-updates,
|
||||
# global-config-overlay becomes an overlay for your changes.
|
||||
|
|
|
@ -12,4 +12,5 @@
|
|||
7="introduced script 'check-health' with new configuration parameters";
|
||||
8="added donation hint and option to silence it";
|
||||
9="introduced configuration overlay 'global-config-overlay'";
|
||||
10="make health threshold for voltage configurable";
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# global functions
|
||||
|
||||
# expected configuration version
|
||||
:global ExpectedConfigVersion 9;
|
||||
:global ExpectedConfigVersion 10;
|
||||
|
||||
# global variables not to be changed by user
|
||||
:global SentConfigChangesNotification "-";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue