新西兰服务器

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


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

发布时间:2021-11-20 17:46:15 来源:高防服务器网 阅读:89 作者:小新 栏目:大数据

小编给大家分享一下怎么编写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”有了一定的了解,如果想了解更多相关知识,欢迎关注高防服务器网行业资讯频道,感谢各位的阅读!

[微信提示:高防服务器能助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

[图文来源于网络,不代表本站立场,如有侵权,请联系高防服务器网删除]
[