Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return CRITICAL instead of UNKNOWN when check-redis reachable is failed #865

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion check-redis/lib/check-redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func checkReachable(args []string) *checkers.Checker {

c, info, err := connectRedisGetInfo(opts)
if err != nil {
return checkers.Unknown(err.Error())
return checkers.Critical(err.Error())
}
defer c.Close()

Expand Down
8 changes: 8 additions & 0 deletions check-redis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ password=passpass
port=16379
image=redis:5

RET=$($plugin reachable --port $port --password $password)
# check-redis should return CRITICAL (exit code 2) when the server is unreachable
if [ $? -ne 2 ]; then
echo "$prog: $plugin returned $? (2 is expected)" >&2
exit 2
fi
echo "$RET"

docker run --name "test-$plugin" -p "$port:6379" -d "$image" --requirepass "$password"
trap 'docker stop test-$plugin; docker rm test-$plugin; exit' EXIT
sleep 10
Expand Down