美文网首页
Linux 安装zabbix

Linux 安装zabbix

作者: xuanxiao | 来源:发表于2020-07-21 15:03 被阅读0次

    运行docker-compose

    version: "3.7"
    
    networks:
      frontend:
        driver: "bridge"
      backend:
        driver: "bridge"
    mysql:
        container_name: "mysql:8"
        #build: "./mysql"
        ports:
          - "3306:3306"
        networks:
          - backend
        volumes:
          - /docker/data/mysql/data:/var/lib/mysql:rw
        #  - ./mysql/conf.d/mysqld.cnf:/etc/mysql/conf.d/mysqld.cnf
        #security_opt:
        #    - seccomp:unconfined
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: 123456
    zabbix-server:
        image: "zabbix/zabbix-server-mysql:ubuntu-latest"
        container_name: "zabbix-server"
        #build: "./zabbix/zabbix-server"
        depends_on:
          - mysql
        ports:
          - "10051:10051"
        networks:
          - backend
        volumes:
          - /docker/data/zabbix/zabbix-server:/var/lib/zabbix:rw
        restart: always
        environment:
          DB_SERVER_HOST: mysql
          DB_SERVER_PORT: 3306
          MYSQL_USER: zabbix
          MYSQL_PASSWORD: zabbix
          MYSQL_ROOT_PASSWORD: 123456
      zabbix-web:
        image: "zabbix/zabbix-web-nginx-mysql:centos-latest"
        container_name: "zabbix-web"
        #build: "./zabbix/zabbix-web"
        depends_on:
          - mysql
        ports:
          - "8080:8080"
        networks:
          - frontend
          - backend
        restart: always
        environment:
          ZBX_SERVER_HOST: zabbix-server
          ZBX_SERVER_PORT: 10051
          PHP_TZ: Asia/Shanghai
          DB_SERVER_HOST: mysql
          DB_SERVER_PORT: 3306
          MYSQL_ROOT_PASSWORD: 123456
          POSTGRES_USER: zabbix
          POSTGRES_PASSWORD: 123456
    

    设置数据库/密码

    mysql -uroot -p
    password
    mysql> create database zabbix character set utf8 collate utf8_bin;
    mysql> create user zabbix@localhost identified by 'password';
    mysql> grant all privileges on zabbix.* to zabbix@localhost;
    mysql> quit;
    

    安装zabbix-agent

    rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
    yum clean all
    yum install -y zabbix-agent
    #启动
    systemctl restart zabbix-agent
    #加入开机启动
    systemctl enable zabbix-agent
    

    配置zabbix-agent

    cd /etc/zabbix
    cp zabbix_agentd.conf zabbix_agentd.conf.bak
    vim zabbix_agentd.conf
    #更改内容
    Server=127.0.0.1  => Server=zabbix-server的ip
    ServerActive=127.0.0.1 => ServerActive=zabbix-server的ip
    Hostname=Zabbix server => 注释掉
    HostnameItem=system.hostname => 打开
    

    重启zabbix-agent

    登录

    http://域名或地址:8080
    默认账号:admin 密码:zabbix

    官方安装地址

    相关文章

      网友评论

          本文标题:Linux 安装zabbix

          本文链接:https://www.haomeiwen.com/subject/vgpikktx.html