• Zabbix运维---基本搭建


    一、基本介绍

      1、企业级监控工具

      

       2、zabbix组成

      

       3、zabbix架构

      

       4、zabbix server组成

      

       5、zabbix基本术语

        1)组件功能

        

         2)监控收集

        

         3)数据展示

        

         4)告警相关

        

        5) 认证和权限

        

     二、搭建安装

      1、资源要求

      

      2、二进制安装

    centos 7 添加阿里云镜像
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    yum install epel-release
    
    
    安装常用的开发组件
    yum  groups install "Development Tools"
    yum groups info  "Development Tools"
    
    
    增加Zabbix镜像源
    rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
    
    
    关闭SElinux
    systemctl stop firewalld.service
    systemctl disable  firewalld.service
    
    vim /etc/selinux/config
    
    yum install iptables-services
    
    
    安装Zabbix Server和Frontend
    yum install zabbix-server-mysql
    yum install zabbix-web-mysql
    
    
    安装MySQL
    yum install mariadb-server
    systemctl  start mariadb.service
    systemctl  status mariadb.service
    mysql_secure_installation
    
    
    创建数据库
    mysql -uroot -p
    create database zabbix character set utf8 collate utf8_bin;
    grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@findsec123';
    
    导入数据结构
    zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix@findsec123  zabbix
    
    
    配置Zabbix Serve
    vim /etc/zabbix/zabbix_server.conf
    
    
    启动Zabbix Server
    systemctl  start zabbix-server.service
    systemctl  status zabbix-server.service
    
    more /var/log/zabbix/zabbix_server.log
    
    
    配置Zabbix frontend
    vim /etc/php.ini
    
    max_execution_time = 300
    memory_limit = 128M
    post_max_size = 16M
    upload_max_filesize = 2M
    max_input_time = 300
    max_input_vars = 10000
    always_populate_raw_post_data = -1
    date.timezone = Asia/Shanghai
    
    
    启动httpd
    systemctl  start  httpd.service
    systemctl  status  httpd.service
    
    http://10.211.55.7/zabbix/setup.php
    
    Admin
    zabbix
    
    
    安装Zabbix Agent
    yum install zabbix-agent
    
    systemctl  start zabbix-agent.service

      3、源码安装

    下载zabbix server源码包
    wget -O zabbix-4.0.4.tar.gz  https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.4/zabbix-4.0.4.tar.gz/download
    
    安装依赖
    yum install wget telnet net-tools python-paramiko gcc gcc-c++ dejavu-sans-fonts python-setuptools python-devel sendmail mailx net-snmp
    net-snmp-devel net-snmp-utils freetype-devel libpng-devel perl unbound libtasn1-devel p11-kit-devel OpenIPMI unixODBC libevent-devel
    mysql-devel libxml2-devel libssh2-devel OpenIPMI-devel java-1.8.0-openjdk-devel openldap-devel curl-devel unixODBC-devel 解压并编译安装 tar -zxvf zabbix-4.0.4.tar.gz cd zabbix-4.0.4/ 建立编译安装目录 mkdir -p /data/findsec/zabbix ./configure --prefix=/data/findsec/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc
    --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv make make install /data/findsec/zabbix/sbin/zabbix_server -V 数据库安装 yum install mariadb-server systemctl start mariadb.service systemctl status mariadb.service mysql_secure_installation 创建数据库 mysql -uroot -p create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@findsec123'; 导入数据结构 mysql -uzabbix -pzabbix@findsec123 zabbix < /root/zabbix-4.0.4/database/mysql/schema.sql mysql -uzabbix -pzabbix@findsec123 zabbix < /root/zabbix-4.0.4/database/mysql/images.sql mysql -uzabbix -pzabbix@findsec123 zabbix < /root/zabbix-4.0.4/database/mysql/data.sql 修改zabbix server配置 vim /data/findsec/zabbix/etc/zabbix_server.conf 增加用户 groupadd --system zabbix useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix 启动服务 /data/findsec/zabbix/sbin/zabbix_server -c /data/findsec/zabbix/etc/zabbix_server.conf tailf /tmp/zabbix_server.log 增加Zabbix镜像源 rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm 安装Zabbix Frontend yum install zabbix-web-mysql 配置Zabbix frontend vim /etc/php.ini max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 max_input_vars = 10000 always_populate_raw_post_data = -1 date.timezone = Asia/Shanghai 启动httpd systemctl start httpd.service systemctl status httpd.service http://10.211.55.7/zabbix/setup.php Admin zabbix 安装Zabbix Agent yum install zabbix-agent systemctl start zabbix-agent.service

      4、docker容器安装

    安装和启动docker:
    yum install docker-latest -y 
    systemctl start docker-latest
    systemctl status docker-latest
    ps -ef | grep docker
    
    测试容器功能
    docker run -d -p 80:80 httpd
    ps -ef | grep httpd
    docker stop ffc18f4d40c9
    
    安装mysql
    docker run --name mysql-server -t -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="ZCJ24576" -e MYSQL_ROOT_PASSWORD="123456" -d mysql:5.7 
    --character-set-server=utf8 --collation-server=utf8_bin 运行结果如下: 9779cb64318e mysql:5.7 "docker-entrypoint..." 44 minutes ago Up 44 minutes 3306/tcp, 33060/tcp mysql-server 安装zabbix-java-gateway docker run --name zabbix-java-gateway -t -d zabbix/zabbix-java-gateway:latest 23d4cceb8f06 zabbix/zabbix-java-gateway:latest "docker-entrypoint.sh" 41 minutes ago Up 41 minutes 10052/tcp zabbix-java-gateway 安装zabbix-server的容器 docker run --name zabbix-server-mysql -t -e DB_SERVER_HOST="mysql-server" -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="ZCJ24576" -e MYSQL_ROOT_PASSWORD="123456"
    -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 *这里的link后面跟的是已经正在运行的mysql容器和zabbix-java-gateway容器的NAME字段名称 运行结果如下: 23d4cceb8f06 zabbix/zabbix-java-gateway:latest "docker-entrypoint.sh" 41 minutes ago Up 41 minutes 10052/tcp zabbix-java-gateway 安装zabbix的前端 docker run --name zabbix-web-nginx-mysql -t -e DB_SERVER_HOST="mysql-server" -e MYSQL_DATABASE="zabbix" -e MYSQL_USER="zabbix" -e MYSQL_PASSWORD="ZCJ24576" -e MYSQL_ROOT_PASSWORD="123456"
    --link mysql-server:mysql --link zabbix-server-mysql:zabbix-server -p 80:80 -d zabbix/zabbix-web-nginx-mysql:latest 运行结果如下: a2fcd886b106 zabbix/zabbix-web-nginx-mysql:latest "docker-entrypoint.sh" 10 minutes ago Up 10 minutes 0.0.0.0:80->80/tcp, 443/tcp zabbix-web-nginx-mysql 安装zabbix_agent docker run --name zabbix-agent -e ZBX_HOSTNAME="Zabbix server" -e ZBX_SERVER_HOST="zabbix-server-mysql" --link zabbix-server-mysql:zabbix-server -d zabbix/zabbix-agent:latest 711101115ca0 zabbix/zabbix-agent:latest "/sbin/tini -- /us..." 8 minutes ago Up 8 minutes 10050/tcp zabbix-agent
  • 相关阅读:
    springcloud之Feign(五)
    ElasticSearch
    SpringCloud之Hystrix介绍
    SpringCloud之Ribbon负载均衡(四)
    springcloud之Eureka集群配置(三)
    Problem08 输入数字求和
    Problem07 处理字符串
    Problem06 求最大公约数及最小公倍数
    Problem05 判断分数等级
    Problem04 分解质因数
  • 原文地址:https://www.cnblogs.com/aqicheng/p/13779310.html
Copyright © 2020-2023  润新知