Elasticsearch-6.5.4之MetricBeat学习

MetricBeat

Elasticsearch-6.5.4之MetricBeat学习_第1张图片

  • 定期收集操作系统或者应用服务的指标
  • 存储到ElasticSearch中,进行实时的分析

1.1 MetricBeat组成

- Module: 收集对象,mysql, redis, nginx 等
-  Metricset 收集指标的集合, cpu, memory, network 等

Elasticsearch-6.5.4之MetricBeat学习_第2张图片

1.2 部署与收集系统指标

tar -xvf metricbeat-6.5.4-linux-x86_64.tar.gz
cd metricbeat-6.5.4-linux-x86_64
vim metricbeat.yml
metricbeat.config.modules:
  path: ${
     path.config}/modules.d/*.yml
  reload.enabled: false
setup.template.settings:
  index.number_of_shards: 1
  index.codec: best_compression
setup.kibana:
output.elasticsearch:
  hosts: ["192.168.40.133:9200","192.168.40.134:9200","192.168.40.135:9200"]
processors:
- add_host_metadata: ~
- add_cloud_metadata: ~
#启动
./metricbeat -e

在elasticsearch里面可以看到相关的数据
Elasticsearch-6.5.4之MetricBeat学习_第3张图片

1.3 Module

./metricbeat modules list #查看列表
Enabled:
system #默认启用
Disabled:
aerospike
apache
ceph
couchbase
docker
dropwizard
elasticsearch
envoyproxy
etcd
golang
graphite
haproxy
http
jolokia
kafka
kibana
kubernetes
kvm
logstash
memcached
mongodb
munin
mysql
nginx
php_fpm
postgresql
prometheus
rabbitmq
redis
traefik
uwsgi
vsphere
windows

1.4 Nginx Module配置

在nginx中,需要开启状态查询,才能查询到指标数据。

#重新编译nginx
./configure --prefix=/usr/local/nginx --with-http_stub_status_module
make
make install
./nginx -V #查询版本信息
nginx version: nginx/1.11.6
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module
#配置nginx
vim nginx.conf
location /nginx-status {
     
stub_status on;
access_log off;
}

开始配置nginx module

#启用redis module
./metricbeat modules enable nginx
#修改redis module配置
vim modules.d/nginx.yml
# Module: nginx
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/6.5/metricbeat-modulenginx.html
- module: nginx
#metricsets:
# - stubstatus
period: 10s
# Nginx hosts
hosts: ["http://192.168.40.133"]
# Path to server status. Default server-status
server_status_path: "nginx-status"
#username: "user"
#password: "secret"
#启动
./metricbeat -e

你可能感兴趣的:(Elasticsearch-6.5.4之MetricBeat学习)