Update dsmon.sh
This commit is contained in:
28
dsmon.sh
28
dsmon.sh
@@ -99,12 +99,12 @@ CHECK(){
|
|||||||
declare -A host_ids
|
declare -A host_ids
|
||||||
declare -a hostnames_sort
|
declare -a hostnames_sort
|
||||||
|
|
||||||
if [ "${1}" == "report" ]; then
|
# if [ "${1}" == "report" ]; then
|
||||||
unset idsCL idsBG idsST
|
unset idsCL idsBG idsST
|
||||||
idsCL=('')
|
idsCL=('')
|
||||||
idsBG=('')
|
idsBG=('')
|
||||||
idsST=('')
|
idsST=('')
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
if [ "${1}" != "report" ]; then
|
if [ "${1}" != "report" ]; then
|
||||||
MSG="Determining hosts and preparing"
|
MSG="Determining hosts and preparing"
|
||||||
@@ -147,8 +147,7 @@ CHECK(){
|
|||||||
NTS=$(grep -oP '(?<=dscheck\.).*?(?=\.done)' <<< "${host}")
|
NTS=$(grep -oP '(?<=dscheck\.).*?(?=\.done)' <<< "${host}")
|
||||||
if [ -n "$NTS" ]; then
|
if [ -n "$NTS" ]; then
|
||||||
echo "'$host' = '$NTS'"
|
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
|
rm -f /tmp/dscheck.${NTS}.* >/dev/null 2>&1
|
||||||
((nc_count++))
|
((nc_count++))
|
||||||
fi
|
fi
|
||||||
@@ -171,27 +170,6 @@ 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]}
|
||||||
|
|||||||
Reference in New Issue
Block a user