RedisKey is a lightweight Prometheus exporter that exposes numerical Redis key values (via GET key) or the number of items in the Redis list key (via LLEN key) as metrics. It connects to Redis using either a standalone host or Redis Sentinel and periodically refreshes metrics at a configurable interval.
Each Redis key you specify becomes a Prometheus gauge metric, and the exporter also provides an internal error counter to help monitor failures when fetching or parsing Redis values.
- Go >= 1.25.4
$ git clone https://github.com/flant/rediskey.git
$ cd rediskey
$ go build cmd/rediskey/main.go
$ sudo install -m 755 main /usr/local/bin/rediskeyRedisKey is configured entirely through environment variables. Below is the full list of supported variables:
| Variable | Required | Default | Description |
|---|---|---|---|
RKE_LISTEN_ADDRESS |
No | 0.0.0.0:8080 |
Address and port where RedisKey listens. |
RKE_REDIS_DB |
No | 0 |
Redis database number to connect to. |
RKE_REDIS_KEYS_GET |
No | none | Comma-separated list of Redis keys to monitor via GET. Only keys with a numerical value are supported. |
RKE_REDIS_KEYS_LLEN |
No | none | Comma-separated list of Redis keys to monitor via LLEN. |
RKE_REDIS_HOST |
No | none | Standalone Redis host and port in the format host:port. Ignored if sentinels are set. |
RKE_REDIS_PASSWORD |
No | none | Password for Redis authentication, if required. |
RKE_REDIS_SENTINELS |
No | none | Comma-separated list of Redis Sentinel addresses in the format host1:port,host2:port. |
RKE_REDIS_MASTER_NAME |
No | mymaster |
Master name for Sentinel mode. |
RKE_METRICS_PATH |
No | /metrics |
HTTP path where Prometheus metrics are exposed. |
RKE_REFRESH_INTERVAL |
No | 10 |
Interval in seconds between metric refreshes from Redis. |
These are the minimum variables needed to run RedisKey:
$ export RKE_REDIS_HOST="rfrm-redis:6379"
$ export RKE_REDIS_KEYS_GET="queue.message_id"
$ export RKE_REDIS_KEYS_LLEN="queue.waiting"$ rediskey
2025/11/28 19:11:57 Starting Redis Key Exporter...
2025/11/28 19:11:57 Listening on 0.0.0.0:8080/metrics