Zabbix的安装

来源:互联网 发布:知世故而不世故, 编辑:程序博客网 时间:2024/05/24 04:59

本文档主要内容:

  • Centos6.5
  • Zabbix3.0.9 LTS
  • php 5.6 (require 5.4.0 or later not 7.0
  • Apache (require 1.3.12 or later)
  • MySQL 5.3 (require 5.0 or later)

Apache

  • 安装: yum install httpd*
  • 启动: service httpd start
  • tips:httpd使用80端口,不要和nginx冲突
vi /etc/httpd/conf/httpd.confServerName localhost:80

Php

  • 配置yum源
  • 安装php

配置yum源:

rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm 
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


解决方案:
http://thinkpig007.blog.51cto.com/971471/1578451


关闭后如下所示:

若是centos7版本

ftp://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-9.noarch.rpm


安装php:

yum install --enablerepo=remi --enablerepo=remi-php56 php php-devel php-opache php-apache php-bcmath php-xmlphp-xmlrpc php-mbstring php-gd php-ldap php-mysqlnd php-mssql php-mcrpyt php-fpm php-gmp php-phpunit-PHPUnitphp-pecl-xdebug php-pecl-xhprof

安装 Zabbix

  • yum源配置 (每台机器都要配)
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm

centos7版本配置如下:
rpm -Uvh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

  • server
yum install zabbix-server-mysql zabbix-web-mysql

修改server配置文件

vim /etc/zabbix/zabbix_server.confDBHost=172.24.5.173DBName=zabbixDBUser=zabbixDBPassword=zabbix

需要从别处拷贝一份过来:

vim /etc/httpd/conf.d/zabbix.confphp_value date.timezone Asia/Shanghai
  • agent
yum install zabbix-agent

修改agent配置文件

vim /etc/zabbix/zabbix_agentd.confServer=172.24.5.173 # server ipServerActive=172.24.5.173 # 主动监控server的ipHostname=bgs-5p174-wangwenting #Hostname必须和zabbix web上配置的一直,否则zabbix主动监控无法正常工作HostMetadataItem=system.uname 配置自动发现主机:https://www.zabbix.com/documentation/3.2/manual/discovery/auto_registration
  • yum install zabbix-get
yum install zabbix-get
服务分配 ip zabbix­-server 172.24.5.173 zabbix­-agent 172.24.5.[173-175]

安装mysql

mysql在之前的博客中有写到,这里就不再安装了。可以点此链接前往:mysql的安装

在172.24.5.173上创建server数据库、并导入数据

mysql> CREATE DATABASE zabbix CHARACTER SET UTF8;mysql> GRANT ALL PRIVILEGES on zabbix.* to zabbix@localhost IDENTIFIED BY 'zabbix';mysql> GRANT ALL PRIVILEGES on zabbix.* to zabbix@172.24.5.173 IDENTIFIED BY 'zabbix';mysql> GRANT ALL PRIVILEGES on zabbix.* to zabbix@'*'IDENTIFIED BY 'zabbix';mysql> FLUSH PRIVILEGES;mysql> quit

导入数据
在安装完zabbix的时候该目录下面会有一个初始化数据库的表,作为zabbix的使用表

zcat /usr/share/doc/zabbix-server-mysql-3.0.9/create.sql.gz | mysql -uzabbix -pzabbix zabbix
启动 zabbix­serverservice zabbix-server start  启动 httpd service httpd start  访问 http://172.24.5.173/zabbix

在做好准备工作后,接下来我们将服务重启后,在浏览器中输入:172.24.5.173/zabbix就会出现以下的页面

  • 欢迎界面

  • php需求检查

  • MySQL配置

  • zabbix服务端详细信息

  • zabbix安装前信息列表

  • 安装完成

  • 登陆zabbix,默认用户名:Admin,密码:zabbix

  • 如下是zabbix首页

zabbix问题解决

1、当输入172.24.5.173/zabbix网址的时候,报404页面找不到的错误
- 解决方案:

cp /usr/share/doc/zabbix-web-3.0.9/httpd22-example.conf /etc/httpd/conf.d/zabbix.conf

是在安装zabbix的时候会生成这个文件。这次安装不知道为什么没有,从之前安装过的地方拷贝了一份。

2、当输入172.24.5.173/zabbix网址的时候,报You don’t have permission to access /zabbix/ on this server.的错误。

  • 解决方案:
    vim /etc/httpd/conf/httpd.conf,将其中的值改为下图中的值,然后重启生效。

3、zabbix时区问题处理办法

  • 解决方案:
    修改该文件的值 vim /etc/php.ini

    修改后,记得重启
原创粉丝点击