目录
环境:
(隔天做的更换了IP,不影响实际操作)
IP 192.168.50.50
关闭防火墙规则
更改主机名
root@localhost \~\]# vim /etc/hostname agent.zabbix.com \[root@localhost \~\]# hostname agent.zabbix.com \[root@localhost \~\]# bash
配置开始
配置域名解析
root@agent zabbix\]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.50.51 server.zabbix.com 192.168.50.50 agent.zabbix.com
上一篇没有配置 这里直接cp过去
root@agent \~\]# scp /etc/hosts 192.168.50.51:/etc/ The authenticity of host '192.168.50.51 (192.168.50.51)' can't be established. ECDSA key fingerprint is SHA256:KUnDzA9EBdTNT0UE3pDB18XcdeWBK780vEkpfsZR7PI. ECDSA key fingerprint is MD5:f6:96:4e:cc:7f:5d:73:60:d6:e3:22:7c:00:25:32:3a. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.50.51' (ECDSA) to the list of known hosts. [email protected]'s password: hosts 100% 222 152.5KB/s 00:00
安装依赖包
root@agent \~\]# yum -y install libxml2-devel libcurl-devel pcre-devel ntpdate 同步清华大学源 \[root@agent \~\]# ntpdate s1a.time.edu.cn 19 Jul 09:23:19 ntpdate\[60579\]: adjust time server 202.112.10.60 offset 0.032335 sec 解压zabbix包 \[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-3.4.11\]# ./configure --prefix=/usr/local/zabbix --enable-agent --with-net-snmp --with-libcurl --with-libxml2 \&\& make -j2 \&\& make install **--enable-agent** **启用agent**
复制启动脚本
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\]# ll 总用量 0 drwxr-xr-x. 2 zabbix zabbix 45 7月 19 09:31 bin drwxr-xr-x. 3 zabbix zabbix 60 7月 19 09:31 etc drwxr-xr-x. 2 zabbix zabbix 6 7月 19 09:31 lib drwxr-xr-x. 2 zabbix zabbix 27 7月 19 09:31 sbin drwxr-xr-x. 3 zabbix zabbix 17 7月 19 09:31 share \[root@agent zabbix\]# mkdir loga \[root@agent zabbix\]# chown -R zabbix:zabbix loga \[root@agent \~\]# cd /usr/local/zabbix/ \[root@agent zabbix\]# ll 总用量 0 drwxr-xr-x. 2 zabbix zabbix 45 7月 19 09:31 bin drwxr-xr-x. 3 zabbix zabbix 60 7月 19 09:31 etc drwxr-xr-x. 2 zabbix zabbix 6 7月 19 09:31 lib drwxr-xr-x. 2 zabbix zabbix 27 7月 19 09:31 sbin drwxr-xr-x. 3 zabbix zabbix 17 7月 19 09:31 share **备份agent文件** \[root@agent zabbix\]# cp /usr/local/zabbix/etc/zabbix_agentd.conf{,.bak} **修改agent文件** \[root@agent zabbix\]# vim /usr/local/zabbix/etc/zabbix_agentd.conf 30 LogFile=/usr/local/zabbix/loga/zabbix_agentd.log 31 Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/\*.conf 92 PidFile=/tmp/zabbix_agentd.pid 93 Server=192.168.1.128 134 ServerActive=192.168.1.128 145 Hostname=agent.zabbix.com **启动客户端** \[root@agent zabbix\]# service zabbix_agentd start Zabbix agent started. **查看端口** \[root@agent zabbix\]# netstat -antp \| grep 10050 tcp 0 0 0.0.0.0:10050 0.0.0.0:\* LISTEN 68738/zabbix_agentd
Zabbix 添加linux主机

4.为agent. zabbix.com 添加模板



- 等一下查看 成功

下期 Zabbix -server监控mysql及httpd服务