Redis monitoring with Warden

In today’s post, I’ll briefly describe one of the most recent watchers responsible for the Redis monitoring. Of course, it is a part of the Warden project, therefore, all of the features such as hooks and integrations are available. Let’s not waste anymore time and start with the code examples.


 

Let me start with a classic, easiest configuration possible which may look like this:

What it does? For the connection string localhost and database id 1 it will monitor its availability by a simple heartbeat (ping).
Can we do anything more sophisticated? Certainly, we can:

In this scenario, it will run a command get test and then validate that this key contains the value test-value. For now, the subset of commands is very, very limited, only get, set, lrange are available, but there will be more added in a future (if they will be needed).

Thanks to the latest improvements, in order to add and configure the Redis watcher you can make use of one of the many available extension methods, for example:

To install the package, which is currently in the prerelease version, run the following command in the Package Manager:

As for the custom configuration, the following interfaces are available to be implemented, if you feel a need to provide your own Redis connector:

By default it uses the StackExchange.Redis library to connect to the Redis and run the commands.

If you’re interested about more technical details and available configuration, please read the wiki docs.

Leave A Comment

Your email address will not be published. Required fields are marked *