Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
prometheus.exporter.redis
The prometheus.exporter.redis
component embeds
redis_exporter for collecting metrics from a Redis database.
Usage
prometheus.exporter.redis "LABEL" {
redis_addr = REDIS_ADDRESS
}
Arguments
The following arguments can be used to configure the exporter’s behavior. Omitted fields take their default values.
If redis_password_file
is defined, it will take precedence over redis_password
.
When check_key_groups
is not set, no key groups are made.
The check_key_groups_batch_size
argument name reflects key groups for backwards compatibility, but applies to both key and key groups.
The script_path
argument may also be specified as a comma-separated string of paths, though it is encouraged to use script_paths
when using
multiple Lua scripts.
Any leftover key groups beyond max_distinct_key_groups
are aggregated in the ‘overflow’ bucket.
The is_cluster
argument must be set to true
when connecting to a Redis cluster and using either of the check_keys
and check_single_keys
arguments.
Note that setting export_client_port
increases the cardinality of all Redis metrics.
Exported fields
The following fields are exported and can be referenced by other components.
For example, the targets
can either be passed to a discovery.relabel
component to rewrite the targets’ label sets or to a prometheus.scrape
component that collects the exposed metrics.
The exported targets use the configured in-memory traffic address specified by the run command.
Component health
prometheus.exporter.redis
is only reported as unhealthy if given
an invalid configuration. In those cases, exported fields retain their last
healthy values.
Debug information
prometheus.exporter.redis
does not expose any component-specific
debug information.
Debug metrics
prometheus.exporter.redis
does not expose any component-specific
debug metrics.
Example
This example uses a prometheus.scrape
component to collect metrics
from prometheus.exporter.redis
:
prometheus.exporter.redis "example" {
redis_addr = "localhost:6379"
}
// Configure a prometheus.scrape component to collect Redis metrics.
prometheus.scrape "demo" {
targets = prometheus.exporter.redis.example.targets
forward_to = [prometheus.remote_write.demo.receiver]
}
prometheus.remote_write "demo" {
endpoint {
url = PROMETHEUS_REMOTE_WRITE_URL
basic_auth {
username = USERNAME
password = PASSWORD
}
}
}
Replace the following:
PROMETHEUS_REMOTE_WRITE_URL
: The URL of the Prometheus remote_write-compatible server to send metrics to.USERNAME
: The username to use for authentication to the remote_write API.PASSWORD
: The password to use for authentication to the remote_write API.
Compatible components
prometheus.exporter.redis
has exports that can be consumed by the following components:
- Components that consume Targets
Note
Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.