• ELK Betas 6.0安装及使用


    Betas 6.0安装及使用

    注意: Elastic官网更新非常的快,每个版本的文档有会有不同,具体需要去官网查看最新文档进行配置调整。

    Beats 平台集合了多种单一用途数据采集器。这些采集器安装后可用作轻量型代理,从成百上千或成千上万台机器向 Logstash 或 Elasticsearch 发送数据。

    官网网址为:https://www.elastic.co/en/products/beats

    Beats在6.0和和Logstash的主要分工的,Betas提供定制化的、轻量级的日志上报功能,并结合kibana自动生成图标功能,Logstash主要是分析自定义化的日志上报功能。

    功能 说明
    FileBeat 包含对Apache、Nginx、Mysql等日志的上报功能
    MetricBeat 监控日志上报,结合kibana提供报表服务,如系统监控、apache、nginx连接状态、php-fpm、zookeeper、kafka等。
    PacketBeat 监控应用程序的网络数据包情况,如Redis、ICMP、HTTP、DNS等
    WinlogBeat windows的事件日志,可上报到logstash、elasticsearch,并使用kibana图表化
    AutidtBeat 系统的审计数据
    HeartBeat 运行时间监控 支持ICMP、TCP 和 HTTP 进行 ping 检测,也支持认证方式的检测

    FileBeat架构图

    img

    我们实例安装一个metricBeat,并配置system监控模块,最后将图标发送到kibana平台上实时查看。

    安装metricBeat安装包

    官网下载地址为:https://www.elastic.co/downloads/beats/metricbeat

    我目前在试用的最新版本为6.0版本,官网最新把ELK的版本号都进行了统一,现在对每个版本的软件之间的兼容性也有了非常清晰的说明。

    我们试用rpm包方式安装,能自动创建init.d/并托管给系统service管理,方便我们后面的维护

    # wget https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-6.0.0-x86_64.rpm
    # rpm -ivh metricbeat-6.0.0-x86_64.rpm 
    # chkconfig --add metricbeat
    # chkconfig metricbeat on
    # vim /etc/metribeat/metribeat.yml
    

    可执行文件目录: /usr/share/metricbeat

    日志目录: /var/log/metricbeat

    配置文件目录:/etc/metricbeat/

    配置metricbeat配置文件

    编辑配置文件metribeat.yml,配置文件的格式yaml格式,主要配置两处,setup.kibana和output.elasticsearch,如果es安装了x-pack security插件,则需要配置username和password字段。

    setup.kibana:
    
      # Kibana Host
      # Scheme and port can be left out and will be set to the default (http and 5601)
      # In case you specify and additional path, the scheme is required: http://localhost:5601/path
      # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
      host: "172.31.7.116:5601"
      username : "kibana"
      password : "xxx"
    
    output.elasticsearch:
      # Array of hosts to connect to.
      hosts: ["172.31.7.116:9200", "172.31.0.155:9200"]
    
      # Optional protocol and basic auth credentials.
      protocol: "http"
      username: "elastic"
      password: "xxx"
    

    当然metricbeat还支持nginx、apache、docker、kibana等很多模块,每个模块的配置文件在./modules.d/文件夹中,需要把扩展名重命名为.yml才会被加载。

    配置system模块
    # vim /etc/metricbeat/modules.d/system.yml
    # mv /etc/metricbeat/modules.d/system.yml.idsabled /etc/metricbeat/modules.d/system.yml
    - module: system
      period: 10s
      metricsets:
        - cpu
        - load
        - memory
        - network
        - process
        - process_summary
        - core
        - diskio
        - socket
      processes: ['.*']
      process.include_top_n:
        by_cpu: 5      # include top 5 processes by CPU
        by_memory: 5   # include top 5 processes by memory
    
    - module: system
      period: 1m
      metricsets:
        - filesystem
        - fsstat
      processors:
      - drop_event.when.regexp:
          system.filesystem.mount_point: '^/(sys|cgroup|proc|dev|etc|host|lib)($|/)'
    
    
    设置kibana仪表板

    如果需要在kibana的仪表板显示,需要先新建metribeat-*索引,系统自带了命令可以自动创建,运行前需要确保kibana是否正常运行,如果是rpm安装执行以下命令即可,如果是绿色安装则要增加-c yml配置文件目录

    # metricbeat setup --dashboards
    
    启动metricbeat
    # service metricbeat start
    

    如果启动失败,可以查看/var/log/metricbeat/metricbeat日志文件错误信息,进行排查原因。

    查看kibana仪表板

    参考官方文档

    利用metricbeat可以将应用层的数据上报给监控平台,发现ELK最新版本的功能是越来越强大了,现在都涉及到监控这块了,虽然没有zibbix功能强大, 但是配合使用还是不错的,kibana平台的图表功能也是越来越强大了,6.0明显的感觉是配置越来越简单,功能越来越强大。

  • 相关阅读:
    使用BeyondCompare作为Subversive的比较器
    Ubuntu下安装jdk6的方法和步骤
    推荐几款通用的数据库管理工具
    通用数据库都有哪些
    Linux下卸载ORACLE的多种方法(参考使用)
    jar包查询网站 非常好用!
    8种Nosql数据库系统对比
    SQL2005数据库镜像的步骤
    建立与删除SQL 2008事务复制发布
    同步复制JOB说明
  • 原文地址:https://www.cnblogs.com/gaoxu387/p/7890021.html
Copyright © 2020-2023  润新知