Zabbix 4.0 安装与基本配置

一、Zabbix介绍

Zabbix介绍

Zabbix是一套企业级开源分布式监控解决方案,监控包括IT基础设施(网络、服务器和云资源)、服务、应用等。

Zabbix官方网站

Zabbix架构

Zabbix由以下组件组成:

  • 服务端
  • 数据库存储
  • Web界面
  • 代理Proxy(可选)
  • 客户端Agent
  • 数据交互流

二、Zabbix安装

Zabbix安装需求

  • Apache:1.3.12 or later
  • PHP:5.4.0 or later
  • MySQL:5.0.3-8.0.X版本

Zabbix 4.0 安装需求

本次Zabbix安装环境说明:

  • 系统:CentOS Linux release 7.3.1611 (Core)
  • Linux内核版本:3.10.0-514.el7.x86_64
  • HOSTNAME:zabbix-server
  • IP:192.168.0.201/24

Apache安装

安装Apache 2.4.6与相关依赖组件

yum install httpd libxml2-devel net-snmp-devel libcurl-devel -y

修改Apache配置

vim /etc/httpd/conf/httpd.conf
#按实际情况填写IP/DNS:端口
ServerName 192.168.0.201:80

启动Apache并设置开机自启动

systemctl start httpd
systemctl enable httpd

PHP安装

安装PHP 5.6与相关依赖组件

#安装PHP yum源
rpm -ivh http://repo.webtatic.com/yum/el7/epel-release.rpm
rpm -ivh http://repo.webtatic.com/yum/el7/webtatic-release.rpm
#安装PHP与相关依赖组件
yum install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap -y

修改PHP配置

vim /etc/php.ini
#调整执行时间等
max_execution_time = 300
max_input_time = 300
post_max_size = 16M
date.timezone =Asia/Shanghai
always_populate_raw_post_data = -1

重启Apache

systemctl restart httpd

MySQL安装

安装MySQL yum源

rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

安装MySQL 5.7

yum install mysql-community-server -y

关闭MySQL密码策略

vim /etc/my.cnf
#在[mysqld]元素下添加下面配置
validate-password=OFF

启动MySQL

systemctl start mysqld

查看初始密码并修改密码为123456

grep 'password' /var/log/mysqld.log |head -1
#按实际填写下面初始密码
mysqladmin -uroot -p'oIdZHvIhb9=i' password 123456

Zabbix server安装

安装Zabbix yum源

rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

安装Zabbix server、web和agent

yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y

初始化数据库

#登录MySQL
mysql -uroot -p123456
#创建zabbix数据库并授权zabbix用户,密码为123456
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by '123456';

导入初始数据库

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p123456 zabbix

(可选)配置Zabbix server/proxy

vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456

启动Zabbix server并设置开机自启动

systemctl start zabbix-server
systemctl enable zabbix-server

重启Apache

systemctl restart httpd

Zabbix 4.0 官方文档

三、Zabbix 基本使用

Zabbix web初始化

打开浏览器,输入http://<server_ip_or_name>/zabbix,显示Zabbix web设置界面

http://192.168.0.201/zabbix/
  1. Welcome to Zabbix 4.0--Next setup
  2. Check of pre-requisites:检查是否全部为OK
  3. Configure DB connection:填写MySQL数据库信息
    • Database type:MySQL
    • Database host:localhost
    • Database port:0
    • Database name:zabbix
    • User:zabbix
    • Password:123456
  4. Zabbix server details:
    • Host:localhost
    • Port:10051
    • Name:(留空)
  5. Next--Finish

Zabbix web设置

Zabbix 登录

http://192.168.0.201/zabbix/

默认用户名:Admin,默认密码:zabbix

Zabbix server 监控

开启Zabbix Server上的zabbix-agent,并设置开机自启动

systemctl start zabbix-agent
systemctl enable zabbix-agent

登录Zabbix依次点击:Configuration--Hosts,可以看到Zabbix server的Availability ZBX显示为绿色。

更改Zabbix server语言为中文

登录Zabbix依次点击:右上角Admin(Zabbix Administrator)--Language:Chinese(zh_CN)--Update

posted @ 2019-01-06 21:35  小王子1024  阅读(227)  评论(0)    收藏  举报