Zabbix 企业级应用
一、配置zabbix自动发现
- 发现那些正在运行Zabbix代理的主机
- 每10分钟运行一次发现
- 添加主机以监视主机正常运行时间是否超过1小时
- 如果主机停机时间超过24小时,则删除主机
- 将Linux主机添加到“ Linux服务器”组
- 将Windows主机添加到“ Windows服务器”组
- 针对Linux主机使用Template OS Linux
- 针对Windows主机使用Template OS Windows
1. 配置Zabbix自动发现
$ rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
$ yum install -y zabbix-agent
$ vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.119.128
ServerActive=192.168.119.128
Hostname=test01
$ firewall-cmd --add-service=zabbix-agent --permanent
$ firewall-cmd --reload
2. 配置自动发现
2.1 配置自动发现规则
![](https://img-blog.csdnimg.cn/img_convert/9ed73a7d849a498f2052ad557fcde754.png)
2.2. 配置动作及操作(Linux)
![](https://img-blog.csdnimg.cn/img_convert/8bee8b21873f02daddc1e842a094e5f9.png)
![](https://img-blog.csdnimg.cn/img_convert/f3098e6e144c4849cfad194a773d3ca1.png)
2.5 配置动作及操作(Windows)
![](https://img-blog.csdnimg.cn/img_convert/efd1b14e0071f1769bd63c91822490b1.png)
![](https://img-blog.csdnimg.cn/img_convert/6008d2c14a6560ed57fd12645ce6aed3.png)
![](https://img-blog.csdnimg.cn/img_convert/76d09b1cfcd25c389415dca4f29387a1.png)
2.4 查看结果
![](https://img-blog.csdnimg.cn/img_convert/8cdb6b72b34ae8afcbd0795ec44a6491.png)
3. 自动删除主机
![](https://img-blog.csdnimg.cn/img_convert/3acbe3534492ecbc472064fc4da3c2b6.png)
![](https://img-blog.csdnimg.cn/img_convert/a7c487bcbbf5e65c929234847b2a0e79.png)
二、配置zabbix agent以主动模式工作,并被zabbix server监控
1. zabbix agent端主动模式配置
$ grep -v '^#' /etc/zabbix/zabbix_agentd.conf | grep -v '^$'
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.119.128
StartAgents=0
ServerActive=192.168.119.128
Hostname=active-agent
Include=/etc/zabbix/zabbix_agentd.d/*.conf
$ systemctl restart zabbix-agent.service
$ netstat -antp | grep agent
$ netstat -antp | grep 10050
2. 添加主动模式主机
![](https://img-blog.csdnimg.cn/img_convert/2b92ee9d86dd69630d071a8cc51677ee.png)
3. 选择主动模式模板
![](https://img-blog.csdnimg.cn/img_convert/a48f7752329a2f77dda8fa01f77779be.png)
4. 监控数据
![](https://img-blog.csdnimg.cn/img_convert/1cae1450e69f69c308aed0afca39a6b5.png)