小编给大家分享一下怎么编写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”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。
原文链接:https://my.oschina.net/javacy/blog/4561397