Promethues:监控Redis
Redis Metrics Exporter:https://github.com/oliver006/redis_exporter
下载
下载地址:https://github.com/oliver006/redis_exporter/releases
1 | mkdir -p /monitor/exporter |
配置
配置如图,支持监控多个Redis实例:
1 | scrape_configs: |
配置说明:
Name | Environment Variable Name | Description |
---|---|---|
redis.addr | REDIS_ADDR | Address of the Redis instance, defaults to redis://localhost:6379 . |
redis.user | REDIS_USER | User name to use for authentication (Redis ACL for Redis 6.0 and newer). |
redis.password | REDIS_PASSWORD | Password of the Redis instance, defaults to "" (no password). |
check-keys | REDIS_EXPORTER_CHECK_KEYS | Comma separated list of key patterns to export value and length/size, eg: db3=user_count will export key user_count from db 3 . db defaults to 0 if omitted. The key patterns specified with this flag will be found using SCAN. Use this option if you need glob pattern matching; check-single-keys is faster for non-pattern keys. Warning: using --check-keys to match a very large number of keys can slow down the exporter to the point where it doesn’t finish scraping the redis instance. |
check-single-keys | REDIS_EXPORTER_CHECK_SINGLE_KEYS | Comma separated list of keys to export value and length/size, eg: db3=user_count will export key user_count from db 3 . db defaults to 0 if omitted. The keys specified with this flag will be looked up directly without any glob pattern matching. Use this option if you don’t need glob pattern matching; it is faster than check-keys . |
check-streams | REDIS_EXPORTER_CHECK_STREAMS | Comma separated list of stream-patterns to export info about streams, groups and consumers. Syntax is the same as check-keys . |
check-single-streams | REDIS_EXPORTER_CHECK_SINGLE_STREAMS | Comma separated list of streams to export info about streams, groups and consumers. The streams specified with this flag will be looked up directly without any glob pattern matching. Use this option if you don’t need glob pattern matching; it is faster than check-streams . |
script | REDIS_EXPORTER_SCRIPT | Path to Redis Lua script for gathering extra metrics. |
debug | REDIS_EXPORTER_DEBUG | Verbose debug output |
log-format | REDIS_EXPORTER_LOG_FORMAT | Log format, valid options are txt (default) and json . |
namespace | REDIS_EXPORTER_NAMESPACE | Namespace for the metrics, defaults to redis . |
connection-timeout | REDIS_EXPORTER_CONNECTION_TIMEOUT | Timeout for connection to Redis instance, defaults to “15s” (in Golang duration format) |
web.listen-address | REDIS_EXPORTER_WEB_LISTEN_ADDRESS | Address to listen on for web interface and telemetry, defaults to 0.0.0.0:9121 . |
web.telemetry-path | REDIS_EXPORTER_WEB_TELEMETRY_PATH | Path under which to expose metrics, defaults to /metrics . |
redis-only-metrics | REDIS_EXPORTER_REDIS_ONLY_METRICS | Whether to also export go runtime metrics, defaults to false. |
include-system-metrics | REDIS_EXPORTER_INCL_SYSTEM_METRICS | Whether to include system metrics like total_system_memory_bytes , defaults to false. |
ping-on-connect | REDIS_EXPORTER_PING_ON_CONNECT | Whether to ping the redis instance after connecting and record the duration as a metric, defaults to false. |
is-tile38 | REDIS_EXPORTER_IS_TILE38 | Whether to scrape Tile38 specific metrics, defaults to false. |
export-client-list | REDIS_EXPORTER_EXPORT_CLIENT_LIST | Whether to scrape Client List specific metrics, defaults to false. |
skip-tls-verification | REDIS_EXPORTER_SKIP_TLS_VERIFICATION | Whether to to skip TLS verification |
tls-client-key-file | REDIS_EXPORTER_TLS_CLIENT_KEY_FILE | Name of the client key file (including full path) if the server requires TLS client authentication |
tls-client-cert-file | REDIS_EXPORTER_TLS_CLIENT_CERT_FILE | Name the client cert file (including full path) if the server requires TLS client authentication |
tls-server-key-file | REDIS_EXPORTER_TLS_SERVER_KEY_FILE | Name of the server key file (including full path) if the web interface and telemetry should use TLS |
tls-server-cert-file | REDIS_EXPORTER_TLS_SERVER_CERT_FILE | Name of the server certificate file (including full path) if the web interface and telemetry should use TLS |
tls-ca-cert-file | REDIS_EXPORTER_TLS_CA_CERT_FILE | Name of the CA certificate file (including full path) if the server requires TLS client authentication |
set-client-name | REDIS_EXPORTER_SET_CLIENT_NAME | Whether to set client name to redis_exporter, defaults to true. |
启动
1 | # 无密码 |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 时间之旅!
评论