Hello,
my Redis setup only has the socket /run/redis/redis-server.sock, but the agent gives an error because the ‘-’ character is not valid in Bash variable names:
/usr/lib/check_mk_agent/plugins/mk_redis: line 92: declare: `REDIS_HOST_unixsocket__run_redis_redis-server_sock=/run/redis/redis-server.sock’: not a valid identifier
This small patch fixes the problem:
--- /usr/lib/check_mk_agent/plugins/mk_redis.orig 2025-04-03 14:17:56.645230643 +0200
+++ /usr/lib/check_mk_agent/plugins/mk_redis 2025-04-03 14:18:07.898179820 +0200
@@ -84,7 +84,7 @@
IFS=":" read -ra parts <<<"$inst"
# dot of IP can not be used in variable names
- REDIS_NAME=$(echo "$inst" | tr ':./' '_')
+ REDIS_NAME=$(echo "$inst" | tr ':./-' '_')
# create dynamic variables
if [[ "${parts[0]}" == "unixsocket" ]]; then