#!/bin/bash
PrintRes() {
echo "$1"
}
CheckAllEnd() {
Total=$1
Actual=0
for AcutalFile in $(find /tmp/ -name Monithor_\*-tmp)
do
[[ ! -z $(tail -n 1 $ActualFile | grep 'End of') ]] && Acutal=$((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/webmonithor
rm /tmp/Monithor -f
echo '
' >> /tmp/webmonithor
mv /tmp/webmonithor ../web/index.html
fi
}
GenerateWebEnd(){
echo ''| tee -a $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}
}