#!/bin/sh
SHOME="/v/stat"
OPDIR=$SHOME/opreports
CONF=$SHOME/Poll.conf
M=/usr/local/bin/mailx

if [ $# = 1 ]; then
       fname=$1
       date=$1
elif [ $# = 2 ]; then
       date=$1
       fname=$2
else
       fname=`date +%y.%m.%d`
       date=$fname
fi

test -d $OPDIR/ITER || mkdir $OPDIR/ITER
/v/noc/stat/bin/snmpreport-h -a -r -c $CONF $date > $OPDIR/${fname}.html
/v/noc/stat/bin/snmpreport-h -a -r -c $CONF $date 'iter.*' | perl -pe 's/iter4Arelis/ITER-4/g' > $OPDIR/ITER/${fname}.html
/v/noc/stat/bin/snmpreport-h -a -r -c $CONF $date 'honolulu.*' | $M -s "    $fname" vt elin
/v/noc/stat/bin/snmptbl -c $CONF $date | tbl | nroff -me -Tlpr > $OPDIR/${fname}.tab
cat $OPDIR/ITER/${fname}.html | perl -pe 's/<LI>/  - /g; s/<\w*>//g; s/<\/\w*>//g' | /usr/local/bin/mailx -s "   ($OPDIR/${fname}.html)" or@relcom.ru alex

