线上监控系统由zabbix 1.8.10直接变成zabbix 2.2,简单使用发现zabbix 2.2的复制功能、自动发现功能(网卡、分区挂载)比以前智能多了。果然不错,还增加了jmx的监控。
整个简单脚本来对被监控节点重新安装吧。
#!/bin/bash
HOST=`/sbin/ifconfig eth0 | sed -n '/inet /{s/.*addr://;s/ .*//;p}'`
pkill -9 zabbix_agentd
test -e /usr/local/zabbix && rm -rf /usr/local/zabbix
test -e /etc/zabbix && rm -rf /etc/zabbix
rm -rf /tmp/zabbix*
rm -rf /etc/init.d/zabbix_agentd_ctl
cd /usr/local/src
test -e zabbix-2.0.2.tar.gz || wget :81/zabbix-2.0.2.tar.gz
tar -xzf zabbix-2.0.2.tar.gz && cd zabbix-2.0.2
./configure --prefix=/usr/local/zabbix --enable-agent --with-net-snmp --with-libcurl && make && make install
test -e /usr/local/zabbix/etc/zabbix_agentd.conf.d/ || mkdir -p /usr/local/zabbix/etc/zabbix_agentd.conf.d/
sed -i 's/\# EnableRemoteCommands=0/EnableRemoteCommands=1/g' /usr/local/zabbix/etc/zabbix_agentd.conf
sed -i 's/\# LogRemoteCommands=0/LogRemoteCommands=1/g' /usr/local/zabbix/etc/zabbix_agentd.conf
sed -i 's/Server=127.0.0.1/Server=1.1.1.1/g' /usr/local/zabbix/etc/zabbix_agentd.conf
sed -i 's/ServerActive=127.0.0.1/ServerActive=1.1.1.1:10051/g' /usr/local/zabbix/etc/zabbix_agentd.conf
sed -i "s/Zabbix\ server/${HOST}/g" /usr/local/zabbix/etc/zabbix_agentd.conf
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
sed -i 's/\# UnsafeUserParameters=0/UnsafeUserParameters=1/g' /usr/local/zabbix/etc/zabbix_agentd.conf
netstat -tnlp|grep 8088 && wget :81/configure/squid -P /usr/local/zabbix/etc/zabbix_agentd.conf.d/
wget :81/configure/disk-io -P /usr/local/zabbix/etc/zabbix_agentd.conf.d/
/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf