Zabbix

学习手册

https://www.zabbix.com/documentation/4.0/zh/manual

1|0 安装zabbix

1、前端安装的先决条件

rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-proxy-mysql zabbix-web-mysql -y

2、安装mysql并配置

create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to 'zabbix'@'%' identified by "zabbix";
flush privileges;

3、导入数据

zcat /usr/share/doc/zabbix-server-mysql-4.4.10/create.sql.gz | mysql -u zabbix -h 192.168.88.10 -p zabbix

 4、修改配置文件

[root@localhost zabbix-server-mysql-4.4.10]# grep -E '^[^#]' /etc/zabbix/zabbix_server.conf ListenPort=10051 LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_server.pid SocketDir=/var/run/zabbix DBHost=192.168.88.10 DBName=zabbix DBUser=zabbix DBPassword=zabbix SNMPTrapperFile=/var/log/snmptrap/snmptrap.log Timeout=4 AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000

5、启动zabbix

systemctl start zabbix-server.service
systemctl enable zabbix-server.service

6、Zabbix 前端配置

取消 "date.timezone" 注释,并为其设置正确的时区 
[root@localhost zabbix-server-mysql-4.4.10]#vim /etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/Shanghai
systemctl restart zabbix-server.service
systemctl start httpd.service
systemctl enable httpd.service

访问 http://192.168.88.10/zabbix

 

 

 登录初始账号密码 Admin:zabbix

解决问题

[root@localhost ~]# zabbix_server -V zabbix_server (Zabbix) 4.4.10
rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-agent-4.4.10-1.el7.x86_64.rpm
[root@localhost ~]# grep -E '^[^#]' /etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=192.168.88.10 ListenPort=10050 ListenIP=0.0.0.0 ServerActive=127.0.0.1 Hostname=test-10 Include=/etc/zabbix/zabbix_agentd.d/*.conf
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service

修改主机ip

更新后等待几分钟

 

结果

 

2|0 监控

2|11、监控test-20,在test-20安装agent

[root@test-20 src]# rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-agent-4.4.10-1.el7.x86_64.rpm

2|22、修改配置文件填写zabbix服务器的ip然后启动agent

[root@test-20 src]# grep -E '^[^#]' /etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=192.168.88.10 ListenPort=10050 ListenIP=0.0.0.0 ServerActive=192.168.88.10 Hostname=test-20 Include=/etc/zabbix/zabbix_agentd.d/*.conf
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service

2|33、点击配置-主机,创建主机

2|44、选择-添加-更新模板

 

2|5 5、监控客户端httpd是否存活

[root@localhost ~]# vim /etc/zabbix/zabbix_agentd.d/key.conf UserParameter=port.status[*],ss -an | grep -w $1
systemctl restart zabbix-agent.service

2|6 6、设置映射值

 

2|7 7、添加监控项

2|8 8、添加触发器

2|9 9、添加邮箱

 登录qq邮箱设置

 复制授权码

把授权码粘贴到密码

 选择用户添加报警媒介

 选择发给那个邮箱

修改报警信息

 

启用

 测试

 

 

2|1010、设置动作

在客户端修改配置,允许远程执行命令

[root@localhost ~]# vim /etc/zabbix/zabbix_agentd.conf EnableRemoteCommands=1

提高客户端zabbix用户的权限

[root@localhost ~]# visudo zabbix ALL=(ALL) NOPASSWD: ALL
systemctl restart zabbix-agent.service

设置动作为尝试重启后发送邮件

 

 

 测试

 故障自动解决

3|0 Web检测

 

 

 

 

 

4|0 自动注册+主动模式

设置监控项为主动模式,应先全克隆模板

 

 

 

 

 自动注册

修改test-20配置文件

[root@test-20 promethus]# grep -E '^[^#]' /etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=192.168.88.30 ListenPort=10050 ListenIP=0.0.0.0 ServerActive=192.168.88.30 Hostname=test-20 Include=/etc/zabbix/zabbix_agentd.d/*.conf
systemctl restart zabbix-agent.service

 

 

 

 

 仍然可以获取数据

 


__EOF__

本文作者panda-wei
本文链接https://www.cnblogs.com/panda-wei/p/16789346.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   kivtx  阅读(110)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示