小编给大家分享一下怎么编写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”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
原创文章,作者:306829225,如若转载,请注明出处:https://blog.ytso.com/208348.html