- Metricbeat 参考文档其他版本
- Metricbeat 概述
- 快速入门:安装和配置
- 设置并运行
- 升级 Metricbeat
- Metricbeat 的工作原理
- 配置
- 模块
- 常规设置
- 项目路径
- 配置文件加载
- 输出
- Kerberos
- SSL
- 索引生命周期管理 (ILM)
- Elasticsearch 索引模板
- Kibana 端点
- Kibana 仪表板
- 处理器
- 定义处理器
- add_cloud_metadata
- add_cloudfoundry_metadata
- add_docker_metadata
- add_fields
- add_host_metadata
- add_id
- add_kubernetes_metadata
- add_labels
- add_locale
- add_network_direction
- add_nomad_metadata
- add_observer_metadata
- add_process_metadata
- add_tags
- append
- community_id
- convert
- copy_fields
- decode_base64_field
- decode_duration
- decode_json_fields
- decode_xml
- decode_xml_wineventlog
- decompress_gzip_field
- detect_mime_type
- dissect
- dns
- drop_event
- drop_fields
- extract_array
- fingerprint
- include_fields
- move_fields
- rate_limit
- registered_domain
- rename
- replace
- script
- syslog
- translate_ldap_attribute
- translate_sid
- truncate_fields
- urldecode
- 自动发现
- 内部队列
- 日志
- HTTP 端点
- 正则表达式支持
- 检测
- 功能标志
- metricbeat.reference.yml
- 操作指南
- 模块
- ActiveMQ 模块
- Aerospike 模块
- Airflow 模块
- Apache 模块
- AWS 模块
- AWS Fargate 模块
- Azure 模块
- Beat 模块
- Ceph 模块
- Cloudfoundry 模块
- CockroachDB 模块
- Consul 模块
- Containerd 模块
- Coredns 模块
- Couchbase 模块
- CouchDB 模块
- Docker 模块
- Dropwizard 模块
- Elasticsearch 模块
- Elasticsearch ccr 指标集
- Elasticsearch cluster_stats 指标集
- Elasticsearch enrich 指标集
- Elasticsearch index 指标集
- Elasticsearch index_recovery 指标集
- Elasticsearch index_summary 指标集
- Elasticsearch ingest_pipeline 指标集
- Elasticsearch ml_job 指标集
- Elasticsearch node 指标集
- Elasticsearch node_stats 指标集
- Elasticsearch pending_tasks 指标集
- Elasticsearch shard 指标集
- Enterprise Search 模块
- Envoyproxy 模块
- Etcd 模块
- Google Cloud Platform 模块
- Google Cloud Platform billing 指标集
- Google Cloud Platform carbon 指标集
- Google Cloud Platform compute 指标集
- Google Cloud Platform dataproc 指标集
- Google Cloud Platform firestore 指标集
- Google Cloud Platform gke 指标集
- Google Cloud Platform loadbalancing 指标集
- Google Cloud Platform metrics 指标集
- Google Cloud Platform pubsub 指标集
- Google Cloud Platform storage 指标集
- Golang 模块
- Graphite 模块
- HAProxy 模块
- HTTP 模块
- IBM MQ 模块
- IIS 模块
- Istio 模块
- Jolokia 模块
- Kafka 模块
- Kibana 模块
- Kubernetes 模块
- Kubernetes apiserver 指标集
- Kubernetes container 指标集
- Kubernetes controllermanager 指标集
- Kubernetes event 指标集
- Kubernetes node 指标集
- Kubernetes pod 指标集
- Kubernetes proxy 指标集
- Kubernetes scheduler 指标集
- Kubernetes state_container 指标集
- Kubernetes state_cronjob 指标集
- Kubernetes state_daemonset 指标集
- Kubernetes state_deployment 指标集
- Kubernetes state_job 指标集
- Kubernetes state_node 指标集
- Kubernetes state_persistentvolumeclaim 指标集
- Kubernetes state_pod 指标集
- Kubernetes state_replicaset 指标集
- Kubernetes state_resourcequota 指标集
- Kubernetes state_service 指标集
- Kubernetes state_statefulset 指标集
- Kubernetes state_storageclass 指标集
- Kubernetes system 指标集
- Kubernetes volume 指标集
- KVM 模块
- Linux 模块
- Logstash 模块
- Memcached 模块
- Cisco Meraki 模块
- MongoDB 模块
- MSSQL 模块
- Munin 模块
- MySQL 模块
- NATS 模块
- Nginx 模块
- Openmetrics 模块
- Oracle 模块
- Panw 模块
- PHP_FPM 模块
- PostgreSQL 模块
- Prometheus 模块
- RabbitMQ 模块
- Redis 模块
- Redis Enterprise 模块
- SQL 模块
- Stan 模块
- Statsd 模块
- SyncGateway 模块
- System 模块
- System core 指标集
- System cpu 指标集
- System diskio 指标集
- System entropy 指标集
- System filesystem 指标集
- System fsstat 指标集
- System load 指标集
- System memory 指标集
- System network 指标集
- System network_summary 指标集
- System process 指标集
- System process_summary 指标集
- System raid 指标集
- System service 指标集
- System socket 指标集
- System socket_summary 指标集
- System uptime 指标集
- System users 指标集
- Tomcat 模块
- Traefik 模块
- uWSGI 模块
- vSphere 模块
- Windows 模块
- ZooKeeper 模块
- 导出的字段
- ActiveMQ 字段
- Aerospike 字段
- Airflow 字段
- Apache 字段
- AWS 字段
- AWS Fargate 字段
- Azure 字段
- Beat 字段
- Beat 字段
- Ceph 字段
- 云提供商元数据字段
- Cloudfoundry 字段
- CockroachDB 字段
- 通用字段
- Consul 字段
- Containerd 字段
- Coredns 字段
- Couchbase 字段
- CouchDB 字段
- Docker 字段
- Docker 字段
- Dropwizard 字段
- ECS 字段
- Elasticsearch 字段
- Enterprise Search 字段
- Envoyproxy 字段
- Etcd 字段
- Google Cloud Platform 字段
- Golang 字段
- Graphite 字段
- HAProxy 字段
- 主机字段
- HTTP 字段
- IBM MQ 字段
- IIS 字段
- Istio 字段
- Jolokia 字段
- Jolokia Discovery 自动发现提供程序字段
- Kafka 字段
- Kibana 字段
- Kubernetes 字段
- Kubernetes 字段
- KVM 字段
- Linux 字段
- Logstash 字段
- Memcached 字段
- MongoDB 字段
- MSSQL 字段
- Munin 字段
- MySQL 字段
- NATS 字段
- Nginx 字段
- Openmetrics 字段
- Oracle 字段
- Panw 字段
- PHP_FPM 字段
- PostgreSQL 字段
- 进程字段
- Prometheus 字段
- Prometheus 类型指标字段
- RabbitMQ 字段
- Redis 字段
- Redis Enterprise 字段
- SQL 字段
- Stan 字段
- Statsd 字段
- SyncGateway 字段
- 系统字段
- Tomcat 字段
- Traefik 字段
- uWSGI 字段
- vSphere 字段
- Windows 字段
- ZooKeeper 字段
- 监控
- 安全
- 故障排除
- 获取帮助
- 调试
- 了解已记录的指标
- 常见问题
- FreeBSD 上出现“open /compat/linux/proc: no such file or directory”错误
- Metricbeat 为您未配置的接口收集系统指标
- Metricbeat 使用过多带宽
- 加载配置文件时出错
- 发现意外或未知字符
- Logstash 连接不起作用
- 发布到 Logstash 失败,并显示“connection reset by peer”消息
- @metadata 在 Logstash 中丢失
- 不确定是使用 Logstash 还是 Beats
- SSL 客户端无法连接到 Logstash
- 监控 UI 显示的 Beats 比预期的少
- 仪表板无法找到索引模式
- 由于 MADV 设置导致 RSS 内存使用量过高
- 为 Beats 做出贡献
配置模块
编辑配置模块
编辑您可以在 modules.d
目录(推荐)或 Metricbeat 配置文件中配置模块。 modules.d
目录中已启用模块的设置优先于 Metricbeat 配置文件中的模块设置。
在启用模块的情况下运行 Metricbeat 之前,请确保您还设置了使用 Kibana 仪表板的环境。有关更多信息,请参阅快速入门:安装和配置。
在具有 POSIX 文件权限的系统上,所有 Beats 配置文件都受所有权和文件权限检查。有关更多信息,请参阅配置文件所有权和权限。
在 modules.d
目录中配置模块
编辑modules.d
目录包含 Metricbeat 中所有可用模块的默认配置。要启用或禁用 modules.d
下的特定模块配置,请运行 modules enable
或 modules disable
命令。例如
metricbeat modules enable apache mysql
metricbeat modules enable apache mysql
./metricbeat modules enable apache mysql
./metricbeat modules enable apache mysql
PS > .\metricbeat.exe modules enable apache mysql
然后,当您运行 Metricbeat 时,它会加载 modules.d
目录中指定的相应模块配置(例如,modules.d/apache.yml
和 modules.d/mysql.yml
)。
要查看已启用和已禁用模块的列表,请运行
metricbeat modules list
metricbeat modules list
./metricbeat modules list
./metricbeat modules list
PS > .\metricbeat.exe modules list
要更改默认模块配置,请修改 modules.d
目录中的 .yml
文件。
以下示例显示了 Apache 模块的基本配置
- module: apache metricsets: ["status"] hosts: ["http://127.0.0.1/"] period: 10s fields: dc: west tags: ["tag"] processors: ....
有关其他配置示例,请参阅配置组合。
在 metricbeat.yml
文件中配置模块
编辑在可能的情况下,您应该使用 modules.d
目录中的配置文件。
但是,如果您是从以前版本的 Metricbeat 升级,并且不想将模块配置移动到 modules.d
目录,则直接在配置文件中配置模块是一种实用的方法。您可以继续在 metricbeat.yml
文件中配置模块,但您将无法使用 modules
命令来启用和禁用配置,因为该命令需要 modules.d
布局。
要在 metricbeat.yml
配置文件中启用特定的模块和指标集,请将条目添加到 metricbeat.modules
列表。列表中的每个条目都以破折号 (-) 开头,后跟该模块的设置。
检查 modules.d
目录以验证您在 metricbeat.yml
中指定的模块是否已禁用(文件名以 .disabled
结尾)。如果它们没有禁用,请立即运行 metricbeat modules disable <modulename>
来禁用它们。
以下示例显示了启用 apache
和 mysql
模块的配置
metricbeat.modules: #---------------------------- Apache Status Module --------------------------- - module: apache metricsets: ["status"] period: 1s hosts: ["http://127.0.0.1/"] #---------------------------- MySQL Status Module ---------------------------- - module: mysql metricsets: ["status"] period: 2s hosts: ["root@tcp(127.0.0.1:3306)/"]
在以下示例中,每秒都会爬取 Redis 主机以获取 stats
信息,因为这是关键数据,但仅每 30 秒提取一次完整的 Apache 指标集列表,因为这些指标不那么关键。
metricbeat.modules: - module: redis metricsets: ["info"] hosts: ["host1"] period: 1s - module: apache metricsets: ["info"] hosts: ["host1"] period: 30s
配置变体
编辑每个模块都带有默认配置文件。一些模块还带有一个或多个变体配置文件,其中包含该模块的常见替代配置。
当您看到已启用和已禁用模块的列表时,具有配置变体的模块将显示为 <module_name>-<variant_name>
。您可以通过指定 metricbeat modules enable <module_name>-<variant_name>
和 metricbeat modules disable <module_name>-<variant_name>
分别启用或禁用模块的特定配置变体。
配置组合
编辑您可以指定使用指标集、周期和主机的不同组合的模块配置。
对于定义了多个指标集的模块,可以定义该模块两次,并为每个指标集指定不同的使用周期。对于以下示例,将每 10 秒提取一次 set1
指标集,而每 2 分钟提取一次 set2
指标集
- module: example metricsets: ["set1"] hosts: ["host1"] period: 10s - module: example metricsets: ["set2"] hosts: ["host1"] period: 2m
标准配置选项
编辑您可以为任何 Metricbeat 模块指定以下选项。某些模块需要其他配置设置。有关更多信息,请参阅模块部分。
module
编辑要运行的模块的名称。有关每个模块的文档,请参阅模块部分。
metricsets
编辑要执行的指标集列表。请确保您仅列出模块中可用的指标集。无法引用其他模块中的指标集。有关可用指标集的列表,请参阅模块。
enabled
编辑一个布尔值,指定是否启用模块。如果您使用默认配置文件 metricbeat.yml
,则默认情况下启用系统模块(设置为 enabled: true
)。如果配置块中缺少 enabled
选项,则默认情况下启用该模块。
period
编辑执行指标集的频率。如果系统不可访问,则 Metricbeat 将为每个周期返回一个错误。此设置是必需的。
hosts
编辑从中获取信息的主机列表。对于某些指标集(例如,系统模块),此设置是可选的。
fields
编辑将随指标集事件发送的字段字典。此设置是可选的。
tags
编辑将随指标集事件发送的标签列表。此设置是可选的。
processors
编辑要应用于指标集生成的数据的处理程序列表。
有关在配置中指定处理程序的信息,请参阅处理程序。
index
编辑如果存在,则此格式化字符串将覆盖来自此模块的事件的索引(对于 Elasticsearch 输出),或设置事件元数据的 raw_index
字段(对于其他输出)。此字符串只能引用代理名称和版本以及事件时间戳;要访问动态字段,请使用 output.elasticsearch.index
或处理程序。
示例值:"%{[agent.name]}-myindex-%{+yyyy.MM.dd}"
可能会扩展为 "metricbeat-myindex-2019.12.13"
。
keep_null
编辑如果此选项设置为 true,则具有 null
值的字段将在输出文档中发布。默认情况下,keep_null
设置为 false
。
service.name
编辑用户给定的从其中收集数据的服务的名称。例如,它可以用于标识从具有相同 service.type
的不同集群节点收集的信息。
标准 HTTP 配置选项
编辑将主机定义为 HTTP URL 的模块和指标集可以使用 HTTP 的标准方案(http://
和 https://
)以及以下方案来连接到本地管道
-
http+unix://
连接到 UNIX 套接字。 -
http+npipe://
连接到 Windows 命名管道。
以下选项可用于将主机定义为 HTTP URL 的模块和指标集
username
编辑用于基本身份验证的用户名。
password
编辑用于基本身份验证的密码。
connect_timeout
编辑完成 HTTP 连接的总时间限制(默认值:2 秒)。
timeout
编辑模块发出的 HTTP 请求的总时间限制(默认值:10 秒)。
ssl
编辑用于 HTTPS 连接的 SSL 参数的配置选项,例如要使用的证书颁发机构。
有关更多信息,请参阅SSL。
headers
编辑要用于 HTTP 请求的标头列表。例如
headers: Cookie: abcdef=123456 My-Custom-Header: my-custom-value
bearer_token_file
编辑如果已定义,Metricbeat 将在初始化时读取一次文件内容,然后将该值用于 HTTP 授权标头。
basepath
编辑要在 HTTP URI 中使用的可选基本路径。如果已定义,Metricbeat 将此值作为 HTTP URI 路径中的第一个段插入。
query
编辑在 YAML 中传递通用查询参数的可选值。您可以使用 ?key=value&key2&value2
语法在主机值中设置查询参数,而不是在此处进行设置,如下所示
query: key: value key2: value2 list: - 1.1 - 2.95 - -15
On this page