zabbix3.4 安装

为了简单起见,以下的安装将zabbix-server,zabbix-agent和mariadb数据库装在同一台服务器中,并通过使用yum源的方式来进行快速搭建zabbix服务。

测试系统环境:CentOS Linux release 7.3.1611 (Core) 

搭建服务之前,大家可以查看一下自己服务器的版本号:

[root@localhost yum.repos.d]# cat /etc/redhat-release 

CentOS Linux release 7.3.1611 (Core) 

Yum源安装:

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

服务器端安装

# yum install zabbix-server-mysql zabbix-web-mysql

# yum install mariadb-server -y            安装mariadb数据库

# mysqladmin -uroot password '<password>' 修改数据库的root密码

# mysql -uroot -p<password>

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';

mysql> quit

#zcat /usr/share/doc/zabbix-server-mysql-3.4.0/create.sql.gz | mysql -uzabbix -p zabbix   导入zabbix所需要的表

Configure database for Zabbix server

# vi /etc/zabbix/zabbix_server.conf

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=<password>

#systemctl start zabbix-server

注意关闭selinux,否则启动报错。

关闭selinux步骤如下:

vi /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=permissive                            将此处的SELINUX=enforcing为permissive

# SELINUXTYPE= can take one of three two values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

修改完配置文件以后使用setenforce命令来即时修改配置

# setenforce 0

查看是否修改成功:

getenforce(或者sestatus),如:

# sestatus

[root@localhost ~]# sestatus 

SELinux status:                 enabled

SELinuxfs mount:                /sys/fs/selinux

SELinux root directory:         /etc/selinux

Loaded policy name:             targeted

Current mode:                   permissive

Mode from config file:          permissive

Policy MLS status:              enabled

Policy deny_unknown status:     allowed

Max kernel policy version:      28

zabbix的PHP的前端配置

php_value max_execution_time 300

php_value memory_limit 128M

php_value post_max_size 16M

php_value upload_max_filesize 2M

php_value max_input_time 300

php_value always_populate_raw_post_data -1

php_value date.timezone Asia/Shanghai      此处为自己修改的时区

#systemctl start httpd

http://<server_ip_or_name>/zabbix 进行前端配置安装,zabbix默认的用户为Admin,密码为zabbix

需要关闭防火墙,否则无法访问页面,关闭防火墙:

#systemctl stop firewalld.service

zabbix代理安装     (代理端用于使用监控主机)

# yum install zabbix-agent

# service zabbix-agent start

注意:在后面的创建Item过程中,选择Key时,要将选择的system.cpu.load[<cpu>,<mode>]的key值修改成system.cpu.load,否则会报Invalid first parameter的错误。