Server-Erreichbarkeit durch Watchdog u.a.

…oder: Wie verhindere ich, dass ich den Schreibtisch verlassen muss?

Ich habe einen kleinen, alten Linux-Rechner laufen, auf den ich per rsync meine wichtigsten Daten kopiere. Dieser Rechner läuft aber aus Sicherheitsgründen nicht bei mir zu Hause. D.h. ich komme nicht so einfach dran, wenn er mal hängen sollte. Also muss ich alles dransetzen, zu verhindern, dass er – aus welchem Grund auch immer – so hängen bleibt, dass man physisch den Reset-Knopf oder ähnliches drücken müsste.

Folgende Maßnahmen zur automatischen “Remote-Recovery” bei Hängern habe ich gefunden und eingebaut:

Watchdog

/etc/watchdog.conf:

#ping                   = 172.31.14.1
#DSTK geht nicht: ping                  = 8.8.8.8
#DSTK geht nicht: interface             = tun0
file                    = /var/log/syslog
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 syslogd is still running by enabling the following line
#pidfile                = /var/run/syslogd.pid   

Und dann

update-rc.d watchdog enable

Und zur Sicherheit ein cronjob, der regelmäßig was ins Syslog schreibt, damit sich der Watchdog nicht in ruhigen Phasen aufregt:

*/15 * * * *    logger "keep watchdog happy"

Grub

/etc/default/grub:

GRUB_DEFAULT=0
#DSTK commented GRUB_HIDDEN_TIMEOUT=0
#DSTK commented GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#DSTK was: GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

# DSTK 2014-04 added:
GRUB_RECORDFAIL_TIMEOUT=10
...

Und dann

update-grub

Sysctl

/etc/sysctl.conf:

kernel.panic=1800

Außerdem

…hat mich hier schon der remote reset gerettet.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert