系统模块
了解更多
Elastic Agent 是一种统一的方式,可以为主机添加日志、指标和其他类型数据的监控。它还可以保护主机免受安全威胁,查询操作系统数据,转发远程服务或硬件数据,等等。请参阅文档,了解 Beats 和 Elastic Agent 的详细比较。
System 模块可让您监控服务器。由于 System 模块始终应用于本地服务器,因此不需要 hosts 配置选项。
默认的 metricsets 是 cpu、load、memory、network、process、process_summary、socket_summary、filesystem、fsstat 和 uptime。要禁用默认的 metricset,请在 modules.d/system.yml 配置文件中将其注释掉。如果所有 metricsets 都被注释掉并且 System 模块已启用,Metricbeat 将使用默认的 metricsets。
请注意,某些 metricsets 可能需要访问 /proc 来收集进程信息,并且内核为了检查权限而进行的相应 ptrace_may_access() 调用可能会被 AppArmor 和其他 LSM 软件阻止,即使 System 模块没有直接使用 ptrace。
System 模块监控的某些指标需要收集多个值。例如,system.process.cpu.total.norm.pct 字段报告自上次事件以来进程花费的 CPU 时间百分比。为了确定这个百分比,进程需要至少出现两次,以便可以计算性能增量。
请注意,在某些情况下,如果进程尚未存在足够长的时间以包含在两个指标收集周期内,则该字段可能会在 System 模块的 metricset 中丢失。
System 模块附带一个预定义的仪表板。例如

