#author=nieming
#use=./install
#this script will auto install zabbix-agent at different struct computer
#such as X86_64 and i386,then this script will auto config the agent config
#if you want config it in custom,change ./zabbix_agentd.conf and change
#server IP :)
#########################################################################
abcd=`uname -a |egrep -o "x86_64" |wc -l`
hostname=`echo $HOSTNAME`
if [ $abcd -ne 0 ];then
rpm -ivh ./zabbix-agent-2.4.4-1.el6.x86_64.rpm
elif [ $abcd -eq 0 ];then
rpm -ivh ./zabbix-agent-2.4.3-1.el6.i686.rpm
fi
cp -f ./zabbix_agentd.conf /etc/zabiix
sed 's/Hostname=zabbix server/Hostname='$hostname'/g' -i /etc/zabbix/zabbix_agentd.conf
service zabbix-agent start
需要配置的机器没有外网的访问权限,从官网直接下的rpm包,然后安装的时候发现问提
安装机的版本都太老从最老的cent 4. 到6.x都有,并且依赖问题很难解决。这脚本牺牲。。
然后用zabbix官网的预编译版本,结果报错终端显示乱码,将错误信息复制到windwos中用
ultra edit查看,文件目录不存在。研究了好一会,然后老大将当前语言编码设置为空(utf-8)
export LANG=
终端输出错误信息,浮点类型错误,原因还是系统版本太老,编译二进制文件无法运行。
然后去官方下载源码,挨个机器编译安装(20多台啊啊啊啊,忙到一下午)
http://www.zabbix.com/download.php
下载tar.gz源码包,然后挨个机器上传,可气的是目标主机都有防火墙,从我的机器无法直接ssh过去,需要从监控机上传。
scp ./zabbix_agents_2.4.1.linux2_6.amd64.tar.gz syswatch@192.168.6.19:/home/syswatch/
最后又写了一个脚本自动配置安装清理
#!/bin/bash
#use ./install.sh
#author nieming
#this script auto install zabbix_agent and configure conf
#clean install dir
######################################################
mkdir zabbix_compile
./configure --prefix=/home/syswatch/zabbix_compile --enable-agent
make
make install
cd /home/syswatch/zabbix_compile/etc
sed 's/Server=127.0.0.1/Server=192.168.13.77/g' -i ./zabbix_agentd.conf
sed 's/ServerActive=127.0.0.1/ServerActive=192.168.13.77/g' -i ./zabbix_agentd.conf
sed 's/Hostname=Zabbix server/Hostname='$HOSTNAME'/g' -i ./zabbix_agentd.conf
cd /home/syswatch/zabbix_compile/sbin
./zabbix_agentd -c /home/syswatch/zabbix_compile/etc/zabbix_agentd.conf
cd /home/syswatch
mv zabbix-2.4.4.tar zabbix-2.4.4
mv zabbix-2.4.4/ zabbix_compile/
ps aux |grep zabbix
一天就这么愉快的过去了。。