zabbix安裝及配置
一、安裝mysql、php、apache、zabbix
安裝環境:
操作系統:rhel6.3-x86-64
mysql:5.6.23 --官網下載rpm包安裝
php:5.3.3 --使用系統鏡像自帶的php-rpm包安裝。 ---rhel5.8鏡像內自帶的php-rpm包版本為5.1.6,不支持zabbix2.4
zabbix 2.4.4.1 --官網下載rpm包安裝 --該版本的zabbix需要php5.3以上支持。
Apache/2.2.15 --使用系統鏡像自帶的php-rpm包安裝。
說明:rhel6.3沒測試,除了zabbix安裝包需要自裁外,mysql、php、apache可直接使用鏡像里的原rpm包直接安裝。
如果是其它操作系統版本,如rhel5.8,系統鏡像里的php-rpm包版本太低,需要下載新版本的php安裝,否則zabbix檢查環境時不通過。
安裝步驟:
1、配置本地yum源:
安裝過程中需要安裝各種依賴的包,所以最好上傳系統iso鏡像至服務器,並配置本地yum源。否則,各種痛苦。
配置方法參考:http://www.cnblogs.com/rusking/p/4248946.html
2、安裝mysql
參考:http://www.cnblogs.com/rusking/p/4422986.html
還要安裝這個:rpm -ivh MySQL-devel包
3、安裝php
yum install php* -y
這三個包系統鏡像沒有,下載地址: http://rpm.pbone.net
php-bcmath-5.3.3-3.el6_2.8.x86_64.rpm
php-mbstring-5.3.3-3.el6_2.8.x86_64.rpm
php-mcrypt-5.3.3-3.el6.x86_64.rpm
4、安裝apache
創建用戶及組:
# groupadd apache
# useradd –g apache apache
yum命令安裝apache
yum install httpd -y --與apache相關的包在iso鏡像里都有,配置yum源后,直接yum install httpd即可。
5、安裝zabbix
安裝順序:
zabbix-2.4.4-1.el6.x86_64.rpm
這三個包系統鏡像沒有,下載地址: http://rpm.pbone.net
fping-3.9-1.el6.rf.x86_64.rpm
iksemel-1.4-2_2.el6.x86_64.rpm
libiksemel3-1.4-2_2.el6.x86_64.rpm
zabbix-server-2.4.4-1.el6.x86_64.rpm
zabbix-server-mysql-2.4.4-1.el6.x86_64.rpm
兩個包一起安裝,否則提示:zabbix-server-implementation…… is needed by zabbix-server-……
zabbix-web-2.4.4-1.el6.noarch.rpm
zabbix-web-mysql-2.4.4-1.el6.noarch.rpm
兩個包一起安裝。
zabbix-agent-2.4.4-1.el6.x86_64.rpm
6、修改相關配置文件:
修改zabbix主配置文件(和數據庫保持一致)
find / -name zabbix_server.conf
/etc/zabbix/zabbix_server.conf
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
添加zabbix的服務端口 vi/etc/services
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trappe
修改php.ini
date.timezone = Asia/Shanghai
post_max_size = 16M
max_execution_time = 300
msx_input_time = 300
always_populate_raw_post_data = -1
7、啟動mysql,創建zabbix數據庫,導入sql腳本
service mysql start
創建zabbix數據庫及授權
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to 'zabbix'@'%' identified by '密碼';
[root@localhost ~]# mysql -uzabbix -p -h 192.168.1.123--確認zabbix遠程及本地登錄正常。
[root@localhost ~]# mysql -uzabbix -p --本地登錄
導入zabbix相關的sql腳本:
[root@rusky /]# cd /usr/share/doc/zabbix-server-mysql-2.4.4/create/
[root@rusky /]# ls
data.sql images.sql schema.sql
# mysql -uroot -p zabbix < schema.sql
# mysql -uroot -p zabbix < images.sql
# mysql -uroot -p zabbix < data.sql
=================
其它:
修改apache配置文件支持php.ini
修改DirectoryIndex index.html 為DirectoryIndex index.html index.php
並添加AddType application/x-httpd-php .php
1、 復制zabbix/frontends下的php到apache的www/html目錄下
[root@rhel201 frontends]# pwd
/mnt/hgfs/VH-share/zabbix-2.4.5/frontends
[root@rhel201 frontends]# cp php /var/www/html/zabbix/
說明:如果apache是編譯安裝的,沒有/var/www目錄。則時需要把cp -rf frontends/php apache安裝目錄/htdocs/zabbix
2、httpd start報錯:
# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 10.168.51.228 for ServerName
[ OK ]
解決辦法:vi /etc/httpd/conf/httpd.conf 加入一句 ServerName localhost:80
8、啟動appache及zabbix服務
啟動apache:
service httpd start
或/etc/init.d/httpd start
啟動zabbix:
/etc/init.d/zabbix-server start
/etc/init.d/zabbix-agentd start
或者:/usr/sbin/zabbix_server start
/usr/sbin/zabbix_agentd start
zabbix默認日志目錄:/var/log/zabbix
查看apache及zabbix服務端及客戶端啟動狀態:
ps -ef | grep httpd
ps -ef | grep zabbix
二、訪問web界面及配置
1、登錄界面:
http://ip/ --打開apache默認界面,出現如下則說明apache安裝沒問題。
http://ip/zabbix --打開zabbix初始化界面,如下圖:
2、檢查安裝環境
3、填寫對應數據庫的信息
4、zabbix的ip、端口以及主機名的設置
5、配置信息預覽
6、Finish-Insall
這一步如果create zabbix.conf.php文件失敗,則點擊下載文件,然后再上傳到上述指定路徑即可。
6、登錄: 默認用戶名:Admin(注意A大寫) 密碼zabbix
7、首次登錄頁面信息
提示zabbix serveris running--values=No,解決方法:http://www.cnblogs.com/rusking/p/4441362.html
三、客戶端的安裝與配置
1、安裝客戶端:
使用下載的rpm包安裝在客戶端服務器:zabbix-agent-2.4.4-1.el6.x86_64.rpm
groupadd -r zabbix
useradd -g zabbix -s /sbin/nologin zabbix
2、啟動客戶端進程
/etc/init.d/zabbix-agent start
lsof -i:10050 #####查看開啟偵聽的端口 服務端端口為10051
3、配置Server頁面
Configuration -----> Hosts,修改當前主機為enable.
……
下篇:web界面配置。