CHROMIUM: diasydog: count HwWatchdogReboot CRos-events
This is part 2/2 where we look for symptoms of HwWatchdogReboot events
and add them to the CrosEvent histogram.
BUG=chromium:221000
TEST=First, trigger watchdog and verify chrome://histograms updated CrosEvents
Second, confirm daisydog is running after reboot in either case.
(initial version was getting errors in pre-start script)
Change-Id: I88f14a14842f1db5b9e0fe8cb134eb3bb3ea9624
Signed-off-by: Grant Grundler <grundler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46980
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
diff --git a/daisydog.conf b/daisydog.conf
index 5403fb1..86b5bcb 100644
--- a/daisydog.conf
+++ b/daisydog.conf
@@ -5,8 +5,17 @@
description "Simple Watchdog daemon"
author "chromium-os-dev@chromium.org"
-start on starting boot-services
+start on started boot-services
stop on stopping boot-services
respawn
+pre-start script
+ # Depending on kernel output strings is fragile. :/
+ # Could monitor daisydog output instead?
+ # Only better since this conf file is part of daisydog ebuild.
+ if dmesg | fgrep -q 'Watchdog timed out' ; then
+ metrics_client -v HwWatchdogReboot
+ fi
+end script
+
exec nice -n -20 /sbin/minijail0 -u watchdog -g watchdog -- /usr/sbin/daisydog