Update dsmon.sh

This commit is contained in:
2024-01-26 10:49:51 -06:00
parent b264c053b2
commit 946579f461

View File

@@ -391,7 +391,7 @@ RUNCMD_SUB(){
tmpfile=/tmp/.dsmon.runcmd.${host// /-}
touch ${tmpfile}.running > /dev/null 2>&1
echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host} - Running command: ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21} ${22}${idsCL[Default]}${idsST[Reset]}" >> ${tmpfile}.running
if ssh_output=$(ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${ip} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21} ${22}) ; then
if ssh_output=$(ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 -t root@${ip} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21} ${22}) ; then
echo -e "${ssh_output}" >> ${tmpfile}.running
else
echo -e "${idsST[Bold]}${idsCL[Red]} ${host} - Timeout${idsCL[Default]}${idsST[Reset]}" >> ${tmpfile}.running
@@ -408,7 +408,7 @@ UPDATENODES(){
while read hostid hostname hostip hostlimits; do
if [ "${hostname}" != "host" ]; then
echo -e "${idsCL[LightCyan]}Updating DSMON on '${hostname}'${idsCL[Default]}"
ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@$(echo $hostip | cut -d ";" -f1) "dsmon update"
ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 -t root@$(echo $hostip | cut -d ";" -f1) "dsmon update"
echo
fi
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC")
@@ -465,7 +465,7 @@ GETCRONTABS(){
# checkhost=$(CHECK_HOST ${host_ip[$hostid]})
# if [ "${checkhost}" != "false" ]; then
# echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs ... ${idsCL[Default]}${idsST[Reset]}"
ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd} &
ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 -t root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd} &
# else
# echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}"
# fi