We have seen in one of the past articles about Redis clustering and how we can take backup and restore it. In this, we are going to see how we can monitor Redis nodes using Prometheus and Grafana. If you don’t know about Prometheus and Grafana read about it here. Now let’s see how we can do Redis monitoring using Prometheus and Grafana
We will divide this article into three phases. First, how to expose the metrics, second is where to save the time series data and the last part is how we can plot the data to make sense out of it.
How to expose Redis node metrics
For exposing the metrics you can run this Redis exporter.
You can build and run it. You can find all the configuration settings on the Github link. Once you run this you will see the metrics on the port specified. Next, we have to tell Prometheus to scrape and metrics and save it. This comes in the second section of our article.
Saving metrics in Prometheus
Now if you are aware of how Prometheus works, what it does it you give config to Prometheus about the location it has to scrape and then it does its job and scrapes and saves the data. Below are the Prometheus config required.
scrape_configs: - job_name: redis_exporter static_configs: - targets: ['<<REDIS-EXPORTER-HOSTNAME>>:9121']
Now you will be able to see the data in Prometheus.
Plotting the data
For plotting the data we are going to use Grafana. Now you can tell Grafana to use Prometheus as a data store. After that, you can use import this dashboard to plot it.
You can see here how to import Grafana dashboard
Now you should be able to see the plots on the Grafana dashboard.
This was how you can plot your Redis data to Grafana dashboard. If you like the article please share and subscribe.