如何在promtheus.yml文件中解决此错误

发布于 2025-01-23 07:43:58 字数 712 浏览 1 评论 0原文

面对promtheus.yml文件中的错误

“错误加载config(-config.file =/etc/prometheus/prometheus/prometheus.yml)” file =/etc/etc/prometheus/prometheus/prometheus.yml err =”解析yaml file/etc/prometheus/prometheus/prometheus.yml:yaml:yaml:yaml :第7行7字段静态config在类型config.scrapeconfig

中找不到

这是我的prometheus.yml文件

global:
  scrape_interval: 5s
  external_labels:
    monitor: 'devopsage-monitor'
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']   # your server ip
  - job_name: 'node-exporter'             
    static_configs:
      - targets: ['localhost:9100']   # your server ip

Facing error in promtheus.yml file

"Error loading config (--config.file=/etc/prometheus/prometheus.yml)" file=/etc/prometheus/prometheus.yml err="parsing YAML file /etc/prometheus/prometheus.yml: yaml: line 7 field static config not found in type config.scrapeconfig

this is my prometheus.yml file

global:
  scrape_interval: 5s
  external_labels:
    monitor: 'devopsage-monitor'
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']   # your server ip
  - job_name: 'node-exporter'             
    static_configs:
      - targets: ['localhost:9100']   # your server ip

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昔梦 2025-01-30 07:43:58

您可以尝试使用此配置来解决此问题。

global:
  scrape_interval: 5s
  external_labels:
    monitor: 'devopsage-monitor'
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: 
          - localhost:9090   # your server ip
  - job_name: 'node-exporter'             
    static_configs:
      - targets: 
          - localhost:9100   # your server ip

You can try this configuration to solve this problem.

global:
  scrape_interval: 5s
  external_labels:
    monitor: 'devopsage-monitor'
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: 
          - localhost:9090   # your server ip
  - job_name: 'node-exporter'             
    static_configs:
      - targets: 
          - localhost:9100   # your server ip

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文