Added ability to search .nagiosapikey instead of specific url

dev
Eric Loyd 1 year ago
parent eed6de3818
commit d6be03b24b

@ -295,12 +295,16 @@ do_debug 1 "Looking for url=$url in $APIkeyFile"
APIKEY="$key" APIKEY="$key"
continue continue
fi fi
if [ "$url" = "$XI_URL" ]; then do_debug 2 "Looking for url=$url XI_URL=$XI_URL"
if [[ "$url" =~ "$XI_URL" ]]; then
XI_URL="$url"
APIKEY="$key" APIKEY="$key"
fi fi
done < "$APIkeyFile" done < "$APIkeyFile"
fi fi
[ -z "$XI_URL" -o -z "$APIKEY" ] && echo "Empty URL or Key." && exit
do_api() { do_api() {
api_start="$1" api_start="$1"
api_command="$2" api_command="$2"
@ -316,7 +320,7 @@ do_api() {
url+="&$colName=$colVal" url+="&$colName=$colVal"
fi fi
do_debug 2 "start=$1 command=$2" do_debug 2 "start=$1 command=$2"
do_debug 1 "Executing (tesmode=${myOptions[TestMode]}): $url" do_debug 1 "Executing (testmode=${myOptions[TestMode]}): $url"
[ -z "${myOptions[TestMode]}" ] && $curl -XGET -k "$url" [ -z "${myOptions[TestMode]}" ] && $curl -XGET -k "$url"
} }

Loading…
Cancel
Save