Monitor Redis using Datadog

/ / / / / / /

This post is part 3 of a 3-part series on Redis monitoring. Part 1 explores the key metrics available in Redis, and Part 2 is about collecting those metrics on an ad-hoc basis.

To implement ongoing, meaningful monitoring, you will need a dedicated system that allows you to store, visualize, and correlate your Redis metrics with the rest of your infrastructure. You also need to be alerted when any system starts to misbehave. In this post, we will show you how to use Datadog to capture and report on all the key metrics identified in Part 1, and more.

Integrating Datadog and Redis

Verify that Redis and redis-cli are working

Before you begin, run this command on your server to verify that Redis is running properly:

    
redis-cli info | grep uptime_in_seconds
  

If you are running the command from a different host or port, add arguments to the command as follows:

    
redis-cli -h <host> -p <port> info | grep uptime_in_seconds
  

Make sure the output displays “uptime_in_seconds: ”:

    
uptime_in_seconds: 162
  

Install the Datadog Agent

The Datadog Agent is open-source software that collects and reports metrics from your different hosts so you can view, monitor, and correlate them on the Datadog platform. Installing the Agent usually requires just a single command. Installation instructions for different systems are available here.

As soon as the Datadog Agent is up and running, you should see your host reporting basic system metrics in your Datadog account.

Reporting host in Datadog

Configure the Agent

Next you will need to create a Redis configuration file for the Agent. You can find the location of the Agent configuration directory for your OS here. In that directory you will find a sample Redis config file named redisdb.yaml.example. Copy this file to redisdb.yaml. You can edit the file to change the port setting if you are running Redis on a non-default port, have multiple Redis instances running, and can include a list of tags that will be applied to every collected metric:

    
init_config:
instances:
- host: localhost
port: 6379
tags: 
instance:production
  

Save and close the file.

Restart the Agent

Restart the Agent to load your new configuration. The restart command varies somewhat by platform; see the specific commands for your platform here.

Verify the configuration settings

To check that Datadog and Redis are properly integrated, execute the Datadog info command. The command for each platform is available here.

If the configuration is correct, you will see a section like this in the info output:

    
Checks
======
   [...]

    redisdb
-------
     - instance #0 [OK] Last run duration: 0.00831699371338
     - Collected 26 metrics, 0 events & 2 service checks
  

The snippet above shows two service checks in addition to the collected metrics. For Redis, the service checks report the availability of your Redis instance, as well as on the status of the master link (when using Redis’s replication features).

Turn on the integration

Finally, click the Redis Install Integration button inside your Datadog account. The button is located under the Configuration tab in the Redis integration settings.

Redis integration installation

Metrics!

Once the Agent begins reporting Redis metrics, you will see a Redis dashboard among your list of available dashboards in Datadog.

The default Redis dashboard displays the key metrics to watch highlighted in our introduction to Redis monitoring.

default Redis dashboard

You can easily create a more comprehensive dashboard to monitor your entire web stack by adding additional graphs and metrics from your other systems. For example, you might want to graph Redis metrics alongside metrics from your NGINX web servers, or alongside host-level metrics such as network traffic. To start building a custom dashboard, clone the default Redis dashboard by clicking on the gear on the upper right of the dashboard and selecting Clone Dash.

Clone Redis dashboard

Alerting on Redis metrics

Once Datadog is capturing and visualizing your metrics, you will likely want to set up some alerts to be automatically notified of potential issues.

Datadog can monitor individual hosts, containers, services, processes—or virtually any combination thereof. For instance, you can monitor all of your Redis hosts, or all hosts in a certain availability zone, or a single key metric being reported by all hosts corresponding to a specific tag.

Conclusion

In this post we’ve walked you through integrating Redis with Datadog to visualize your key metrics and notify the right team whenever your infrastructure shows signs of trouble.

If you’ve followed along using your own Datadog account, you should now have improved visibility into what’s happening in your environment, as well as the ability to create automated alerts tailored to your infrastructure, your usage patterns, and the metrics that are most valuable to your organization.

If you don’t yet have a Datadog account, you can sign up for a and start monitoring Redis right away.


Source Markdown for this post is available on GitHub. Questions, corrections, additions, etc.? Please let us know.


Want to write articles like this one? Our team is hiring!
Monitor Redis using Datadog