这篇文章主要介绍了如何升级Zabbix2.4.5到Zabbix3.0.2,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。一 应用场景描述&nb
这篇文章主要介绍了如何升级Zabbix2.4.5到Zabbix3.0.2,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
一 应用场景描述
Zabbix在2016年2月份发布了Zabbix 3.0.0,又是一个LTS长期支持版本。Zabbix官方在4月份发布了Zabbix 3.0.2.线上使用的Zabbix版本是2.4,看了Zabbix官方关于3.0版本的描述决定升级线上版本到3.0.2.Zabbix3.0在以下几个方面作了改进:
重新设计了Zabbix的前端展示页面
提供Zabbix server,proxy和agent之间的加密和认证功能,基于PSK加密算法。如果对安全性要求高的用户就不再需要第三方工具或者×××来实现加密了
增加趋势预估功能
可以在特定时间执行一些监控项目
可以定义报警类别之间的依赖关系
强制执行housekeeper
性能得到改进
减小了poller配置缓存,优化了history缓存和history同步
通过引入in-memory缓存机制明显改善了action处理过程的性能
使用哈希机制改善trigger处理性能
限制数据库请求来提供nodata()函数的计算过程
之前的版本中,zabbix proxy连接到server端时,proxy相关的信息是直接从数据库获取的,在3.0版本,proxy相关的信息从server端配置的缓存中获取。另一方面,proxy配置更改不会立即生效,它必须等到server端缓存同步到数据库。
Value缓存得到改善
二 升级步骤
Zabbix agent不强制升级到3.0.2,但是官方建议升级。Zabbix server和proxy必须升级到同一个版本。
为了在升级过程中尽量减少宕机时间和数据丢失,建议先停掉并升级Zabbix server,然后再一个接一个地停掉并升级proxy。当所有的proxy升级过后,再启动zabbix server。
Zabbix3.0以后需要PHP5.4以后,php5.7暂时不支持
其他相关的依赖软件查看官方文档
rpm -Uvh Http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh http://mirror.WEBtatic.com/yum/el6/latest.rpm
yum -y install php54w php54w-gd php54w-bcmath php54w-ctype php54w-libxml php54w-mbstring php54w-gettext php54w-ldap php54w-Mysqli
PHP在配置的时候有几个参数需要改
post_max_size = 128M 最小值是16M
max_execution_time = 600 最小值是300秒
max_input_time = 600 最小值是300秒
date.timezone = Asia/Shanghai 需要设置时区
数据库容量规划
Zabbix数据库大小主要取决于以下几个变量,这几个变量定义了存储的历史数据的总量
NVPS Number of processed values per second
这个值是每秒Zabbix server接收的新值的平均数。例如,如果每隔60秒有3000个监控项目需要监控,那么NVPS就是3000/60=50.意味着每秒有50个新值添加到zabbix数据库
Housekeeper settings for history
Zabbix会保留监控数据一段时间,通常是几周或者几个月。每个新的监控数据都需要一些磁盘空间来存储数据和索引。所以,如果我们保留30天的历史数据并且每秒中接收50个新值,监控数值总量就是
(30*24*3600)*50 = 129600000或者大约130M
依据使用的数据库引擎,接收值得类型(floats,integers,strings,log files等等),单个值占用的磁盘空间可能是40字节到几百字节。通常一个字符类型监控项目大约是90字节。130M个监控值需要130M*90字节=10.9GB字节磁盘空间
text和log监控项目的值无法准确预测,可以假定为每个监控值大小为500字节
Housekeeper settings for trends
Zabbix在trends表中为每个监控项目保留一个小时的 max/min/avg/count监控值。这些数据用于趋势统计和长期的图表分析。一个小时的间隔时间没法自定义更改。
每个趋势数据大约为90字节。假设要保留5年的趋势数据,那么3000个监控项目每年需要24*365*3000*90=2.2GB,5年就是11GB。
Housekeeper settings for events
每个Zabbix event需要大约170字节磁盘空间。很难估计zabbix每天产生的events数量。最坏的情况下,假定zabbix每秒产生一个event
如果要保留3年的events,就需要3*365*24*3600*170=15GB
Parameter | FORMula for required disk space (in bytes) |
Zabbix configuration | Fixed size. Normally 10MB or less. |
History | days*(items/refresh rate)*24*3600*bytes items : number of items days : number of days to keep history refresh rate : average refresh rate of items bytes : number of bytes required to keep single value, depends on database engine, normally ~90 bytes. |
Trends | days*(items/3600)*24*3600*bytes items : number of items days : number of days to keep history bytes : number of bytes required to keep single trend, depends on database engine, normally ~90 bytes. |
Events | days*events*24*3600*bytes events : number of event per second. One (1) event per second in worst case scenario. days : number of days to keep history bytes : number of bytes required to keep single trend, depends on database engine, normally ~170 bytes. |
总共的磁盘空间大小就是:
Configuration + History + Trends + Events
1.停掉Zabbix server
停掉zabbix server不让新的数据插入到数据库
service zabbix-server stop
2.备份zabbix数据库
mysqldump -uroot -p zabbix > zabbix_backup20160508.sql
3.备份配置文件,PHP文件和zabbix 二进制文件
4.安装新的zabbix server
5.检查zabbix server的配置文件
主要注意几个参数
CacheSize=200M 配置信息的缓存大小,用于存储host,item和trigger数据的共享内存大小。取值范围是128k~8G,默认是8M
CacheUpdateFrequency=60 zabbix执行配置缓存更新的时间间隔,默认是60秒
DebugLevel=3 指定日志级别,默认是3打印警告信息,4是调试信息,5是更加详细的调试信息
HistoryCacheSize=50M 用于存储历史数据的共享存储大小,默认是16M,可以取值范围是128K~2G
HistoryIndexCacheSize=8M 用于索引历史数据缓存中的历史数据的共享存储大小,缓存一个监控项目大约需要100字节。这个参数从3.0.0开始支持
HousekeepingFrequency=1 设置zabbix执行housekeeping的频率,默认是1小时。housekeeping操作时删除数据库中过期的数据。可以设置HousekeepingFrequency为0关闭自动housekeeping,然后手动执行housekeeper_execute来清理过期数据
MaxHousekeeperDelete=5000 在一个housekeeping任务中删除的过期数据数量不超过这个值
TrendCacheSize=20M 存储trend数据的共享内存大小
ValueCacheSize=10M 缓存监控数据的历史数据的共享内存大小。
6.启动新的zabbix server并注意查看日志
zabbix server会自动升级数据库
23164:20160508:105436.724 using configuration file: /opt/app/zabbix/conf/zabbix_server.conf
23164:20160508:105436.734 current database version (mandatory/optional): 02040000/02040000
23164:20160508:105436.734 required mandatory version: 03000000
23164:20160508:105436.734 starting automatic database upgrade
23164:20160508:105436.806 completed 0% of database upgrade
23164:20160508:105436.910 completed 1% of database upgrade
23164:20160508:105436.998 completed 2% of database upgrade
23164:20160508:105437.022 completed 3% of database upgrade
23164:20160508:105437.052 completed 4% of database upgrade
23164:20160508:105437.072 completed 5% of database upgrade
23164:20160508:105437.194 completed 6% of database upgrade
23164:20160508:105437.273 completed 7% of database upgrade
23164:20160508:105437.329 completed 8% of database upgrade
23164:20160508:105437.372 completed 9% of database upgrade
23164:20160508:105437.931 completed 10% of database upgrade
23164:20160508:105438.032 completed 11% of database upgrade
23164:20160508:105438.050 completed 12% of database upgrade
23164:20160508:105438.052 completed 13% of database upgrade
23164:20160508:105438.053 completed 14% of database upgrade
23164:20160508:105438.097 completed 15% of database upgrade
23164:20160508:105438.123 completed 16% of database upgrade
23164:20160508:105438.158 completed 17% of database upgrade
23164:20160508:105438.182 completed 18% of database upgrade
23164:20160508:105438.212 completed 19% of database upgrade
23164:20160508:105438.221 completed 20% of database upgrade
23164:20160508:105438.237 completed 21% of database upgrade
23164:20160508:105438.252 completed 22% of database upgrade
23164:20160508:105438.269 completed 23% of database upgrade
23164:20160508:105438.287 completed 24% of database upgrade
23164:20160508:105438.296 completed 25% of database upgrade
23164:20160508:105438.311 completed 26% of database upgrade
23164:20160508:105438.325 completed 27% of database upgrade
23164:20160508:105438.359 completed 28% of database upgrade
23164:20160508:105438.367 completed 29% of database upgrade
23164:20160508:105438.382 completed 30% of database upgrade
23164:20160508:105438.396 completed 31% of database upgrade
23164:20160508:105438.412 completed 32% of database upgrade
23164:20160508:105438.430 completed 33% of database upgrade
23164:20160508:105438.580 completed 34% of database upgrade
23164:20160508:105438.608 completed 35% of database upgrade
23164:20160508:105438.647 completed 36% of database upgrade
23164:20160508:105438.670 completed 37% of database upgrade
23164:20160508:105438.672 completed 38% of database upgrade
23164:20160508:105438.677 completed 39% of database upgrade
23164:20160508:105438.681 completed 40% of database upgrade
23164:20160508:105438.686 completed 41% of database upgrade
23164:20160508:105438.690 completed 42% of database upgrade
23164:20160508:105438.695 completed 43% of database upgrade
23164:20160508:105438.699 completed 44% of database upgrade
23164:20160508:105438.725 completed 45% of database upgrade
23164:20160508:105438.800 completed 46% of database upgrade
23164:20160508:105438.891 completed 47% of database upgrade
23164:20160508:105438.977 completed 48% of database upgrade
23164:20160508:105439.042 completed 49% of database upgrade
23164:20160508:105439.109 completed 50% of database upgrade
23164:20160508:105439.178 completed 51% of database upgrade
23164:20160508:105439.206 completed 52% of database upgrade
23164:20160508:105439.224 completed 53% of database upgrade
23164:20160508:105439.230 completed 54% of database upgrade
23164:20160508:105439.254 completed 55% of database upgrade
23164:20160508:105439.261 completed 56% of database upgrade
23164:20160508:105439.262 completed 57% of database upgrade
23164:20160508:105439.302 completed 58% of database upgrade
23164:20160508:105439.304 completed 59% of database upgrade
23164:20160508:105439.342 completed 60% of database upgrade
23164:20160508:105439.366 completed 61% of database upgrade
23164:20160508:105439.413 completed 62% of database upgrade
23164:20160508:105439.423 completed 63% of database upgrade
23164:20160508:105439.457 completed 64% of database upgrade
23164:20160508:105439.475 completed 65% of database upgrade
23164:20160508:105439.483 completed 66% of database upgrade
23164:20160508:105439.497 completed 67% of database upgrade
23164:20160508:105439.513 completed 68% of database upgrade
23164:20160508:105439.530 completed 69% of database upgrade
23164:20160508:105439.544 completed 70% of database upgrade
23164:20160508:105439.556 completed 71% of database upgrade
23164:20160508:105439.558 completed 72% of database upgrade
23164:20160508:105439.606 completed 73% of database upgrade
23164:20160508:105439.636 completed 74% of database upgrade
23164:20160508:105439.672 completed 75% of database upgrade
23164:20160508:105439.680 completed 76% of database upgrade
23164:20160508:105439.695 completed 77% of database upgrade
23164:20160508:105439.711 completed 78% of database upgrade
23164:20160508:105439.731 completed 79% of database upgrade
23164:20160508:105439.740 completed 80% of database upgrade
23164:20160508:105439.756 completed 81% of database upgrade
23164:20160508:105439.792 completed 82% of database upgrade
23164:20160508:105439.797 completed 83% of database upgrade
23164:20160508:105439.799 completed 84% of database upgrade
23164:20160508:105439.839 completed 85% of database upgrade
23164:20160508:105439.841 completed 86% of database upgrade
23164:20160508:105439.878 completed 87% of database upgrade
23164:20160508:105439.900 completed 88% of database upgrade
23164:20160508:105439.933 completed 89% of database upgrade
23164:20160508:105439.941 completed 90% of database upgrade
23164:20160508:105439.969 completed 91% of database upgrade
23164:20160508:105439.985 completed 92% of database upgrade
23164:20160508:105439.995 completed 93% of database upgrade
23164:20160508:105440.010 completed 94% of database upgrade
23164:20160508:105440.026 completed 95% of database upgrade
23164:20160508:105440.044 completed 96% of database upgrade
23164:20160508:105440.045 completed 97% of database upgrade
23164:20160508:105440.050 completed 98% of database upgrade
23164:20160508:105440.051 completed 99% of database upgrade
23164:20160508:105440.052 completed 100% of database upgrade
23164:20160508:105440.052 database upgrade fully completed
启动成功后就可以关闭zabbix server了等所有的proxy更新完成再启动,尽量减少数据丢失
7.安装zabbix web
8.停掉proxy
service zabbix-proxy stop
9.备份proxy的配置文件和zabbix proxy二进制文件
10.安装新版本proxy
所有的proxy升级完成以后就可以启动zabbix server了,升级过程中注意查看日志。
zabbix agent不必强制升级,推荐升级到新版本。
三 安装Graphtree插件
Graphtree是由OneOaas开源的zabbix插件,可以根据zabbix分组分主机分应用显示。这点比zatree做得好,同时Grahtree在性能方面比zatree有很大的提升,查看图表快很多,果断抛弃zatree使用Graphtree插件。Zatree在界面显示上很鸡肋,与本身的Zabbix界面没法结合,Graphtree在界面方面就做得很好,和Zabbix自身的界面结合得好。cd zabbix-3.0.2/frontends/php
wget https://raw.GitHubusercontent.com/OneOaaS/graphtrees/master/graphtree3-0-1.patch
patch -Np0 < graphtree3-0-1.patch
rsync -avz * /opt/webapps/zabbix/
rsync -avz zabbix.conf.php /opt/webapps/zabbix/conf/
然后重新加载下Nginx或者Apache,登录页面看看。
感谢你能够认真阅读完这篇文章,希望小编分享的“如何升级Zabbix2.4.5到Zabbix3.0.2”这篇文章对大家有帮助,同时也希望大家多多支持编程网,关注编程网数据库频道,更多相关知识等着你来学习!
--结束END--
本文标题: 如何升级Zabbix2.4.5到Zabbix3.0.2
本文链接: https://lsjlt.com/news/64899.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0