LoginSignup
7
6

More than 5 years have passed since last update.

watchdogでサーバーを自動で再起動させよう

Last updated at Posted at 2014-01-27

監視項目に異常があればOSを再起動させる仕組み。Macには無い。

監視可能な項目

  • ping
  • load average
  • memory usage
  • 温度
  • pid

PIDの監視方法

/etc/watchdog.conf
-#pidfile         = /var/run/syslogd.pid   
+pidfile         = /var/run/rsyslogd.pid
設定反映
$ sudo /etc/init.d/watchdog restart
動作テスト
$ sudo /etc/init.d/rsyslog stop

OSが再起動することを確認。

watchdogによる再起動通知先

/etc/watchdog.conf
-#admin         = root
+admin         = hoge@fuga.com
watchdogからのメール例
Message from watchdog:
The system will be rebooted because of error 2!

watchdog because of error 2でググルと、error noが何を意味するかを教えてくれる。

ネットワークが応答なくなった時、再起動する設定

/etc/watchdog.conf
-#ping                   = 172.31.14.1
+ping                    = 192.168.12.1

間違ってifdownした時やOSがハングアップした時(こちらは確認中)再起動してくれます。

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6