From 06dcbb7ed40c520771ddf979d69698ae8d38c869 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 20 Dec 2018 23:49:27 +0000 Subject: [PATCH] feat(monitor): add tcp query to query raw (#2134) --- lgsm/functions/command_dev_query_raw.sh | 16 +++++++++++++++- lgsm/functions/command_monitor.sh | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lgsm/functions/command_dev_query_raw.sh b/lgsm/functions/command_dev_query_raw.sh index af0e7de6a..30db99ea5 100644 --- a/lgsm/functions/command_dev_query_raw.sh +++ b/lgsm/functions/command_dev_query_raw.sh @@ -41,4 +41,18 @@ echo "./query_gsquery.py -a \"${ip}\" -p \"${queryport}\" -e \"${engine}\"" if [ ! -f "${functionsdir}/query_gsquery.py" ]; then fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5" fi -"${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${engine}" \ No newline at end of file +"${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${engine}" + +echo"" +echo "=================================" +echo "tcp Raw Output" +echo "=================================" +echo"" +echo "bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}''" +bash -c 'exec 3<> /dev/tcp/'${ip}'/'${queryport}'' +querystatus="$?" +if [ "${querystatus}" == "0" ]; then + echo "tcp query PASS" +else + echo "tcp query FAIL" +fi \ No newline at end of file diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index 2a291cd15..5849da984 100644 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -13,6 +13,7 @@ local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_monitor_loop(){ # Will query up to 5 times every 15 seconds. # Query will wait up to 60 seconds to confirm server is down giving server time if changing map. +totalseconds=0 for queryattempt in {1..5}; do fn_print_dots "Querying port: ${querymethod}: ${ip}:${queryport} : ${totalseconds}/${queryattempt}: " fn_print_querying_eol