[root@agent ~]# cat /etc/hostname
agent.zabbix.com
[root@agent ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.20.10.2 server.zabbix.com
172.20.10.3 agent.zabbix.com
172.20.10.8 windows10
[root@agent ~]# ping server.zabbix.com -c 4
[root@agent ~]# nslookup www.baidu.com
源码安装zabbix
[root@agent ~]# ls
1 anaconda-ks.cfg error.txt sfz.sh 图片
1.sh caipiao.sh initial-setup-ks.cfg yum.sh 文档
2 cai.sh jia.sh zabbix-3.4.11.tar.gz 下载
[root@agent ~]# cd /etc/yum.repos.d/
[root@agent yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[root@agent yum.repos.d]# ls
bak Centos-7.repo CentOS-Media.repo
[root@agent yum.repos.d]# cd
[root@agent ~]# yum -y install libxml2-devel libcurl-devel pcre-devel ntpdate
[root@agent ~]# ntpdate us.pool.ntp.org
[root@agent ~]# tar xf zabbix-3.4.11.tar.gz -C /usr/src
[root@agent ~]# cd /usr/src/zabbix-3.4.11/
[root@agent zabbix]# ./configure --prefix=/usr/local/zabbix --enable-agent --with-net-snmp --with-libcurl --with-libxml2 && make -j2 && make install
[root@agent zabbix-3.4.11]# cp misc/init.d/tru64/zabbix_agentd /etc/init.d
[root@agent zabbix-3.4.11]# vim /etc/init.d/zabbix_agentd
24行修改 DAEMON=/usr/local/zabbix/sbin/zabbix_agentd
[root@agent zabbix-3.4.11]# chmod +x /etc/init.d/zabbix_agentd
[root@agent zabbix-3.4.11]# cd
[root@agent ~]# useradd -M -s /sbin/nologin zabbix
[root@agent ~]# chown -R zabbix:zabbix /usr/local/zabbix/
[root@agent ~]# cd /usr/local/zabbix/
[root@agent zabbix]# mkdir logs
[root@agent zabbix]# chown -R zabbix:zabbix logs
[root@agent zabbix]# cp /usr/local/zabbix/etc/zabbix_agentd.conf{,.bak}
[root@agent zabbix]# vim /usr/local/zabbix/etc/zabbix_agentd.conf
PidFile=/tmp/zabbix_agentd.pid
Server=172.20.10.2
ServerActive=172.20.10.2
Hostname=agent.zabbix.com
LogFile=/usr/local/zabbix/logs/zabbix_agentd.log
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf
UnsafeUserParameters=1
UserParameter=mysql.version,mysql -V
UserParameter=mysql.status[*],/usr/local/zabbix/etc/chk_mysql.sh $1
UserParameter=mysql.ping,mysqladmin -uroot -p123123 -P3306 -h172.20.10.3 ping |grep -c alive
[root@agent zabbix]# service zabbix_agentd start
Zabbix agent started.
[root@agent zabbix]# netstat -anpt |grep 10050
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 20698/zabbix_agentd
zabbix添加linux主机
为agent.zabbix.com 添加模块
等待指示灯亮起,大约1-2分钟左右
部署完毕,可以添加监控端每台服务器上的服务了