[[email protected] ~]# cat /etc/hostname
agent.zabbix.com
[[email protected] ~]# 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
[[email protected] ~]# ping server.zabbix.com -c 4
[[email protected] ~]# nslookup www.baidu.com
源码安装zabbix
[[email protected] ~]# 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 下载
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
[[email protected] yum.repos.d]# ls
bak Centos-7.repo CentOS-Media.repo
[[email protected] yum.repos.d]# cd
[[email protected] ~]# yum -y install libxml2-devel libcurl-devel pcre-devel ntpdate
[[email protected] ~]# ntpdate us.pool.ntp.org
[[email protected] ~]# tar xf zabbix-3.4.11.tar.gz -C /usr/src
[[email protected] ~]# cd /usr/src/zabbix-3.4.11/
[[email protected] zabbix]# ./configure --prefix=/usr/local/zabbix --enable-agent --with-net-snmp --with-libcurl --with-libxml2 && make -j2 && make install
[[email protected] zabbix-3.4.11]# cp misc/init.d/tru64/zabbix_agentd /etc/init.d
[[email protected] zabbix-3.4.11]# vim /etc/init.d/zabbix_agentd
24行修改 DAEMON=/usr/local/zabbix/sbin/zabbix_agentd
[[email protected] zabbix-3.4.11]# chmod +x /etc/init.d/zabbix_agentd
[[email protected] zabbix-3.4.11]# cd
[[email protected] ~]# useradd -M -s /sbin/nologin zabbix
[[email protected] ~]# chown -R zabbix:zabbix /usr/local/zabbix/
[[email protected] ~]# cd /usr/local/zabbix/
[[email protected] zabbix]# mkdir logs
[[email protected] zabbix]# chown -R zabbix:zabbix logs
[[email protected] zabbix]# cp /usr/local/zabbix/etc/zabbix_agentd.conf{,.bak}
[[email protected] 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
[[email protected] zabbix]# service zabbix_agentd start
Zabbix agent started.
[[email protected] 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分钟左右
部署完毕,可以添加监控端每台服务器上的服务了
原文地址:https://www.cnblogs.com/zc1741845455/p/10888950.html