aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-10-14 19:06:21 +0200
committerGravatar Christian Hesse <mail@eworm.de>2019-10-14 19:13:31 +0200
commitf40bb2c8c85adaa1ee84bb693b76a7a7e334f54a (patch)
tree4d27ef162d4705d52d15b4eff0fedb7e1c6783af
parent09ce75c5b10b61bd8fbc15c61895add2ac36f1a8 (diff)
check-health: make threshold for voltage configurablechange-10
-rw-r--r--check-health7
-rw-r--r--global-config6
-rw-r--r--global-config-overlay2
-rw-r--r--global-config.changes1
-rw-r--r--global-functions2
5 files changed, 11 insertions, 7 deletions
diff --git a/check-health b/check-health
index 8cfe47a..3b5c0de 100644
--- a/check-health
+++ b/check-health
@@ -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) ]);
}
diff --git a/global-config b/global-config
index 7a2787a..8089f83 100644
--- a/global-config
+++ b/global-config
@@ -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";
diff --git a/global-config-overlay b/global-config-overlay
index c1971db..871aaa4 100644
--- a/global-config-overlay
+++ b/global-config-overlay
@@ -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.
diff --git a/global-config.changes b/global-config.changes
index 98c8a2c..bd8cac3 100644
--- a/global-config.changes
+++ b/global-config.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";
};
diff --git a/global-functions b/global-functions
index e50c61e..2336961 100644
--- a/global-functions
+++ b/global-functions
@@ -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 "-";