Skip to content

Commit 0b65677

Browse files
committed
return CRITICAL instead of UNKNOWN when check-redis reachable subcommand is failed.
1 parent 3f1aff0 commit 0b65677

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

check-redis/lib/check-redis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func checkReachable(args []string) *checkers.Checker {
139139

140140
c, info, err := connectRedisGetInfo(opts)
141141
if err != nil {
142-
return checkers.Unknown(err.Error())
142+
return checkers.Critical(err.Error())
143143
}
144144
defer c.Close()
145145

check-redis/test.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ password=passpass
2020
port=16379
2121
image=redis:5
2222

23+
RET=$($plugin reachable --port $port --password $password)
24+
# check-redis should return CRITICAL (exit code 2) when the server is unreachable
25+
if [ $? -ne 2 ]; then
26+
echo "$prog: $plugin returned $? (2 is expected)" >&2
27+
exit 2
28+
fi
29+
echo "$RET"
30+
2331
docker run --name "test-$plugin" -p "$port:6379" -d "$image" --requirepass "$password"
2432
trap 'docker stop test-$plugin; docker rm test-$plugin; exit' EXIT
2533
sleep 10

0 commit comments

Comments
 (0)