安装Zabbix agent端亚博体育(yabo618點cn)
这里我启动了一台IP为192.168.171.134的服务器,来用于充当agent端
[root@agent /]# mkdir /zabbix # 个人习惯,可忽略
[root@agent /]# cd /zabbix/
[root@agent /]# rz
[root@agent zabbix]# tar zxf zabbix-3.2.1.tar.gz
[root@agent zabbix]# cd zabbix-3.2.1/
[root@agent zabbix-3.2.1]# useradd -M -s /sbin/nologin zabbix
[root@agent zabbix-3.2.1]# ./configure --prefix=/usr/local/zabbix --enable-agent && make && make install
[root@agent zabbix-3.2.1]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
[root@agent /]# sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
[root@agent /]# sed -i 's/PIDFILE=\/tmp\/$BINARY_NAME.pid/PIDFILE=$BASEDIR\/logs\/$BINARY_NAME.pid/g' /etc/init.d/zabbix_agentd
[root@agent /]# chmod +x /etc/init.d/zabbix_agentd
[root@agent /]# sed -i 's/# PidFile=\/tmp\/zabbix_agentd.pid/PidFile=\/usr\/local\/zabbix\/logs\/zabbix_agentd.pid/g' /usr/local/zabbix/etc/zabbix_agentd.conf
[root@agent /]# sed -i 's/LogFile=\/tmp\/zabbix_agentd.log/LogFile=\/usr\/local\/zabbix\/logs\/zabbix_agentd.log/g' /usr/local/zabbix/etc/zabbix_agentd.conf
[root@agent /]# sed -i 's/Server=127.0.0.1/Server=192.168.171.133/g' /usr/local/zabbix/etc/zabbix_agentd.conf
[root@agent /]# sed -i 's/# ListenPort=10050/ListenPort=10050/g' /usr/local/zabbix/etc/zabbix_agentd.conf
[root@agent /]# sed -i 's/ServerActive=127.0.0.1/ServerActive=192.168.171.133/g' /usr/local/zabbix/etc/zabbix_agentd.conf
[root@agent /]# sed -i 's/Hostname=Zabbix server/Hostname=192.168.171.134/g' /usr/local/zabbix/etc/zabbix_agentd.conf
[root@agent /]# sed -i 's/# Timeout=3/Timeout=15/g' /usr/local/zabbix/etc/zabbix_agentd.conf
[root@agent /]# sed -i 's/# Include=\/usr\/local\/etc\/zabbix_agentd.conf.d\//Include=\/usr\/local\/zabbix\/etc\/zabbix_agentd.conf.d\//g' /usr/local/zabbix/etc/zabbix_agentd.conf
[root@agent /]# egrep -v '^$|^#' /usr/local/zabbix/etc/zabbix_agentd.conf
PidFile=/usr/local/zabbix/logs/zabbix_agentd.pid
LogFile=/usr/local/zabbix/logs/zabbix_agentd.log
Server=192.168.171.133
ListenPort=10050
ServerActive=192.168.171.133
Hostname=192.168.171.134
Timeout=15
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
[root@agent /]# mkdir -p /usr/local/zabbix/logs # 创建日志存放路径
[root@agent /]# chown -R zabbix:zabbix /usr/local/zabbix/ # 赋予权限
[root@agent /]# /etc/init.d/zabbix_agentd start # 启动agent
Reloading systemd: [ OK ]
Starting zabbix_agentd (via systemctl): [ OK ]