网站建设资讯

NEWS

网站建设资讯

CentOS7.7yum方式安装配置Zabbix4.0LTS详解(九)

十一、使用Zabbix Proxy模式添加Linux主机:

站在用户的角度思考问题,与客户深入沟通,找到香洲网站设计与香洲网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都做网站、网站制作、企业官网、英文网站、手机端网站、网站推广、域名申请、虚拟空间、企业邮箱。业务覆盖香洲地区。

1、Zabbix Proxy分布式监控简单说明:

Zabbix Proxy收集各个Zabbix Agent的数据,并将收集到的数据统一汇报给Zabbix Server

2、sh-proxy节点部署和zabbix-server节点一致的MySQL 5.7

3、sh-proxy节点创建zabbix_proxy数据库和'zbxproxy'@'192.168.0.%'用户,并授权'zbxproxy'@'192.168.0.%'用户远程管理:

# mysql -uroot -p

mysql> create database zabbix_proxy character set utf8 collate utf8_bin;

mysql> create user 'zbxproxy'@'192.168.0.%' identified by '123456';

mysql> grant all on zabbix_proxy.* to 'zbxproxy'@'192.168.0.%';

mysql> flush privileges;

4、sh-proxy节点安装zabbix-proxy-mysql软件包:# yum -y install zabbix-proxy-mysql

5、sh-proxy节点导入schema.sql文件,初始化zabbix_proxy数据库:

# zcat /usr/share/doc/zabbix-proxy-mysql-4.0.14/schema.sql.gz | mysql -uzbxproxy -h292.168.0.121 -p zabbix_proxy

6、sh-proxy节点修改zabbix_proxy.conf配置文件:

# cd /etc/zabbix

# cp zabbix_proxy.conf{,.bak}

# vim zabbix_proxy.conf

修改前

修改后

# ProxyMode=0

ProxyMode=0

Server=127.0.0.1

Server=192.168.0.120

# ServerPort=10051

ServerPort=10051

Hostname=Zabbix proxy

Hostname=sh-proxy

# ListenPort=10051

ListenPort=10051

# LogType=file

LogType=file

LogFile=/var/log/zabbix/zabbix_proxy.log

保持默认

# DBHost=localhost

DBHost=192.168.0.121

DBName=zabbix_proxy

保持默认

DBUser=zabbix

DBUser=zbxproxy

# DBPassword=

DBPassword=123456

# DBSocket=

DBSocket=/var/lib/mysql/mysql.sock

# DBPort=

DBPort=3306

# HeartbeatFrequency=60

HeartbeatFrequency=60

# ConfigFrequency=3600

ConfigFrequency=3600

# DataSenderFrequency=1

DataSenderFrequency=1

# ListenIP=0.0.0.0

ListenIP=192.168.0.121

ExternalScripts=/usr/lib/zabbix/externalscripts

保持默认

# AllowRoot=0

AllowRoot=0

# User=zabbix

User=zabbix

7、sh-proxy节点启动Zabbix Proxy:

# systemctl start zabbix-proxy

# systemctl status zabbix-proxy

# ps aux | grep zabbix_proxy

# ss -tunlp | grep -w 10051

# tail -100 /var/log/zabbix/zabbix_proxy.log

8、配置开机自启:# systemctl enable zabbix-proxy

9、node-122节点修改zabbix_agentd.conf配置文件,将参数Server和ServerActive的值修改为sh-proxy节点所对应的IP:

# vim /etc/zabbix/zabbix_agentd.conf

修改前

修改后

PidFile=/var/run/zabbix/zabbix_agentd.pid

保持默认

# LogType=file

LogType=file

LogFile=/var/log/zabbix/zabbix_agentd.log

保持默认

LogFileSize=0

保持默认

# EnableRemoteCommands=0

EnableRemoteCommands=1

Server=127.0.0.1

Server=192.168.0.121

# ListenPort=10050

ListenPort=10050

# ListenIP=0.0.0.0

ListenIP=192.168.0.122

ServerActive=127.0.0.1

ServerActive=192.168.0.121

Hostname=Zabbix server

Hostname=node-122

# AllowRoot=0

AllowRoot=0

# User=zabbix

User=zabbix

Include=/etc/zabbix/zabbix_agentd.d/*.conf

保持默认

# UnsafeUserParameters=0

UnsafeUserParameters=1

10、node-122节点重启Zabbix Agent:# systemctl restart zabbix-agent

11、sh-proxy节点重启Zabbix Proxy:# systemctl restart zabbix-proxy

12、sh-proxy节点使用zabbix-get进行取值测试:

# yum -y install zabbix-get

# zabbix_get -s 192.168.0.122 -k system.uname

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

13、Zabbix Web新增proxy:

Administration --> Proxies --> Create proxy --> Add

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

14、Zabbix Web修改node-122节点“Monitored by proxy”的值为sh-proxy:

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

15、查看node-122节点最新监控数据:

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

16、sh-proxy节点安装zabbix-agent软件包:# yum -y install zabbix-agent

17、sh-proxy节点修改zabbix_agentd.conf配置文件:

# cd /etc/zabbix

# cp zabbix_agentd.conf{,.bak}

# vim zabbix_agentd.conf

修改前

修改后

PidFile=/var/run/zabbix/zabbix_agentd.pid

保持默认

# LogType=file

LogType=file

LogFile=/var/log/zabbix/zabbix_agentd.log

保持默认

LogFileSize=0

保持默认

# EnableRemoteCommands=0

EnableRemoteCommands=1

Server=127.0.0.1

Server=192.168.0.121

# ListenPort=10050

ListenPort=10050

# ListenIP=0.0.0.0

ListenIP=192.168.0.121

ServerActive=127.0.0.1

ServerActive=192.168.0.121

Hostname=Zabbix server

Hostname=sh-proxy

# AllowRoot=0

AllowRoot=0

# User=zabbix

User=zabbix

Include=/etc/zabbix/zabbix_agentd.d/*.conf

保持默认

# UnsafeUserParameters=0

UnsafeUserParameters=1

说明:Server和ServerActive参数中配置的不是Zabbix Server的IP,而是Zabbix Proxy自己的IP

18、sh-proxy节点启动Zabbix Agent:

# systemctl start zabbix-agent

# systemctl status zabbix-agent

# ps aux | grep zabbix_agent

# ss -tunlp | grep -w 10050

# tail -100 /var/log/zabbix/zabbix_agentd.log

19、配置开机自启:# systemctl enable zabbix-agent

20、sh-proxy节点重启Zabbix Proxy:# systemctl restart zabbix-proxy

21、Zabbix Web添加sh-proxy节点:

Configuration --> Hosts --> Create host --> Add

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

22、sh-proxy节点链接Linux监控模板:

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

23、查看sh-proxy节点最新监控数据:

CentOS 7.7 yum方式安装配置Zabbix 4.0 LTS详解(九)

 

 


本文题目:CentOS7.7yum方式安装配置Zabbix4.0LTS详解(九)
浏览路径:http://njwzjz.com/article/ipeods.html