A Python script that exports Redis Stream metrics for Prometheus monitoring. Exporter connects to one or multiple redis instances (or databases), autodiscover streams and collects metrics.
pip install -r requirements.txt
python redis-stream-exporter.py
docker run -p 9124:9124 -it --rm --name redis-stream-exporter andriik/redis-stream-exporter
docker run -it --rm --net host --name redis-stream-exporter andriik/redis-stream-exporter // host network
usage: redis-stream-exporter.py [-h] [--redis_uris REDIS_URIS] [--scan_count SCAN_COUNT] [--sleep_interval SLEEP_INTERVAL] [--http_port HTTP_PORT]
Redis Stream Metrics Exporter
options:
-h, --help show this help message and exit
--redis_uris REDIS_URIS
Comma-separated list of Redis URIs (default: redis://localhost:6379/0)
--scan_count SCAN_COUNT
Number of keys to scan for a streams, adjust accordingly to your db size (default: 1000000)
--sleep_interval SLEEP_INTERVAL
Interval in seconds between metric collections (default: 10)
--http_port HTTP_PORT
Port for the Prometheus HTTP server (default: 9124)
You can use REDIS_URIS, SCAN_COUNT, SLEEP_INTERVAL, HTTP_PORT
environment variables to configure the exporter. If an environment variable is set, it takes precedence over the corresponding command-line argument.
Inspired by chrnola/redis-streams-exporter
You can find example dashboard at id 21566