CentOS 7上搭建 Zabbix4.0,一次性成功,收藏了!
时间:2022-07-26
本文章向大家介绍CentOS 7上搭建 Zabbix4.0,一次性成功,收藏了!,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
zabbix介绍
Zabbix 是一个基于 WEB 界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。它能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
zabbix软件组成
zabbix-server
: 监控服务端
zabbix-agent
: 监控客户端
zabbix-web
: 监控网站服务
php
: 处理动态请求
mysql
: 数据库存储监控数据
zabbix
: 负责收集agent信息汇总告知zabbix-server
1.关闭防火墙和selinux
[root@zabbix ~]# setenforce 0
[root@zabbix ~]# sed -ri '/^SELINUX=/cSELINUX=disabled' /etc/sysconfig/selinux
[root@zabbix ~]# systemctl stop firewalld ; systemctl disable firewalld
2.添加zabbix源和epel源
[root@zabbix ~]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm ##这里使用的是清华源
[root@zabbix ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo ##添加epel源
3.安装zabbix和相关服务组件
[root@zabbix ~]# wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/{zabbix-server-mysql-4.0.20-1.el7.x86_64.rpm,zabbix-web-4.0.22-1.el7.noarch.rpm} ##把这两个包先拿下来,因为安装的时候网络问题会出现安装超时
[root@zabbix ~]# yum install -y httpd php zabbix-server-mysql-4.0.20-1.el7.x86_64.rpm zabbix-web-mysql ###安装zabbix的服务程序和web程序
[root@zabbix ~]# yum install -y mariadb-server ##安装数据库服务
4.修改zabbix配置文件
[root@zabbix ~]# sed -ri.bak '/# DBPassword=/cDBPassword=zabbix' /etc/zabbix/zabbix_server.conf ##修改zabbix数据库密码为zabbix
[root@zabbix ~]# sed -ri.bak 's/ #(.*)date.timezone.*/1date.timezone Asia/Shanghai/' /etc/httpd/conf.d/zabbix.conf ##修改时区为国内
5.配置数据库服务
[root@zabbix ~]# systemctl start mariadb #启动数据库
[root@zabbix ~]# mysql_secure_installation ##初始化数据库
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:
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
... 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] n
... skipping.
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!
[root@zabbix ~]# mysql -uroot -p ##登录数据库
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 8
Server version: 5.5.65-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; ##创建zabbix数据库
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; ##创建数据库管理用户
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.20/create.sql.gz | mysql -uzabbix -pzabbix zabbix ##将数据表写入到zabbix库中
6.启动zabbix和相关服务
[root@zabbix ~]# systemctl start zabbix-server.service httpd mariadb.service
[root@zabbix ~]# systemctl enable zabbix-server.service httpd mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
7.登录zabbix的web界面,进行初始化
初始化地址http://172.16.210.56/zabbix/setup.php
点击Next step
检查php的一些变量条件,如果没有报错的信息可以点击next step
填写好对应的数据库密码和帐号点击Next step
设置主机和端口还有监控页面名字,然后点击Next step
确认信息.然后点击Next step
点击Finish
帐号Admin 密码zabbix ,再点Sign in
登录成功。
8.更改zabbix界面语言为中文
点击右上角的小人
选择Chinese
再点击update
- phalcon-入门篇4(log日志和session缓存)
- zephir-(5)类型
- zephir-(10)内置函数
- zephir-(9)类和对象2
- 深度学习中的动手实践:在CIFAR-10上进行图像分类
- 数据库中间件 MyCAT源码分析 —— XA分布式事务
- [喵咪Golang(1)]Go语言开篇
- phalcon-进阶篇2(拦截器)
- 【死磕Java并发】—–深入分析synchronized的实现原理
- phalcon-进阶篇1(过滤与清理)
- phalcon-入门篇9(view层基础使用)
- PhalApi视频教程
- 【学术】一文搞懂自编码器及其用途(含代码示例)
- PhalApi-Zip--压缩文件处理类
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- MySQL慢查询日志
- Pandas处理时间序列数据的20个关键知识点
- CentOS7下的LNMP环境搭建Dedecms网站
- 持久层框架JPA与Mybatis该如何选型
- 技术分享 | Online DDL 工具 pt-osc
- 基于hexo框架搭建个人博客【技术创作训练营】
- 对比讲解lambda表达式与传统接口函数实现方式
- 如何使用Java8 Stream API对Map按键或值进行排序
- TencentOS tiny RTOS快速入门
- Nginx用户认证与域名重定向
- LNMP架构介绍与搭建
- Mac 最新版Python3.7.4安装配置,设置默认python版本
- 15个应该掌握的Jupyter Notebook 使用技巧
- python 环境重启方法,系统环境变量配置后python生效设置方法
- 快速上手 WebAssembly 应用开发:Emscripten 使用入门