remington_young 发表于 2019-1-19 09:25:41

Zabbix部署教程

  一、准备工作
我用的是CentOS 7.4 的系统
zabbix 3.4
database:MariaDB
首先关闭防火墙 不然会报错
systemctl stop firewalld
开机不自启
systemctl disable firewalld
关闭selinux:
临时:setenforce 0
永久:sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
  二、rpm安装zabiix的yum源
rpm -ivh
http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

安装zabbix
  yum -y install zabbix-server-mysql zabbix-web-mysql
#zabbix-server-mysql    @ server端连接MySQL的组件
#zabbix-web-mysql   @ zabbix web与MySQL交互组件

安装MariaDB
  yum -y install mariadb-server
设置开机自启 启用数据库
systemctl enable mariadb.service
systemctl start mariadb.service

初始化数据库
  mysql_secure_installation

    登陆 MySQL
  mysql -uroot -p **
创建数据库 zabbix 编码格式是utf8
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
对数据库进行授权 设置用户及密码
MariaDB [(none)]> grant all on zabbix.* to zabbix@'localhost' identified by '123456';
MariaDB [(none)]> flush privileges;

导入数据
  zcat /usr/share/doc/zabbix-server-mysql-3.4.14/create.sql.gz | mysql -uzabbix -p123456 zabbix
备份配置文件
cp /etc/httpd/conf/httpd.conf //etc/httpd/conf/httpd.conf.bak
  vim /etc/httpd/conf/httpd.conf
修改username=127.0.0.1:80

修改一下时区
  vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai

在这里先解决中文乱码问题
  方法一
yum -y install wqy-microhei-fonts
cp -f /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
如果事前忘了设置 还有一个办法解决
方法二
windows c盘里面有一个windows的目录进去/找到Fonts/进去找到任意一种中文字体复制出来上传到/usr/share/zabbix/fonts目录下
修改文件名
\mv xxxx.ttf xxxx.ttf

然后启动apache
  systemctl enable httpd
systemctl start httpd

使用浏览器访问 //server IP /zabbix
http://i2.运维网.com/images/blog/201810/20/335a25149e3699731a8692dfae23de60.png
http://i2.运维网.com/images/blog/201810/20/1cfd30ae12ee5ac5285f9991d6a4d9e3.png
http://i2.运维网.com/images/blog/201810/20/674147e7ded0fa36a8e06c673912964e.png
http://i2.运维网.com/images/blog/201810/20/93bc89353526a9a305eb9913b603d9dd.png
http://i2.运维网.com/images/blog/201810/20/37e0c2b9e91a8e0534589819ab606515.png
http://i2.运维网.com/images/blog/201810/20/4b999a4aa1f8da1a30ac3a6177b25f3b.png

显示服务器还未运行 我们配置一下服务器
http://i2.运维网.com/images/blog/201810/20/406d0881df72237c39d6e170d3ba7efe.png

配置 zabbix-server
vim /etc/zabbix/zabbix_server.conf
修改 DBPassword=123456
systemctl enable zabbix-server
systemctl start zabbix-server
http://i2.运维网.com/images/blog/201810/20/7b90a80893d81e47f9874030e8b44bd4.png

      zabbix不仅可以监控别的服务器 也可以监控自己的服务器
  在这里我把zabbix-agent安装到自己服务器上

rpm -ivh
http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
  wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo
yum install -y zabbix-agent
cp /etc/zabbix/zabbix_agentd.conf //etc/zabbix/zabbix_agentd.conf.bak

#我们用服务器做agent 所以不用改配置文件 如果有客户机的话我们得改成Server=服务器IP
地址
  #vim /etc/zabbix/zabbix_agentd.conf
#Server=127.0.0.1改成Server=ServerIP(服务器ip地址)

我们启动zabbix
  systemctl enable zabbix-agent
systemctl start zabbix-agent

   zabbix有中文模式可以修改 右上角点击图标
  点击下面红箭头指的那个小图标   
http://i2.运维网.com/images/blog/201810/20/234261f66c4df66ded5d6c227aa0e489.png

    设置成zh_CN
http://i2.运维网.com/images/blog/201810/20/4444c3e8b3b049864963bd27d4ea8c3b.png

可以参考官网的说明:
https://www.zabbix.com/documentation/3.0/manual/installation/
install_from_packages/server_installation_with_mysql      
以上简单的zabbix部署就完成了
——————@_@


页: [1]
查看完整版本: Zabbix部署教程