System metricsets 收集不同种类的指标数据,这可能需要专用权限才能获取。出于安全原因,建议授予尽可能低的权限。本节说明了特定 metricsets 需要存在的权限。
请注意,现代 Linux 实现将传统上与超级用户关联的权限划分为称为 capabilities 的独立单元,这些单元可以独立启用和禁用。Capabilities 是一个每线程属性。
CPU 统计信息(空闲、中断、用户、系统、I/O 等待、软中断、核心、nice、窃取、总计)应无需提升权限即可获得。
CPU 负载数据(1 分钟、5 分钟、15 分钟、核心)应无需提升权限即可获得。
内存统计信息(交换、总计、已用、空闲、实际)应无需提升权限即可获得。
接口的网络指标(入站、出站、错误、丢弃、字节、数据包)应无需提升权限即可获得。
进程执行数据(状态、内存、CPU、命令行)应供授权用户使用。
如果 beats 进程以特权较低的用户身份运行,则可能无法读取属于其他用户的进程数据。该问题应在应用程序日志中报告。
2019-12-23T13:32:06.457+0100 DEBUG [processes] process/process.go:475 Skip process pid=235: error getting process state for pid=235: Could not read process info for pid 23
一般进程摘要(未知、死亡、总计、睡眠、运行、空闲、停止、僵尸)应无需提升权限即可获得。请注意,如果进程数据属于其他用户,则它将被计为未知值(应用程序日志中不会报告任何错误)。
已用套接字摘要(TCP、UDP、计数、侦听、已建立、等待等)应无需提升权限即可获得。
熵数据(可用、池大小)需要访问 /proc/sys/kernel/random 路径。否则将报告错误。
每个 CPU 核心的使用统计信息(空闲、中断、用户、系统、I/O 等待、软中断、核心、nice、窃取、总计)应无需提升权限即可获得。
磁盘 I/O 指标(I/O、读取、写入)应无需提升权限即可获得。
每个新 TCP 套接字事件应供授权用户使用。
如果 beats 进程以特权较低的用户身份运行,则可能无法查看属于其他用户的套接字数据。
Systemd 服务数据(内存、任务、状态)应供授权用户使用。
如果 beats 进程以特权较低的用户身份运行,则可能无法读取属于其他用户的进程数据。该问题应在应用程序日志中报告。
2020-01-02T08:19:50.635Z INFO module/wrapper.go:252 Error fetching data for metricset system.service: error getting list of running units: Rejected send message, 2 matched rules; type="method_call", sender=":1.35" (uid=1000 pid=4429 comm="./metricbeat -d * -e ") interface="org.freedesktop.systemd1.Manager" member="ListUnitsByPatterns" error name="(unset)" requested_reply="0" destination="org.freedesktop.systemd1" (uid=0 pid=1 comm="/usr/lib/systemd/systemd --switched-root --system ")
文件系统指标数据(总计、可用、类型、挂载点、文件、空闲、已用)应无需提升权限即可获得。
Fsstat 指标数据(总大小、空闲、总计、已用计数)应无需提升权限即可获得。
Uptime 指标数据(持续时间)应无需提升权限即可获得。
RAID 指标数据(块、磁盘)需要访问 /sys/block 挂载点和所有引用的设备。否则将报告错误。
System 模块支持在 Modules 中描述的标准配置选项。这是一个示例配置。
metricbeat.modules:
- module: system
metricsets:
- cpu
- load
- memory
- network
- process
- process_summary
- uptime
- socket_summary
#- core
#- diskio
#- filesystem
#- fsstat
#- raid
#- socket
#- service
enabled: true
period: 10s
processes: ['.*']
# Configure the mount point of the host’s filesystem for use in monitoring a host from within a container
#hostfs: "/hostfs"
# Configure the metric types that are included by these metricsets.
cpu.metrics: ["percentages","normalized_percentages"]
core.metrics: ["percentages"]
# A list of filesystem types to ignore. The filesystem metricset will not
# collect data from filesystems matching any of the specified types, and
# fsstats will not include data from these filesystems in its summary stats.
# If not set, types associated to virtual filesystems are automatically
# added when this information is available in the system (e.g. the list of
# `nodev` types in `/proc/filesystem`).
#filesystem.ignore_types: []
# These options allow you to filter out all processes that are not
# in the top N by CPU or memory, in order to reduce the number of documents created.
# If both the `by_cpu` and `by_memory` options are used, the union of the two sets
# is included.
#process.include_top_n:
# Set to false to disable this feature and include all processes
#enabled: true
# How many processes to include from the top by CPU. The processes are sorted
# by the `system.process.cpu.total.pct` field.
#by_cpu: 0
# How many processes to include from the top by memory. The processes are sorted
# by the `system.process.memory.rss.bytes` field.
#by_memory: 0
# If false, cmdline of a process is not cached.
#process.cmdline.cache.enabled: true
# Enable collection of cgroup metrics from processes on Linux.
#process.cgroups.enabled: true
# A list of regular expressions used to whitelist environment variables
# reported with the process metricset's events. Defaults to empty.
#process.env.whitelist: []
# Include the cumulative CPU tick values with the process metrics. Defaults
# to false.
#process.include_cpu_ticks: false
# Raid mount point to monitor
#raid.mount_point: '/'
# Configure reverse DNS lookup on remote IP addresses in the socket metricset.
#socket.reverse_lookup.enabled: false
#socket.reverse_lookup.success_ttl: 60s
#socket.reverse_lookup.failure_ttl: 60s
# Diskio configurations
#diskio.include_devices: []
# Filter systemd services by status or sub-status
#service.state_filter: ["active"]
# Filter systemd services based on a name pattern
#service.pattern_filter: ["ssh*", "nfs*"]
# This option enables the use of performance counters to collect data for cpu/core metricset.
# Only effective for Windows.
# You should use this option if running beats on machins with more than 64 cores.
#use_performance_counters: false
- CPU 使用率
- CPU 负载平均值
- 内存使用情况
- 网络 I/O
- 每个进程的指标
- 进程摘要
- 系统正常运行时间
- 套接字摘要
- 每个 CPU 核心的使用情况
- 磁盘 I/O
- 每个挂载点的文件系统使用情况
- 文件系统摘要指标
- RAID
- 套接字和连接信息(仅限 Linux)
- systemd 服务信息
- 另一个可用的选项是 ticks。
- 另一个可用的选项是 ticks。
以下 metricsets 可用: