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
3 files changed