Update dsmon.sh

This commit is contained in:
2025-06-14 10:29:35 -05:00
parent 66b68284da
commit ff08a517de

View File

@@ -171,6 +171,27 @@ 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}
touch /tmp/dscheck.${hostname}.running
hostid=${host_ids[$hostname]}
@@ -571,6 +592,7 @@ if [[ "${noheader}" != *" ${1} "* ]] && [[ "${noheader}" != *" ${2} "* ]]; then
fi
case ${ACTION} in
check) CHECK ${2};;
runcheck) RUN_CHECK ${2};;
setupssh) SETUPSSH;;
get-crontabs) GETCRONTABS ${2};;
get-crontab) GETCRONTAB ${2};;