Update dsmon.sh
This commit is contained in:
22
dsmon.sh
22
dsmon.sh
@@ -171,6 +171,27 @@ CHECK(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
RUN_CHECK(){
|
RUN_CHECK(){
|
||||||
|
|
||||||
|
declare -A host_ip
|
||||||
|
declare -A host_name
|
||||||
|
declare -A host_limits
|
||||||
|
declare -A host_ids
|
||||||
|
declare -a hostnames_sort
|
||||||
|
while read hostid hostname hostip hostlimits; do
|
||||||
|
if [ "$hostid" != "id" ]; then
|
||||||
|
hostip=$(echo $hostip | cut -d ";" -f1)
|
||||||
|
# echo "$hostid - $hostip - $hostname - $hostlimits"
|
||||||
|
host_ip[${hostid}]=$hostip
|
||||||
|
host_name[${hostid}]=$hostname
|
||||||
|
host_limits[${hostid}]=$hostlimits
|
||||||
|
host_ids[$hostname]=$hostid
|
||||||
|
hostnames_sort+=("$hostname")
|
||||||
|
fi
|
||||||
|
done <<< $(MYSQL_PWD="sysmoninsert" ${mysqlcmd} ${mysql_conn} -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0")
|
||||||
|
IFS=$'\n' hostnames_sort=($(sort <<<"${hostnames_sort[*]}")); unset IFS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hostname=${1}
|
hostname=${1}
|
||||||
touch /tmp/dscheck.${hostname}.running
|
touch /tmp/dscheck.${hostname}.running
|
||||||
hostid=${host_ids[$hostname]}
|
hostid=${host_ids[$hostname]}
|
||||||
@@ -571,6 +592,7 @@ if [[ "${noheader}" != *" ${1} "* ]] && [[ "${noheader}" != *" ${2} "* ]]; then
|
|||||||
fi
|
fi
|
||||||
case ${ACTION} in
|
case ${ACTION} in
|
||||||
check) CHECK ${2};;
|
check) CHECK ${2};;
|
||||||
|
runcheck) RUN_CHECK ${2};;
|
||||||
setupssh) SETUPSSH;;
|
setupssh) SETUPSSH;;
|
||||||
get-crontabs) GETCRONTABS ${2};;
|
get-crontabs) GETCRONTABS ${2};;
|
||||||
get-crontab) GETCRONTAB ${2};;
|
get-crontab) GETCRONTAB ${2};;
|
||||||
|
|||||||
Reference in New Issue
Block a user