測試centos7安裝zabbix3.4

環境:centos7 x64 1501
php

實驗ip爲:192.168.31.77html


1.安裝必須軟件包java

yum -y install httpd mariadb mariadb-server php php-gd php-mysql php php-gd php-mysql php-bcmath php-mbstringmysql

修改apache的配置文件,默認首頁設置爲phplinux

vim /etc/httpd/conf/httpd.confweb

找到:
AddType application/x-gzip .gz .tgz
在該行下面添加
AddType application/x-httpd-php .php
找到:
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
將該行改成
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>
sql

增長php應用的支持數據庫

重啓httpdapache

 systemctl restart httpd.servicevim

firewall-cmd --add-port=80/tcp --permanent

firewall-cmd --reload

2.配置zabbixzone package

 

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm

3.安裝zabbix server 

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway -y

yum install zabbix-get

 

編輯/etc/httpd/conf.d/zabbix.conf

更改時區:

添加上海時區

php_value date.timezone Asia/Shanghai

 

重啓httpd生效配置

開啓mariadb

systemctl enable mariadb

systemctl  start mariadb

而後設置數據庫密碼777777

 mysqladmin  -uroot password 777777

4.建立mariadb數據庫和用戶

mysql -uroot -p777777

create database zabbix character set utf8;

受權

grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';

刷新權限

flush privileges; 

5.數據庫導入zabbix  template

查看須要導入的數據表

 ls -l  /usr/share/doc/zabbix-server-mysql-3.4.0/

登陸zabbix數據庫

mysql -uzabbix -pzabbix

使用zabbix數據庫

use zabbix;

導入模板數據


---------------------------------------------------------------------------------------

備註:

2.0版本導入數據方法:

source /usr/share/doc/zabbix-server-mysql-2.4.8/create/schema.sql

source /usr/share/doc/zabbix-server-mysql-2.4.8/create/images.sql

source /usr/share/doc/zabbix-server-mysql-2.4.8/create/data.sql

或者:

# mysql -uroot -pttlsapwd zabbix <schema.sql

# mysql -uroot -pttlsapwd zabbix <images.sql

# mysql -uroot -pttlsapwd zabbix <data.sql

---------------------------------------------------------------------------------------

3.0版本以上導入數據:

zcat /usr/share/doc/zabbix-server-mysql-3.4.0/create.sql.gz | mysql -uzabbix -pzabbix zabbix

6.配置zabbix server

vi /etc/zabbix/zabbix_server.conf

開啓參數

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

7.配置zabbix-agent

vi /etc/zabbix/zabbix_agentd.conf

修改添加zabbix-server的ip

Server=127.0.0.1 

修改

ServerActive=127.0.0.1

修改

Hostname=127.0.0.1 

8.修改PHP配置

編輯文件/etc/php.ini


max_execution_time = 600

max_input_time = 600

memory_limit = 256

post_max_size = 32M

upload_max_filesize = 16M

date.timezone = Asia/Shanghai

9.修改Firewall和selinux設置

開放zabbix端口10050 和10051

firewall-cmd --permanent --add-port=10050/tcp

firewall-cmd --permanent --add-port=10051/tcp

systemctl restart firewalld

若是使用selinux,運行一下命令使apache能夠和zabbix通訊

setsebool -P  httpd_can_connet_zabbix=1

啓動zabbix-server和zabbix-agent,重啓httpd,並設置開機自動啓動

systemctl start zabbix-server

systemctl start zabbix-agent

systemctl restart httpd

systemctl restart mariadb

systemctl enable zabbix-server

systemctl enable zabbix-agent

11.經過控制檯配置zabbix(2.4和3.4圖示基本相同)

http://192.168.31.77/zabbix/setup.php

12.客戶端安裝:

windows客戶端安裝


1.下載客戶端:zabbix_agentd.zip

2.在c盤建立文件夾zabbix,解壓conf和bin目錄

3.將conf下的zabbix_agentd.win.conf 修改成zabbix_agentd.conf

4.修改配置文件zabbix_agentd.conf:

  LogFile=C:\zabbix\zabbix_agentd.log

  Server=192.168.31.77 備註:-----zabbix server 源地址

  ServerActive=192.168.31.150

  Hostname=192.168.31.150 備註: ------本計算機名或IP

.安裝:

  cd C:\zabbix\bin

  zabbix_agentd.exe -c "C:\zabbix\conf\zabbix_agentd.conf" -i

啓動:

  zabbix_agentd.exe -c "C:\zabbix\conf\zabbix_agentd.conf" -s

-----------------------------------------

linux客戶端:

 

rpm -Uv http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
yum install zabbix-sender zabbix-agent zabbix -y

sed -i "s/Server=127.0.0.1/Server=192.168.31.77/" /etc/zabbix/zabbix_agentd.conf
sed -i "s/ServerActive=127.0.0.1/ServerActive=192.168.31.77/" /etc/zabbix/zabbix_agentd.conf
sed -i "s/Hostname=Zabbix server/Hostname=192.168.31.50/" /etc/zabbix/zabbix_agentd.conf 
systemctl enable zabbix-agent
systemctl start zabbix-agent
netstat -anlpt
firewall-cmd --add-port=10050/tcp --permanent
firewall-cmd --reload

1三、zabbix圖形中文亂碼

cd /usr/share/zabbix/include
[root@zabbix-server include]# vi defines.inc.php

define('ZBX_FONT_NAME','simkai');

define('ZBX_GRAPH_FONT_NAME','simkai')

而後下載微軟楷體字體,更名爲simkai傳入 /usr/share/zabbix/fonts目錄下便可
相關文章
相關標籤/搜索