zabbix 4.0安装

zabbix 4.0安装

zabbix 4.0安装

环境准备

下载zabbix源码,并上传源码到目标机器。

1
2
3
$ tar -zxvf zabbix-4.0.1.tar.gz
$ groupadd zabbix
$ useradd -g zabbix zabbix

配置mysql数据库

1
2
3
4
5
6
7
8
9
$ mysql -uroot -p<password>
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
> quit;
$ cd zabbix-4.0.1/database/mysql/
$ mysql -uzabbix -pzabbix zabbix < schema.sql
# stop here if you are creating database for Zabbix proxy
$ mysql -uzabbix -pzabbix zabbix < images.sql
$ mysql -uzabbix -pzabbix zabbix < data.sql

安装并启动server端和agent端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 配置安装盘为本地yum源
$ yum -y install libxml2-devel
$ yum -y install net-snmp-devel
$ yum -y install libevent-devel
$ yum -y install curl-devel
$ yum install php-ldap
$ yum install php-gd
$ yum install php-xmlreader
$ yum install php-mbstring
$ yum install php-bcmath

$ ./configure --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
$ make install
$ zabbix_server
$ zabbix_agentd
错误解决:zabbix_server: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
==================》
1.ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/mysql/libmysqlclient.so.20
2.ldconfig

安装配置web

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ yum install httpd
$ mkdir /var/www/html/zabbix
$ cd zabbix-4.0.1/frontends/php
$ cp -a . /var/www/html/zabbix
$ systemctl start httpd
$ systemctl enable httpd
$ yum install php php-mysql
$ vi php.ini
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300

#注意关闭selinux

输入网址http://192.168.106.246/zabbix/setup.php


根据提示修改:上图问题需要执行以下解决

1
2
3
4
5
6
7
8
9
10
yum install php-ldap
yum install php-gd
yum install php-xmlreader
yum install php-mbstring
yum install php-bcmath
修改php.ini
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300

配置查看

cd /var/www/html/zabbix/conf

被监控服务器的Zabbix-agent安装

1
2
3
4
5
6
7
8
[root@master ~]#tar -xzvf zabbix-4.0.1.tar.gz
[root@master ~]# cd zabbix-4.0.1/
[root@master zabbix-4.0.1]# ./configure --enable-agent
[root@master zabbix-4.0.1]# make install
[root@master zabbix-4.0.1]# vi /usr/local/etc/zabbix_agentd.conf
[root@master zabbix-4.0.1]# groupadd zabbix
[root@master zabbix-4.0.1]# useradd -g zabbix zabbix
[root@master zabbix-4.0.1]# zabbix_agentd