Skip to content

Commit

Permalink
Detect 308 redirect (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Napsty authored Sep 24, 2019
1 parent 784e866 commit 64d5349
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion check_rancher2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# 20190308 1.1.0 Added node(s) check #
# 20190903 1.1.1 Detect invalid hostname (non-API hostname) #
# 20190903 1.2.0 Allow self-signed certificates (-s) #
# 20190913 1.2.1 Detect additional redirect (308) #
##########################################################################################
# (Pre-)Define some fixed variables
STATE_OK=0 # define the exit code if status is OK
Expand All @@ -41,7 +42,7 @@ STATE_CRITICAL=2 # define the exit code if status is Critical
STATE_UNKNOWN=3 # define the exit code if status is Unknown
export PATH=/usr/local/bin:/usr/bin:/bin:$PATH # Set path
proto=http # Protocol to use, default is http, can be overwritten with -S parameter
version=1.2.0
version=1.2.1

# Check for necessary commands
for cmd in jshon curl [
Expand Down Expand Up @@ -118,6 +119,8 @@ elif [[ $apicheck = 301 ]]
then echo -e "CHECK_RANCHER2 UNKNOWN - Redirect detected. Maybe http to https? Use -S parameter."; exit ${STATE_UNKNOWN}
elif [[ $apicheck = 302 ]]
then echo -e "CHECK_RANCHER2 UNKNOWN - Redirect detected. Maybe http to https? Use -S parameter."; exit ${STATE_UNKNOWN}
elif [[ $apicheck = 308 ]]
then echo -e "CHECK_RANCHER2 UNKNOWN - Redirect detected. Maybe http to https? Use -S parameter."; exit ${STATE_UNKNOWN}
elif [[ $apicheck = 401 ]]
then echo -e "CHECK_RANCHER2 WARNING - Authentication failed"; exit ${STATE_WARNING}
elif [[ $apicheck -gt 499 ]]
Expand Down

0 comments on commit 64d5349

Please sign in to comment.