温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

怎么编写Prometheus配置文件prometheus.yml

发布时间:2021-11-20 17:46:15 来源:亿速云 阅读:708 作者:小新 栏目:大数据

小编给大家分享一下怎么编写Prometheus配置文件prometheus.yml,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

默认情况下,二进制执行文件当前目录下,会有prometheus.yml这个配置文件,我们需要做的,就是将exporter的ip和端口号,按照固定格式填写到配置文件中并重启Prometheus。

如下例子,每注册一个exporter可以新增一个job,然后将对应的exporter机器的ip和端口号写到targets下:

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
 
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
 
    static_configs:
    - targets: ['localhost:9090']
  - job_name: 'node_exporter'
    static_configs:
      - targets:
        - '172.31.182.140:9100'
        - '172.31.182.141:9100'
        - '172.31.182.142:9100'
        - '172.31.182.143:9100'
        - '172.31.182.144:9100'
        - '172.31.182.145:9100'
        - '172.31.182.146:9100'
        - '172.31.182.147:9100'

看完了这篇文章,相信你对“怎么编写Prometheus配置文件prometheus.yml”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI