centos7下怎么通过zabbix监控redis状态
这篇文章主要讲解了“centos7下怎么通过zabbix监控redis状态”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“centos7下怎么通过zabbix监控redis状态”吧!
成都创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于网站设计、成都网站设计、徽县网络推广、微信小程序定制开发、徽县网络营销、徽县企业策划、徽县品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;成都创新互联公司为所有大学生创业者提供徽县建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com
准备
先准备两台服务器,已经部署好了zabbix-sever和zabbix-agent
zabbix-server 192.168.1.70 centos7.2
zabbix-agent 192.168.1.70 centos7.2
zabbix-agent端 安装部署redis
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]#
重启zabbix-agent服务
[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状态这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
文章名称:centos7下怎么通过zabbix监控redis状态
URL标题:http://scyanting.com/article/giccod.html