CentOS6.9部署zabbix3.0監控系統

環境:php

[root@redis ~]# uname -a
Linux redis 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 21 19:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@redis ~]# cat /etc/redhat-release 
CentOS release 6.9 (Final)
[root@redis ~]# getenforce 
Disabled
[root@redis ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@redis ~]# 

 

部署zabbix server

若是會配置yum源環境(zabbix源、repo源)的話能夠直接執行:html

這些也是安裝zabbix server須要的一些程序,若是不會配置yum源環境,就繼續向下看詳細的安裝步驟。java

yum install httpd zabbix-web zabbix-server-mysql zabbix-web-mysql zabbix-get mysql-server php55w php55w-mysql php55w-common php55w-gd php55w-mbstring php55w-mcrypt php55w-devel php55w-xml php55w-bcmath zabbix-get zabbix-java-gateway wqy-microhei-fonts net-snmp net-snmp-utils -y

安裝zabbix、httpd、php

[root@m01 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
[root@m01 ~]# yum install -y zabbix-server-mysql zabbix-web-mysql
已安裝:
  zabbix-server-mysql.x86_64 0:3.0.13-2.el6    zabbix-web-mysql.noarch 0:3.0.13-2.el6   

做爲依賴被安裝:
  OpenIPMI-libs.x86_64 0:2.0.19-15.el6        OpenIPMI-modalias.x86_64 0:2.0.19-15.el6  
  dejavu-fonts-common.noarch 0:2.33-6.el6     dejavu-sans-fonts.noarch 0:2.33-6.el6     
  fontpackages-filesystem.noarch 0:1.44-8.el6 fping.x86_64 0:3.10-4.el6                 
  httpd.x86_64 0:2.4.6-67.el6.centos.6        httpd-tools.x86_64 0:2.4.6-67.el6.centos.6
  iksemel.x86_64 0:1.4-6.el6                  libX11.x86_64 0:1.6.5-1.el6               
  libX11-common.noarch 0:1.6.5-1.el6          libXau.x86_64 0:1.0.8-2.1.el6             
  libXpm.x86_64 0:3.5.12-1.el6                libpng.x86_64 2:1.5.13-7.el6_2            
  libxcb.x86_64 0:1.12-1.el6                  libzip.x86_64 0:0.10.1-8.el6              
  mailcap.noarch 0:2.1.41-2.el6               net-snmp-libs.x86_64 1:5.7.2-28.el6       
  php.x86_64 0:5.4.16-42.el6                  php-bcmath.x86_64 0:5.4.16-42.el6         
  php-cli.x86_64 0:5.4.16-42.el6              php-common.x86_64 0:5.4.16-42.el6         
  php-gd.x86_64 0:5.4.16-42.el6               php-ldap.x86_64 0:5.4.16-42.el6           
  php-mbstring.x86_64 0:5.4.16-42.el6         php-mysql.x86_64 0:5.4.16-42.el6          
  php-pdo.x86_64 0:5.4.16-42.el6              php-xml.x86_64 0:5.4.16-42.el6            
  t1lib.x86_64 0:5.1.2-14.el6                 unixODBC.x86_64 0:2.3.1-11.el6            
  zabbix-web.noarch 0:3.0.13-2.el6           

完畢!
安裝過程

mysql安裝

[root@m01 ~]# yum install -y mysql-server
已安裝:
  mariadb-server.x86_64 1:5.5.56-2.el6                                                   

做爲依賴被安裝:
  libaio.x86_64 0:0.3.109-13.el6                                                         
  mariadb.x86_64 1:5.5.56-2.el6                                                          
  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el6                                           
  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el6                                            
  perl-DBD-MySQL.x86_64 0:4.023-5.el6                                                    
  perl-DBI.x86_64 0:1.627-4.el6                                                          
  perl-IO-Compress.noarch 0:2.061-2.el6                                                  
  perl-Net-Daemon.noarch 0:0.48-5.el6                                                    
  perl-PlRPC.noarch 0:0.2020-14.el6                                                      

完畢!
安裝過程

  啓動mysql:mysql

[root@redis ~]# /etc/init.d/mysqld start

建立zabbix所需的庫

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

將sql文件導入數據庫

[root@redis ~]# zcat /usr/share/doc/zabbix-server-mysql-3.0.13/create.sql.gz|mysql -uzabbix -pzabbix zabbix

配置zabbix server鏈接mysql

[root@redis ~]# sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf

複製zabbix到站點目錄下

\cp -R /usr/share/zabbix/ /var/www/html/

修改zabbix須要的php參數

這步也能夠根據網頁作。(根據網頁初始化的Check of pre-requisites這一頁作)web

sed -i '/^max_execution_time/cmax_execution_time = 300'  /etc/php.ini
sed -i '/^max_input_time/cmax_input_time = 300'  /etc/php.ini
sed -i '/^post_max_size/cpost_max_size = 32M'  /etc/php.ini
date.timezone = Asia/Shanghai    --- 手動改吧

網頁登錄操做

登錄帳號密碼:Admin   zabbixredis

改中文

 

安裝zabbix agent 客戶端

 下載安裝客戶端 

[root@db03 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm

[root@db03 ~]# yum install -y zabbix-agent

 修改客戶端配置文件

[root@db03 ~]# sed -i.ori 's#Server=127.0.0.1#Server=172.16.1.88#' /etc/zabbix/zabbix_agentd.conf

 啓動zabbix-agent

/etc/init.d/zabbix-agent start

 檢查zabbix是否能夠監控(只能在server端操做)

yum install zabbix-get -y
zabbix_get -s 172.16.1.61 -p 10050 -k 

網頁添加監控

主機名稱:要與zabbix-agent.conf中Hostname指定的名字同樣或者填寫主機ip,設置這個主要是爲了讓zabbix server程序調用的sql

可見名稱:顯示在zabbix網頁上的,給咱們看的數據庫


相關文章
相關標籤/搜索