Server端:
1、安裝開發軟件包
yum -y groupinstall "Development Tools"
2、安裝所需的依賴包
yum -y install httpd mysql mysql-server phpphp-mysql php-common php-mbstring php-gd php-odbc php-pear curl curl-develnet-snmp net-snmp-devel perl-DBI php-xml ntpdate php-bcmath
3、同步服務端的時間,保持所有服務器時間一致避免出現時間不同導致的不可用的監控數據
ntpdate pool.ntp.rog ---過程略。
4、創建zabbix服務運行所需要的用戶和組
groupadd -g 201 zabbix
useradd -g zabbix -u 201 -mzabbix
5、centos7 用的是mariadb
安裝方法:yum -yinstall mariadb*
systemctl start mariadb.service
systemctl enable mariadb.service
6、創建zabbix運行所需要的數據庫及用戶權限
mysqladmin -uroot -h127.0.0.1 password "123456"
mysql -uroot -h127.0.0.1 -p
create database zabbix character set utf8;
grant all privileges on zabbix.* tozabbix@'192.168.251.10' identified by 'zabbix';
flush privileges;
7、下載解壓zabbix
wgethttp://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz
cd /usr/src/
tar xf zabbix-2.2.2.tar.gz
cd /usr/src/zabbix-2.2.2
8、將zabbix的初始數據導入到數據庫中
mysql -uroot -p123456 zabbix <database/mysql/schema.sql
mysql -uroot -p123456 zabbix <database/mysql/p_w_picpaths.sql
mysql -uroot -p123456 zabbix < database/mysql/data.sql
9、編譯安裝zabbix
./configure --prefix=/usr/local/zabbix--with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent--enable-proxy
10、添加服務端口: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 Trapper
11、添加配置文件
mkdir -p /etc/zabbix
cp -r conf/* /etc/zabbix/
chown -R zabbix:zabbix /etc/zabbix
12、修改server配置文件,添加zabbix數據庫密碼
cp misc/init.d/fedora/core/zabbix_server/etc/init.d/
cpmisc/init.d/fedora/core/zabbix_agentd /etc/init.d/
cp -R frontends/php/var/www/html/zabbix
sed-i 's/^DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
sed-i 's/^.*DBPassword=.*$/DBPassword=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
sed-i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
sed-i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
13、改Agentd配置文件,更改HOSTNAME爲本機的hostname
vi /etc/zabbix/zabbix_agentd.conf
PidFile=/tmp/zabbix_agentd.pid
EnableRemoteCommands=1
Server=192.168.251.10
Hostname=testserver10
14、啓動zabbix server
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
echo "/etc/init.d/zabbix_serverstart" >> /etc/rc.local
echo "/etc/init.d/zabbix_agentdstart" >> /etc/rc.local
15、修改php.ini
memory_limit = 256M
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 600
upload_max_filesize = 16M
max_input_time = 600
16、修改apache 的配置文件
<IfModule dir_module>
DirectoryIndex index.html php
</IfModule>
17、圖形訪問:
web頁面配置,配置http訪問好了後web登陸:http://ip/zabbix
確認每個Required都是ok的纔會顯示Next按鈕,如果有Fail的需要完善系統要求
這裏主要下,出現Fail的原因是zabbix的配置文件沒有,需要點擊“Download configurationfile”將zabbix.conf.php下載到本地在上傳到服務器的zabbix/conf/目錄下,然後在web頁面Retry即可
到此web頁面配置完畢,已經到了登陸界面,zabbix的默認登陸賬號是admin,密碼是zabbix
服務器的zabbix服務必須的重啓
更換中文字體,登陸後在頁面的右上邊點擊“Prefile”
在Language選項中選擇“Chinese(zh_CN)”,然後Save
客戶端配置:
scp -r zabbix-2.2.2.tar.gz [email protected]:/usr/src
cd /usr/src
tar xzvf zabbix-2.2.2.tar.gz
cd zabbix-2.2.2
./configure--prefix=/usr/local/zabbix-2.2.2/ --enable-agent
make && make install
cp misc/init.d/fedora/core/zabbix_agentd/etc/init.d/
/etc/init.d/zabbix_agentd start
echo "/etc/init.d/zabbix_agentdstart" >> /etc/rc.local
vi/usr/local/zabbix-2.2.2/etc/zabbix_agent.conf
Server=192.168.251.10
UnsafeUserParameters=1
Include=/usr/local/zabbix-2.2.2/etc/zabbix_agent.conf.d/
vi /usr/local/zabbix-2.2.2/etc/zabbix_agentd.conf
Server=192.168.251.10
ServerActive=192.168.251.10
Include=/usr/local/zabbix-2.2.2/etc/zabbix_agentd.conf.d/
UnsafeUserParameters=1
ln -s /usr/local/zabbix-2.2.2/sbin/*/usr/local/sbin/
ln -s /usr/local/zabbix-2.2.2/bin/*/usr/local/bin/
echo 'zabbix-agent 10050/tcp #Zabbix Agent'>> /etc/services
echo 'zabbix-agent 10050/udp #Zabbix Agent'>> /etc/services
echo 'zabbix-trapper 10051/tcp #Zabbixtrapper' >> /etc/services
echo 'zabbix-trapper 10051/udp #Zabbixtrapper' >> /etc/services
systemctl daemon-reload
service zabbix_agentd start
chmod +x /etc/rc.d/init.d/zabbix_agentd
chkconfig zabbix_agentd on