Snowflake-Labs/redis_exporter
forked from oliver006/redis_exporter
Captured source
source ↗Snowflake-Labs/redis_exporter
Description: Snowflake fork for oliver006/redis_exporter
License: MIT
Stars: 0
Forks: 0
Open issues: 0
Created: 2026-01-15T04:43:04Z
Pushed: 2026-01-26T08:29:39Z
Default branch: master
Fork: yes
Parent repository: oliver006/redis_exporter
Archived: no
README:
Prometheus Valkey & Redis Metrics Exporter

Prometheus exporter for Valkey metrics (Redis-compatible).\ Supports Valkey and Redis 2.x, 3.x, 4.x, 5.x, 6.x, and 7.x
Ukraine is still suffering from Russian aggression, please consider supporting Red Cross Ukraine with a donation.

Building and running the exporter
Build and run locally
git clone https://github.com/oliver006/redis_exporter.git cd redis_exporter go build . ./redis_exporter --version
Pre-build binaries
For pre-built binaries please take a look at the releases.
Basic Prometheus Configuration
Add a block to the scrape_configs of your prometheus.yml config file:
scrape_configs: - job_name: redis_exporter static_configs: - targets: ['>:9121']
and adjust the host name accordingly.
Kubernetes SD configurations
To have instances in the drop-down as human readable names rather than IPs, it is suggested to use instance relabelling.
For example, if the metrics are being scraped via the pod role, one could add:
- source_labels: [__meta_kubernetes_pod_name] action: replace target_label: instance regex: (.*redis.*)
as a relabel config to the corresponding scrape config. As per the regex value, only pods with "redis" in their name will be relabelled as such.
Similar approaches can be taken with other role types depending on how scrape targets are retrieved.
Prometheus Configuration to Scrape Multiple Redis Hosts
The Prometheus docs have a very informative article on how multi-target exporters are intended to work.
Run the exporter with the command line flag --redis.addr= so it won't try to access the local instance every time the /metrics endpoint is scraped. Using below config instead of the /metric endpoint the /scrape endpoint will be used by prometheus. As an example the first target will be queried with this web request: http://exporterhost:9121/scrape?target=first-redis-host:6379
scrape_configs: ## config for the multiple Redis targets that the exporter will scrape - job_name: 'redis_exporter_targets' static_configs: - targets: - redis://first-redis-host:6379 - redis://second-redis-host:6379 - redis://second-redis-host:6380 - redis://second-redis-host:6381 metrics_path: /scrape relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: >:9121 ## config for scraping the exporter itself - job_name: 'redis_exporter' static_configs: - targets: - >:9121
The Redis instances are listed under targets, the Redis exporter hostname is configured via the last relabel_config rule.\ If authentication is needed for the Redis instances then you can set the password via the --redis.password command line option of the exporter (this means you can currently only use one password across the instances you try to scrape this way. Use several exporters if this is a problem). \ You can also use a json file to supply multiple targets by using file_sd_configs like so:
scrape_configs: - job_name: 'redis_exporter_targets' file_sd_configs: - files: - targets-redis-instances.json metrics_path: /scrape relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: >:9121 ## config for scraping the exporter itself - job_name: 'redis_exporter' static_configs: - targets: - >:9121
The targets-redis-instances.json should look something like this:
[
{
"targets": [ "redis://redis-host-01:6379", "redis://redis-host-02:6379"],
"labels": { }
}
]Prometheus uses file watches and all changes to the json file are applied immediately.
Prometheus Configuration to Scrape All Nodes in a Redis Cluster
When using a Redis Cluster, the exporter provides a discovery endpoint that can be used to discover all nodes in the cluster. To use this feature, the exporter must be started with the --is-cluster flag.\ The discovery endpoint is available at /discover-cluster-nodes and can be used in the Prometheus configuration like this:
scrape_configs: - job_name: 'redis_exporter_cluster_nodes' http_sd_configs: - url: http://>:9121/discover-cluster-nodes refresh_interval: 10m metrics_path: /scrape relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: >:9121 ## config for scraping the exporter itself - job_name: 'redis_exporter' static_configs: - targets: - >:9121
Command line flags
| Name | Environment Variable Name | Description | |-------------------------------------|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | redis.addr | REDIS_ADDR | Address of the Redis instance, defaults to redis://localhost:6379. If TLS is enabled, the address must…
Excerpt shown — open the source for the full document.
Notability
notability 1.0/10Routine fork, low impact.