当前位置:网站首页>Zabbix agent主动模式的实现
Zabbix agent主动模式的实现
2022-07-04 07:08:00 【一直在努力学习的菜鸟】
Zabbix agent主动模式的实现
主动模式是由zabbix agent主动向zabbix server的10051端口发起TCP连接请求。因此主动模式下必须在zabbix agent配置文件中指定zabbix server的IP或者主机名(必须可以被解析为IP地址),在连接到zabbix server之前,zabbix agent是不知道自己要采集哪些数据以及间隔多久采集一次数据的,然后在连接到zabbix server以后获取到zabbix agent的监控项和数据采集间隔时间周期,然后再根据监控项采集数据并返回给zabbix server。在主动模式下不再需要zabbix server向zabbix agent发起连接请求,因此,主动模式在一定程度上可以减轻zabbix server打开的本地随机端口和进程数,在一定程度上可以减轻zabbix server的负载压力。
环境准备
四台机器:
zabbix_agent 5.0 被动模式(已安装) Zabbix_java_gateway 5.0 (已安装) 10.0.0.7
zabbix_server 5.0(已安装) 10.0.0.17
Tomcat-8.5(已安装) 10.0.0.27
zabbix_agent 5.0 主动模式 10.0.0.37
关闭防火墙和selinux
#关闭selinux
[[email protected] ~]#sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
#关闭防火墙
[[email protected] ~]#systemctl disable --now firewalld
#重启生效
[[email protected] ~]#reboot
1. 安装zabbix rpm源
[[email protected] ~]#rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[[email protected] ~]#sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
[[email protected] ~]#yum clean all
2. 安装zabbix agent
[[email protected] ~]#yum install -y zabbix-agent
#编辑配置文件 /etc/yum.repos.d/zabbix.repo
[[email protected] ~]#vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...
3. 修改zabbix agent配置文件
[[email protected] ~]#vim /etc/zabbix/zabbix_agentd.conf
Server=10.0.0.17
ListenPort=10050
ListenIP=0.0.0.0
StartAgents=5
ServerActive=10.0.0.17 #主动模式的zabbix server地址
Hostname=10.0.0.37
Timeout=30
[[email protected] ~]#grep "^[a-Z]" /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=10.0.0.17
ListenPort=10050
ListenIP=0.0.0.0
StartAgents=5
ServerActive=10.0.0.17
Hostname=10.0.0.37
Timeout=30
Include=/etc/zabbix/zabbix_agentd.d/*.conf
4. 启动Zabbix agent进程
#启动Zabbix agent进程,并设置开机自启
[[email protected] ~]#systemctl restart zabbix-agent.service
[[email protected] ~]#systemctl enable zabbix-agent.service
[[email protected] ~]#systemctl status zabbix-agent.service
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2022-07-02 19:12:04 CST; 18s ago
Main PID: 1755 (zabbix_agentd)
CGroup: /system.slice/zabbix-agent.service
├─1755 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─1756 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
├─1757 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─1758 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─1759 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
├─1760 /usr/sbin/zabbix_agentd: listener #4 [waiting for connection]
├─1761 /usr/sbin/zabbix_agentd: listener #5 [waiting for connection]
└─1762 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
Jul 02 19:12:04 centos7 systemd[1]: Starting Zabbix Agent...
Jul 02 19:12:04 centos7 systemd[1]: Started Zabbix Agent.
#验证Zabbix agent进程是否存在
[[email protected] ~]#ss -ntlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:10050 *:*users:(("zabbix_agentd",pid=1762,fd=4),("zabbix_agentd",pid=1761,fd=4),("zabbix_agentd",pid=1760,fd=4),("zabbix_agentd",pid=1759,fd=4),("zabbix_agentd",pid=1758,fd=4),("zabbix_agentd",pid=1757,fd=4),("zabbix_agentd",pid=1756,fd=4),("zabbix_agentd",pid=1755,fd=4))
LISTEN 0 128 *:22 *:*users:(("sshd",pid=1298,fd=3))
LISTEN 0 100 127.0.0.1:25 *:*users:(("master",pid=1461,fd=13))
LISTEN 0 128 [::]:22 [::]:*users:(("sshd",pid=1298,fd=4))
LISTEN 0 100 [::1]:25 [::]:*users:(("master",pid=1461,fd=14))
[[email protected] ~]#ps -ef | grep zabbix_agentd
zabbix 1755 1 0 19:12 ? 00:00:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
zabbix 1756 1755 0 19:12 ? 00:00:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 1757 1755 0 19:12 ? 00:00:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 1758 1755 0 19:12 ? 00:00:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 1759 1755 0 19:12 ? 00:00:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 1760 1755 0 19:12 ? 00:00:00 /usr/sbin/zabbix_agentd: listener #4 [waiting for connection]
zabbix 1761 1755 0 19:12 ? 00:00:00 /usr/sbin/zabbix_agentd: listener #5 [waiting for connection]
zabbix 1762 1755 0 19:12 ? 00:00:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 1788 1565 0 19:14 pts/0 00:00:00 grep --color=auto zabbix_agentd
5. 生成主动模式模板
点击【配置-主机-10.0.0.7-web1-克隆】
6. 验证主动模式主机状态
#【ZBX】绿色,表示主机可用,监控指标检查已成功
7. 验证主动模式主机端口
[[email protected]_server ~]#netstat -tanlp | grep 10.0.0.37
tcp 0 0 10.0.0.17:10051 10.0.0.37:43072 TIME_WAIT -
tcp 0 0 10.0.0.17:10051 10.0.0.37:43062 TIME_WAIT -
tcp 0 0 10.0.0.17:10051 10.0.0.37:43070 TIME_WAIT -
tcp 0 0 10.0.0.17:10051 10.0.0.37:43068 TIME_WAIT -
tcp 0 0 10.0.0.17:10051 10.0.0.37:43066 TIME_WAIT -
tcp 0 0 10.0.0.17:10051 10.0.0.37:43064 TIME_WAIT -
8. 验证主动模式主机数据
9.把【自动发现规则】的时间间隔改为60s
点击【配置-主机-10.0.0.37-web2-自动发现规则】
边栏推荐
- Chapter 1 programming problems
- Recursive Fusion and Deformable Spatiotemporal Attention for Video Compression Artifact Reduction
- Review of enterprise security incidents: how can enterprises do a good job in preventing source code leakage?
- Vulhub vulnerability recurrence 77_ zabbix
- Technical experts from large factories: common thinking models in architecture design
- Download address of the official website of national economic industry classification gb/t 4754-2017
- 【FPGA教程案例7】基于verilog的计数器设计与实现
- Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
- ABCD four sequential execution methods, extended application
- 【网络数据传输】基于FPGA的百兆网/兆网千UDP数据包收发系统开发,PC到FPGA
猜你喜欢
"Sword finger offer" 2nd Edition - force button brush question
Introduction to spark core components
响应式移动Web测试题
Solution of running crash caused by node error
提升复杂场景三维重建精度 | 基于PaddleSeg分割无人机遥感影像
云Redis 有什么用? 云redis怎么用?
win10微软拼音输入法输入文字时候下方不出现中文提示
Adaptive spatiotemporal fusion of multi-target networks for compressed video perception enhancement
MySQL storage engine
【Kubernetes系列】Kubernetes 上安装 KubeSphere
随机推荐
[FPGA tutorial case 7] design and implementation of counter based on Verilog
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
Deep profile data leakage prevention scheme
Finishing (III) - Exercise 2
Pangu open source: multi support and promotion, the wave of chip industry
[network data transmission] FPGA based development of 100M / Gigabit UDP packet sending and receiving system, PC to FPGA
selenium IDE插件下载安装使用教程
How notepad++ counts words
Introduction to deep learning Ann neural network parameter optimization problem (SGD, momentum, adagrad, rmsprop, Adam)
电脑通过Putty远程连接树莓派
Google Chrome Portable Google Chrome browser portable version official website download method
校园网络问题
图的底部问题
输入年份、月份,确定天数
Highly paid programmers & interview questions: how does redis of series 119 realize distributed locks?
【GF(q)+LDPC】基于二值图GF(q)域的规则LDPC编译码设计与matlab仿真
Chain ide -- the infrastructure of the metauniverse
The difference between synchronized and lock
Industrial computer anti-virus
[FPGA tutorial case 8] design and implementation of frequency divider based on Verilog