docker工人组成一个节点出口商的基本Prometheus / Grafana例子

问题 :如何configurationPrometheus服务器从节点导出器中提取数据?

我已经在Grafana上成功设置了数据源,并使用以下docker-compose.yml查看默认仪表板。 这3种服务是:

  • 普罗米修斯服务器
  • 节点出口商
  • Grafana

Dockerfile

 version: '2' services: prometheus_srv: image: prom/prometheus container_name: prometheus_server hostname: prometheus_server prometheus_node: image: prom/node-exporter container_name: prom_node_exporter hostname: prom_node_exporter depends_on: - prometheus_srv grafana: image: grafana/grafana container_name: grafana_server hostname: grafana_server depends_on: - prometheus_srv 

在这里输入图像说明


编辑:

我用了类似于@Daniel Lee分享的东西,它似乎工作:

 # my global config global: scrape_interval: 10s # By default, scrape targets every 15 seconds. evaluation_interval: 10s # By default, scrape targets every 15 seconds. scrape_configs: # Scrape Prometheus itself - job_name: 'prometheus' scrape_interval: 10s scrape_timeout: 10s static_configs: - targets: ['localhost:9090'] # Scrape the Node Exporter - job_name: 'node' scrape_interval: 10s static_configs: - targets: ['prom_node_exporter:9100'] 

在YAMLconfiguration文件中 ,这是来自Prometheus的Grafanatesting实例的一个例子。

docker文件:

 FROM prom/prometheus ADD prometheus.yml /etc/prometheus/ 

YAML文件:

 # my global config global: scrape_interval: 10s # By default, scrape targets every 15 seconds. evaluation_interval: 10s # By default, scrape targets every 15 seconds. # scrape_timeout is set to the global default (10s). # Load and evaluate rules in this file every 'evaluation_interval' seconds. rule_files: # - "first.rules" # - "second.rules" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'prometheus' # Override the global default and scrape targets from this job every 5 seconds. scrape_interval: 10s scrape_timeout: 10s # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: #- targets: ['localhost:9090', '172.17.0.1:9091', '172.17.0.1:9100', '172.17.0.1:9150'] - targets: ['localhost:9090', '127.0.0.1:9091', '127.0.0.1:9100', '127.0.0.1:9150']