Zabbix工作模式
被动模式:被动模式就是由zabbix server向zabbix agent发出指令获取数据, 即zabbix agent被动的去获取数据并返回给zabbix server, zabbix server周期性的向agent 索取数据, 这种模式的最大问题就是会加大zabbix server的工作量, 在数百台服务器的环境下zabbix server不能及时获取到最新数据, 但这也是默认的工作方式。
主动模式:zabbix agent主动采集数据并返回给zabbix server, 不再需要zabbix serve进行干预, 因此主动模式在一定程度上可减轻zabbix server的压力
server端每次找agent采集数据,server还需要想一下自己要什么数据,这样就会消耗cpu,所以就让agent主动向server发送数据,server端只接收就行。
安装
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-agent-3.4.2-1.el7.x86_64.rpm
修改/etc/zabbix/zabbix_agentd.conf文件内容,实例如下
vim /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=172.16.0.71
ListenIP=0.0.0.0
StartAgents=0
ServerActive=172.16.0.71
Hostname=ceshi2
Include=/etc/zabbix/zabbix_agentd.d/*.conf
启动客户端程序
systemctl enable zabbix-agent
systemctl start zabbix-agent
克隆创建新的模板
![](https://i-blog.csdnimg.cn/blog_migrate/fac1578039a392eaa5f70e4120769582.png)
![](https://i-blog.csdnimg.cn/blog_migrate/b3b8de8adbac6a205eba33c9d03fd820.png)
![](https://i-blog.csdnimg.cn/blog_migrate/b1a510c87f8e5f41e92725310feb46db.png)
![](https://i-blog.csdnimg.cn/blog_migrate/2fed241a532a950bf4a2764649c44113.png)
更新监控项
![](https://i-blog.csdnimg.cn/blog_migrate/5ed4fbed6657d6f05157667f90e9dc66.png)
![](https://i-blog.csdnimg.cn/blog_migrate/1d3f9de8c77dc773c691e7d274761350.png)
![](https://i-blog.csdnimg.cn/blog_migrate/b0b4ed4a2f31c1635684979761da6804.png)
![](https://i-blog.csdnimg.cn/blog_migrate/ae48c28b4cdf977f721986f8b54ae270.png)
更新规则
![](https://i-blog.csdnimg.cn/blog_migrate/8d032daba401544e11939812310da2be.png)
![](https://i-blog.csdnimg.cn/blog_migrate/7fa6f8d13eff247cd1ad0f72b25827be.png)
![](https://i-blog.csdnimg.cn/blog_migrate/55bf8a609b89db497b6c6180c4c59df8.png)
更新监控项
![](https://i-blog.csdnimg.cn/blog_migrate/aac3ad5aa09a4923f925b5924d931d4a.png)
![](https://i-blog.csdnimg.cn/blog_migrate/99aa0b04a0854155a2458cd335678674.png)
![](https://i-blog.csdnimg.cn/blog_migrate/95de018df3998cf70ee04c5e304c8461.png)
![](https://i-blog.csdnimg.cn/blog_migrate/75ed89de30864164fa07748139323bea.png)
![](https://i-blog.csdnimg.cn/blog_migrate/d1f7a9fd44e7b2e44d7536bf4a31195a.png)
![](https://i-blog.csdnimg.cn/blog_migrate/0181a4b44a3a2c5e6daa0eeaf69cc52d.png)
![](https://i-blog.csdnimg.cn/blog_migrate/fbd1ff0520f390fb00c541b7f477fa88.png)
![](https://i-blog.csdnimg.cn/blog_migrate/8b0315a51b4a14efa19ac04067583c19.png)
链接模板
![](https://i-blog.csdnimg.cn/blog_migrate/9b2349804d2dbd224e60ee1664c2375b.png)
![](https://i-blog.csdnimg.cn/blog_migrate/efc9ba2150932b55a987161e10ed289f.png)
添加监控主机
![](https://i-blog.csdnimg.cn/blog_migrate/d945680b280e2b4b563fd1a03365ead5.png)
![](https://i-blog.csdnimg.cn/blog_migrate/6c387a459567f5ebe716064478ce8bad.png)
![](https://i-blog.csdnimg.cn/blog_migrate/5e5dc74c420be56dda646a35cc6f0f3c.png)
更新:
目前最新的zabbix版本为5.0,使用最新版时,不再需要自己克隆创建新的模板,zabbix自带主动模式的模板,推荐使用最新版
软件下载:
wget http://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-agent-5.0.11-1.el7.x86_64.rpm
配置文件跟旧版本一样
自带模板的名称
Template OS Linux by Zabbix agent active
注:agent端10050端口不监听,但是anegt端要能访问server端10051端口,也就是说server端的10051端口要放开
参考文献:
https://blog.csdn.net/liang_operations/article/details/81872348
https://blog.csdn.net/weixin_39845407/article/details/80764200