#!/bin/bash
PrintRes() {
echo "$1"
}
CheckAllEnd() {
if [[ ! -f /tmp/webmonithor ]]
then
Total=$1
Actual=0
for ActualFile in $(find /tmp/ -name Monithor_\*-tmp)
do
[[ ! -z $(tail -n 1 $ActualFile | grep 'End of') ]] && Actual=$((Actual + 1))
done
if [[ ${Total} -eq ${Actual} ]]
then
echo '
MoniThor on '${RemoteIp}'
MONITHOR
Date : '$(date +'%Y-%m-%d %H:%M:%S')'
| MoniThor Result |
' > /tmp/webmonithor
cat /tmp/Monithor_*-tmp >> /tmp/webmonithor
echo '
' >> /tmp/webmonithor
mv /tmp/webmonithor ../web/index.html
rm /tmp/Monithor_* -f
fi
fi
}
GenerateWebEnd(){
echo '' >> $1
}
GenerateWeb(){
Val=$(echo $1 | cut -d"|" -f1)
Txt=$(echo $1 | cut -d"|" -f2)
Sonde=$2
Arg=$3
Remote=$4
File=$5
Color=red
[[ $Val == "0" ]] && Color=green
[[ $Val == "1" ]] && Color=yellow
echo '
| '$Remote' | '$Sonde' | '$Arg' | '$Val' | '$Txt' |
' >> ${File}
}