1.zabbix 主被动模式监控、主被动模式proxy使用

添加一个节点

# wget https://repo.zabbix.com/zabbix/4.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.2-1+bionic_all.deb
# dpkg -i zabbix-release_4.2-1+bionic_all.deb
# apt update
root@node2:~# apt -y install  zabbix-agent
root@node2:~# vim /etc/zabbix/zabbix_agentd.conf 
Server=173.22.90.17
ServerActive=173.22.90.17
Hostname=173.22.90.19
本机地址,不能写出否则数据采集不到
root@node2:~# systemctl start zabbix-agent
root@node2:~# systemctl enable zabbix-agent
添加主机

zabbix的日志

root@node2:~# tail -f /var/log/zabbix/zabbix_agentd.log

DebugLevel=3 这个是记录日志的级别的
root@zabbix:~# /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
root@node2:~# vim /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1
这种是通过主动模式采集的

添加zabbix-proxy

wget https://repo.zabbix.com/zabbix/4.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.2-1+bionic_all.deb
dpkg -i zabbix-release_4.2-1+bionic_all.deb
apt update
apt-get install zabbix-proxy-mysql

https://www.zabbix.com/documentation/4.0/manual/installation/install_from_packages/debian_ubuntu

https://www.zabbix.com/documentation/4.0/manual/appendix/install/db_scripts#mysql

创建主动模式的数据库

create database zabbix_proxy_active character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix_proxy_active.* to zabbix_proxy_active@"173.22.90.%" identified by '123456';
root@node2:~# mysql -uzabbix_proxy_active -h173.22.90.17 -p123456
MariaDB [(none)]> show databases;
+---------------------+
| Database            |
+---------------------+
| information_schema  |
| zabbix_proxy_active |
+---------------------+
root@node1:~# zcat /usr/share/zabbix-proxy-mysql/schema.sql.gz
初始化数据库
root@node1:~# zcat /usr/share/zabbix-proxy-mysql/schema.sql.gz | mysql -uzabbix_proxy_active -h 173.22.90.17 -p123456 zabbix_proxy_active


root@node2:~# vim /etc/zabbix/zabbix_proxy.conf 
ProxyMode=0
0表示主动模式
Server=173.22.90.17
服务器地址
ServerPort=10051
Hostname=Zabbix_proxy_active
代理程序名称
ListenPort=10051
SourceIP=173.22.90.19
本机地址
LogType=file
DebugLevel=3
警告级别3
EnableRemoteCommands=1
LogRemoteCommands=0
DBHost=173.22.90.17
DBName=zabbix_proxy_active
数据库名称
DBUser=zabbix_proxy_active
DBPassword=123456
ProxyLocalBuffer=720
保存多长时间的数据,最多一个月
ProxyOfflineBuffer=720
HeartbeatFrequency=120
ConfigFrequency=60
多长时间获取数据
DataSenderFrequency=60
数据发送间隔周期
StartPollers=20
JavaGateway=173.22.90.17
JavaGatewayPort=10052
StartJavaPollers=20
启动20个收集器
 ListenIP=0.0.0.0
CacheSize=128M
设置共享内存大小
建议这里一定要配置大点
StartDBSyncers=10
启动的数据库进程
CacheSize=128M
进程的内存大小
HistoryCacheSize=128M
HistoryIndexCacheSize=32M
Timeout=30
AllowRoot=0
User=zabbix
root@node2:~# grep "^[a-Z]" /etc/zabbix/zabbix_proxy.conf 
root@node2:~# systemctl start zabbix-proxy
root@node2:~# systemctl enable zabbix-proxy

image.png

root@wang:/home/wang# apt install fping -y
`
[root@docker-node3 ~]#rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
[root@docker-node3 ~]#yum install zabbix-agent -y


[root@docker-node3 ~]#vim /etc/zabbix/zabbix_agentd.conf
Server=173.22.90.17,173.22.90.13
被动模式server
ServerActive=173.22.90.19
Hostname=173.22.90.19
[root@docker-node3 ~]#systemctl restart zabbix-agent

`


image.png

image.png

你可能感兴趣的:(1.zabbix 主被动模式监控、主被动模式proxy使用)