sensor-mon: Start timers and shutdown
When the threshold alarm is tripped, start a timer for the configured
amount of time. If the alarm clears before that time, stop the timer.
If it doesn't, power off the system.
Note that the alarm for the SoftShutdown threshold still does a hard
shutdown. That's because in the family of systems this was written for,
the hypervisor also gets an alert when the threshold trips and is the
one that drives the power off. The shutdown that this code does would
only occur when the hypervisor doesn't shut down first.
This could easily be wrapped in some sort of compile flags where the
default behavior would be to do a soft shutdown, but since at this point
there is no user of that the default will remain the way it is.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I3bc8f82562594dcd61bfcbc471ffe1a2d9451595
diff --git a/configure.ac b/configure.ac
index d89fa3e..ae01878 100644
--- a/configure.ac
+++ b/configure.ac
@@ -233,6 +233,24 @@
AS_IF([test "x$enable_sensor_monitor" == "xyes"], [
+ #Default hard shutdown delay is 23 seconds
+ AC_ARG_VAR(SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS,
+ [Milliseconds to delay the alarm hard shutdown])
+ AS_IF([test "x$SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS" == "x"],
+ [SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS=23000])
+ AC_DEFINE_UNQUOTED([SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS],
+ [$SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS],
+ [Milliseconds to delay the alarm hard shutdown])
+
+ #Default soft shutdown delay is 15 minutes
+ AC_ARG_VAR(SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS,
+ [Milliseconds to delay the alarm soft shutdown])
+ AS_IF([test "x$SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS" == "x"],
+ [SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS=900000])
+ AC_DEFINE_UNQUOTED([SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS],
+ [$SHUTDOWN_ALARM_SOFT_SHUTDOWN_DELAY_MS],
+ [Milliseconds to delay the alarm soft shutdown])
+
AC_CONFIG_FILES([sensor-monitor/Makefile])
])