diff --git a/monithor-client/etc/monithor-client/conf/Card_10.10.10.3-1666.cfg b/monithor-client/etc/monithor-client/conf/Card_10.10.10.3-1666.cfg deleted file mode 100644 index cc80ee5..0000000 --- a/monithor-client/etc/monithor-client/conf/Card_10.10.10.3-1666.cfg +++ /dev/null @@ -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 diff --git a/monithor-client/etc/monithor-client/conf/Card_10.10.10.4-1666.cfg b/monithor-client/etc/monithor-client/conf/Card_10.10.10.4-1666.cfg deleted file mode 100644 index 094c910..0000000 --- a/monithor-client/etc/monithor-client/conf/Card_10.10.10.4-1666.cfg +++ /dev/null @@ -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 diff --git a/monithor-client/etc/monithor-client/conf/sample.cfg b/monithor-client/etc/monithor-client/conf/sample.cfg new file mode 100644 index 0000000..b8f92eb --- /dev/null +++ b/monithor-client/etc/monithor-client/conf/sample.cfg @@ -0,0 +1,4 @@ +#IP:PORT#SONDE#ARGUMENT +#Ex : +#10.10.10.3:1666#part#/home/isen|50|80 + diff --git a/monithor-client/usr/local/bin/monithor-client b/monithor-client/usr/local/bin/monithor-client index 71fac8a..9d58723 100755 --- a/monithor-client/usr/local/bin/monithor-client +++ b/monithor-client/usr/local/bin/monithor-client @@ -19,8 +19,8 @@ if [[ "$1" == "start" ]] [[ -f /tmp/endmonitor ]] && rm -f /tmp/endmonitor rm /tmp/Monitor* /tmp/webmonithor &> /dev/null - TotalConfig=$(ls -1 /etc/monithor-client/conf/ | grep Card_.*\.cfg|wc -l) - for Conf in $(ls -1 /etc/monithor-client/conf/ | grep Card_.*\.cfg) + TotalConfig=$(ls -1 /etc/monithor-client/conf/ | grep grep .*\.cfg| wc-l) + for Conf in $(ls -1 /etc/monithor-client/conf/ | grep grep .*\.cfg) do screen -dmS ${Conf} bash /usr/local/bin/monithor-client.d/MoniThor ${Conf} done diff --git a/monithor-client/usr/local/bin/monithor-client.d/MoniThor b/monithor-client/usr/local/bin/monithor-client.d/MoniThor index 805f881..ea9d947 100755 --- a/monithor-client/usr/local/bin/monithor-client.d/MoniThor +++ b/monithor-client/usr/local/bin/monithor-client.d/MoniThor @@ -15,16 +15,19 @@ while [[ ! -f /tmp/endmonitor ]] GenerateWebEnd /tmp/Monithor_${ConfFile}-tmp sleep ${Rotation} else - while read DATA - do - Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1) - Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2) - 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=$? - GenerateWeb "${Res:-5|No sonde $Cmd on serveur $Remote}" ${Cmd:-Nodata} ${Arg:-Noadata} ${Remote:-Nodata} /tmp/Monithor_${ConfFile}-tmp - done < /etc/monithor-client/conf/${ConfFile} + while read DATA + do + Remote=$(echo $DATA| cut -d"#" -f1| cut -d":" -f1) + Port=$(echo $DATA| cut -d"#" -f1| cut -d":" -f2) + 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=$? + if [[ ! -z $(echo $DATA | grep ^"[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:[0-9]*#.*#" ) ]] + 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 done