zoukankan      html  css  js  c++  java
  • Zabbix编译安装(全)

    一、前言

      (一)、概述

      Zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案,Zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位,解决存在的各种问题;Zabbix主要由两部分构成,Zabbix server与可选组件Zabbix agent;

      (二)、预处理

    配置环境   

      OS:CentOS 7.5 64bit
        Zabbix版本:
    3.4
        PHP版本:7.2.8
        MySQL版本:5.7.22
        Nginx版本:1.14.0
        hostname:zabbix-1-1
        
    ip:10.18.43.141

     

     基础需求

    [root@zabbix-1-1 ~]# systemctl stop firewalld
    [root@zabbix-1-1 ~]# sed -ri '/^SELINUX=*/cSELINUX=disabled' /etc/selinux/config
    [root@zabbix-1-1 ~]# setenforce 0
    
    [root@zabbix-1-1 ~]# mkdir -p /date/zabbix
    
    [root@zabbix-1-1 ~]# groupadd zabbix
    [root@zabbix-1-1 ~]# useradd -r -g zabbix -s /sbin/nologin zabbix

     

    二、Zabbix安装

      (一)、Zabbix编译

    依赖环境库下载:

    [root@zabbix-1-1 ~]# yum install net-snmp-devel libevent-devel mysql-devel -y
    [root@zabbix-1-1 ~]# wget -P /data/zabbix https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.11/zabbix-3.4.11.tar.gz 
    [root@zabbix-1-1 ~]# cd /data/zabbix/
    [root@zabbix-1-1 zabbix]# tar xf zabbix-3.4.11.tar.gz
    [root@zabbix-1-1 zabbix]# cd zabbix-3.4.11/

    执行编译:

    [root@zabbix-1-1 zabbix-3.4.11]# ./configure 
    --enable-server
    --enable-agent
    --with-mysql
    --enable-ipv6
    --with-net-snmp
    --with-libcurl
    --with-libxml2
    --prefix=/usr/local/zabbix [root@zabbix-1-1 zabbix-3.4.11]# make install

      (二)、MySQL配置

    MySQL编译安装请参考:传送门

    [root@zabbix-1-1 ~]# mysql -p'Passwd@123' 
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 1070
    Server version: 5.7.22 Source distribution
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

    mysql> create database zabbix default character set utf8; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbixadmin'@'10.18.43.141' identified by 'Zabbix@123'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbixadmin'@'127.0.0.1' identified by 'Zabbix@123'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbixadmin'@'localhost' identified by 'Zabbix@123'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> grant all privileges on zabbix.* to 'zabbixadmin'@'%' identified by 'Zabbix@123'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
    mysql> q
    Bye

    数据导入(注意导入数据的先后顺序,如果顺序错误,就会使数据导入不成功或者其它错误)

    [root@zabbix-1-1 ~]# cd /data/zabbix/zabbix-3.4.11/database/mysql/
    
    [root@zabbix-1-1 mysql]# mysql -u'zabbixadmin' -p'Zabbix@123' zabbix < schema.sql 
    mysql: [Warning] Using a password on the command line interface can be insecure.
    [root@zabbix-1-1 mysql]# mysql -u'zabbixadmin' -p'Zabbix@123' zabbix < images.sql 
    mysql: [Warning] Using a password on the command line interface can be insecure.
    [root@zabbix-1-1 mysql]# mysql -u'zabbixadmin' -p'Zabbix@123' zabbix < data.sql 
    mysql: [Warning] Using a password on the command line interface can be insecure.

      (三)、Zabbix server配置

    [root@zabbix-1-1 ~]# vim /usr/local/zabbix/etc/zabbix_server.conf
    ### Option: LogFile
    #       Log file name for LogType 'file' parameter.
    #
    # Mandatory: no
    # Default:
    # LogFile=
    
    LogFile=/tmp/zabbix_server.log          #日志存放位置
    
    ### Option: DBHost
    #       Database host name.
    #       If set to localhost, socket is used for MySQL.
    #       If set to empty string, socket is used for PostgreSQL.
    #
    # Mandatory: no
    # Default:
    # DBHost=localhost
    DBHost=10.18.43.141                 #数据库IP地址
    
    ### Option: DBName
    #       Database name.
    #       For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
    #
    # Mandatory: yes
    # Default:
    # DBName=
    DBName=zabbix                       #数据库名称
    
    ### Option: DBUser
    #       Database user. Ignored for SQLite.
    #
    # Mandatory: no
    # Default:
    # DBUser=
    
    DBUser=zabbixadmin                  #数据库用户名称
    
    ### Option: DBPassword
    #       Database password. Ignored for SQLite.
    #       Comment this line if no password is used.
    #
    # Mandatory: no
    # Default:
    # DBPassword=
    DBPassword=Zabbix@123               #数据库用户密码
    
    ### Option: AlertScriptsPath
    #       Full path to location of custom alert scripts.
    #       Default depends on compilation options.
    #
    # Mandatory: no
    # Default:
    # AlertScriptsPath=${datadir}/zabbix/alertscripts
    AlertScriptsPath=/usr/local/zabbix/alertscripts         #脚本存放位置

     

      (四)、Nginx配置

    Nginx编译安装请参考:传送门

    [root@zabbix-1-1 ~]# vim /usr/local/nginx/conf/nginx.conf
    user  nginx;                    #修改使用用户
    http {
      include     /usr/local/nginx/conf/conf.d/*.conf;    #添加子配置路径
    }

    [root@zabbix-1-1 ~]# vim /usr/local/nginx/conf/conf.d/zabbix.conf

    server {
           listen       80;
           server_name  _;

     location / {
           root  /usr/local/nginx/html;
           index index.php;
           }
     location ~ ".php$" {
           root    /usr/local/nginx/html;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;
           include fastcgi_params;
           }
    }

       (五)、PHP参数修改

    PHP编译安装请参考:传送门

    [root@mysql-1-1 ~]# vim /usr/local/php/lib/php.ini
    post_max_size = 16M
    max_execution_time = 300
    max_input_time = 300

    三、Zabbix-server Web界面配置

    (一)、访问Web页面

    访问本机IP地址:http://10.18.43.141/setup.php

    (二)、PHP参数修改

    (三)、MySQL参数配置

    (四)Zabbix-server 配置

    (五)、信息确认

    确认以上填写的Web信息,继续下一步。图略。。。

    (六)、错误

    无法自动下载配置文件,需要我们手动下载。

    下载后,刷新页面即可。

    (七)、登录界面

    (八)、开始使用

    安装完成之后的界面,下次访问 http://10.18.43.141/zabbix.php

     

     

     

  • 相关阅读:
    Java多态性理解
    多态详解
    public static void main(String[] args){}函数诠释
    继承、封装
    面向对象的理解
    重载与构造函数的解析
    冒泡排序及二分查找
    数组总结之补充
    计算机中如何表示数字-07IEEE754浮点数标准
    synchronized 和ReentrantLock
  • 原文地址:https://www.cnblogs.com/sky-k/p/9367186.html
Copyright © 2011-2022 走看看