麒麟Zabbix Agent安装配置全攻略

一、准备工作(依赖安装)

bash 复制代码
yum install gcc gcc-c++ make pcre-devel openssl-devel -y

useradd -r -s /sbin/nologin zabbix

二、下载并解压源码

bash 复制代码
cd /data/zabbix
tar -zxvf zabbix-7.0.3.tar.gz
cd zabbix-7.0.3

三、编译安装 仅 Agent

bash 复制代码
./configure --enable-agent
make
make install

安装完成后:

程序:/usr/local/sbin/zabbix_agentd

默认配置:/usr/local/etc/zabbix_agentd.conf

四、生成配置文件

bash 复制代码
cat > /usr/local/etc/zabbix_agentd.conf << EOF
# ====== Zabbix Agent 远程监控标准配置 ======

# 允许哪些 Zabbix Server 主动来拉取数据(被动模式)
# 这里填写【你的 Zabbix 服务器IP】,多个用逗号分隔
Server=192.168.38.130

# 允许 Agent 主动往哪个 Zabbix Server 推送数据(主动模式)
# 这里填写【你的 Zabbix 服务器IP:10051】
ServerActive=192.168.38.130:10051

# 本机在 Zabbix Web 里的主机名(必须和 Web 里一致!)
Hostname=Linux-Server-01

# Agent 监听端口(默认 10050,不用改)
ListenPort=10050

# 监听所有网卡(允许外部服务器访问)
ListenIP=0.0.0.0

# 运行用户(安全必须用 zabbix)
User=zabbix

# 日志类型:文件
LogType=file

# 日志存放路径
LogFile=/tmp/zabbix_agentd.log

# 日志文件大小上限(MB)
LogFileSize=10

# 调试日志级别(3=正常,4=调试)
DebugLevel=3

# 允许远程执行命令(可选 0=关闭 1=开启)
EnableRemoteCommands=0

# 允许重启 Agent
AllowRoot=0

# 超时时间(秒)
Timeout=30
EOF

五、复制官方启动脚本

bash 复制代码
cd /data/zabbix/zabbix-7.0.3/misc/init.d/fedora/core/
cp zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd

六、修改脚本路径(适配你的安装位置)

bash 复制代码
sed -i 's#/usr/local/zabbix/sbin/zabbix_agentd#/usr/local/sbin/zabbix_agentd#g' /etc/init.d/zabbix_agentd
sed -i 's#/usr/local/zabbix/etc/zabbix_agentd.conf#/usr/local/etc/zabbix_agentd.conf#g' /etc/init.d/zabbix_agentd

七、设置开机自动启动

bash 复制代码
chkconfig --add zabbix_agentd
chkconfig zabbix_agentd on

八、启动 Agent 服务

bash 复制代码
service zabbix_agentd start

查看状态:

bash 复制代码
service zabbix_agentd status

九、验证是否正常运行

bash 复制代码
ps -ef | grep zabbix_agentd
netstat -anp | grep 10050

10050 端口需要被zabbix_agentd独占

测试连通性:

bash 复制代码
zabbix_get -s 127.0.0.1 -p 10050 -k agent.ping
相关推荐
似水এ᭄往昔5 小时前
【Linux】自动化构建-make/Makefile
linux·运维·服务器·ubuntu
顶点多余6 小时前
Linux“信号“从硬件到软件详解
linux·运维·服务器
瀚高PG实验室7 小时前
rpm包安装报错:cannot open Packages index using db5 - Cannot allocate memory (12)
linux·运维·服务器·瀚高数据库
追风少年王大爷丶7 小时前
nginx 配置无域名访问拒绝
运维·服务器·nginx
AI+程序员在路上7 小时前
嵌入式软件技术大全
linux·开发语言·arm开发·单片机
black方块cxy7 小时前
实现一个输入框多个ip以逗号分隔最多20组,且ip不能重复
java·服务器·前端
Snasph7 小时前
在Ubuntu上进行端口转发
linux·运维·ubuntu
线束线缆组件品替网7 小时前
Amphenol RJE1Y22A53644401线束详解与替代网络线束选型指南
运维·服务器·网络·智能路由器·电脑·51单片机
TG_yunshuguoji8 小时前
阿里云代理商: 阿里云部署OpenClaw 个性化配置指南 3 大场景模板详解
服务器·阿里云·云计算·openclaw