准備工作
apt-get install gettext
apt-get install unzip
apt-get install rar
一、安裝主程序
代碼: 全選
wget
http://repo.zabbix.com/zabbix/3.0/ubunt ... ty_all.deb
dpkg -i zabbix-release_3.0-1+trusty_all.deb
apt-get update
apt-get install zabbix-server-mysql zabbix-frontend-php# 裝服務器端
apt-get install zabbix-agent
二、設置數據庫表(假設你設置的mysql的root密碼是123456)
shell> mysql -uroot -p123456
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> quit;
shell> cd /usr/share/doc/zabbix-server-mysql
shell> zcat create.sql.gz | mysql -uroot -p123456 zabbix
三、編輯zabbix的設置文件
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
四、編輯conf文件,准備安裝
vi /etc/apache2/conf-enabled/zabbix.conf
編輯時區
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
最后一行,去掉#號,時區改成 Asia/Shanghai
開始安裝
先重啟服務
service zabbix-server start
service apache2 restart
然后瀏覽器登錄:
http://yourhost/zabbix
數據庫帳號是zabbix,密碼是你設置的密碼:zabbix
一路安裝。。。web登錄帳號是Admin/zabbix,基本ok!
五、優化設置
1、啟用中文
vi /usr/share/zabbix/include/locales.inc.php
把zh_CN后面參數寫true
然后去選擇語言吧。
如果,去選擇語言的時候,你發現還是不能選擇。。。。
提示:
You are not able to choose some of the languages, because locales for them are not installed on the web server.
是因為你系統里沒中文環境
那么:設置中文環境
第一步,安裝中文包:
apt-get install language-pack-zh-hant language-pack-zh-hans
第二步,配置相關環境變量:
vi /etc/environment
在文件中增加語言和編碼的設置:
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
第三步,重新設置本地配置:
dpkg-reconfigure locales
現在重啟apache&zabbix_server兩個服務一下,應該可以選了。。
2、但是我發現翻譯的不好,有大神做了更好的翻譯
參見:https://github.com/echohn/zabbix-zh_CN
先進入
cd /usr/share/zabbix/locale/zh_CN/LC_MESSAGES目錄
代碼: 全選
wget
https://github.com/echohn/zabbix-zh_CN/ ... master.zip
unzip master.zip
rm frontend.mo
cp zabbix-zh_CN-master/frontend.mo frontend.mo
現在重啟apache&zabbix_server兩個服務
service zabbix-server restart
service apache2 restart
3、看圖時候,如果有中文,會亂碼
調整圖像里的中文亂碼
下載雅黑
代碼: 全選
wget
http://dx.sc.chinaz.com/Files/DownLoad/font2/dd.rar
解壓縮文件
rar x dd.rar
cp dd/msyh.ttf msyh.ttf
然后修改 vi /usr/share/zabbix/include/defines.inc.php
找到
define('ZBX_GRAPH_FONT_NAME', 'graphfont'); // font file name
修改成:
define('ZBX_GRAPH_FONT_NAME', 'msyh'); // font file name
重啟apache服務即可
4、重要的mibs庫,必須更新,否則snmp監控交換機時,mib會報錯。
apt-get install snmp-mibs-downloader
六、一些提示 tips
重新啟動zabbix-server服務進程
# service zabbix-server restart
重新啟動zabbix-agent進程
# service zabbix-server restart
重啟apache進程
#service apache2 restart
重要目錄:
log: /var/log/zabbix/zabbix_server/log和agent.log 排查錯誤必須
conf:/etc/zabbix/*.conf
安裝目錄:/usr/share/zabbix 重要的include,font .etc
根web目錄在var/www/html