Prometheus configuration: Difference between revisions

From wikinotes
Line 3: Line 3:
== Consuming Exporters ==
== Consuming Exporters ==
<blockquote>
<blockquote>
Configure '''jobs''' to poll prometheus metric endpoints within <code>scrape_configs</code>.<br>
For example, the following config polls metrics from <code>http://localhost:9115/metrics</code> every <code>5s</code>.
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
# /usr/local/etc/prometheus.yml
# /usr/local/etc/prometheus.yml
global:
global:
   scrape_interval: 15s
   scrape_interval: 5s


scrape_configs:
scrape_configs:
- job_name: myserver_node
- job_name: blackbox # To get metrics about the exporter itself
  metrics_path: /metrics
   static_configs:
   static_configs:
  - targets: ['localhost:9100']
    - targets:
      - localhost:9115
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Exporters -->
</blockquote><!-- Exporters -->
</blockquote><!-- Prometheus -->
</blockquote><!-- Prometheus -->

Revision as of 02:11, 16 February 2022

Prometheus

Consuming Exporters

Configure jobs to poll prometheus metric endpoints within scrape_configs.
For example, the following config polls metrics from http://localhost:9115/metrics every 5s.

# /usr/local/etc/prometheus.yml

global:
  scrape_interval: 5s

scrape_configs:
- job_name: blackbox # To get metrics about the exporter itself
  metrics_path: /metrics
  static_configs:
    - targets:
      - localhost:9115