ELK Betas 6.0安装及使用

Betas 6.0安装及使用

注意: Elastic官网更新很是的快,每一个版本的文档有会有不一样,具体须要去官网查看最新文档进行配置调整。php

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

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

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

功能 说明
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架构图docker

img

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

安装metricBeat安装包

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

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

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

# 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明显的感受是配置愈来愈简单,功能愈来愈强大。

相关文章
相关标签/搜索