慧9建 发表于 2019-1-24 06:47:42

安装配置Zabbix开源监控系统用于生产环境中

  运行环境:
  操作系统:CentOS release 6.10 (Final)
  数据库:MySQL Ver 14.14 Distrib 5.5.55
  Web中间件:Apache/2.2.15 (Unix)
  程序语言环境:PHP 5.4.45
  软件包:Zabbix 3.4
  任务:安装配置Zabbix,尝试使用在生产环境中。
  操作步骤:
  1.安装MySQL数据库
  # rpm -i https://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
  2.安装Zabbix server,Web前端,agent
  # yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
  3.创建初始数据库
  # mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit;
  导入初始架构和数据,系统将提示您输入新创建的密码。
  #zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
  4.为Zabbix server配置数据库
  编辑配置文件/etc/zabbix/zabbix_server.conf
  DBPassword=password
  5.为Zabbix前端配置PHP
  配置时区
  # pwd
  /etc/httpd/conf.d
  # vi php.conf
  php_value date.timezone Asia/Shanghai
  # vi /etc/php.ini
  date.timezone =Asia/Shanghai
  6.启动Zabbix server和agent进程
  # service zabbix-server restart
  Shutting down Zabbix server:                               [确定]
  Starting Zabbix server:                                    [确定]
  # service zabbix-agent restart
  Shutting down Zabbix agent:                              [确定]
  Starting Zabbix agent:   
  7.配置Zabbix前端
  # pwd
  /usr/share/zabbix
  # cp –rzabbix/   /var/www/html/
  #如果前端无法访问zabbix,将原安装zabbix的源码位置迁移到httpd的/var/www/html目录下
  连接到新安装的Zabbix前端: http://server_ip_or_name/zabbix
  前端配置,请访问官网:https://www.zabbix.com/documentation/3.0/manual/installation/install#installing_frontend
   http://s1.运维网.com/images/20181207/1544145494699865.png

Pre-requisiteMinimum valueDescriptionPHP version5.4.0
PHP memory_limit option128MBIn php.ini:
memory_limit = 128MPHP post_max_size option16MBIn php.ini:
post_max_size = 16MPHP upload_max_filesize option2MBIn php.ini:
upload_max_filesize = 2MPHP max_execution_time option300 seconds (values 0 and -1 are allowed)In php.ini:
max_execution_time = 300PHP max_input_time option300 seconds (values 0 and -1 are allowed)In php.ini:
max_input_time = 300PHP session.auto_start optionmust be disabledIn php.ini:
session.auto_start = 0Database supportOne of: IBM DB2, MySQL, Oracle, PostgreSQL, SQLiteOne of the following modules must be installed:
ibm_db2, mysql, oci8, pgsql, sqlite3bcmath
php-bcmathmbstring
php-mbstringPHP mbstring.func_overload optionmust be disabledIn php.ini:
mbstring.func_overload = 0PHP always_populate_raw_post_data optionmust be disabledRequired only for PHP versions 5.6.0 or newer.
In php.ini:
always_populate_raw_post_data = -1sockets
php-net-socket. Required for user script support.gd2.0 or higherphp-gd. PHP GD extension must support PNG images (--with-png-dir), JPEG (--with-jpeg-dir) images and FreeType 2 (--with-freetype-dir).libxml2.6.15php-xml or php5-domxmlwriter
php-xmlwriterxmlreader
php-xmlreaderctype
php-ctypesession
php-sessiongettext
php-gettext
Since Zabbix 2.2.1, the PHP gettext extension is not a mandatory requirement for installing Zabbix. If gettext is not installed, the frontend will work as usual, however, the translations will not be available.配置php.ini参数表

  http://s1.运维网.com/images/20181207/1544146028170785.png
  相关步骤按默认导航安装即可。
  配置Zabbix时要注意几个事项:

  1.配置zabbix.conf.php文件
  
  # pwd
  /etc/zabbix/web
  # vizabbix.conf.php

  $DB['TYPE']   = 'MYSQL';
  $DB['SERVER']   = 'localhost';
  $DB['PORT']   = '3306';
  $DB['DATABASE'] = '*****';
  $DB['USER']   = '******';
  $DB['PASSWORD'] = '**********';
  // Schema name. Used for IBM DB2 and PostgreSQL.

  $DB['SCHEMA'] = '';
  $ZBX_SERVER      = 'localhost';

  $ZBX_SERVER_PORT = '10051';
  $ZBX_SERVER_NAME = 'zabbix_server';
  2.配置zabbix_agentd.conf和zabbix_server.conf两个文件
  # pwd
  /etc/zabbix
  ServerActive=ip      #启用服务IP
  ListenIP=127.0.0.1   #启用监控IP
  3.配置防火墙
  # cat /etc/sysconfig/iptables
  -A INPUT -p tcp -m state --state NEW -m tcp --dport 10051 -j ACCEPT

  -A OUTPUT-p tcp -m state --state NEW -m tcp --dport 10050-j ACCEPT
  以上服务器端基本配置完成,客户端在这里不做说明。
  4.相关Zabbix配置文档请点击下面链接:
  http://blog.运维网.com/sky9896/1852873
  http://blog.运维网.com/sky9896/1940105
  5.运行效果图如下:
  http://s1.运维网.com/images/20181207/1544147169275401.png
自动监控设备运行情况
  http://s1.运维网.com/images/20181207/1544147288203977.png
      监控Nginx
  http://s1.运维网.com/images/20181207/1544147342929598.png
                                                                              监控IIS连接数
  http://s1.运维网.com/images/20181207/1544147388192686.png
  http://s1.运维网.com/images/20181207/1544147491130200.png
  Zabbix功能强大于Cacti监控系统。

  相对Cacti来讲,Zabbix配置应用更复杂。



页: [1]
查看完整版本: 安装配置Zabbix开源监控系统用于生产环境中