Update dsmon.sh
This commit is contained in:
30
dsmon.sh
30
dsmon.sh
@@ -390,11 +390,11 @@ RUNCMD_SUB(){
|
||||
host=${2}
|
||||
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
|
||||
echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host}${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
|
||||
echo -e "${ssh_output}" >> ${tmpfile}.running
|
||||
else
|
||||
echo -e "${idsST[Bold]}${idsCL[Red]} ${host} - Timeout${idsCL[Default]}${idsST[Reset]}" >> ${tmpfile}.running
|
||||
echo -e "${idsCL[Red]} ${host} - Timeout${idsCL[Default]}" >> ${tmpfile}.running
|
||||
fi
|
||||
mv ${tmpfile}.running ${tmpfile}.done > /dev/null 2>&1
|
||||
}
|
||||
@@ -440,7 +440,7 @@ GETTSIP_NODE(){
|
||||
|
||||
GETCRONTABS(){
|
||||
start=`date +%s`
|
||||
|
||||
rtpsswd=${1}
|
||||
declare -A host_ip
|
||||
declare -A host_name
|
||||
|
||||
@@ -453,23 +453,21 @@ GETCRONTABS(){
|
||||
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")
|
||||
|
||||
if [ "${1}" == "" ]; then
|
||||
if [ "${rtpsswd}" == "" ]; then
|
||||
read -p "Enter the password for the 'nm_crontab_user' account on MySQL-Manager: " rtpsswd
|
||||
echo
|
||||
else
|
||||
rtpsswd=${1}
|
||||
fi
|
||||
|
||||
# for hostid in "${!host_ip[@]}"; do
|
||||
# # echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - ${host_ip[$hostid]}${idsCL[Default]}${idsST[Reset]}"
|
||||
# # 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} &
|
||||
# # else
|
||||
# # echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}"
|
||||
# # fi
|
||||
# done
|
||||
for hostid in "${!host_ip[@]}"; do
|
||||
# echo -e "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - ${host_ip[$hostid]}${idsCL[Default]}${idsST[Reset]}"
|
||||
# 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} &
|
||||
# else
|
||||
# echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}"
|
||||
# fi
|
||||
done
|
||||
|
||||
echo
|
||||
end=`date +%s`
|
||||
|
||||
Reference in New Issue
Block a user