[UPDATE] - TP 05 - '#'

This commit is contained in:
Prof Isen 2022-05-02 21:37:32 +02:00
parent 2ff5c979b5
commit 2f2a283f7e
5 changed files with 19 additions and 18 deletions

View File

@ -1,3 +0,0 @@
10.10.10.3:1666#file#/tmp/test
10.10.10.3:1666#part#/home/isen|50|80
10.10.10.3:1666#process#sshd

View File

@ -1,3 +0,0 @@
10.10.10.4:1666#file#/tmp/test
10.10.10.4:1666#part#/home/isen|50|80
10.10.10.4:1666#process#sshd

View File

@ -0,0 +1,4 @@
#IP:PORT#SONDE#ARGUMENT
#Ex :
#10.10.10.3:1666#part#/home/isen|50|80

View File

@ -19,8 +19,8 @@ if [[ "$1" == "start" ]]
[[ -f /tmp/endmonitor ]] && rm -f /tmp/endmonitor [[ -f /tmp/endmonitor ]] && rm -f /tmp/endmonitor
rm /tmp/Monitor* /tmp/webmonithor &> /dev/null rm /tmp/Monitor* /tmp/webmonithor &> /dev/null
TotalConfig=$(ls -1 /etc/monithor-client/conf/ | grep Card_.*\.cfg|wc -l) TotalConfig=$(ls -1 /etc/monithor-client/conf/ | grep grep .*\.cfg| wc-l)
for Conf in $(ls -1 /etc/monithor-client/conf/ | grep Card_.*\.cfg) for Conf in $(ls -1 /etc/monithor-client/conf/ | grep grep .*\.cfg)
do do
screen -dmS ${Conf} bash /usr/local/bin/monithor-client.d/MoniThor ${Conf} screen -dmS ${Conf} bash /usr/local/bin/monithor-client.d/MoniThor ${Conf}
done done

View File

@ -15,16 +15,19 @@ while [[ ! -f /tmp/endmonitor ]]
GenerateWebEnd /tmp/Monithor_${ConfFile}-tmp GenerateWebEnd /tmp/Monithor_${ConfFile}-tmp
sleep ${Rotation} sleep ${Rotation}
else else
while read DATA while read DATA
do do
Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1) Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1)
Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2) Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2)
Cmd=$(echo $DATA| cut -d"#" -f2) Cmd=$(echo $DATA| cut -d"#" -f2)
Arg=$(echo $DATA| cut -d"#" -f3) Arg=$(echo $DATA| cut -d"#" -f3)
Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null) Res=$( echo -e "${Cmd}#${Arg}" | eval ${NcCmd} ${Remote} ${Port} 2> /dev/null)
Ret=$? Ret=$?
GenerateWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} /tmp/Monithor_${ConfFile}-tmp if [[ ! -z $(echo $DATA | grep ^"[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:[0-9]*#.*#" ) ]]
done < /etc/monithor-client/conf/${ConfFile} then
GenerateWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} /tmp/Monithor_${ConfFile}-tmp
fi
done < /etc/monithor-client/conf/${ConfFile}
fi fi
done done