Skip to main content
⏳ Estimated read time: 2 min read

Redis/ElastiCache

StackGen's [Kubernetes agent](../../Collecting Telemetry/Install the OpsVerse Agent#VEqXM) can be used to collect metrics from Redis/ElastiCache.

Kubernetes

Add the following YAML snippet to the agent's values.yaml and run the agent based on these [instructions](../../Collecting Telemetry/Install the OpsVerse Agent#VEqXM).

redis-exporter:
enabled: true
auth:
# Use password authentication
enabled: false
# Use existing secret (ignores redisPassword)
secret:
name: ""
key: ""
# Redis password (when not stored in a secret)
redisPassword: ""
# Set up PasswordFile if setting Auth for multiple endpoints
redisPasswordFile:
secret:
name: "redis-secret" # Set to "" if not using auth
key: "config" # Set to "" if not using auth

If you need to scrape multiple redis servers with authentication, create a file named authentication.txt and populate with passwords for your connection strings:

{ 
"redis://user@redis-server:17811": "password",
"redis://redis-server-2:6379": "password2"
}

To create a secret from this file, use the command kubectl create secret generic redis-secret -n devopsnow --from-file=config=authentication.txt

tip

Refer values.yaml file from Prometheus community for additional value configurations and default values.

Add the following YAML snippet to the property victoria-metrics-agent.config.extraScrapeConfigs in your values.yaml and run the agent based on these [instructions](../../Collecting Telemetry/Install the OpsVerse Agent#VEqXM).

extraScrapeConfigs:
- job_name: redis_exporter_targets
metrics_path: /scrape
relabel_configs:
- source_labels:
- __address__
target_label: __param_target
- source_labels:
- __param_target
target_label: instance
- replacement: devopsnow-agent-redis-exporter.devopsnow:9121
target_label: __address__
metric_relabel_configs:
- source_labels:
- instance-name
regex: (.+)
target_label: instance
action: replace
static_configs:
- targets:
- redis://user@redis-server:6379
labels:
instance-name: unique-redis-servername
- targets:
- redis://redis-server-2:6379

Single Machine

Alternatively, you can install the Prometheus Redis exporter on a single machine.

Prerequisite(s):

  • you have the [StackGen Agent running on the machine](../../Collecting Telemetry/Install the OpsVerse Agent#dszlx).

Run this command to install the Redis exporter as a systemd unit:

# For amd64
curl https://raw.githubusercontent.com/OpsVerseIO/installers/main/prometheus-exporters/install-exporter-amd64.sh | sudo bash -s -- -e redis

# For arm64
curl https://raw.githubusercontent.com/OpsVerseIO/installers/main/prometheus-exporters/install-exporter-arm64.sh | sudo bash -s -- -e redis
  • The agent will begin scraping the metrics automatically; the script will drop the scrape target into /etc/opsverse/targets/, so the agent will begin automatically scraping
  • If you need to update Redis connection info, after you install, you may edit /etc/systemd/system/prom-redis-exporter.service with the appropriate CLI args you want, and then restart the service:
sudo systemctl restart prom-redis-exporter