Files
scripts-conlxsyslog03/bow-report.sh
conetadm 5718e70f15 init
2024-11-14 21:11:06 +01:00

112 lines
3.8 KiB
Bash
Executable File

#!/bin/bash
xyz="bow"
# 2016-03-01
AUSGABEDIR=/var/www/html/$xyz-report/
MAILREC=$1
MANDAT=$2
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 "http://10.101.0.11/graph.php?device=$d&type=$t&id=$i&from=$a&to=$e&width=$w&height=$h"
wget -q -O $d$t.png "http://10.101.0.11/graph.php?device=$d&type=$t&id=$i&from=$a&to=$e&width=$w&height=$h"
else
rm -f $d$t.png
echo "http://10.101.0.11/graph.php?device=$d&type=$t&from=$a&to=$e&width=$w&height=$h"
wget -q -O $d$t.png "http://10.101.0.11/graph.php?device=$d&type=$t&from=$a&to=$e&width=$w&height=$h"
fi
}
function get_pngp {
t=$1; p=$2; a=$START; e=$ENDE; h=$IMGH; w=$IMGW;
rm -f $t$p.png
echo "http://10.101.0.11/graph.php?type=port_bits&to=$e&id=$p&from=$a&height=$h&width=$w"
wget -q -O $t$p.png "http://10.101.0.11/graph.php?type=port_bits&to=$e&id=$p&from=$a&height=$h&width=$w"
}
function get_pngc {
t=$1; p=$2; a=$START; e=$ENDE; h=$IMGH; w=$IMGW;
rm -f $t$p.png
echo "http://10.101.0.11/graph.php?type=processor_usage&to=$e&id=$p&from=$a&height=$h&width=$w"
wget -q -O $t$p.png "http://10.101.0.11/graph.php?type=processor_usage&to=$e&id=$p&from=$a&height=$h&width=$w"
}
function init {
mkdir -p $AUSGABEDIR && pushd $AUSGABEDIR
if [ "$MANDAT" == "" ]
then
ENDE=`date +%s`
MDATE=`date +%Y-%m-%d`
else
ENDE=`date -d "$2" +%s`
MDATE=$MANDAT
fi
MONAT=`expr 60 \* 60 \* 24 \* 31`
START=`expr $ENDE - $MONAT`
IMGW=900
IMGH=`expr $IMGW / 3`
}
function destruct {
popd
}
init;
wget -q -O $AUSGABEDIR/fastlta.png "http://10.101.0.11/graph.php?type=customoid_graph&id=820&to=$ENDE&from=$START&height=$IMGH&width=$IMGW"
echo "http://10.101.0.11/graph.php?type=customoid_graph&id=820&to=$ENDE&from=$START&height=$IMGH&width=$IMGW"
# asa-hosting switch-catalyst-5 conlxscript1
devices="38:1 145:1 366:1"
graphs="device_availability"
# asa-hosting Schnittstellen Bochum Bochum-DMZ
ports=" 10063 10062 "
#
cores="2860"
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 $PORT
done
for CORE in $cores
do
get_pngc core $CORE
done
destruct;
htmldoc -t pdf14 -f "/var/www/tmp/$xyz-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 /var/www/html/$xyz-report.html
for MAIL in $MAILREC
do
echo "TO: $MAIL" > /tmp/$xyz-mailreportfile.tmp
echo "FROM: CONET Services Monitoring Reporter <help@conet.de>" >> /tmp/$xyz-mailreportfile.tmp
echo "SUBJECT: Bochum Monitoring Report $MDATE" >> /tmp/$xyz-mailreportfile.tmp
echo "X-CONET-SRC: root@conlxsyslog03:/scripts/$xyz-report.sh" >> /tmp/$xyz-mailreportfile.tmp
echo "" >> /tmp/$xyz-mailreportfile.tmp
echo "" >> /tmp/$xyz-mailreportfile.tmp
echo "" | mutt -H /tmp/$xyz-mailreportfile.tmp -a /var/www/tmp/$xyz-report_$MDATE.pdf -- $MAIL
rm /tmp/$xyz-mailreportfile.tmp
done