您好,登錄后才能下訂單哦!
這篇文章主要講解了“centos7下怎么通過zabbix監控redis狀態”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“centos7下怎么通過zabbix監控redis狀態”吧!
先準備兩臺服務器,已經部署好了zabbix-sever和zabbix-agent
zabbix-server 192.168.1.70 centos7.2
zabbix-agent 192.168.1.70 centos7.2
redis的部署過程就不介紹了,百度一大堆 安裝好redis之后,用redis info命令查看redis信息
[root@localhost zabbix_agentd.d]# redis-cli -a ac123456 info # Server redis_version:4.0.6 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:c69914497129c95c redis_mode:standalone os:Linux 3.10.0-693.el7.x86_64 x86_64 arch_bits:64 multiplexing_api:epoll atomicvar_api:atomic-builtin gcc_version:4.8.5 process_id:16956 run_id:c9dc9487378a1dc42ee9e362c6bacae6dd8dcd3e tcp_port:6379 uptime_in_seconds:140 uptime_in_days:0 hz:10 lru_clock:14818741 executable:/usr/local/redis-4.0.6/src/redis-server config_file:/usr/local/redis-4.0.6/redis.conf # Clients connected_clients:1 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0 # Memory used_memory:885434 used_memory_human:864.68K used_memory_rss:2220032 used_memory_rss_human:2.12M used_memory_peak:935546 used_memory_peak_human:913.62K used_memory_peak_perc:94.64% used_memory_overhead:884956 used_memory_startup:835326 used_memory_dataset:478 used_memory_dataset_perc:0.95% total_system_memory:67240886272 total_system_memory_human:62.62G used_memory_lua:37888 used_memory_lua_human:37.00K maxmemory:0 maxmemory_human:0B maxmemory_policy:noeviction mem_fragmentation_ratio:2.51 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:1558322473 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:146 total_commands_processed:278 instantaneous_ops_per_sec:3 total_net_input_bytes:5916 total_net_output_bytes:371281 instantaneous_input_kbps:0.08 instantaneous_output_kbps:4.93 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:71b0ed4332fc4a6319ec9aca91bd6bd42feca56a 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.13 used_cpu_user:0.06 used_cpu_sys_children:0.00 used_cpu_user_children:0.00 # Cluster cluster_enabled:0 # Keyspace [root@localhost zabbix_agentd.d]#
參數講解 -a ac123456是指定redis密碼,如果redis沒有密碼 這個可以忽略
在zabbix-agent端創建redis監控項的配置文件
[root@localhost zabbix_agentd.d]# cat /etc/zabbix/zabbix_agentd.d/redis.conf UserParameter=redis[*],redis-cli -a ac123456 info | grep $1":" | cut -d ':' -f 2 UserParameter=redis-ping,redis-cli -a 123456 ping | grep -c PONG UserParameter=redis.version, redis-server --version | cut -d " " -f 3 | cut -d "=" -f 2 [root@localhost zabbix_agentd.d]#
[root@localhost zabbix_agentd.d]# systemctl restart zabbix-agent [root@localhost zabbix_agentd.d]#
zabbix-server端通過zabbix-get測試獲取數據
以下信息可以看出能成功的獲取redis的信息
[root@localhost zabbix_agentd.d]# zabbix_get -s 192.168.1.70 -k redis.version 4.0.6 [root@localhost zabbix_agentd.d]#
感謝各位的閱讀,以上就是“centos7下怎么通過zabbix監控redis狀態”的內容了,經過本文的學習后,相信大家對centos7下怎么通過zabbix監控redis狀態這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。