Metricbeat收集系统指标

Metricbeat 部署

下载程序

1
2
3
curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.6.2-darwin-x86_64.tar.gz
tar xzvf metricbeat-7.6.2-darwin-x86_64.tar.gz
cd metricbeat-7.6.2-darwin-x86_64/

修改配置文件

修改 metricbeat.yml 设置连接信息:

es信息

1
2
3
4
5
6
7
8
9
10
11
12
13
#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["172.16.100.92:9200"]

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

# Authentication credentials - either API key or username/password.
#api_key: "id:api_key"
#username: "elastic"
#password: "changeme"

Kibana信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#============================== 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: "172.16.100.92:5601"

# Kibana Space ID
# ID of the Kibana Space into which the dashboards should be loaded. By default,
# the Default Space will be used.
#space.id:

公共信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#================================ General =====================================

# The name of the shipper that publishes the network data. It can be used to group
# all the transactions sent by a single shipper in the web interface.
name: 172.16.100.92

# The tags of the shipper are included in their own field with each
# transaction published.
#tags: ["service-X", "web-tier"]

# Optional fields that you can specify to add additional information to the
# output.
#fields:
# env: staging

启动system模块

./metricbeat modules enable system

其他模块请参考/modules.d 下的文件

可以在 modules.d 文件夹下找到 system.yml 配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Module: system
# Docs: https://www.elastic.co/guide/en/beats/metricbeat/7.6/metricbeat-module-system.html

- module: system
period: 10s
metricsets:
- cpu
- load
- memory
- network
- process
- process_summary
- socket_summary
#- entropy
#- core
#- diskio
#- socket
#- service
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)($|/)'

- module: system
period: 15m
metricsets:
- uptime

#- module: system
# period: 5m
# metricsets:
# - raid
# raid.mount_point: '/'

设置仪表盘数据

./metricbeat setup

前台启动

./metricbeat -e

安装成系统服务

请参考 springboot开机自启


Metricbeat收集系统指标
https://zhaops-hub.github.io/2021/11/16/elasticsearch/Metricbeat收集系统指标/
作者
赵培胜
发布于
2021年11月16日
许可协议