sdxh0506 发表于 2018-1-2 08:41:16

Centos 7 下 Zabbix 3.4.x 服务搭建

  一、zabbix介绍
  zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
  二、部署环境
  1、关闭Selinux   
  

a.查看 Selinux 状态  #getenforce
  
b.临时关闭 Selinux
  #setenforce
0  
c.永久关闭 Selinux 需要重启机器
  #vim
/etc/selinux/config  将SELINUX
=enforcing改为SELINUX=disabled  重启机器即可
  

  1.1 常见问题
  如果不关闭 selinux可能报错: cannot set resource limit: Permission denied cannot disable core dump, exiting…
  2、更新 系统 和 EPEL 源   
  yum install -y epel-release
  yum install update
  yum update -y
  3、配置LAMP
  Centos 7 LAMP 部署
  三、安装 zabbix
  1、配置ZabbixZone package repository and GPG key
  # rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX
  # rpm -Uv http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
  2、安装 zabbix-server,zabbix-agent(可选)
  # yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-java-gateway zabbix-agent
  3、配置 /etc/httpd/conf.d/zabbix
  # vim /etc/httpd/conf.d/zabbix.conf   修改时区为:Asia/Shanghai
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122114840102-634641956.png
  4、重启服务
  # systemctl restart httpd
  5、创建Mysql 数据库 和 用户
  a.登录 MariaDB:
  # mysql -uroot -p
  b. 创建一个 名为‘zabbix’ 的数据库 和 数据库用户‘zabbix’
  

MariaDB [(none)]> create database zabbix character set utf8;  
MariaDB [(none)]
> grant all privileges on zabbix.* to 'zabbix'@'localhost'>
MariaDB [(none)]> flush privileges;  
MariaDB [(none)]
> quit;   

  6、准备数据库模板脚本
  # cd /usr/share/doc/zabbix-server-mysql-3.4.4/
  # gunzip create.sql.gz
  7、导入 zabbix 数据库模板
  a. 使用 zabbix 用户登录数据库
  # mysql -uzabbix -p(密码:zabbix或 你自己设置的密码)
  b. 导入数据库模板
  # MariaDB [(none)]> use zabbix;
  # MariaDB [(zabbix)]>source /usr/share/doc/zabbix-server-mysql-3.4.4/create.sql;
  # MariaDB [(zabbix)]>quit;
  8、配置zabbix server
  # vim /etc/zabbix/zabbix_server.conf   修改三个参数:
  DBName=zabbix
  DBUser=zabbix
  DBPassword=zabbix
  9、配置 zabbix agent(可选)
  # vim /etc/zabbix/zabbix_agentd.conf
  Hostname = xx    (修改为 服务器主机名)
  10、配置 php
  修改 php.ini 为 zabbix 推荐的配置 ,参考: vim /etc/httpd/conf.d/zabbix.conf
  # vim /etc/php.ini
  max_execution_time = 300
  max_input_time = 300
  memory_limit = 128M
  post_max_size = 16M
  upload_max_filesize = 2M
  date.timezone = Asia/Shanghai
  11、修改并重启防火墙 firewall
  # firewall-cmd --permanent --add-port=10050/tcp
  # firewall-cmd --permanent --add-port=10051/tcp
  # systemctl restart firewalld
  12 、启动服务和设置开机自启  
  

systemctl start zabbix-server  
systemctl start zabbix-agent
  
systemctl restart httpd
  
systemctl restart mariadb
  
systemctl enable zabbix-server
  
systemctl enable zabbix-agent
  

  13、web 界面配置 zabbix
  浏览器打开:http://server-ip-address/zabbix
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122142525102-1756433891.png
  查看 所有依赖包 和参数配置,确保全部ok
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122142813899-31780204.png
  配置 zabbix 调用的数据库、账号、密码
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122142952852-1073969304.png
  填写zabbix server主机名
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122143150805-14830209.png
  确认配置信息
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122143211836-956471880.png
  完成zabbix 初始化安装。
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122143239149-591840694.png
  安装完成后进入登录页面,默认账号和密码:admin/zabbix
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122143253961-253118519.png
  zabbix 仪表盘如下:
https://images2017.cnblogs.com/blog/638293/201711/638293-20171122143602493-1392138337.png
  安装部署完成。
  备注:个人部署整理,仅供参考。
  THE END

vmcloud 发表于 2018-1-2 09:04:32

多谢分享

liuyu 发表于 2018-1-5 21:37:27

安装完不知道咋用
页: [1]
查看完整版本: Centos 7 下 Zabbix 3.4.x 服务搭建