[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Überwachung für Apache?



Dr. Werner Popken wrote:

Gibt es für diesen Fall ein Überwachungsprogramm?

Neben den bereits genannten kann auch heartbeat (Cluster Manager) sowas.
Bei mir sind /var/www und /var/log/apache2 über DRBD auf einen Standby-Rechner in Echzeit gespiegelt, und Heartbeat schaltet im Fehlerfall automatisch auf den anderen Rechner.

Ich rufe jetzt von
einer anderen Maschine jede Minute lynx auf, teste, ob eine
vernünftige Antwort kommt, und löse gegebenenfalls von da aus ein
reboot aus. Das ist aber natürlich aufwendig und primitiv. Ich könnte
mir vorstellen, daß es da etwas Einfacheres und Eleganteres gibt. Weiß
jemand etwas?

Wenn Du in das Resource-Script von heartbeat für Apache2 schaust, macht das ähnliches:

- wget von http://dein.server/server-status

Dazu muss mod_status konfiguriert sein.
mod_status ist genau dafür gedacht.

----snip aus /etc/ha.d/resource.d/apache2----
[...]
# For us to think status will work, we have to have the following things:
#
# - $WGET has to exist and be executable
# - The mod_status module must be loaded
# - The server-status handler has to be mapped to some URL somewhere
#
# We assume that:
#
# - the "main" web server at $PORT will also support it if we can find it
#     somewhere in the file
# - it will be supported at the same URL as the one we find in the file
[...]
monitor_apache() {
  case $HasStatus in
    no) echo "Monitoring not supported by $CONFIGFILE"
        return 1;;
  esac
  if
    silent_status
  then
run sh -c "$WGET $WGETOPTS $STATUSURL | grep -i '</ *body *></ *html *>' >/dev/null"
  else
    echo "$CMD not running"
    return 1
  fi
}

Helmut Wollmersdorfer



Reply to: