#!/bin/sh # #NADDS Agent - http://nadds.drmadcow.net/ #Network Card Interface Report #Agent Author: Daryl Quenet #Date: 2003-May-21 (V1.0) . /usr/local/bcnu/etc/bcnuenv . $BCNUHOME/agent/agent_head OUTFILE=$BCNUTMP/${BCNUAGENT}.out TMPFILE=$BCNUTMP/${BCNUAGENT}.tmp rm -f $OUTFILE $TMPFILE 2>/dev/null ERR="" MSG="" ERRMSG="" printf "Network Interface Connectivity Report:\n" >$OUTFILE for param in $BCNUPARAM do bcnu_param INT="$p1" MEDIATYPE=$p2 /sbin/mii-tool -v $INT >$TMPFILE printf "\n" >>$OUTFILE cat $TMPFILE >>$OUTFILE STATUS=`grep $INT $TMPFILE` LINKTYPE=`echo $STATUS|awk 'NF==5{print $3} NF!=5{print "Link Error"}'|sed s/,//` if [ $LINKTYPE != $MEDIATYPE ]; then ERRMSG="error - $INT running at $LINKTYPE" ERR=1 else MSG="ok - $INT running at $LINKTYPE" fi done if [ $ERR ]; then BCNUMSG="$BCNU -m '$ERRMSG' -f $OUTFILE -e $BCNU_ERR -t $BCNUHOSTTYPE $BCNUHOST" bcnu_err_send else BCNUMSG="$BCNU -m '$MSG' -f $OUTFILE -e $BCNU_OK -t $BCNUHOSTTYPE $BCNUHOST" bcnu_send fi