zabbix3.4使用说明

zabbix架构图

zabbix安装

​ zabbix需要安装依赖的数据库,需要安装zabbix server以及zabbix web,本文介绍docker安装zabbix的方法,且安装在ubuntu14.04系统

  • mysql安装

    1. 创建mysql目录
    sudo mkdir -p ~/mysql/data ~/mysql/logs ~/mysql/conf
    2. 新增mysql配置
    sudo cp -r my.cnf  ~/mysql/conf/ &&  cd ~/mysql/
    3. 启动mysql
    sudo docker run -p 3306:3306 \    
      --name mysql-server \    
      -v $PWD/conf/my.cnf:/etc/mysql/my.cnf \
        -v $PWD/logs:/logs \
        -v $PWD/data:/mysql_data \
        -e MYSQL_ROOT_PASSWORD=root_pwd \
        -e MYSQL_DATABASE=zabbix    \
        -e MYSQL_USER=zabbix    \
        -e MYSQL_PASSWORD=zabbix_pwd  \
        -d daocloud.io/library/mysql:5.7
    
  • zabbix java gateway安装

    sudo docker run --name zabbix-java-gateway -t \
          -d zabbix/zabbix-java-gateway:latest
    
  • zabbix server安装

    sudo docker run --name zabbix-server-mysql -t \
          -e PHP_TZ="Asia/Shanghai" \
          -e DB_SERVER_HOST="mysql-server" \
          -e MYSQL_DATABASE="zabbix" \
          -e MYSQL_USER="zabbix" \
          -e MYSQL_PASSWORD="zabbix_pwd" \
          -e MYSQL_ROOT_PASSWORD="root_pwd" \
          -e ZBX_JAVAGATEWAY="zabbix-java-gateway" \
          --link mysql-server:mysql \
          --link zabbix-java-gateway:zabbix-java-gateway \
          -p 10051:10051 \
          -d zabbix/zabbix-server-mysql:latest
    
  • zabbix web安装

    sudo docker run --name zabbix-web-nginx-mysql -t \
           -e PHP_TZ="Asia/Shanghai" \
          -e DB_SERVER_HOST="mysql-server" \
          -e MYSQL_DATABASE="zabbix" \
          -e MYSQL_USER="zabbix" \
          -e MYSQL_PASSWORD="zabbix_pwd" \
          -e MYSQL_ROOT_PASSWORD="root_pwd" \
          --link mysql-server:mysql \
          --link zabbix-server-mysql:zabbix-server \
          -p 80:80 \
          -d zabbix/zabbix-web-nginx-mysql:latest
    
  • zabbix agent安装

    windows安装

    1. 官网下载agent软件包(zabbix_agents_3.4.6.win.zip),解压到c:/zabbix下

    2. 修改配置C:\zabbix\conf\ zabbix_agentd.win.conf

      LogFile=C:\zabbix\zabbix_agentd.log
      Server=192.168.17.44
      ServerActive=192.168.17.44
      Hostname=WIN-0IRTKRANCQ1
      
    3. 注册agent(以管理员用户执行)

      C:\zabbix\bin\win64\zabbix_agentd.exe-c C:\zabbix\conf\zabbix_agentd.win.conf -i
      
    4. 启动agent(以管理员用户执行)

      zabbix_agentd.exe --start
      

    linux安装

    sudo docker run --name gateway-zabbix-agent \
      -p 10050:10050 \
      -e ZBX_HOSTNAME="gateway-ubuntu" \
        -e ZBX_SERVER_HOST="192.168.17.44" \
        -d zabbix/zabbix-agent:ubuntu-3.4-latest
    

    zabbix主机监控

    我们涉及的系统,主要是windows和linux操作系统,交换机等设备

    windows主机监控

    1. 准备

      待监控机器安装zabbix agent,具体参考zabbix agent windows安装

    2. 新增主机


      zabbix3.4使用说明_第1张图片
      image.png

      zabbix3.4使用说明_第2张图片
      image.png
    3. 配置主机检测模版


      zabbix3.4使用说明_第3张图片
      image.png

    linux主机监控

    ​ linux监控类似windows监控,需要安装zabbix agent linux版本,然后新增主机,选择对应主机模版即可

    注意:所有的机器,在配置主机名字需要与待监控主机hostname名字相同

    数据库监控

    • oracle监控
      1. 配置jdk

      2. 创建oracle监控用户

        创建用户
        CREATE USER ZABBIX  IDENTIFIED BY zabbix DEFAULT TABLESPACE SYSTEM TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
        赋予用户权限
        GRANT ALTER SESSION TO zabbix; 
        GRANT CREATE SESSION TO zabbix; 
        GRANT CONNECT TO zabbix; 
        ALTER USER zabbix DEFAULT ROLE ALL; 
        GRANT SELECT ON V_$INSTANCE TO zabbix; 
        GRANT SELECT ON DBA_USERS TO zabbix; 
        GRANT SELECT ON V_$LOG_HISTORY TO zabbix; GRANT SELECT ON V_$LOG TO zabbix; GRANT SELECT ON V_$PARAMETER TO zabbix; 
        GRANT SELECT ON SYS.DBA_AUDIT_SESSION TO zabbix;
        GRANT SELECT ON V_$LOCK TO zabbix; 
        GRANT SELECT ON DBA_REGISTRY TO zabbix; 
        GRANT SELECT ON V_$LIBRARYCACHE TO zabbix; 
        GRANT SELECT ON V_$SYSSTAT TO zabbix; 
        GRANT SELECT ON V_$PARAMETER TO zabbix; 
        GRANT SELECT ON V_$LATCH TO zabbix; 
        GRANT SELECT ON V_$PGASTAT TO zabbix; 
        GRANT SELECT ON V_$SGASTAT TO zabbix; 
        GRANT SELECT ON V_$LIBRARYCACHE TO zabbix; 
        GRANT SELECT ON V_$PROCESS TO zabbix; 
        GRANT SELECT ON DBA_DATA_FILES TO zabbix; 
        GRANT SELECT ON DBA_TEMP_FILES TO zabbix; 
        GRANT SELECT ON DBA_FREE_SPACE TO zabbix; 
        GRANT SELECT ON V_$SYSTEM_EVENT TO zabbix; 
        GRANT SELECT ON V_$locked_object TO zabbix; 
        GRANT SELECT ON dba_objects TO zabbix; 
        GRANT SELECT ON dba_tablespaces TO zabbix; 
        GRANT SELECT ON v_$SESSION TO zabbix;
        如果是oracle11g,需要执行以下语句
        exec dbms_network_acl_admin.create_acl(acl =>'resolve.xml',description => 'resolve acl', principal =>'ZABBIX',is_grant => true, privilege => 'resolve');
        exec dbms_network_acl_admin.assign_acl(acl =>'resolve.xml', host =>'*');
        验证
        select utl_inaddr.get_host_name('127.0.0.1') from dual;
        
      3. 安装orabbix

        下载解压
        wget https://sourceforge.net/projects/orabbix/files/orabbix-1.2.3.zip
        sudo mkdir /usr/local/orabbix
        sudo mv orabbix-1.2.3.zip /usr/local/orabbix/
        cd /usr/local/orabbix/&& sudo unzip orabbix-1.2.3.zip
        修改配置
        cd conf && sudo cp config.props.sample config.props
        sudo vi config.props
        
zabbix3.4使用说明_第4张图片
image.png
  1. 启动执行sh run.sh

  2. 导入监控模版Orabbix_export_full.xml

  3. 新建主机,选择上传的模版


    zabbix3.4使用说明_第5张图片
    image.png
  • mysql监控

你可能感兴趣的:(zabbix3.4使用说明)