運行環(huán)境:
成都創(chuàng)新互聯(lián)主要從事成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)江源,十多年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):028-86922220操作系統(tǒng):CentOS release 6.8 (Final)
數(shù)據(jù)庫:MySQL 5.5.52
Web應(yīng)用服務(wù)器:Apache/2.2.15(Unix):
開源監(jiān)控程序:Zabbix 3.2.6
任務(wù):安裝zabbix。
操作步驟:
[root@sky9896html]# tar xf zabbix-3.2.6.tar.gz
[root@sky9896html]# cd zabbix-3.2.6
[root@sky9896zabbix-3.2.6]# cd database/
root@sky9896database]# cd mysql/
[root@sky9896mysql]# ll
總用量 3068
-rw-r--r-- 1 10001000 1036662 5月 522:51 data.sql
-rw-r--r-- 1 10001000 1978341 5月 522:50 p_w_picpaths.sql
-rw-r--r-- 1 10001000 122134 5月 5 22:51schema.sql
[root@sky9896mysql]# mysql -uroot -p
Enter password:
mysql> createdatabase zabbix character set utf8;
mysql> insertinto mysql.user(Host,User,Password)values('localhost','zabbix',password('******'));
mysql> flushprivileges;
mysql> grantall on zabbix.* to 'zabbix'@'127.0.0.1' identified by '***' with grant option;
mysql> usezabbix;
mysql> source/var/www/html/zabbix-3.2.6/database/mysql/schema.sql;
mysql> source/var/www/html/zabbix-3.2.6/database/mysql/p_w_picpaths.sql;
mysql> source/var/www/html/zabbix-3.2.6/database/mysql/data.sql;
mysql> exit
[root@sky9896mysql]# ln -s libmysqlclient.so.16.0.0libmysqlclient.so
[root@sky9896mysql]# ln -s libmysqlclient_r.so.16.0.0libmysqlclient_r.so
[root@sky9896mysql]# useradd zabbix
useradd:用戶“zabbix”已存在
[root@sky9896mysql]# ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
[root@sky9896mysql]# /sbin/ldconfig
root@sky9896zabbix-3.2.6]# ./configure \
--prefix=/usr/local/zabbix\
--enable-server \
--enable-agent \
--with-net-snmp \
--with-libcurl \
--enable-proxy \
--with-mysql=/usr/bin/mysql_config
[root@sky9896 zabbix-3.2.6]#make
[root@sky9896 zabbix-3.2.6]#make install
[root@sky9896 zabbix-3.2.6]#vi /usr/local/zabbix/etc/zabbix_server.conf #配置文件
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=***
DBPort=3306
DBSocket=/var/lib/mysql/mysql.sock
[root@sky9896 etc]# vi zabbix_agentd.conf
Server=127.0.0.1 #建議改成實際IP
ServerActive=127.0.0.1 #建議改成實際IP
Hostname=Zabbix server
User=zabbix
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
UnsafeUserParameters=1
[root@sky9896 zabbix-3.2.6]#
cp /var/www/html/zabbix-3.2.6/misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server
[root@sky9896 zabbix-3.2.6]#
cp /var/www/html/zabbix-3.2.6/misc/init.d/fedora/core/zabbix_agentd/etc/rc.d/init.d/zabbix_agentd
[root@sky9896 zabbix-3.2.6]#chmod +x /etc/rc.d/init.d/zabbix_server
[root@sky9896 zabbix-3.2.6]#chmod +x /etc/rc.d/init.d/zabbix_agentd
[root@sky9896 zabbix-3.2.6]#chkconfig zabbix_server on
[root@sky9896 zabbix-3.2.6]#chkconfig zabbix_agentd on
[root@sky9896 zabbix-3.2.6]#vi /etc/rc.d/init.d/zabbix_server
BASEDIR=/usr/local/zabbix/
[root@sky9896 zabbix]# vi /etc/rc.d/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix/
[root@sky9896 zabbix]# cp -r /var/www/html/zabbix-3.2.6/frontends/php/var/www/html/zabbix
[root@sky9896 zabbix]# chown apache.apache -R/var/www/html/zabbix
[root@sky9896 zabbix]# service zabbix_server restart
[root@sky9896 zabbix]# service zabbix_agentd start
[root@sky9896 zabbix]# vi/var/www/html/zabbix/include/locales.inc.php
'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => true], #啟用中文版
以上都是安裝之前的配置:
現(xiàn)在開始安裝:http://IP+setup.php
該圖是配置中文版
發(fā)布過程出現(xiàn)以下問題:
問題1:zabbix監(jiān)控報錯zabbixserver is not running: the information displayed may not be current
[root@sky9896 tmp]# cat zabbix_server.log #查日志
26996:20170619:203827.925 [Z3001]connection to database 'zabbix' failed: [2002] Can't connect to local MySQLserver through socket '/tmp/mysql.sock' (2)
26996:20170619:203827.926 database is down:reconnecting in 10 seconds
解決問題1:
[root@sky9896 etc]# pwd
/usr/local/zabbix/etc
[root@sky9896 etc]# vi zabbix_server.conf
#DBSocket=/tmp/mysql.sock #默認目錄
DBSocket=/var/lib/mysql/mysql.sock #指定實際的mysql.sock目錄
[root@sky9896 init.d]# vi zabbix_server.conf
BASEDIR=/usr/local/ 默認安裝目錄在zabbix 或者指定:BASEDIR=/usr/local/zabbix/
[root@sky9896 init.d]# vi zabbix_agentd.conf
BASEDIR=/usr/local/ 默認安裝目錄在zabbix 或者指定:BASEDIR=/usr/local/zabbix/
問題2:
[root@sky9896 tmp]# cat zabbix_agentd.log
23521:20170620:091435.666 using configuration file:/usr/local/zabbix/etc/zabbix_agentd.conf
23521:20170620:091435.667 agent #0 started[main process]
23523:20170620:091435.668 agent #1 started[collector]
23525:20170620:091435.668agent #3 started [listener #2]
23527:20170620:091435.669 agent #5 started[active checks #1]
23524:20170620:091435.669 agent #2 started[listener #1]
23526:20170620:091435.669 agent #4 started[listener #3]
23527:20170620:100835.983 active checkconfiguration update from [127.0.0.1:10051] started to fail (cannot connect to[[127.0.0.1]:10051]: [111] Connection refused)
解決問題2:
[root@sky9896 etc]# vi zabbix_agentd.conf
Server=117.40.*.* #把127.0.0.1改成實際IP
ServerActive=117.40.*.* #把127.0.0.1改成實際IP
到這里安裝完畢。
另外有需要云服務(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)用場景需求。