当前位置:网站首页>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-自动发现规则】



边栏推荐
- 抽奖系统测试报告
- 用于压缩视频感知增强的多目标网络自适应时空融合
- How notepad++ counts words
- MySQL relearn 2- Alibaba cloud server CentOS installation mysql8.0
- Set JTAG fuc invalid to normal IO port
- tars源码分析之4
- jdbc连接es查询的时候,有遇到下面这种情况的大神嘛?
- Splicing plain text into JSON strings - easy language method
- uniapp小程序分包
- 由于dms升级为了新版,我之前的sql在老版本的dms中,这种情况下,如何找回我之前的sql呢?
猜你喜欢

【网络数据传输】基于FPGA的百兆网/兆网千UDP数据包收发系统开发,PC到FPGA

Introduction to spark core components

Shopping malls, storerooms, flat display, user-defined maps can also be played like this!

MySQL relearn 2- Alibaba cloud server CentOS installation mysql8.0

"Sword finger offer" 2nd Edition - force button brush question

com. alibaba. nacos. api. exception. NacosException

Centos8 install mysql 7 unable to start up

MySQL 45 lecture learning notes (VII) line lock

Selenium driver ie common problem solving message: currently focused window has been closed
![[Valentine's day] - you can change your love and write down your lover's name](/img/ab/402872ad39f9dc58fd27dd6fc823ef.jpg)
[Valentine's day] - you can change your love and write down your lover's name
随机推荐
Research on an endogenous data security interaction protocol oriented to dual platform and dual chain architecture
Electronic Association C language level 1 35, bank interest
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
[Mori city] random talk on GIS data (I)
About how idea sets up shortcut key sets
Data double write consistency between redis and MySQL
Mobile adaptation: vw/vh
Redis - detailed explanation of cache avalanche, cache penetration and cache breakdown
大厂技术专家:架构设计中常用的思维模型
电子协会 C语言 1级 34 、分段函数
tornado项目之路由装饰器
Computer connects raspberry pie remotely through putty
There is no Chinese prompt below when inputting text in win10 Microsoft Pinyin input method
【FPGA教程案例7】基于verilog的计数器设计与实现
Flink memory model, network buffer, memory tuning, troubleshooting
【Kubernetes系列】Kubernetes 上安装 KubeSphere
同一个job有两个source就报其中一个数据库找不到,有大佬回答下吗
selenium IDE插件下载安装使用教程
Boast about Devops
A new understanding of how to encrypt industrial computers: host reinforcement application