1. 程式人生 > 實用技巧 >Zabbix-4.0.24 服務端安裝

Zabbix-4.0.24 服務端安裝

依賴包安裝:

yum install net-snmp* libssh-devel libssh2-devel -y

Zabbix server安裝:

wget https://cdn.zabbix.com/zabbix/sources/stable/4.0/zabbix-4.0.24.tar.gz

groupadd -g 1010 zabbix
useradd -g 1010 -u 1010 zabbix -s /sbin/nologin

tar -zxvf zabbix-4.0.24.tar.gz && cd zabbix-4.0.24
./configure --prefix=/data/soft/zabbix --enable-server --enable-agent --with-mysql --disable-ipv6 --with-net-snmp --with-libcurl --enable-proxy --with-ssh2

make && make install 

MySQL 資料部分匯入:

cd /data/src/zabbix-4.0.24/database/mysql/

mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> flush privileges;
mysql> use zabbix;
mysql> source schema.sql;
mysql> source images.sql;
mysql> source data.sql;

Zabbix server 啟動指令碼:

cd /data/src/zabbix-4.0.24/misc/init.d/fedora/core

cp zabbix_server /etc/init.d/
chkconfig --add zabbix_server
chkconfig --list | grep zabbix
zabbix_agentd  	0:關閉	1:關閉	2:關閉	3:關閉	4:關閉	5:關閉	6:關閉
zabbix_server  	0:關閉	1:關閉	2:關閉	3:關閉	4:關閉	5:關閉	6:關閉
chkconfig  zabbix_server on
chkconfig  zabbix_agentd on

/etc/init.d/zabbix_server restart
/etc/init.d/zabbix_agentd restart

Zabbix Web 安裝:

#1 ) 環境:
nginx + php 環境自行搞定

#2 ) 複製程式碼:
mkdir /data/www/zabbix -p 
cd /data/src/zabbix-4.0.24/frontends/php
cp -rf ./* /data/www/zabbix/
chown -R fmw.fmw /data/www/zabbix


post_max_size=16M
max_execution_time=300
max_input_time=300

#3 ) 
http://域名/   訪問頁面開始安裝

zabbix 字型亂碼:


# 1) 進入程式碼存放目錄的字型目錄:
cd /data/www/zabbix/assets/fonts

# 2) 下載字型並解壓縮:
http://y.downya.com/soft/simkai_downyi.com.zip
unzip simkai_downyi.com.zip

# 3) 賦予許可權: 
chmod 777 *.ttf

# 4) 修改php檔案呼叫的字型檔名:
vim /data/www/zabbix/include/defines.inc.php
......
define('ZBX_FONTPATH',                          realpath('assets/fonts')); // where to search for font (GD > 2.0.18)
//define('ZBX_GRAPH_FONT_NAME',         'DejaVuSans'); // font file name
define('ZBX_GRAPH_FONT_NAME',           'simkai'); // font file name
define('ZBX_GRAPH_LEGEND_HEIGHT',       120); // when graph height is less then this value, some legend will not show up
......
* 註釋原來的行,新增下面的行
define('ZBX_GRAPH_FONT_NAME',           'simkai');


zabbix 管理員密碼忘記:


# 1) 登入資料庫:
    mysql -u root -pxxxxxxxx

     zabbix儲存在資料庫中使用者名稱密碼是經過32位,小寫,md5加密過的。我們可以手動修改資料庫中使用者的密碼。

# 2)  生成密碼:

# 3)  更新密碼
    update zabbix.users set passwd='21232f297a57a5a743894a0e4a801fc3' where alias='Admin';

# 4)  使用密碼:
     admin登陸即可,登陸後,可以再將自己的密碼改成其他的。
     Admin   |  admin