prometheus.exporter.redis
The prometheus.exporter.redis component embeds the redis_exporter to collect metrics from a Redis database.
You can specify multiple prometheus.exporter.redis components by giving them different labels.
Usage
prometheus.exporter.redis "<LABEL>" {
redis_addr = "<REDIS_ADDRESS>"
}Arguments
You can use the following arguments with prometheus.exporter.redis:
The redis_addr argument accepts a host and port, such as localhost:6379, or a URI with one of the following schemes:
redis://: Connects without TLS. This is the default when you omit the scheme.rediss://: Connects with TLS.valkey://: Equivalent toredis://.valkeys://: Equivalent torediss://.
Caution
The exporter enables TLS only when
redis_addrstarts withrediss://orvalkeys://. Thetls_ca_cert_file,tls_client_cert_file,tls_client_key_file, andskip_tls_verificationarguments have no effect on a connection that uses any other scheme.
You can supply the Redis password with redis_password, redis_password_file, or redis_password_map_file.
Set only one of redis_password_file and redis_password_map_file.
If you set both of them, the component fails with an invalid configuration error.
You can set redis_password together with one of the file arguments.
If you set redis_password_file, the component uses the password from that file and ignores redis_password.
If you set redis_password_map_file, the component ignores redis_password only for the addresses that the file maps.
Set tls_client_cert_file and tls_client_key_file together.
If you set only one of them, the component fails with an invalid configuration error.
If you don’t set tls_ca_cert_file, the component verifies the Redis server certificate against the system CA certificates.
If you don’t set check_key_groups, the component creates no key groups.
The check_key_groups_batch_size argument name reflects key groups for backwards compatibility, but applies to both key and key groups.
The component aggregates any leftover key groups beyond max_distinct_key_groups into the overflow bucket.
Set is_cluster to true when you connect to a Redis cluster and use check_keys or check_single_keys.
The script_path argument accepts a comma-separated string of paths, but use script_paths when you have multiple Lua scripts.
Set either script_path or script_paths, not both.
If you set both, the component fails with an invalid configuration error.
Note
Setting
export_client_portincreases the cardinality of all Redis metrics.
The component sets the instance label on its exported targets to the value of redis_addr.
Blocks
The prometheus.exporter.redis component doesn’t support any blocks. You can configure this component with arguments.
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 doesn’t expose any component-specific debug information.
Debug metrics
prometheus.exporter.redis doesn’t 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 Prometheusremote_writecompatible server to send metrics to.<USERNAME>: The username to use for authentication to theremote_writeAPI.<PASSWORD>: The password to use for authentication to theremote_writeAPI.
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.


