diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-plugins/bartlby_check_http.c bartlby-plugins/bartlby_check_http.c --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-plugins/bartlby_check_http.c 2007-01-05 02:49:10.000000000 +0100 +++ bartlby-plugins/bartlby_check_http.c 2007-03-27 17:42:06.000000000 +0200 @@ -200,6 +200,7 @@ char * client_request; char server_return[1024]; + char fin_server_return[1024000]; struct sockaddr_in remote; struct sigaction act1, oact1; @@ -297,13 +298,10 @@ alarm(timeout); while ((b_rtc = read(c_sock, server_return, 1024))) { //printf("%d: %s\n", b_rtc, server_return); - server_return[b_rtc-1]='\0'; - if(do_regex) { - if(my_regMatch(server_return, regex) == 0) reg_matched++; - } - - sscanf(server_return, "HTTP/1.1 %d\r\n", &HTTP_code); + server_return[b_rtc]='\0'; + strcat(fin_server_return, server_return); + if(b_rtc == -1) break; //printf("%d, %s", get_request, server_return); recieved_bytes += b_rtc; @@ -321,7 +319,10 @@ close(c_sock); - + if(do_regex) { + if(my_regMatch(fin_server_return, regex) == 0) reg_matched++; + } + gettimeofday(&tv_end, NULL); diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-plugins/bartlby_check_ilog bartlby-plugins/bartlby_check_ilog --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-plugins/bartlby_check_ilog 1970-01-01 01:00:00.000000000 +0100 +++ bartlby-plugins/bartlby_check_ilog 2007-01-15 20:06:04.000000000 +0100 @@ -0,0 +1,87 @@ +#!/bin/bash + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin + +PROGNAME=`basename $0` +PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` +REVISION=`echo '$Revision: 1.1 $' | sed -e 's/[^0-9.]//g'` + + + +print_usage() { + echo -e "Check logfile" + echo -e "* Checks LOGFILE if given pattern is found" + echo "---------------------Usage-----------------------------------------------" + echo "-F LogFile Def: /var/log/messages" + echo "-P Pattern to find (AWK LIKE REGEX)" + echo "-w WARN if X entries found Def:1" + echo "-c CRITICAL if X Entries found Def:2" + echo "-h Show This Help" + echo "-------------------------------------------------------------------------" + +} + + + +#Defs: +CRIT=2; +WARN=1; +FL=/var/log/messages +PATTERN="alex" + +while getopts F:P:w:c:h o +do + case $o in + F) FL=$OPTARG;; + P) PATTERN=$OPTARG;; + w) WARN=$OPTARG;; + c) CRIT=$OPTARG;; + h) print_usage; exit $STATE_UNKOWN;; + + esac + + +done +#### + + +UTMP=/var/tmp/bartlby_`hostname`_`echo $FL|tr -s "/" "_"`.tmp +if [ -e "$UTMP" ] +then + t=`cat $UTMP`; + NM=`echo $t|tr -d [:blank:]`; +else + echo 1 > $UTMP; + NM=1; +fi; + + +STR="cat $FL|sed '1, $NM d'|awk '{if (\$0 ~ /$PATTERN/) {print}}'" +FOUND=`eval $STR|wc -l|tr -d [:blank:]`; + +#################################### +# +# Update last Line FILE UTMP +#################################### +cat $FL|wc -l > $UTMP + +##################################### +# ok +# lets do critical warn check :) +#################################### +if [ $FOUND -ge $CRIT ] +then + echo "CheckILog($FL/$PATTERN $NM-EOF)[critical] found $FOUND CRIT: $CRIT"; + exit $STATE_CRITICAL; +fi; + +if [ $FOUND -ge $WARN ] +then + echo "CheckILog($FL/$PATTERN Range: $NM-EOF)[warning] found $FOUND WARN: $CRIT"; + exit $STATE_WARNING; +fi; + + echo "CheckILog($FL/$PATTERN range: $NM-EOF)[Ok] found $FOUND"; + exit $STATE_OK; + + diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-plugins/Makefile bartlby-plugins/Makefile --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-plugins/Makefile 2006-10-08 01:46:59.000000000 +0200 +++ bartlby-plugins/Makefile 2007-01-27 00:20:20.000000000 +0100 @@ -34,6 +34,7 @@ $(CPPVA) -m 777 bartlby.funcs $(BARTLBY_HOME)/; $(CPPVA) -m 777 bartlby_tcp $(BARTLBY_HOME)/; + $(CPPVA) -m 777 bartlby_check_ilog $(BARTLBY_HOME)/; $(CPPVA) -m 777 bartlby_load $(BARTLBY_HOME)/; $(CPPVA) -m 777 bartlby_http $(BARTLBY_HOME)/; $(CPPVA) -m 777 bartlby_disk.sh $(BARTLBY_HOME)/;