diff --git a/defaults.inc b/defaults.inc index 88c3f0b..e0cd7a3 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS=2.3.36-09082024 +VERS=2.3.37-02222025 DS_FOLDER=/opt/idssys/dsmon DS_CRONTAB_FOLDER=/opt/idssys/nodemgmt/crontabs diff --git a/dsmon.sh b/dsmon.sh index 2e6fbfd..cafc4ab 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -399,6 +399,25 @@ RUNCMD_SUB(){ fi mv ${tmpfile}.running ${tmpfile}.done > /dev/null 2>&1 } +RUNCMDSLOW(){ + start=`date +%s` + echo -e "\n${idsCL[White]}The following command will be run on all nodes:" + echo -e "${idsST[Bold]}'${idsCL[LightCyan]}$(echo "${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}" | awk '{$1=$1};1')${idsCL[White]}'${idsCL[Default]}${idsST[Reset]}\n" + + while read hostid hostname hostip hostlimits; do + if [ "${hostname}" != "host" ]; then + ssh -tq -o ConnectTimeout=3 -o ConnectionAttempts=1 root@$(echo ${hostip} | cut -d ";" -f1) ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21} ${22} + fi + done <<< $(MYSQL_PWD="sysmoninsert" mariadb --skip-ssl -h ${mysqlip} -P 3307 -u sysmoninsert -e "SELECT id,host,ip,limits FROM servermonitor.hosts WHERE disabled=0 ORDER BY host ASC") + + echo -e "${idsCL[LightGreen]}Complete, the command was ran on all nodes\n" + + echo + end=`date +%s` + runtime=$((end-start)) + echo "Script Runtime: ${runtime}" + echo +} UPDATENODES(){ start=`date +%s` @@ -537,6 +556,7 @@ case ${ACTION} in gettsip-node) GETTSIP_NODE;; run) RUN ${2};; runcmd) RUNCMD ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21};; + runcmdslow) RUNCMDSLOW ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21};; update);; updatenodes) UPDATENODES;; *)