Skip to content

Commit 79881ef

Browse files
committed
Additional fixes for issue 24
1 parent 7828fcc commit 79881ef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

check_rancher2.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
# 20210210 1.4.0 Checking specific workloads and pods inside a namespace #
4545
# 20210413 1.5.0 Plugin now uses jq instead of jshon, fix cluster error check (#19) #
4646
# 20210504 1.6.0 Add usage performance data on single cluster check, fix project check #
47-
# 20210824 1.6.1 Fix cluster not found error (#24) #
47+
# 20210824 1.6.1 Fix cluster and project not found error (#24) #
4848
##########################################################################################
4949
# (Pre-)Define some fixed variables
5050
STATE_OK=0 # define the exit code if status is OK
@@ -329,11 +329,11 @@ if [[ -z $clustername ]]; then
329329

330330
else
331331

332-
# Check status of all nodes in a specific clusters
332+
# Check status of all nodes in a specific cluster
333333
api_out_nodes=$(curl -s ${selfsigned} -u "${apiuser}:${apipass}" "${proto}://${apihost}/v3/nodes/?clusterId=${clustername}")
334334

335335
# Check if that given cluster name exists
336-
if [[ -n $(echo "$api_out_nodes" | grep -i "error") ]]
336+
if [[ -n $(echo "$api_out_nodes" | grep -i "NotFound") ]]
337337
then echo "CHECK_RANCHER2 CRITICAL - Cluster $clustername not found. Hint: Use '-t info' to identify cluster and project names."; exit ${STATE_CRITICAL}
338338
fi
339339

@@ -406,7 +406,7 @@ else
406406
api_out_single_project=$(curl -s ${selfsigned} -u "${apiuser}:${apipass}" "${proto}://${apihost}/v3/project/${projectname}")
407407

408408
# Check if that given project name exists
409-
if [[ -n $(echo "$api_out_single_project" | grep -i "error") ]]
409+
if [[ -n $(echo "$api_out_single_project" | grep -i "NotFound") ]]
410410
then echo "CHECK_RANCHER2 CRITICAL - Project $projectname not found. Hint: Use '-t info' to identify cluster and project names."; exit ${STATE_CRITICAL}
411411
fi
412412

0 commit comments

Comments
 (0)