這篇文章主要介紹了如何升級Zabbix2.4.5到Zabbix3.0.2,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
公司主營業(yè)務(wù):成都做網(wǎng)站、成都網(wǎng)站建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)、移動網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)公司是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)公司推出魯山免費做網(wǎng)站回饋大家。一 應(yīng)用場景描述
Zabbix在2016年2月份發(fā)布了Zabbix 3.0.0,又是一個LTS長期支持版本。Zabbix官方在4月份發(fā)布了Zabbix 3.0.2.線上使用的Zabbix版本是2.4,看了Zabbix官方關(guān)于3.0版本的描述決定升級線上版本到3.0.2.Zabbix3.0在以下幾個方面作了改進(jìn):
重新設(shè)計了Zabbix的前端展示頁面
提供Zabbix server,proxy和agent之間的加密和認(rèn)證功能,基于PSK加密算法。如果對安全性要求高的用戶就不再需要第三方工具或者×××來實現(xiàn)加密了
增加趨勢預(yù)估功能
可以在特定時間執(zhí)行一些監(jiān)控項目
可以定義報警類別之間的依賴關(guān)系
強制執(zhí)行housekeeper
性能得到改進(jìn)
減小了poller配置緩存,優(yōu)化了history緩存和history同步
通過引入in-memory緩存機制明顯改善了action處理過程的性能
使用哈希機制改善trigger處理性能
限制數(shù)據(jù)庫請求來提供nodata()函數(shù)的計算過程
之前的版本中,zabbix proxy連接到server端時,proxy相關(guān)的信息是直接從數(shù)據(jù)庫獲取的,在3.0版本,proxy相關(guān)的信息從server端配置的緩存中獲取。另一方面,proxy配置更改不會立即生效,它必須等到server端緩存同步到數(shù)據(jù)庫。
Value緩存得到改善
二 升級步驟
Zabbix agent不強制升級到3.0.2,但是官方建議升級。Zabbix server和proxy必須升級到同一個版本。
為了在升級過程中盡量減少宕機時間和數(shù)據(jù)丟失,建議先停掉并升級Zabbix server,然后再一個接一個地停掉并升級proxy。當(dāng)所有的proxy升級過后,再啟動zabbix server。
Zabbix3.0以后需要PHP5.4以后,PHP5.7暫時不支持
其他相關(guān)的依賴軟件查看官方文檔
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在配置的時候有幾個參數(shù)需要改
post_max_size = 128M 最小值是16M
max_execution_time = 600 最小值是300秒
max_input_time = 600 最小值是300秒
date.timezone = Asia/Shanghai 需要設(shè)置時區(qū)
數(shù)據(jù)庫容量規(guī)劃
Zabbix數(shù)據(jù)庫大小主要取決于以下幾個變量,這幾個變量定義了存儲的歷史數(shù)據(jù)的總量
NVPS Number of processed values per second
這個值是每秒Zabbix server接收的新值的平均數(shù)。例如,如果每隔60秒有3000個監(jiān)控項目需要監(jiān)控,那么NVPS就是3000/60=50.意味著每秒有50個新值添加到zabbix數(shù)據(jù)庫
Housekeeper settings for history
Zabbix會保留監(jiān)控數(shù)據(jù)一段時間,通常是幾周或者幾個月。每個新的監(jiān)控數(shù)據(jù)都需要一些磁盤空間來存儲數(shù)據(jù)和索引。所以,如果我們保留30天的歷史數(shù)據(jù)并且每秒中接收50個新值,監(jiān)控數(shù)值總量就是
(30*24*3600)*50 = 129600000或者大約130M
依據(jù)使用的數(shù)據(jù)庫引擎,接收值得類型(floats,integers,strings,log files等等),單個值占用的磁盤空間可能是40字節(jié)到幾百字節(jié)。通常一個字符類型監(jiān)控項目大約是90字節(jié)。130M個監(jiān)控值需要130M*90字節(jié)=10.9GB字節(jié)磁盤空間
text和log監(jiān)控項目的值無法準(zhǔn)確預(yù)測,可以假定為每個監(jiān)控值大小為500字節(jié)
Housekeeper settings for trends
Zabbix在trends表中為每個監(jiān)控項目保留一個小時的 max/min/avg/count監(jiān)控值。這些數(shù)據(jù)用于趨勢統(tǒng)計和長期的圖表分析。一個小時的間隔時間沒法自定義更改。
每個趨勢數(shù)據(jù)大約為90字節(jié)。假設(shè)要保留5年的趨勢數(shù)據(jù),那么3000個監(jiān)控項目每年需要24*365*3000*90=2.2GB,5年就是11GB。
Housekeeper settings for events
每個Zabbix event需要大約170字節(jié)磁盤空間。很難估計zabbix每天產(chǎn)生的events數(shù)量。最壞的情況下,假定zabbix每秒產(chǎn)生一個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不讓新的數(shù)據(jù)插入到數(shù)據(jù)庫
service zabbix-server stop
2.備份zabbix數(shù)據(jù)庫
mysqldump -uroot -p zabbix > zabbix_backup20160508.sql
3.備份配置文件,PHP文件和zabbix 二進(jìn)制文件
4.安裝新的zabbix server
5.檢查zabbix server的配置文件
主要注意幾個參數(shù)
CacheSize=200M 配置信息的緩存大小,用于存儲host,item和trigger數(shù)據(jù)的共享內(nèi)存大小。取值范圍是128k~8G,默認(rèn)是8M
CacheUpdateFrequency=60 zabbix執(zhí)行配置緩存更新的時間間隔,默認(rèn)是60秒
DebugLevel=3 指定日志級別,默認(rèn)是3打印警告信息,4是調(diào)試信息,5是更加詳細(xì)的調(diào)試信息
HistoryCacheSize=50M 用于存儲歷史數(shù)據(jù)的共享存儲大小,默認(rèn)是16M,可以取值范圍是128K~2G
HistoryIndexCacheSize=8M 用于索引歷史數(shù)據(jù)緩存中的歷史數(shù)據(jù)的共享存儲大小,緩存一個監(jiān)控項目大約需要100字節(jié)。這個參數(shù)從3.0.0開始支持
HousekeepingFrequency=1 設(shè)置zabbix執(zhí)行housekeeping的頻率,默認(rèn)是1小時。housekeeping操作時刪除數(shù)據(jù)庫中過期的數(shù)據(jù)??梢栽O(shè)置HousekeepingFrequency為0關(guān)閉自動housekeeping,然后手動執(zhí)行housekeeper_execute來清理過期數(shù)據(jù)
MaxHousekeeperDelete=5000 在一個housekeeping任務(wù)中刪除的過期數(shù)據(jù)數(shù)量不超過這個值
TrendCacheSize=20M 存儲trend數(shù)據(jù)的共享內(nèi)存大小
ValueCacheSize=10M 緩存監(jiān)控數(shù)據(jù)的歷史數(shù)據(jù)的共享內(nèi)存大小。
6.啟動新的zabbix server并注意查看日志
zabbix server會自動升級數(shù)據(jù)庫
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啟動成功后就可以關(guān)閉zabbix server了等所有的proxy更新完成再啟動,盡量減少數(shù)據(jù)丟失
7.安裝zabbix web
8.停掉proxy
service zabbix-proxy stop
9.備份proxy的配置文件和zabbix proxy二進(jìn)制文件
10.安裝新版本proxy
所有的proxy升級完成以后就可以啟動zabbix server了,升級過程中注意查看日志。
zabbix agent不必強制升級,推薦升級到新版本。
三 安裝Graphtree插件
Graphtree是由OneOaas開源的zabbix插件,可以根據(jù)zabbix分組分主機分應(yīng)用顯示。這點比zatree做得好,同時Grahtree在性能方面比zatree有很大的提升,查看圖表快很多,果斷拋棄zatree使用Graphtree插件。Zatree在界面顯示上很雞肋,與本身的Zabbix界面沒法結(jié)合,Graphtree在界面方面就做得很好,和Zabbix自身的界面結(jié)合得好。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,登錄頁面看看。
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“如何升級Zabbix2.4.5到Zabbix3.0.2”這篇文章對大家有幫助,同時也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。