Update dsmon.sh
This commit is contained in:
27
dsmon.sh
27
dsmon.sh
@@ -304,13 +304,7 @@ GETCRONTABS(){
|
||||
|
||||
[ ! -d ${DS_CRONTAB_FOLDER} ] && mkdir ${DS_CRONTAB_FOLDER} && chmod -Rf 0777 ${DS_CRONTAB_FOLDER}
|
||||
|
||||
while read hostid hostname hostip hostlimits; do
|
||||
if [ "$hostid" != "id" ]; then
|
||||
host_ip[${hostid}]=$(echo $hostip | cut -d ";" -f1)
|
||||
host_name[${hostid}]=$hostname
|
||||
fi
|
||||
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -P 3306 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC")
|
||||
|
||||
|
||||
if [ "${1}" == "" ]; then
|
||||
read -p "Enter the password for the 'nm_crontab_user' account on MySQL-Manager: " rtpsswd
|
||||
echo
|
||||
@@ -318,7 +312,11 @@ GETCRONTABS(){
|
||||
rtpsswd=${1}
|
||||
fi
|
||||
|
||||
for hostid in "${!host_ip[@]}"; do
|
||||
while read hostid hostname hostip hostlimits; do
|
||||
# if [ "$hostid" != "id" ]; then
|
||||
# host_ip[${hostid}]=$(echo $hostip | cut -d ";" -f1)
|
||||
# host_name[${hostid}]=$hostname
|
||||
# fi
|
||||
checkhost=$(CHECK_HOST ${host_ip[$hostid]})
|
||||
if [ "${checkhost}" != "false" ]; then
|
||||
echo -en "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs ... ${idsCL[Default]}${idsST[Reset]}"
|
||||
@@ -326,7 +324,18 @@ GETCRONTABS(){
|
||||
else
|
||||
echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}"
|
||||
fi
|
||||
done
|
||||
done <<< $(MYSQL_PWD="sysmoninsert" mysql -h ${mysqlip} -P 3306 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC")
|
||||
|
||||
|
||||
# for hostid in "${!host_ip[@]}"; do
|
||||
# checkhost=$(CHECK_HOST ${host_ip[$hostid]})
|
||||
# if [ "${checkhost}" != "false" ]; then
|
||||
# echo -en "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs ... ${idsCL[Default]}${idsST[Reset]}"
|
||||
# ssh -tq 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