Valkey support as well as redis?

Redis is no longer opensource and has been forked/replaced by valkey (in terms of opensource). Valkey is largely a dropin replacement, but checkmk no longer recognises it. Redis/Valkey is a widely used component so I’m surprised to not see any search hits in this forum about it - has anyone got this working or done any work in this space?

1 Like

If it is a real drop-in replacement then you only need to look at this agent script.

and check if it is also working with your Valkey instance.
Or you can post the needed changes.

OK so it’s just the hardcoded process name that is the problem. I added a new REDIS_PROCNAME config variable and adapted mk_redis to use this variable and it then works as expected.

main() {
    set -e -o pipefail

    REDIS_INSTANCES=()
    IS_DETECTED=false

    load_config

    if [[ "${REDIS_PROCNAME}" ]]; then
        PROCNAME="${REDIS_PROCNAME}"
    else
        PROCNAME="redis-server"
    fi

    # if no servers in config file, try to detect
    if [ ${#REDIS_INSTANCES[@]} -eq 0 ]; then
        IS_DETECTED=true
        # find instances and remove entries like "*:6879", possible with docker container
        DETECTED=$(pgrep -xa "${PROCNAME}" 2>/dev/null | awk '/:[0-9]+/ && !/\*/ || /unixsocket:.*/ { print $3 }')

… etc

1 Like

in /etc/check_mk/mk_redis.cfg:

REDIS_PROCNAME="valkey-server"

You may also need to change from redis-cli to valkey-cli (or create a symlink for the cli to work with mk_redis script)

I tried to improve mk_redis in PR #860. We’ll see what will happen.

@martin.hirschvogel Maybe you can tell us if modifying the redis plugin is the right approach. This mimics how the MySQL plugin is handling MariaDB. An alternative would be copying the redis plugin and rename redis to valkey.

1 Like

Given that Valkey and Redis will eventually diverge, I would recommend to create a dedicated agent plug-in.
Otherwise changes at Valkey will impact Redis visa versa. See: 15336 FIX Add support for MariaDB 11 · Checkmk/checkmk@7ed5059 · GitHub
Creates a lot of special case handling eventually if you keep that the same.
That’s how I would do this from a long term perspective.

For your own need, you can just do as you wish.

2 Likes

If we make a separate plugin for Valkey - because it is so close to Redis - should this still be a PR for inclusion in Checkmk or should this be in its own and live in Checkmk exchange?

1 Like

I would put it into the Exchange.
A new plug-in requires implementing the entire testing as well, so that we can guarantee that the plug-in really works now and in the future.
That is beyond a typical pull request and only done for special cases (Hyper-V, Redfish, Nutanix).

2 Likes

I’ve started to fork out the Redis check to a standalone Valkey plugin: checkmk-extensions/valkey/src at valkey · mayrstefan/checkmk-extensions · GitHub

Now I’m missing two files which are not part of the open source version:

  • The bakery plugin
  • The ruleset for the bakery

I have access to an Enterprise Edition and had a look into it. The headers reference the Checkmk Enterprise License and terms and conditions in COPYING. The licenses in share/doc/check_mk/COPYING and share/doc/COPYING are two slighty different GPL v2 licenses. Is the current Checkmk Enterprise License bundled in the installation? I’ve only found https://checkmk.com/application/files/3916/8492/8084/Checkmk_EULA_EnterpriseStandard_EnterpriseManagedServices_EN_2023-05-22.pdf. From my understand I could copy and modify files under this license but I guess I’m not allowed to redistribute it.

Can Checkmk provide those two files under a GPL license so that we can adapt them for Valkey?

Should we recreate those files from scratch? I’m not very comfortable with that because at the end most of it is some sort of data structure and they will be something like ~95% similar

1 Like

Good point - my perspective: the individual bakery plugins probably don’t need the Enterprise license. Just the part which handles these plugins, the bakery, would have to be in the Enterprise license.

I will check with our legal team.