> looking at the subversion checkout for 1.3.3 i couldnt find anything
> which refers to zabbix_check_server within the source tree. Can you
> give me some pointer? TIA.

funny, it seems I got unofficial debs for 1.3 beta, and script I
mentioned exists in there. It's not present in official sources though... 
More, seems it's customized in a specific
way to fit someone's needs. 
It won't be hard to fix it though. 
Debs was taken from here: http://uit.opf.slu.cz/howto/zabbix. 

WONTFIX then or fix and incorporate? ;)

Script attached anyway. Seems simple.

Best regards, 

-- 
[: Patryk Dawidziuk  ~~~ :]

#!/bin/sh

NAME=zabbix_server
NAME2=server
MYNAME=`basename $0`
PIDFILE=/var/run/zabbix/check_${NAME2}.pid

doalert () {
 if echo "$ADMINEMAIL" | grep "\@"; then
   logger "$MYNAME: $NAME died. VERY BAD.. Mailing potential problems to 
$ADMINEMAIL and exiting.."
   tail -30 /var/log/zabbix/${NAME2}.log |mail -s "$0 died. VERY BAD.. 
zabbix_server on `hostname` is not running. Here is some info." "$ADMINEMAIL"
 else
  if [ -n "$ADMINEMAIL"  ]; then
   logger "$MYNAME: $NAME died. VERY BAD.. Using Gnokii to send sms and 
exiting.."
   echo "$0 died! VERY BAD.. zabbix_server on `hostname` is not running." | 
gnokii --sendsms "$ADMINEMAIL" 
  else 
   logger "$MYNAME died. VERY BAD.. exiting.."
  fi
 fi
}

#echo $$ >$PIDFILE

if [ -z "$1" ] || [ -z "$2" ];  then
  echo -e "\nPreocess to check that $NAME is running."
  echo "It checks that sucker processess ar alive and if not, restart them if 
num_of_tries>0."
  echo "Eventualy it sends email to admin that something is wrong."
  echo -e "$0 num_of_tries sleep_before_tries [email]\n"
  exit 1
fi

if [ -n "$3" ]; then
  ADMINEMAIL="$3";
fi

TRIES=$1
SLEEP=$2

sleep $SLEEP
while [ $TRIES -gt 0 ] ; do
  while pidof $NAME >/dev/null 2>/dev/null; do
    sleep $SLEEP
  done
  logger "$MYNAME: $NAME died. Trying to recover (`expr $TRIES - 1` tries left)"
  /etc/init.d/zabbix-server start$NAME2
  sleep $SLEEP
  TRIES=`expr $TRIES - 1`
done

if [ $1 -eq 0 ]; then
  if pidof $NAME >/dev/null 2>/dev/null; then
    exit
  fi
fi

doalert

rm - $PIDFILE
exit 1

Reply via email to