prometheus-redis-exporter
Prometheus exporter for Redis metrics
About this chart
prometheus-redis-exporter
Prometheus exporter for Redis metrics.
This chart bootstraps a Redis exporter deployment on a Kubernetes cluster using the Helm package manager.
Prerequisites
- Kubernetes 1.10+ with Beta APIs enabled
- Helm 3+
Usage
The chart is distributed as an OCI Artifact as well as via a traditional Helm Repository.
- OCI Artifact:
oci://ghcr.io/prometheus-community/charts/prometheus-redis-exporter - Helm Repository:
https://prometheus-community.github.io/helm-chartswith chartprometheus-redis-exporter
The installation instructions use the OCI registry. Refer to the [helm repo](helm repo) command documentation for information on installing charts via the traditional repository.
Install Chart
helm install [RELEASE_NAME] oci://ghcr.io/prometheus-community/charts/prometheus-redis-exporter
See helm install for command documentation.
Uninstall Chart
helm uninstall [RELEASE_NAME]
This removes all the Kubernetes components associated with the chart and deletes the release.
See helm uninstall for command documentation.
Upgrading Chart
helm upgrade [RELEASE_NAME] [CHART] --install
See helm upgrade for command documentation.
To 5.0.0
From 5.0.0 redis exporter is using the Kubernetes recommended labels. Therefore you have to delete the deployment before you upgrade.
kubectl delete deployment -l app=prometheus-redis-exporter
helm upgrade -i prometheus-redis-exporter prometheus-community/prometheus-redis-exporter
From 5.0.0 redis exporter helm chart supports multiple targets.
By enabling serviceMonitor.multipleTarget and settings the targets in serviceMonitor.targets, multiple redis instance can be scraped.
serviceMonitor:
enabled: true
multipleTarget: true
telemetryPath: /scrape
targets:
- url: redis://my-redis:6379
name: foo
- url: redis://my-redis-cluster:6379
name: bar
additionalRelabeling:
- sourceLabels: [type]
targetLabel: type
replacement: cluster
To 3.0.1
The default tag for the exporter image is now v1.x.x. This major release includes changes to the names of various metrics and no longer directly supports the configuration (and scraping) of multiple redis instances; that is now the Prometheus server's responsibility. You'll want to use this dashboard now. Please see the redis_exporter GitHub page for more details.
Configuring
See Customizing the Chart Before Installing. To see all configurable options with detailed comments, visit the chart's values.yaml, or run these configuration commands:
helm show values oci://ghcr.io/prometheus-community/charts/prometheus-redis-exporter
For more information please refer to the redis_exporter documentation.
Redis Connection
- To configure Redis connection by value set
redisAddressstring (example format:redis://myredis:6379) - To configure Redis connection by configmap set
redisAddressConfig.enabledtotrue, setredisAddressConfig.configmap.nameandredisAddressConfig.configmap.keyvalues - To configure auth by value, set
auth.enabledtotrue, andauth.redisPasswordvalue - To configure auth by secret, set
auth.secret.nameandauth.secret.keyvalues
Using a custom LUA-Script
First, you need to deploy the script with a configmap. This is an example script from mentioned in the redis_exporter-image repository
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-redis-exporter-script
data:
script: |-
-- Example collect script for -script option
-- This returns a Lua table with alternating keys and values.
-- Both keys and values must be strings, similar to a HGETALL result.
-- More info about Redis Lua scripting: https://redis.io/commands/eval
local result = {}
-- Add all keys and values from some hash in db 5
redis.call("SELECT", 5)
local r = redis.call("HGETALL", "some-hash-with-stats")
if r ~= nil then
for _,v in ipairs(r) do
table.insert(result, v) -- alternating keys and values
end
end
-- Set foo to 42
table.insert(result, "foo")
table.insert(result, "42") -- note the string, use tostring() if needed
return result
If you want to use this script for collecting metrics, you could do this by just set script.configmap to the name of the configmap (e.g. prometheus-redis-exporter-script) and script.keyname to the configmap-key holding the script (eg. script). The required variables inside the container will be set automatically.
Deploy prometheus-redis-exporter with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prometheus-redis-exporter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartprometheus-redis-exporter is pinned at v6.38.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply