Added ability to search .nagiosapikey instead of specific url
This commit is contained in:
@@ -295,12 +295,16 @@ do_debug 1 "Looking for url=$url in $APIkeyFile"
|
||||
APIKEY="$key"
|
||||
continue
|
||||
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"
|
||||
fi
|
||||
done < "$APIkeyFile"
|
||||
fi
|
||||
|
||||
[ -z "$XI_URL" -o -z "$APIKEY" ] && echo "Empty URL or Key." && exit
|
||||
|
||||
do_api() {
|
||||
api_start="$1"
|
||||
api_command="$2"
|
||||
@@ -316,7 +320,7 @@ do_api() {
|
||||
url+="&$colName=$colVal"
|
||||
fi
|
||||
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"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user