Update dsmon.sh
This commit is contained in:
74
dsmon.sh
74
dsmon.sh
@@ -337,48 +337,48 @@ RUNCMD(){
|
|||||||
echo -e "${idsST[Bold]}'${idsCL[LightCyan]}$(echo "${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}" | awk '{$1=$1};1')${idsCL[White]}'${idsCL[Default]}${idsST[Reset]}\n"
|
echo -e "${idsST[Bold]}'${idsCL[LightCyan]}$(echo "${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}" | awk '{$1=$1};1')${idsCL[White]}'${idsCL[Default]}${idsST[Reset]}\n"
|
||||||
ncount=0
|
ncount=0
|
||||||
|
|
||||||
|
# while read hostid hostname hostip hostlimits; do
|
||||||
|
# if [ "${hostname}" != "host" ]; then
|
||||||
|
# ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${hostip} ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21} ${22}
|
||||||
|
# fi
|
||||||
|
# done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -P 3307 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC")
|
||||||
|
|
||||||
|
|
||||||
while read hostid hostname hostip hostlimits; do
|
while read hostid hostname hostip hostlimits; do
|
||||||
if [ "${hostname}" != "host" ]; then
|
if [ "${hostname}" != "host" ]; then
|
||||||
ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${hostip} ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21} ${22}
|
RUNCMD_SUB $(echo ${hostip} | cut -d ";" -f1) ${hostname} ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ###&
|
||||||
|
((ncount++))
|
||||||
fi
|
fi
|
||||||
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -P 3307 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC")
|
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -P 3307 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC")
|
||||||
|
|
||||||
# while read hostid hostname hostip hostlimits; do
|
nc_count=0; lcount=0; completed=false
|
||||||
# if [ "${hostname}" != "host" ]; then
|
until [ "${completed}" == "true" ]; do
|
||||||
# RUNCMD_SUB $(echo ${hostip} | cut -d ";" -f1) ${hostname} ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ###&
|
for nodecmd in /tmp/.dsmon.runcmd.*.done; do
|
||||||
# ((ncount++))
|
# HOST=$(grep -oP '(?<=runcmd.).*?(?=.done)' <<< "${nodecmd}")
|
||||||
# fi
|
# if [ "${HOST}" != "*" ]; then
|
||||||
# done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -P 3307 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC")
|
# if [[ "${nodecmd}" != *"*"* ]]; then
|
||||||
#
|
# nodecmd_output=$(cat ${nodecmd})
|
||||||
# nc_count=0; lcount=0; completed=false
|
# [ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}\n"
|
||||||
# until [ "${completed}" == "true" ]; do
|
# fi
|
||||||
# for nodecmd in /tmp/.dsmon.runcmd.*.done; do
|
# rm -f ${nodecmd}
|
||||||
# # HOST=$(grep -oP '(?<=runcmd.).*?(?=.done)' <<< "${nodecmd}")
|
|
||||||
# # if [ "${HOST}" != "*" ]; then
|
if [[ "${nodecmd}" != *"*"* ]]; then
|
||||||
# # if [[ "${nodecmd}" != *"*"* ]]; then
|
nodecmd_output=$(cat ${nodecmd})
|
||||||
# # nodecmd_output=$(cat ${nodecmd})
|
[ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}\n"
|
||||||
# # [ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}\n"
|
rm -f ${nodecmd}
|
||||||
# # fi
|
((nc_count++))
|
||||||
# # rm -f ${nodecmd}
|
fi
|
||||||
#
|
done
|
||||||
# if [[ "${nodecmd}" != *"*"* ]]; then
|
if [ ${nc_count} -eq ${ncount} ]; then
|
||||||
# nodecmd_output=$(cat ${nodecmd})
|
echo -e "${idsCL[LightGreen]}Complete, the command was ran on all nodes\n"
|
||||||
# [ "${nodecmd_output}" != "" ] && echo -e "${nodecmd_output}\n"
|
completed=true
|
||||||
# rm -f ${nodecmd}
|
break
|
||||||
# ((nc_count++))
|
fi
|
||||||
# fi
|
[ ${lcount} -ne ${nc_count} ] && echo -e "${idsCL[Yellow]}${nc_count} of ${ncount} completed ...\n"
|
||||||
# done
|
lcount=${nc_count}
|
||||||
# if [ ${nc_count} -eq ${ncount} ]; then
|
|
||||||
# echo -e "${idsCL[LightGreen]}Complete, the command was ran on all nodes\n"
|
sleep 2s
|
||||||
# completed=true
|
done
|
||||||
# break
|
|
||||||
# fi
|
|
||||||
# [ ${lcount} -ne ${nc_count} ] && echo -e "${idsCL[Yellow]}${nc_count} of ${ncount} completed ...\n"
|
|
||||||
# lcount=${nc_count}
|
|
||||||
#
|
|
||||||
# sleep 2s
|
|
||||||
# done
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
end=`date +%s`
|
end=`date +%s`
|
||||||
|
|||||||
Reference in New Issue
Block a user