search
数据采集 采集源配置 Redis 监控指标采集

Redis 监控指标采集

简介

采集 Redis 指标上报到 DataFlux 中

前置条件

配置

进入 DataKit 安装目录下的 conf.d/db 目录,复制 redis.conf.sample 并命名为 redis.conf。示例如下:

# Read Redis's basic status information
[[inputs.redis]]
  ## specify servers via a url matching:
  ##  [protocol://][:password]@address[:port]
  ##  e.g.
  ##    tcp://localhost:6379
  ##    tcp://:password@192.168.99.100
  ##
  ## If no servers are specified, then localhost is used as the host.
  ## If no port is specified, 6379 is used
  servers = ["tcp://localhost:6379"]

  ## specify server password
  # password = "s#cr@t%"

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = true

配置好后,重启 DataKit 即可生效

采集指标

redis

指标 描述 类型 单位 Tag
keyspace_hitrate float number port, server, replication_role
rdb_last_save_time_elapsed int seconds port, server, replication_role

Server

指标 描述 类型 单位 Tag
uptime 正常运行时间 int seconds port, server,replication_role
lru_clock int number port, server,replication_role
redis_version redis版本 string - port, server,replication_role

Clients

指标 描述 类型 单位 Tag
clients 客户 int number port, server,replication_role
client_longest_output_list 客户最长输出列表 int number port, server,replication_role
client_biggest_input_buf 客户最大输入缓存 int number port, server,replication_role
blocked_clients int number port, server,replication_role

Memory

指标 描述 类型 单位 Tag
used_memory 已使用内存 int bytes port, server,replication_role
used_memory_rss int bytes port, server,replication_role
used_memory_peak 已用内存峰值 int bytes port, server,replication_role
total_system_memory 系统总内存 int bytes port, server,replication_role
used_memory_lua int bytes port, server,replication_role
maxmemory 最大内存 int bytes port, server,replication_role
maxmemory_policy 最大内存策略 string - port, server,replication_role
mem_fragmentation_ratio float number port, server,replication_role

Persistance

指标 描述 类型 单位 Tag
loading 加载 int flag port, server, replication_role
rdb_changes_since_last_save int number port, server, replication_role
rdb_bgsave_in_progress int flag port, server, replication_role
rdb_last_save_time int seconds port, server, replication_role
rdb_last_bgsave_status string - port, server, replication_role
rdb_last_bgsave_time_sec int seconds port, server, replication_role
rdb_current_bgsave_time_sec int seconds port, server, replication_role
aof_enabled int flag port, server, replication_role
aof_rewrite_in_progress int flag port, server, replication_role
aof_rewrite_scheduled int flag port, server, replication_role
aof_last_rewrite_time_sec int seconds port, server, replication_role
aof_current_rewrite_time_sec int seconds port, server, replication_role
aof_last_bgrewrite_status string - port, server, replication_role
aof_last_write_status string - port, server, replication_role

Stats

指标 描述 类型 单位 Tag
total_connections_received int number port, server, replication_role
total_commands_processed int number port, server, replication_role
instantaneous_ops_per_sec int number port, server, replication_role
total_net_input_bytes int bytes port, server, replication_role
total_net_output_bytes int bytes port, server, replication_role
instantaneous_input_kbps float bytes port, server, replication_role
instantaneous_output_kbps float bytes port, server, replication_role
rejected_connections int number port, server, replication_role
sync_full int number port, server, replication_role
sync_partial_ok int number port, server, replication_role
sync_partial_err int number port, server, replication_role
expired_keys int number port, server, replication_role
evicted_keys int number port, server, replication_role
keyspace_hits int number port, server, replication_role
keyspace_misses int number port, server, replication_role
pubsub_channels int number port, server, replication_role
pubsub_patterns int number port, server, replication_role
latest_fork_usec int microseconds port, server, replication_role
migrate_cached_sockets int number port, server, replication_role

Replication

指标 描述 类型 单位 Tag
connected_slaves int number port, server, replication_role
master_link_down_since_seconds int number port, server, replication_role
master_link_status string - port, server, replication_role
master_repl_offset int number port, server, replication_role
second_repl_offset int number port, server, replication_role
repl_backlog_active int number port, server, replication_role
repl_backlog_size int bytes port, server, replication_role
repl_backlog_first_byte_offset int number port, server, replication_role
repl_backlog_histlen int bytes port, server, replication_role

CPU

指标 描述 类型 单位 Tag
used_cpu_sys 系统cpu使用率 float number port, server, replication_role
used_cpu_user 用户cpu使用率 float number port, server, replication_role
used_cpu_sys_children float number port, server, replication_role
used_cpu_user_children float number port, server, replication_role

Cluster

指标 描述 类型 单位 Tag
cluster_enabled int flag port, server, replication_role

redis_keyspace

指标 描述 类型 单位 Tag
keys int number port, server, replication_role, database
expires int number port, server, replication_role, database
avg_ttl int number port, server, replication_role, database

redis_cmdstat

指标 描述 类型 单位 Tag
calls int number port, server, replication_role, command
usec int mircoseconds port, server, replication_role, command
usec_per_call float microseconds port, server, replication_role, command

redis_replication

指标 描述 类型 单位 Tag
lag int number replication_role, replica_ip, replica_port, state
offset int number replication_role, replica_ip, replica_port, state