mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
check-health: support hard lower limit for voltage
... to detect slow decrease of voltage, for example with UPS.
This commit is contained in:
parent
d87c50cf68
commit
2625cc09a5
6 changed files with 19 additions and 4 deletions
12
check-health
12
check-health
|
@ -14,6 +14,7 @@
|
|||
:global CheckHealthTemperature;
|
||||
:global CheckHealthTemperatureDeviation;
|
||||
:global CheckHealthTemperatureNotified;
|
||||
:global CheckHealthVoltageLow;
|
||||
:global CheckHealthVoltagePercent;
|
||||
:global Identity;
|
||||
|
||||
|
@ -52,6 +53,17 @@ $ScriptLock $0;
|
|||
message=("The " . $Name . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \
|
||||
"old value: " . [ $FormatVoltage ($CheckHealthLast->$Name) ] . "\n" . \
|
||||
"new value: " . [ $FormatVoltage $Voltage ]) });
|
||||
} else={
|
||||
:if ($Voltage <= $CheckHealthVoltageLow && $CheckHealthLast->$Name > $CheckHealthVoltageLow) do={
|
||||
$SendNotification2 ({ origin=$0; \
|
||||
subject=([ $SymbolForNotification "high-voltage-sign,chart-decreasing" ] . "Health warning: Low " . $Name); \
|
||||
message=("The " . $Name . " on " . $Identity . " dropped to " . [ $FormatVoltage $Voltage ] . " below hard limit.") });
|
||||
}
|
||||
:if ($Voltage > $CheckHealthVoltageLow && $CheckHealthLast->$Name <= $CheckHealthVoltageLow) do={
|
||||
$SendNotification2 ({ origin=$0; \
|
||||
subject=([ $SymbolForNotification "high-voltage-sign,chart-increasing" ] . "Health recovery: Low " . $Name); \
|
||||
message=("The " . $Name . " on " . $Identity . " recovered to " . [ $FormatVoltage $Voltage ] . " above hard limit.") });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ Description
|
|||
This script is run from scheduler periodically, sending notification on
|
||||
health related events:
|
||||
|
||||
* voltage jumps up or down more than configured threshold
|
||||
* voltage jumps up or down more than configured threshold or drops below limit
|
||||
* power supply failed or recovered
|
||||
* temperature is above or below threshold
|
||||
|
||||
|
@ -53,6 +53,7 @@ Configuration
|
|||
The configuration goes to `global-config-overlay`, these are the parameters:
|
||||
|
||||
* `CheckHealthTemperature`: an array specifying temperature thresholds for sensors
|
||||
* `CheckHealthVoltageLow`: value (in volt*10) giving a hard lower limit
|
||||
* `CheckHealthVoltagePercent`: percentage value to trigger voltage jumps
|
||||
|
||||
Also notification settings are required for e-mail, matrix and/or telegram.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
# Make sure all configuration properties are up to date and this
|
||||
# value is in sync with value in script 'global-functions'!
|
||||
:global GlobalConfigVersion 68;
|
||||
:global GlobalConfigVersion 69;
|
||||
|
||||
# This is used for DNS and backup file.
|
||||
:global Domain "example.com";
|
||||
|
@ -105,6 +105,7 @@
|
|||
}
|
||||
# This is deviation on recovery threshold against notification flooding.
|
||||
:global CheckHealthTemperatureDeviation 2;
|
||||
:global CheckHealthVoltageLow 115;
|
||||
:global CheckHealthVoltagePercent 10;
|
||||
|
||||
# Access-list entries matching this comment are updated
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# Make sure all configuration properties are up to date and this
|
||||
# value is in sync with value in script 'global-functions'!
|
||||
# Comment or remove to disable news and change notifications.
|
||||
:global GlobalConfigVersion 68;
|
||||
:global GlobalConfigVersion 69;
|
||||
|
||||
# Copy configuration from global-config here and modify it.
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
66="Moved script 'bridge-port-to-default' to new module.";
|
||||
67="Moved modules to directory with shorter name.";
|
||||
68="Reintroduced 'global-wait' for functions in scheduler.";
|
||||
69="Support hard lower limit for voltage in 'check-health'.";
|
||||
};
|
||||
|
||||
# Migration steps to be applied on script updates
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# https://git.eworm.de/cgit/routeros-scripts/about/
|
||||
|
||||
# expected configuration version
|
||||
:global ExpectedConfigVersion 68;
|
||||
:global ExpectedConfigVersion 69;
|
||||
|
||||
# global variables not to be changed by user
|
||||
:global GlobalFunctionsReady false;
|
||||
|
|
Loading…
Reference in a new issue