[UPDATE] - add muli server
This commit is contained in:
parent
5bbbed29e2
commit
5ad25fb23d
@ -7,17 +7,20 @@ SondeFile=$(pwd)/sonde.cfg
|
|||||||
source service.cfg
|
source service.cfg
|
||||||
source functions
|
source functions
|
||||||
|
|
||||||
[[ "${Crypted}" == "yes" ]] && NcCmd="timeout ${TimeOut} cryptcat -k ${LocalPassword} ${RemoteIp} ${RemotePort} " || NcCmd="timeout ${TimeOut} nc ${RemoteIp} ${RemotePort}"
|
#[[ "${Crypted}" == "yes" ]] && NcCmd="timeout ${TimeOut} cryptcat -k ${LocalPassword} ${RemoteIp} ${RemotePort} " || NcCmd="timeout ${TimeOut} nc ${RemoteIp} ${RemotePort}"
|
||||||
|
[[ "${Crypted}" == "yes" ]] && NcCmd="timeout ${TimeOut} cryptcat -k ${LocalPassword} " || NcCmd="timeout ${TimeOut} nc "
|
||||||
|
|
||||||
|
PrintWeb START_TRATS
|
||||||
while read DATA
|
while read DATA
|
||||||
do
|
do
|
||||||
Cmd=$(echo $DATA| cut -d"#" -f1)
|
Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1)
|
||||||
Arg=$(echo $DATA| cut -d"#" -f2)
|
Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2)
|
||||||
Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} 2> /dev/null)
|
Cmd=$(echo $DATA| cut -d"#" -f2)
|
||||||
|
Arg=$(echo $DATA| cut -d"#" -f3)
|
||||||
|
Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null)
|
||||||
Ret=$?
|
Ret=$?
|
||||||
PrintRes "${Res:-5|No sonde $Cmd on serveur $RemoteIp}"
|
PrintRes "${Res:-5|No sonde $Cmd on serveur $Remote}"
|
||||||
PrintWeb "${Res:-5|No sonde $Cmd on serveur $RemoteIp}" $Cmd $Arg
|
PrintWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata}
|
||||||
done < ${SondeFile}
|
done < ${SondeFile}
|
||||||
PrintWeb END_DNE
|
PrintWeb END_DNE
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ PrintRes() {
|
|||||||
|
|
||||||
PrintWeb() {
|
PrintWeb() {
|
||||||
|
|
||||||
if [ ! -f /tmp/webmonithor ]
|
if [[ ! -f /tmp/webmonithor ]] || [[ "$1" == "START_TRATS" ]]
|
||||||
then
|
then
|
||||||
echo '
|
echo '
|
||||||
<html>
|
<html>
|
||||||
@ -43,12 +43,14 @@ PrintWeb() {
|
|||||||
Txt=$(echo $1 | cut -d"|" -f2)
|
Txt=$(echo $1 | cut -d"|" -f2)
|
||||||
Sonde=$2
|
Sonde=$2
|
||||||
Arg=$3
|
Arg=$3
|
||||||
|
Remote=$4
|
||||||
Color=red
|
Color=red
|
||||||
[[ $Val == "0" ]] && Color=green
|
[[ $Val == "0" ]] && Color=green
|
||||||
[[ $Val == "1" ]] && Color=yellow
|
[[ $Val == "1" ]] && Color=yellow
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>'$Remote'</td>
|
||||||
<td>'$Sonde'</td>
|
<td>'$Sonde'</td>
|
||||||
<td>'$Arg'</td>
|
<td>'$Arg'</td>
|
||||||
<td style="background-color:'${Color}';" > '$Val' </td>
|
<td style="background-color:'${Color}';" > '$Val' </td>
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
RemoteIp=192.168.0.22
|
RemoteIp=10.10.10.3:1666
|
||||||
RemotePort=8990
|
|
||||||
LocalPassword='Evil@MonitoR-666'
|
LocalPassword='Evil@MonitoR-666'
|
||||||
Crypted=no
|
Crypted=no
|
||||||
Rotation=1
|
Rotation=1
|
||||||
TimeOut=2
|
TimeOut=2
|
||||||
WebPort=8888
|
WebPort=80
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
file#/tmp/coucou
|
10.10.10.3:1666#file#/tmp/coucou
|
||||||
file#/tmp/nop
|
10.10.10.3:1666#file#/tmp/nop
|
||||||
file#
|
10.10.10.3:1666#file#
|
||||||
NotRealSondeName#reboot
|
10.10.10.3:1666#NotRealSondeName#reboot
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user