zabbix agent 安装

本文介绍如何在Linux环境下从源码编译安装Zabbix监控系统的Agent,并提供了Windows环境下Zabbix Agent的安装步骤及配置文件样例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#!/bin/sh
path=/opt/zabbix
ver=http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.4/zabbix-3.0.4.tar.gz
wgetp=/usr/local/src
server=192.168.1.55
check=`lsof -i :10050`
conf=$path/etc/zabbix_agentd.conf
name=`ifconfig |grep netmask|grep -v "127.0.0.1"|awk '{print $2}'`
user=zabbix
##############下载agent源码包############
yum -y group install Development Tools
useradd -M -s /sbin/nologin zabbix
yum -y install lsof wget 
cd $wgetp
if [[ -f zabbix-3.0.4.tar.gz ]]; then
	echo "文件已存在"
	cd zabbix-3.0.4
	./configure --prefix=$path --enable-agent
else
	wget $ver
	tar -xvzf zabbix-3.0.4.tar.gz
	cd zabbix-3.0.4
	./configure --prefix=$path --enable-agent
fi
#if [[ $? != 0 ]]; then
#	echo "zabbix install faile pls 检查依赖问题 "
#fi
make 
if [[ $? != 0 ]]; then
	echo " make failed "
fi
make install
sleep 2 
cd $path
##############备份zabbix.conf
cp $conf $conf-$(date +%F)
######替换配置文件#############
cat << EOF >$conf
LogFile=/tmp/zabbix_agentd.log
Server=$server
#ServerActive=$server
Hostname=$name
UnsafeUserParameters=1
EnableRemoteCommands=1
RefreshActiveChecks=300
Timeout=5
Include=$path/etc/zabbix_agentd.conf.d/
EOF
chown -R zabbix.zabbix $path
sleep 2
./sbin/zabbix_agentd
######检测agent是否启动
$check
if [[ $? == 0 ]]; then
	echo "zabbix is runing"
else
	echo "zabbix is runing failed"
fi
tailf /tmp/zabbix_agentd.log


附上window安装:

C:\Windows\system32>C:\zabbix_agents\bin\win64\zabbix_agentd.exe -i -c C:\zabbix
_agents\conf\zabbix_agentd.win.conf
#注意顺序 -i -c
zabbix_agentd.exe [1468]: service [Zabbix Agent] installed successfully
zabbix_agentd.exe [1468]: event source [Zabbix Agent] installed successfully


windows agent配置文件

LogFile=C:\zabbix_agents\zabbix_agentd.log
Server=172.16.100.106
#ServerActive=172.16.100.106
Hostname=172.16.100.81
UnsafeUserParameters=1
EnableRemoteCommands=1
RefreshActiveChecks=300
Timeout=5
#Include=c:\zabbix_agents\zabbix_agentd.conf.d\*.conf



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值