首先确保Redis主机能通过 127.0.0.1:6379 连接到redis。因为目前的zabbix agent 2有BUG,无法支持连接 127.0.0.1:6379 以外的其他URI。
# ./redis-cli
127.0.0.1:6379> info
# Server
redis_version:5.0.13
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:6f9b8c6240f5565d
redis_mode:standalone
os:Linux 3.10.0-1062.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:4.8.5
process_id:4463
run_id:89aa4506c59cc36099f8f35a494e5b6294bd8aee
tcp_port:6379
uptime_in_seconds:9
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:3109087
executable:/usr/local/redis/src/./redis-server
config_file:/usr/local/redis/redis.conf
...
安装并配置zabbix agent 2,不是zabbix agent!
# yum list zabbix*agent*
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
已安装的软件包
zabbix-agent.x86_64 5.0.14-1.el7 @zabbix
zabbix-agent2.x86_64 5.0.15-1.el7 @zabbix
可安装的软件包
zabbix-agent.x86_64 5.0.15-1.el7 zabbix
根据实际情况修改/etc/zabbix/zabbix_agent2.conf
...
Server=127.0.0.1,192.168.198.0/24
...
ServerActive=127.0.0.1,192.168.198.0/24
...
Hostname=192.168.198.144
...
启动zabbix agent 2
# systemctl status zabbix-agent2.service
● zabbix-agent2.service - Zabbix Agent 2
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent2.service; disabled; vendor preset: disabled)
Active: active (running) since 三 2021-09-01 20:19:00 CST; 23min ago
Process: 4373 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=1/FAILURE)
Main PID: 4383 (zabbix_agent2)
Tasks: 8
CGroup: /system.slice/zabbix-agent2.service
└─4383 /usr/sbin/zabbix_agent2 -c /etc/zabbix/zabbix_agent2.conf
9月 01 20:19:00 bogon systemd[1]: zabbix-agent2.service holdoff time over, scheduling restart.
9月 01 20:19:00 bogon systemd[1]: Stopped Zabbix Agent 2.
9月 01 20:19:00 bogon systemd[1]: Started Zabbix Agent 2.
9月 01 20:19:00 bogon zabbix_agent2[4383]: Starting Zabbix Agent 2 [192.168.198.144]. (5.0.15)
9月 01 20:19:00 bogon zabbix_agent2[4383]: Press Ctrl+C to exit.
在zabbix server侧使用zabbix_get进行测试
# zabbix_get -s 192.168.198.144 -k redis.ping
1
zabbix server侧进行主机配置
稍等片刻,出现最新数据
[1].Zabbix LLC. Zabbix + Redis[EB/OL]. [2021-09-01]. https://www.zabbix.com/cn/integrations/redis.
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/zsx0728/article/details/120048264
内容来源于网络,如有侵权,请联系作者删除!