#!/bin/ksh # /home/root/bin/nodeevent # set -x PATH=$PATH:/usr/OV/bin:/home/root/bin kusch=`hostname` Qqwe=$1 ndobjid=$2 if [ "$ndobjid" = "blabla" -o "$ndobjid" = "qwe" -o "$ndobjid" = "QWE" ] ; then ndobjid=`ovobjprint -s $3|grep "OBJECT:"|cut -d" " -f2` fi # get_field2 being a little C program, instead of ovobjprint -o plus cut/awk/sed and similar stuff... Qifcount=`get_field2 $ndobjid "TopM Interface Count"` QdfHist=`get_field2 $ndobjid "dfHist"` QCorrStat2=`get_field2 $ndobjid "CorrStat2"` eventnumber=50462720 if [ "$Qifcount" = "1" -a "$Qqwe" != "blabla" -a "$Qqwe" != "qwe" -a "$Qqwe" != "QWE" ] ; then exit 0 fi if [ "$QdfHist" = "ABS" -o "$QCorrStat2" = "WTF" ] ; then exit 0 fi eventhostname=$3 grephosts=$eventhostname if [ "$eventhostname" = "Network" ] ; then grephosts="$4\." ; fi arg4=$4 arg5=$5 arg6=$6 # echo vorshift $* 4=$arg4 5=$arg5 6=$arg6 gh=$grephosts >>/tmp/qwe.nodeevent # shift 3 times, which means arg nr 4 becomes arg no 1 shift shift shift argrest="$*" # echo nachshift $* >>/tmp/qwe.nodeevent # nodeevent qwe blabla HOSTNAME TEXT TEXT TEXT # eventinfo=`grep "$grephosts" /etc/hosts|grep -v "^#"|awk '{print $3, $4}'|sort -b -u -k2,2` if [ "$eventhostname" != "Network" ] ; then eventinfo=`grep "$grephosts" /etc/hosts|grep -vE "^#|BRI0|erial"|awk '{print $1, $3, $4}'|sort -b -r -u -k3,3` else eventinfo=`grep "$grephosts" /etc/hosts|grep -vE "^#|BRI0|erial"|sort -b -u -k2,2|\ awk '{print $2, $4}'|tr "\n" " "` fi QIPStatus=`get_field2 $ndobjid "IP Status"` if [ "$QIPStatus" = "2" ] ; then eventnumber=50462721 # sysuptime just another little script, running every time i get a Node Up event. # it's nothing but snmpget system.sysUpTime.0 and checking if the bugger was rebooted. # i simply don't trust the guys who SNMP-configure our routers and servers /home/root/bin/sysuptime $eventhostname & fi /usr/OV/bin/event -E $eventnumber -h $eventhostname -d"$argrest $eventinfo" >/dev/null # ovxpopup being another crazy script. important events are ovxecho/ovxbeep-ed /home/root/bin/ovxpopup $eventhostname $argrest $eventinfo >/dev/null & esistjetzt=`date` esistjetzt=`echo $esistjetzt|cut -c1-19` quackfile=/tmp/qwe.quack.$RANDOM echo "$esistjetzt $eventhostname $argrest $eventinfo " >$quackfile # more crazy stuff - writeall goes to every telnet-session /home/root/bin/writeall $quackfile rm $quackfile