[Zabbix] Redis 监控

一、客户端配置

#redis-cli -h127.0.0.1 -p 6379 info          #无密码登录查看

#redis-cli -h127.0.0.1 -p 6379-a passwordinfo   #有密码登录查看

# Server

redis_version:4.0.1

redis_git_sha1:00000000

redis_git_dirty:0

redis_build_id:da89ef6654233ba4

redis_mode:standalone

os:Linux 3.10.0-327.el7.x86_64 x86_64

arch_bits:64

multiplexing_api:epoll

atomicvar_api:atomic-builtin

gcc_version:4.8.5

process_id:15632

run_id:26f81f16d4a4dcc67d3b2387a0caad2e9950fbe0

tcp_port:6379

uptime_in_seconds:711

uptime_in_days:0

hz:10

lru_clock:8471424

executable:/usr/local/bin/redis-server

config_file:/etc/redis/6379.conf

 

# Clients

connected_clients:1

client_longest_output_list:0

client_biggest_input_buf:0

blocked_clients:0

 

# Memory

used_memory:886300

used_memory_human:865.53K

used_memory_rss:2215936

used_memory_rss_human:2.11M

used_memory_peak:886300

used_memory_peak_human:865.53K

used_memory_peak_perc:100.00%

used_memory_overhead:884842

used_memory_startup:835212

used_memory_dataset:1458

used_memory_dataset_perc:2.85%

total_system_memory:1929613312

total_system_memory_human:1.80G

used_memory_lua:37888

used_memory_lua_human:37.00K

maxmemory:0

maxmemory_human:0B

maxmemory_policy:noeviction

mem_fragmentation_ratio:2.50

mem_allocator:libc

active_defrag_running:0

lazyfree_pending_objects:0

 

# Persistence

loading:0

rdb_changes_since_last_save:0

rdb_bgsave_in_progress:0

rdb_last_save_time:1501642937

rdb_last_bgsave_status:ok

rdb_last_bgsave_time_sec:-1

rdb_current_bgsave_time_sec:-1

rdb_last_cow_size:0

aof_enabled:0

aof_rewrite_in_progress:0

aof_rewrite_scheduled:0

aof_last_rewrite_time_sec:-1

aof_current_rewrite_time_sec:-1

aof_last_bgrewrite_status:ok

aof_last_write_status:ok

aof_last_cow_size:0

 

# Stats

total_connections_received:10

total_commands_processed:10

instantaneous_ops_per_sec:0

total_net_input_bytes:157

total_net_output_bytes:34222

instantaneous_input_kbps:0.00

instantaneous_output_kbps:0.00

rejected_connections:0

sync_full:0

sync_partial_ok:0

sync_partial_err:0

expired_keys:0

evicted_keys:0

keyspace_hits:0

keyspace_misses:0

pubsub_channels:0

pubsub_patterns:0

latest_fork_usec:0

migrate_cached_sockets:0

slave_expires_tracked_keys:0

active_defrag_hits:0

active_defrag_misses:0

active_defrag_key_hits:0

active_defrag_key_misses:0

 

# Replication

role:master

connected_slaves:0

master_replid:ab0afb86cfff91dd1b7078b602a7064f9053726e

master_replid2:0000000000000000000000000000000000000000

master_repl_offset:0

second_repl_offset:-1

repl_backlog_active:0

repl_backlog_size:1048576

repl_backlog_first_byte_offset:0

repl_backlog_histlen:0

 

# CPU

used_cpu_sys:0.99

used_cpu_user:0.56

used_cpu_sys_children:0.00

used_cpu_user_children:0.00

 

# Cluster

cluster_enabled:0

 

# Keyspace

 

 

# vi /etc/zabbix/zabbix_agentd.d/userparameter_redis.conf

UserParameter=redis_stats[*],redis-cli -h 127.0.0.1 -p $1 info|grep $2|cut -d : -f2

 

# zabbix agent端配置

# vi /etc/zabbix/zabbix_agentd.conf

PidFile=/var/run/zabbix/zabbix_agentd.pid

LogFile=/var/log/zabbix/zabbix_agentd.log

LogFileSize=0

Server=192.168.1.208

Hostname=192.168.1.208

Include=/etc/zabbix/zabbix_agentd.d/*.conf

UnsafeUserParameters=1

 

# systemctl restart zabbix-agent

 

#手动测试

zabbix_get -s 192.168.1.208 -p 10050 -k'redis_stats[6379,uptime_in_seconds]'

1208

 

 二、WEB端配置

导入模板

模板下载地址:点击打开链接

[Zabbix] Redis 监控