攻略Zabbix4.0升级4.2
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了攻略Zabbix4.0升级4.2相关的知识,希望对你有一定的参考价值。
1.停止zabbix服务service zabbix_server stop
service zabbix_agentd stop
/usr/local/zabbix/sbin/zabbix_java/shutdown.sh
2.保存配置文件
mv /usr/local/zabbix /usr/local/zabbix.bak
mv /usr/local/nginx/html/zabbix /usr/local/nginx/html/zabbix.bak
cp /etc/init.d/zabbix_server /etc/init.d/zabbix_server_bak
cp /etc/init.d/zabbix_agentd /etc/init.d/zabbix_agentd_bak
3.编译安装zabbix4.2
tar -xf zabbix-4.2.5.tar.gz
cd zabbix-4.2.5
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 -with-unixodbc --with-ssh2 --with-openipmi --enable-ipv6 --enable-java --with-openssl --with-ssh2 --with-iconv --with-iconv-include --with-iconv-lib --with-libpcre --with-libpcre-include --with-libpcre-lib --with-libevent --with-libevent-include --with-zlib --with-zlib-include --with-zlib-lib --with-libpthread --with-libpthread-include --with-libpthread-lib --with-libevent-lib --with-ldap
(./congfigure提示缺少java环境,把/usr/local/java/jdk1.6.0_37/bin/此路径加入到/etc/profile文件中即可)
make && make install
4.修改配置参数(zabbix_agentd.conf的配置信息也多了,建议手动改)
cp /usr/local/zabbix.bak/etc/zabbix_agentd.conf /usr/local/zabbix/etc/zabbix_agentd.conf
cp -r /usr/local/zabbix.bak/etc/zabbix_agentd.conf.d /usr/local/zabbix/etc/
cp -r /usr/local/zabbix.bak/scripts /usr/local/zabbix/
mv /usr/local/zabbix/sbin/zabbix_java /usr/local/zabbix/sbin/zabbix_java_bk
cp -r /usr/local/zabbix.bak/sbin/zabbix_java /usr/local/zabbix/sbin/
vi /usr/local/zabbix.bak/etc/zabbix_server.conf
++++++++++++++++++++++
ListenPort=10051
LogFile=/usr/local/zabbix/logs/zabbix_server.log
PidFile=/usr/local/zabbix/logs/zabbix_server.pid
SocketDir=/usr/local/zabbix/logs
DBHost=192.168.1.18
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
StartPollers=100
StartPollersUnreachable=10
StartTrappers=20
StartPingers=10
StartDiscoverers=20
StartAlerters=10
JavaGateway=192.168.1.18
JavaGatewayPort=10052
StartJavaPollers=5
StartVMwareCollectors=2
VMwareCacheSize=80M
VMwareTimeout=300
SNMPTrapperFile=/usr/local/zabbix/logs/zabbix_traps.tmp
HousekeepingFrequency=1
CacheSize=512M
HistoryCacheSize=512M
HistoryIndexCacheSize=512M
TrendCacheSize=512M
ValueCacheSize=512M
Timeout=30
LogSlowQueries=3000
TmpDir=/usr/local/zabbix/logs
User=zabbix
StatsAllowedIP=127.0.0.1
++++++++++++++++++++++
mkdir -p /usr/local/zabbix/logs
chown -R zabbix:zabbix /usr/local/zabbix
mv /etc/init.d/zabbix_server /etc/init.d/zabbix_server-4.2
mv /etc/init.d/zabbix_agentd /etc/init.d/zabbix_agentd-4.2
mv /etc/init.d/zabbix_server_bak /etc/init.d/zabbix_server
mv /etc/init.d/zabbix_agentd_bak /etc/init.d/zabbix_agentd
5.修改网页参数
mkdir /usr/local/nginx/html/zabbix
cp -a frontends/php/* /usr/local/nginx/html/zabbix
cp /usr/local/nginx/html/zabbix/conf/zabbix.conf.php.example /usr/local/nginx/html/zabbix/conf/zabbix.conf.php
vi /usr/local/nginx/html/zabbix/conf/zabbix.conf.php
##修改ip地址即可
chown -R zabbix.zabbix /usr/local/nginx/html/zabbix/
chmod -R 755 /usr/local/nginx/html/zabbix/
6.启动zabbix
chkconfig --add zabbix_server
chkconfig --add zabbix_agentd
chkconfig --level 35 zabbix_agentd on
chkconfig --level 35 zabbix_server on
service snmpd restart
service mysqld restart
service httpd restart 或者 service nginx restart
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
/usr/local/zabbix/sbin/zabbix_java/startup.sh
7.观察日志
vi /usr/local/zabbix/logs/zabbix_server.log
13801:20190808:235013.297 Starting Zabbix Server. Zabbix 4.2.5
13801:20190808:235013.297 ** Enabled features **
13801:20190808:235013.298 SNMP monitoring: YES
13801:20190808:235013.298 IPMI monitoring: YES
13801:20190808:235013.298 Web monitoring: YES
13801:20190808:235013.298 VMware monitoring: YES
13801:20190808:235013.298 SMTP authentication: YES
13801:20190808:235013.298 Jabber notifications: NO
13801:20190808:235013.298 Ez Texting notifications: YES
13801:20190808:235013.298 ODBC: YES
13801:20190808:235013.298 SSH2 support: YES
13801:20190808:235013.298 IPv6 support: YES
13801:20190808:235013.298 TLS support: YES
13801:20190808:235013.298 **
13801:20190808:235013.298 using configuration file: /usr/local/zabbix/etc/zabbix_server.conf
13801:20190808:235013.312 current database version (mandatory/optional): 03040000/03040006
13801:20190808:235013.312 required mandatory version: 04000000
13801:20190808:235013.313 optional patches were found
13801:20190808:235013.313 starting automatic database upgrade
13801:20190808:235013.315 completed 0% of database upgrade
13801:20190808:235014.320 completed 1% of database upgrade
13801:20190808:235014.994 completed 2% of database upgrade
13801:20190808:235015.560 completed 3% of database upgrade
13801:20190808:235015.566 completed 4% of database upgrade
....................略
13801:20190808:235241.870 completed 100% of database upgrade
13801:20190808:235241.871 database upgrade fully completed #数据库自动升级成功
再次重启zabbix可以看到数据库已经成4.2的了
service zabbix_server restart
vi /usr/local/zabbix/logs/zabbix_server.log
13801:20190808:235528.625 Zabbix Server stopped. Zabbix 4.2.5 (revision 53bb6bc0f0).
14447:20190808:235529.655 Starting Zabbix Server. Zabbix 4.2.5 (revision 53bb6bc0f0).
14447:20190808:235529.655 ** Enabled features **
14447:20190808:235529.655 SNMP monitoring: YES
14447:20190808:235529.655 IPMI monitoring: YES
14447:20190808:235529.656 Web monitoring: YES
14447:20190808:235529.656 VMware monitoring: YES
14447:20190808:235529.656 SMTP authentication: YES
14447:20190808:235529.656 Jabber notifications: NO
14447:20190808:235529.656 Ez Texting notifications: YES
14447:20190808:235529.656 ODBC: YES
14447:20190808:235529.656 SSH2 support: YES
14447:20190808:235529.656 IPv6 support: YES
14447:20190808:235529.656 TLS support: YES
14447:20190808:235529.656 **
14447:20190808:235529.656 using configuration file: /usr/local/zabbix/etc/zabbix_server.conf
14447:20190808:235529.665 current database version (mandatory/optional): 04000000/04000003
14447:20190808:235529.665 required mandatory version: 04000000
以上是关于攻略Zabbix4.0升级4.2的主要内容,如果未能解决你的问题,请参考以下文章