====== WatchDog Timer による監視 ======
MA-E3xx シリーズでは、Hardware Watchdog Timer driver を組み込んでいます。\\
watchdog パッケージにより、簡単な設定で Watchdog Timer を利用することができます。
root@plum:~# dpkg -l watchdog|cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================================-================================-============-=============================================================
ii watchdog 5.13-1 armhf system health checker and software/hardware watchdog handler
\\
===== 設定 =====
==== 有効化 ====
=== daemon 起動の設定 ===
有効化するために、/etc/default/watchdog ファイルを編集します。
root@plum:~# nano -w /etc/default/watchdog
# Start watchdog at boot time? 0 or 1
run_watchdog=1
# Load module before starting watchdog
watchdog_module="none"
# Specify additional watchdog options here (see manpage).
run_watchdog を 1 にします。
\\
=== 設定ファイルの編集 ===
/etc/watchdog.conf を編集します。
#ping = 172.31.14.1
#ping = 172.26.1.255
#interface = eth0
#file = /var/log/messages
#change = 1407
# Uncomment to enable test. Setting one of these values to '0' disables it.
# These values will hopefully never reboot your machine during normal use
# (if your machine is really hung, the loadavg will go much higher than 25)
#max-load-1 = 24
#max-load-5 = 18
#max-load-15 = 12
# Note that this is the number of pages!
# To get the real size, check how large the pagesize is on your machine.
#min-memory = 1
#repair-binary = /usr/sbin/repair
#repair-timeout =
#test-binary =
#test-timeout =
watchdog-device = /dev/watchdog
# Defaults compiled into the binary
#temperature-device =
#max-temperature = 120
# Defaults compiled into the binary
#admin = root
#interval = 1
#logtick = 1
#log-dir = /var/log/watchdog
# This greatly decreases the chance that watchdog won't be scheduled before
# your machine is really loaded
realtime = yes
priority = 1
# Check if rsyslogd is still running by enabling the following line
#pidfile = /var/run/rsyslogd.pid
\\
変更点
root@plum:~# diff -u /ro/etc/watchdog.conf /etc/watchdog.conf
--- /ro/etc/watchdog.conf 2013-02-01 20:15:44.000000000 +0900
+++ /etc/watchdog.conf 2017-07-12 16:48:04.731702357 +0900
@@ -20,7 +20,7 @@
#test-binary =
#test-timeout =
-#watchdog-device = /dev/watchdog
+watchdog-device = /dev/watchdog
# Defaults compiled into the binary
#temperature-device =
\\
==== 自動起動設定 ====
MA-E3xx の起動時に自動で実行するように設定します。
root@plum:~# update-rc.d watchdog enable
update-rc.d: warning: start runlevel arguments (none) do not match watchdog Default-Start values (2 3 4 5)
update-rc.d: warning: stop runlevel arguments (none) do not match watchdog Default-Stop values (0 1 6)
Enabling system startup links for /etc/init.d/watchdog ...
Removing any system startup links for /etc/init.d/watchdog ...
/etc/rc0.d/K11watchdog
/etc/rc1.d/K11watchdog
/etc/rc2.d/S89watchdog
/etc/rc3.d/S89watchdog
/etc/rc4.d/S89watchdog
/etc/rc5.d/S89watchdog
/etc/rc6.d/K11watchdog
Adding system startup for /etc/init.d/watchdog ...
/etc/rc0.d/K11watchdog -> ../init.d/watchdog
/etc/rc1.d/K11watchdog -> ../init.d/watchdog
/etc/rc6.d/K11watchdog -> ../init.d/watchdog
/etc/rc2.d/S89watchdog -> ../init.d/watchdog
/etc/rc3.d/S89watchdog -> ../init.d/watchdog
/etc/rc4.d/S89watchdog -> ../init.d/watchdog
/etc/rc5.d/S89watchdog -> ../init.d/watchdog
root@plum:~#
root@plum:~# ls /etc/rc2.d/
K59apcupsd S09wd_keepalive S20ddclient S20redis-server S70dns-clean S89watchdog
K80hostapd S15dnsmasq S20firewalld S20smstools S70pppd-dns S99rc.local
README S19cpufrequtils S20nginx S23ntp S75sudo
root@plum:~#
S89watchdog の symbolic link が作られていることが確認できます。
\\
==== (手動での)起動 ====
起動させてみます。
root@plum:~# /etc/init.d/watchdog start
* Stopping watchdog keepalive daemon... [ OK ]
* Starting watchdog daemon... [ OK ]
root@plum:~#
syslog に下記のように出力され、watchdog daemon が起動したことが確認できます。
Jul 20 11:26:57 plum watchdog[11594]: stopping daemon (5.13)
Jul 20 11:27:02 plum wd_keepalive[11750]: starting watchdog keepalive daemon (5.13):
Jul 20 11:27:02 plum wd_keepalive[11750]: int=10 alive=/dev/watchdog realtime=yes
Jul 20 11:27:02 plum wd_keepalive[11750]: hardware watchdog identity: OMAP Watchdog