Drupal + Nagios + FreeBSD

Nachdem ich meine gesamte Infrastruktur sowieso mit Nagios monitore, liegt es natürlich nahe, auch die Drupal Installation in die Überwachung mit einzubeziehen.

Praktischerweise hat sich über dieses Thema schon einmal jemand Gedanken gemacht und ein Drupal-Modul entwickelt, dass alle Vitalfunktionen einer Drupalinstallation überwacht. Das check_drupal Plugin, das zur Abfrage der Daten beiliegt, lief jedoch nicht out of the Box, sondern brauchte noch einen kleinen Patch, damit es unter FreeBSD lief:

--- check_drupal.orig   2009-09-06 15:48:47.869518520 +0200
+++ check_drupal        2009-09-06 15:53:20.422190456 +0200
@@ -1,2 +1,2 @@
-#!/bin/bash
+#!/bin/sh 
 #
@@ -9,8 +9,6 @@
 ECHO="/bin/echo"
-GREP="/bin/egrep"
+GREP="/usr/bin/egrep"
 RM="/bin/rm"
-WGET="/usr/bin/wget"
 
 PROGNAME=`/usr/bin/basename $0`
-PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
 REVISION=`echo '$Revision: 1.1.2.11 $' | sed -e 's/[^0-9.]//g'`
@@ -19,3 +17,3 @@
 
-. $PROGPATH/utils.sh
+. /usr/local/libexec/nagios/utils.sh
 
@@ -111,18 +109,8 @@
 
-CMD="$WGET -S -T $timeout -O - -U $unique_id http://$hostname/$path"
+HTTP_USER_AGENT=$unique_id fetch -T $timeout -o $temp http://$hostname/$path 2>/dev/null
 
-$CMD > $temp 2>&1
 RC=$?
 
-HTTP=`$GREP "HTTP/1" $temp`
-
 if [ "$RC" != 0 ]; then
-  $ECHO "wget error: $RC: when accessing $hostname/$path. HTTP: $HTTP"
-  $RM -f $temp
-  exit $STATE_CRITICAL
-fi
-
-HTTP_CODE=`$ECHO "$HTTP" | awk '{print $2}'`
-if [ "$HTTP_CODE" != "200" ]; then
-  $ECHO "HTTP returned an error code. HTTP: $HTTP"
+  $ECHO "fetch error: $RC: when accessing $hostname/$path. HTTP: $HTTP"
   $RM -f $temp

Kommentare

eVk4dj qhoteybwuxxs,

eVk4dj qhoteybwuxxs, [url=http://okowzhqaltkk.com/]okowzhqaltkk[/url], [link=http://yvwanezbgxfp.com/]yvwanezbgxfp[/link], http://qpdqkvtnqrqi.com/

v47O3z luktmlxstmeu,

v47O3z luktmlxstmeu, [url=http://qzbgqdljqdsm.com/]qzbgqdljqdsm[/url], [link=http://hwcxaraozgmq.com/]hwcxaraozgmq[/link], http://bwemwnprglvw.com/

Kommentar hinzufügen

  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zeilen und Absätze werden automatisch erzeugt.
  • Zulässige HTML-Tags: <em> <strong> <cite> <code> <br> <p> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td>

Weitere Informationen über Formatierungsoptionen