Zabbix的安装与配置

Posted kevinlucky

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zabbix的安装与配置相关的知识,希望对你有一定的参考价值。


0、环境准备

配置php环境

rpm -Uvh http://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm

yum install php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-gd.x86_64 php72w-ldap.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php72w-mysql.x86_64 php72w-pdo.x86_64

编辑php的ini文件(vim /etc/php.ini)并修改一下内容,注意date.timezone一定要写对,否则在配置完zabbix后,显示的界面全部报错 
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
always_populate_raw_post_data = -1
ldap.max_links = 10
date.timezone Asia/Shanghai
extension=bcmath.so

yum install php-bcmath php-mbstring php-xml  

不安装为报以下问题:
PHP bcmath extension missing (PHP configuration parameter --enable-bcmath).
PHP mbstring extension missing (PHP configuration parameter --enable-mbstring).
PHP xmlwriter extension missing.
PHP xmlreader extension missing.

配置Http服务

vim /etc/httpd/conf/httpd.conf

DirectoryIndex index.html index.html.var index.php

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

设置web前端
mkdir /var/www/html/zabbix
cp -a zabbix-3.4.13/frontends/php/ /var/www/html/zabbix/

设置apache的执行和所有者
chown -R apache:apache /var/www/html/zabbix

赋予可执行权限
chmod +x /var/www/html/zabbix/conf/

1、创建Mysql数据库

create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to [email protected]‘%‘ identified by ‘zabbix‘;
flush privileges;

mysql>use zabbix;
mysql>source /opt/schema.sql;
mysql>source /opt/images.sql;
mysql>source /opt/data.sql;


2、下载解压安装包

wget "https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX Latest Stable/3.4.13/zabbix-3.4.13.tar.gz"
tar -zxvf zabbix-3.4.13.tar.gz

cd zabbix-3.4.13/
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --enable-java --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix

错误解决:
configure: error: Unable to use libevent (libevent check failed)
yum install libevent-devel -y
configure: error: Unable to use libpcre (libpcre check failed)
yum -y install pcre* 

make
make install


配置zabbix的服务和参数

cp misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd



vim /usr/local/zabbix/etc/zabbix_server.conf

DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
 

#修改 /etc/init.d/zabbix_server /etc/init.d/zabbix_agentd的BASEDIR=/usr/local/为BASEDIR=/usr/local/zabbix
sed -i ‘s#BASEDIR=/usr/local/#BASEDIR=/usr/local/zabbix#g‘ /etc/init.d/zabbix_{server,agentd}

3.服务启动

#启动Apache服务
service httpd start

#启用mysql服务
service mysqld start
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start

http://10.66.3.219/zabbix/

  

  





以上是关于Zabbix的安装与配置的主要内容,如果未能解决你的问题,请参考以下文章

zabbix agent安装与配置自定义监控

zabbix服务端安装与配置

Zabbix-CentOS7下zabbix的安装与配置

1zabbix4安装与基础配置

Zabbix最佳实践一:Zabbix Server 的安装与配置

Centos7下zabbix安装与部署,设置中文(保姆级图文)网络工程