你好,游客 登录 注册 搜索
背景:
阅读新闻

CentOS 7.2 安装部署 Zabbix 3.0.4 详解

服务端的安装

[日期:2016-11-29] 来源:Linux社区  作者:goalkeeper [字体: ]

CentOS 7.2 安装部署 Zabbix 3.0.4 详解

一、安装环境

1.1、环境准备

系统版本 Zabbix版本 Mariadb版本
CentOS Linux release 7.2.1511 (Core) zabbix-3.0.4 mariadb-5.5.50-1.el7_2.x86_64

1.2、安装基础环境

1
2
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum install mysql-devel gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml -y 

二、服务端安装

2.1 安装配置数据库

1
yum -y install mariadb-server

2.2 设置开机自启动

1
systemctl enable mariadb

2.3 启动数据库

1
systemctl start mariadb

2.4 初始化数据库 

1
mysql_secure_installation

详细输出解析:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[root@zabbix-server src]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
 
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
 
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
 
Enter current password for root (enter for none):
OK, successfully used password, moving on...
 
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
 
Set root password? [Y/n] Y
New password:                              #设置数据库root密码
Re-enter new password:                    #再次输入
Password updated successfully!
Reloading privilege tables..
... Success!
 
 
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
 
Remove anonymous users? [Y/n] Y    #删除匿名用户
... Success!
 
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
 
Disallow root login remotely? [Y/n] Y  #禁止root远程登陆数据库
... Success!
 
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
 
Remove test database and access to it? [Y/n] Y  #删除test测试库
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
 
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
 
Reload privilege tables now? [Y/n] Y    #刷新数据库表
... Success!
 
Cleaning up...
 
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
 
Thanks for using MariaDB!

2.5 创建zabbix数据库、用户并设置密码

1
2
mysql -uroot -p123456 -e "create database zabbix default character set utf8 collate utf8_bin;" 
mysql -uroot -p123456 -e "grant all on zabbix.* to 'zabbix'@'%' identified by '123456';"

2.6 登陆测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@zabbix-server src]# mysql -uzabbix -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 5.5.50-MariaDB MariaDB Server
 
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| zabbix |
+--------------------+
2 rows in set (0.00 sec)
 
MariaDB [(none)]> use zabbix
Database changed
MariaDB [zabbix]> show tables;
Empty set (0.01 sec)
 
MariaDB [zabbix]> Bye

三、安装zabbix服务端

3.1 yum安装zabbix服务

1
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get

3.2 导入数据表结构

1
2
cd /usr/share/doc/zabbix-server-mysql-3.0.4/
zcat create.sql.gz | mysql -uzabbix -p123456 zabbix

3.3 备份并修改zabbix配置文件

配置数据库:

1
2
3
4
5
6
cp /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf_$(date +%F)
[root@zabbix-server ~]# diff /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf_2016-08-23
115c115
< DBPassword=123456
---
> # DBPassword=

定义时区:

1
2
3
4
5
6
cp /etc/httpd/conf.d/zabbix.conf /etc/httpd/conf.d/zabbix.conf_$(date +%F)
[root@zabbix-server ~]# diff /etc/httpd/conf.d/zabbix.conf /etc/httpd/conf.d/zabbix.conf_2016-08-23
19c19
<      php_value date.timezone Asia/Chongqing
---
>        # php_value date.timezone Europe/Riga

3.4 设置开机自启动,启动zabbix服务器端

1
2
systemctl enalble zabbix-server
systemctl restart zabbix-server

3.5 设置开机自启动,启动apache

1
2
systemctl enable httpd
systemctl start httpd

一些Zabbix相关教程集合

Ubuntu 14.04下Zabbix2.4.5 源码编译安装  http://www.linuxidc.com/Linux/2015-05/117657.htm

安装部署分布式监控系统Zabbix 2.06 http://www.linuxidc.com/Linux/2013-07/86942.htm

《安装部署分布式监控系统Zabbix 2.06》 http://www.linuxidc.com/Linux/2013-07/86942.htm

CentOS 7.0 x64下Zabbix 3.0 安装笔记  http://www.linuxidc.com/Linux/2016-11/137044.htm

Zabbix分布式监控系统实践 http://www.linuxidc.com/Linux/2013-06/85758.htm

CentOS 6.3下Zabbix监控apache server-status http://www.linuxidc.com/Linux/2013-05/84740.htm

CentOS 6.3下Zabbix监控MySQL数据库参数 http://www.linuxidc.com/Linux/2013-05/84800.htm

64位CentOS 6.2下安装Zabbix 2.0.6   http://www.linuxidc.com/Linux/2014-11/109541.htm

四、web界面安装zabbix

4.1 访问地址http://192.168.0.125/zabbix/setup.php配置zabbix

 注:下图中的所有配置必须都为ok才可以。

 注:下图配置zabbix的一些数据库相关信息,按照自己的填写即可。

注:Name为别名设置,可填写

 

注:zabbix默认登录用户名为Admin(A为大写,),密码为zabbix。

 

注:下图进入登录界面

4.2 设置字体显示为中文

注:3.0.4默认的中文显示配置文件里面是开启的,无需重新设置,只需要如下图选择即可

五、总结

  到这里,Zabbix服务器端的配置部署完毕,下篇文章部署Zabbix客户端的配置及其一些常用应用的监控。在配置过程中遇到的问题解决方法见 http://www.linuxidc.com/Linux/2016-11/137671p2.htm

linux
【内容导航】
第1页:服务端的安装 第2页:客户端的安装和添加监控机
第3页:监控Linux客户端的TCP连接数
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款