【问题标题】:"Error getting stats for file: /usr/share/metricbeat/modules.d/system.yml" when running metricbeat on docker“获取文件的统计信息时出错:/usr/share/metricbeat/modules.d/system.yml”在 docker 上运行 metricbeat 时
【发布时间】:2021-10-03 20:54:29
【问题描述】:

我正在尝试在 docker 容器中运行 metricbeat 以监控服务器的 CPU/RAM 使用情况并在 Kibana 上加载,但是当我尝试运行命令 sudo docker-compose up 时出现以下错误:

公制节拍 | 2021-07-28T05:02:22.033Z 错误 cfgfile/glob_watcher.go:66 获取文件的统计信息时出错:/usr/share/metricbeat/modules.d/system.yml

虽然容器在终端中的日志似乎是合法的,但 Kibana 似乎也无法监控信息。

这些配置在其他服务器上运行,它们工作得很好,但我似乎无法找出问题所在。我还在我的目录中运行了sudo chown -R 1000:1000 configs/sudo chmod -R go-w configs/

这是system.yml文件:

- module: system
  metricsets:
    - cpu             # CPU usage
    - load            # CPU load averages
    - memory          # Memory usage
    - network         # Network IO
    - process         # Per process metrics
    - process_summary # Process summary
    - uptime          # System Uptime
    #- socket_summary  # Socket summary
    - core            # Per CPU core usage
    - diskio          # Disk IO
    - filesystem      # File system usage for each mountpoint
    - fsstat          # File system summary metrics
    #- raid           # Raid
    #- socket         # Sockets and connection info (linux only)
    #- service        # systemd service information
  enabled: true
  period: 10s
  processes: ['.*']

  # Configure the mount point of the host’s filesystem for use in monitoring a host from within a container
  system.hostfs: "/hostfs"

  # Configure the metric types that are included by these metricsets.
  cpu.metrics:  ["percentages","normalized_percentages"]  # The other available option is ticks.
  core.metrics: ["percentages"]  # The other available option is ticks.

这是 docker-compose.yml:

services:
  metricbeat:
    image: ${METRICBEAT_IMAGE}
    container_name: metricbeat
    network_mode: host
    environment:
      - ELASTICSEARCH_HOSTS=${ELASTICSEARCH_HOSTS}
      - ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME}
      - ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD}        
    volumes:
      - ./configs/metricbeat.docker.yml:/usr/share/metricbeat/metricbeat.yml:ro
      - ./configs/modules.d:/usr/share/metricbeat/modules.d:ro

      # system module
      - /proc:/hostfs/proc:ro
      - /sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro
      - /:/hostfs:ro

感谢任何帮助,因为这一直困扰着我一段时间,在此先感谢。

【问题讨论】:

    标签: docker-compose elk metricbeat


    【解决方案1】:

    我有同样的错误。 我发现modules.d'权限是

    drw-r--r-x  2 root root 4096 Dec  2 15:17 modules.d
    

    所以我执行:

    chmod g+X -R modules.d
    

    并重新启动 filebeat .Bingo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-26
      • 2020-08-16
      • 1970-01-01
      • 1970-01-01
      • 2020-12-22
      • 1970-01-01
      • 2021-05-09
      • 1970-01-01
      相关资源
      最近更新 更多