C/C++教程

windows 10使用metricbeat 7.15收集性能指标数据

本文主要是介绍windows 10使用metricbeat 7.15收集性能指标数据,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1、安装 Metricbeat

官方教程:https://www.elastic.co/guide/en/beats/metricbeat/7.15/metricbeat-installation-configuration.html

1.1、官网下载Metricbeat
1.2、解压后,按以下命令安装
# 进入安装目录,执行install-service-metricbeat.ps1
PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-metricbeat.ps1.

执行结果
在这里插入图片描述

1.3、在metricbeat.yml中配置kibana

有域名的配置域名,没有则配IP

# =================================== Kibana ===================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
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: "kibana-host:5601"
  # kibana的用户名和密码,如果不配则使用Elasticsearch output里面的
  # username: "my_kibana_user"  
  # password: "{pwd}"
1.4、导入模拟数据(可选)

此步骤加载用于写入Elasticsearch的推荐索引模板,并部署用于在Kibana中可视化数据的示例仪表板。Metricbeat附带了用于解析、索引和可视化数据的预定义模拟数据。要加载这些数据,请执行以下操作:

# windows
metricbeat.exe setup -e

2、收集Elasticsearch指标

官方教程:https://www.elastic.co/guide/en/elasticsearch/reference/7.15/configuring-metricbeat.html

2.1、在Metricbeat 中启用并配置Elasticsearch x-pack模块(如果设置了密码需要该步骤)
# 进入安装目录,执行以下命令
D:\ELK\metricbeat-7.15.0>metricbeat modules enable elasticsearch-xpack
Enabled elasticsearch-xpack

然后配置modules.d/elasticsearch-xpack.yml
在这里插入图片描述
配置如下

- module: elasticsearch
  xpack.enabled: true
  period: 10s
  hosts: ["http://es-node-1-host:9200","http://es-node-2-host:9200"]
  username: "elastic"
  password: "123456"
2.2、在metricbeat.yml配置elasticsearch
# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]

  # Protocol - either `http` (default) or `https`.
  #protocol: "https"

  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  #username: "elastic"
  #password: "changeme"
2.3、启动metricbeat
# 默认的日志路径:C:\ProgramData\metricbeat\Logs
D:\ELK\metricbeat-7.15.0>net start metricbeat 或双击metricbeat.exe

The metricbeat service was started successfully.
2.4、登录kibana查看

点【Management】-【堆栈监控】
在这里插入图片描述

这篇关于windows 10使用metricbeat 7.15收集性能指标数据的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!