62 lines
1007 B
Bash
62 lines
1007 B
Bash
#!/bin/bash
|
|
PrintRes() {
|
|
|
|
echo "$1"
|
|
|
|
}
|
|
|
|
PrintWeb() {
|
|
|
|
if [[ ! -f /tmp/webmonithor ]] || [[ "$1" == "START_TRATS" ]]
|
|
then
|
|
echo '
|
|
<html>
|
|
<head>
|
|
<title>MoniThor on '${RemoteIp}' </title>
|
|
<meta http-equiv="refresh" content="'${Rotation}'" />
|
|
</head>
|
|
|
|
Date : '$(date +'%Y-%m-%d %H:%M:%S')'
|
|
|
|
<table border="1" color="#FFFFFF">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="4">MoniThor Result</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
' > /tmp/webmonithor
|
|
|
|
fi
|
|
|
|
if [ "$1" == "END_DNE" ]
|
|
then
|
|
echo '
|
|
|
|
</tbody>
|
|
</table> ' >> /tmp/webmonithor
|
|
mv /tmp/webmonithor ../web/index.html
|
|
|
|
else
|
|
|
|
Val=$(echo $1 | cut -d"|" -f1)
|
|
Txt=$(echo $1 | cut -d"|" -f2)
|
|
Sonde=$2
|
|
Arg=$3
|
|
Remote=$4
|
|
Color=red
|
|
[[ $Val == "0" ]] && Color=green
|
|
[[ $Val == "1" ]] && Color=yellow
|
|
|
|
echo '
|
|
<tr>
|
|
<td>'$Remote'</td>
|
|
<td>'$Sonde'</td>
|
|
<td>'$Arg'</td>
|
|
<td style="background-color:'${Color}';" > '$Val' </td>
|
|
<td> '$Txt'</td>
|
|
</tr>' >> /tmp/webmonithor
|
|
fi
|
|
|
|
}
|