diff --git a/dsmon.sh b/dsmon.sh index 201e342..cd1445b 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -99,12 +99,12 @@ CHECK(){ declare -A host_ids declare -a hostnames_sort - if [ "${1}" == "report" ]; then + # if [ "${1}" == "report" ]; then unset idsCL idsBG idsST idsCL=('') idsBG=('') idsST=('') - fi + # fi if [ "${1}" != "report" ]; then MSG="Determining hosts and preparing" @@ -147,8 +147,7 @@ CHECK(){ NTS=$(grep -oP '(?<=dscheck\.).*?(?=\.done)' <<< "${host}") if [ -n "$NTS" ]; then echo "'$host' = '$NTS'" - printf "%s\n" "$(cat /tmp/${NTS}.result)" - # printf "%s\n" "$(cat /tmp/dscheck.${NTS}.results)" + printf "%s\n" "$(cat /tmp/dscheck.${NTS}.results)" rm -f /tmp/dscheck.${NTS}.* >/dev/null 2>&1 ((nc_count++)) fi @@ -171,27 +170,6 @@ 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]}