123 lines
4.3 KiB
Bash
Executable File
123 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# 2016-03-01
|
|
#ENDE_DATUM_MANUELL="2017-10-01"
|
|
|
|
CUSTOMER=customer
|
|
OUTPUTDIR=/var/www/html/$CUSTOMER-report
|
|
TMPDIR=/var/www/tmp
|
|
URL=http://10.101.0.11
|
|
OBS_URL=http://10.101.0.11/
|
|
|
|
#MAILREC="ageissler@conet.de andre@geisslermail.de"
|
|
#MAILREC="ageissler@conet.de"
|
|
MAILREC=$1
|
|
|
|
function get_png {
|
|
d=$1; t=$2; i=$3; a=$START; e=$ENDE; h=$IMGH; w=$IMGW;
|
|
if [[ $t == alert* ]]
|
|
then
|
|
rm -f $d$t.png
|
|
echo "$OBS_URL/graph.php?device=$d&type=$t&id=$i&from=$a&to=$e&$width=$w&height=$h"
|
|
wget -q -O $d$t.png "$OBS_URL/graph.php?device=$d&type=$t&id=$i&from=$a&to=$e&$width=$w&height=$h"
|
|
else
|
|
rm -f $d$t.png
|
|
echo "$OBS_URL/graph.php?device=$d&type=$t&from=$a&to=$e&$width=$w&height=$h"
|
|
wget -q -O $d$t.png "$OBS_URL/graph.php?device=$d&type=$t&from=$a&to=$e&$width=$w&height=$h"
|
|
fi
|
|
}
|
|
|
|
function get_pngp {
|
|
p=$1; s=$2; a=$START; e=$ENDE; h=$IMGH; w=$IMGW;
|
|
rm -f $p.png
|
|
echo "$OBS_URL/graph.php?type=port_bits&to=$e&id=$p&from=$a&height=$h&width=$w&scale=$s"
|
|
wget -q -O $p.png "$OBS_URL/graph.php?type=port_bits&to=$e&id=$p&from=$a&height=$h&width=$w&scale=$s"
|
|
}
|
|
|
|
function init {
|
|
mkdir -p $OUTPUTDIR && pushd $OUTPUTDIR
|
|
ENDE=`date +%s`
|
|
MDATE=`date +%Y-%m-%d`
|
|
|
|
if [ "$ENDE_DATUM_MANUELL" != "" ]
|
|
then
|
|
ENDE=`date -d "$ENDE_DATUM_MANUELL" +%s`
|
|
MDATE=$ENDE_DATUM_MANUELL
|
|
fi
|
|
|
|
MONAT=`expr 60 \* 60 \* 24 \* 31`
|
|
START=`expr $ENDE - $MONAT`
|
|
|
|
IMGW=400
|
|
IMGH=`expr $IMGW / 3`
|
|
}
|
|
|
|
function destruct {
|
|
popd
|
|
}
|
|
|
|
init;
|
|
|
|
# ="deviceid:alert_status_id deviceid:alert_status_id ..."
|
|
#devices="73:718 74:719 176:821 242:12282 78:723 79:724 75:720 76:721 217:5708 218:5738 77:722 238:12184 241:12239 240:12225 239:12211 243:12474 244:12486 251:13523 256:13800";
|
|
#graphs="alert_status device_ucd_ss_cpu device_ucd_memory device_storage device_ucd_load device_diskio processor device_processor device_NETAPP-MIB_cp_ops";
|
|
# sp-1 sp-2
|
|
# Wert hinter dem : ist Nummer des alert_status. Meist nicht benötigt. Daher 1
|
|
# Geräteverfügbarkeit bekommt man per device_availability
|
|
|
|
devices="180:1 181:1 82:1 83:1"
|
|
graphs="alert_status device_availability device_processor device_storage device_ucd_memory device_bits device_la"
|
|
|
|
# sp-1 vl2592 vl2596 vl2599 vl444 sp-2 vl1096 vl1099 vl1092 vl444 nexus1 e1/3 nexus3 e1/3
|
|
ports=" 4928 4846 4847 5681 3769 3770 3768 4854 402 3033"
|
|
|
|
for DEV in $devices
|
|
do
|
|
device=$(echo $DEV | cut -f1 -d:)
|
|
id=$(echo $DEV | cut -f2 -d:)
|
|
for GRAPH in $graphs
|
|
do
|
|
type=$GRAPH
|
|
get_png $device $type $id
|
|
done
|
|
done
|
|
|
|
for PORT in $ports
|
|
do
|
|
get_pngp $PORT auto
|
|
done
|
|
|
|
destruct;
|
|
|
|
htmldoc -t pdf14 -f "$TMPDIR/$CUSTOMER-report_$MDATE.pdf" --book --toclevels 3 --no-numbered \
|
|
--toctitle "Inhaltsverzeichnis" \
|
|
--no-title --linkstyle underline --size A4 \
|
|
--left 0.75in --right 0.50in --top 0.50in --bottom 0.50in \
|
|
--header .t. --header1 ... \
|
|
--footer dt/ --nup 1 \
|
|
--tocheader ... \
|
|
--tocfooter dti \
|
|
--color --no-pscommands --no-xrxcomments --compression=1 --jpeg=90 \
|
|
--fontsize 8.0 --fontspacing 1.2 \
|
|
--headingfont Helvetica --bodyfont Times \
|
|
--headfootsize 8.0 --headfootfont Helvetica \
|
|
--charset iso-8859-1 \
|
|
--links --embedfonts \
|
|
--pagemode outline --pagelayout single --firstpage p1 --pageeffect none --pageduration 10 \
|
|
--effectduration 1.0 \
|
|
--no-encryption \
|
|
--permissions all --owner-password "" --user-password "" \
|
|
--browserwidth 1000 \
|
|
--no-strict --no-overflow $URL/$CUSTOMER-report.html
|
|
|
|
for MAIL in $MAILREC
|
|
do
|
|
echo "TO: $MAIL" > $TMPDIR/$CUSTOMER-mailreportfile.tmp
|
|
echo "FROM: CONET Services Monitoring Reporter <help@conet.de>" >> $TMPDIR/$CUSTOMER-mailreportfile.tmp
|
|
echo "SUBJECT: EUWAX Monitoring Report $MDATE" >> $TMPDIR/$CUSTOMER-mailreportfile.tmp
|
|
echo "" >> $TMPDIR/$CUSTOMER-mailreportfile.tmp
|
|
echo "" >> $TMPDIR/$CUSTOMER-mailreportfile.tmp
|
|
echo "" | mutt -H $TMPDIR/$CUSTOMER-mailreportfile.tmp -a $TMPDIR/$CUSTOMER-report_$MDATE.pdf -- $MAIL
|
|
done
|
|
|