天天看点

测试centos7安装zabbix3.4

环境:centos7 x64 1501

实验ip为:192.168.31.77

1.安装必须软件包

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

修改apache的配置文件,默认首页设置为php

vim /etc/httpd/conf/httpd.conf

找到:

AddType application/x-gzip .gz .tgz

在该行下面添加

AddType application/x-httpd-php .php

<IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

将该行改为

    DirectoryIndex index.html index.htm index.php

增加php应用的支持

重启httpd

 systemctl restart httpd.service

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

firewall-cmd --reload

2.配置zabbixzone package

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版本以上导入数据:

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图示基本相同)

<a href="http://172.16.169.128/zabbix/setup.php">http://192.168.31.77/zabbix/setup.php</a>

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客户端:

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 

netstat -anlpt

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

13、zabbix图形中文乱码

本文转自 lcpljc 51CTO博客,原文链接:http://blog.51cto.com/lcpljc/2052196,如需转载请自行联系原作者