Update dsmon.sh
This commit is contained in:
35
dsmon.sh
35
dsmon.sh
@@ -304,6 +304,12 @@ GETCRONTABS(){
|
|||||||
|
|
||||||
[ ! -d ${DS_CRONTAB_FOLDER} ] && mkdir ${DS_CRONTAB_FOLDER} && chmod -Rf 0777 ${DS_CRONTAB_FOLDER}
|
[ ! -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
|
if [ "${1}" == "" ]; then
|
||||||
read -p "Enter the password for the 'nm_crontab_user' account on MySQL-Manager: " rtpsswd
|
read -p "Enter the password for the 'nm_crontab_user' account on MySQL-Manager: " rtpsswd
|
||||||
@@ -312,37 +318,22 @@ GETCRONTABS(){
|
|||||||
rtpsswd=${1}
|
rtpsswd=${1}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read hostid hostname hostip hostlimits; do
|
for hostid in "${!host_ip[@]}"; do
|
||||||
# if [ "$hostid" != "id" ]; then
|
checkhost=$(CHECK_HOST ${host_ip[$hostid]})
|
||||||
# host_ip[${hostid}]=$(echo $hostip | cut -d ";" -f1)
|
|
||||||
# host_name[${hostid}]=$hostname
|
|
||||||
# fi
|
|
||||||
checkhost=$(CHECK_HOST ${hostip})
|
|
||||||
if [ "${checkhost}" != "false" ]; then
|
if [ "${checkhost}" != "false" ]; then
|
||||||
echo -en "${idsST[Bold]}${idsCL[LightCyan]} ${hostname} - Gathering Crontabs ... ${idsCL[Default]}${idsST[Reset]}"
|
echo -en "${idsST[Bold]}${idsCL[LightCyan]} ${host_name[$hostid]} - Gathering Crontabs ... ${idsCL[Default]}${idsST[Reset]}"
|
||||||
ssh -tq root@${hostip} dsmon get-crontab ${rtpsswd}
|
ssh -tq root@${host_ip[$hostid]} dsmon get-crontab ${rtpsswd}
|
||||||
else
|
else
|
||||||
echo -e "${idsST[Bold]}${idsCL[Red]} ${hostname} - Timeout${idsCL[Default]}${idsST[Reset]}"
|
echo -e "${idsST[Bold]}${idsCL[Red]} ${host_name[$hostid]} - Timeout${idsCL[Default]}${idsST[Reset]}"
|
||||||
fi
|
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")
|
done
|
||||||
|
|
||||||
|
|
||||||
# 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
|
echo
|
||||||
end=`date +%s`
|
end=`date +%s`
|
||||||
runtime=$((end-start))
|
runtime=$((end-start))
|
||||||
echo "Script Runtime: ${runtime}"
|
echo "Script Runtime: ${runtime}"
|
||||||
echo
|
echo
|
||||||
dsmon
|
|
||||||
}
|
}
|
||||||
GETCRONTAB(){
|
GETCRONTAB(){
|
||||||
if [ "${1}" != "" ]; then
|
if [ "${1}" != "" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user