以下Linux所有操作均在被监控主机上
被监控主机开放10050端口
[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 10050 -j ACCEPT
[root@localhost ~]# /etc/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@localhost ~]# service iptables restart
上传zabbix-4.4.4.tar.gz源码包到被监控主机
[root@localhost ~]# tar -zxvf zabbix-4.4.4.tar.gz
#创建zabbix用户和组
[root@localhost ~]# cd zabbix-4.4.4/
[root@localhost zabbix-4.4.4]# groupadd zabbix
[root@localhost zabbix-4.4.4]# useradd zabbix -g zabbix -M -s /sbin/nologin
[root@localhost zabbix-4.4.4]# id zabbix #查看用户和组
uid=500(zabbix) gid=501(zabbix) groups=501(zabbix)
指定zabbix被监控端zabbix-agent并按中央处理器核心数进行安装
[root@localhost zabbix-4.4.4]# yum -y install pcre pcre-devel gcc gcc-c++ #安装依赖包
[root@localhost zabbix-4.4.4]# ./configure --prefix=/usr/local/zabbix --enable-agent
[root@localhost zabbix-4.4.4]# make -j `cat /proc/cpuinfo | grep "physical id" | uniq | wc -l` && make install
拷贝启动脚本到系统服务
[root@localhost zabbix-4.4.4]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
查看系统是否有zabbix端口
[root@localhost zabbix-4.4.4]# cat /etc/services | grep -i zabbix
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
修改zabbix-agent配置文件指定监控服务器地址,主机名称,是否开启自定义监控
[root@localhost zabbix-4.4.4]# vim /usr/local/zabbix/etc/zabbix_agentd.conf
94 Server=xxx.xxx.xxx.xxx #zabbix服务器IP
135 ServerActive=xxx.xxx.xxx.xxx #zabbix服务器IP
146 Hostname=zabbixA
303 UnsafeUserParameters=1
修改启动脚本
[root@localhost zabbix-4.4.4]# vim /etc/init.d/zabbix_agentd
22 BASEDIR=/usr/local/zabbix
启动zabbix-agent
[root@localhost zabbix-4.4.4]# /etc/init.d/zabbix_agentd start
Reloading systemd: [ 确定 ]
Starting zabbix_agentd (via systemctl): [ 确定 ]
[root@localhost zabbix-4.4.4]# netstat -nutpl|grep zabbix
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 13069/zabbix_agentd
zabbix服务器端监控web页面选择创建主机,添加需要监控的主机添加监控模板:点击添加按钮选择模板后点击更新按钮