Table of Contents

Prometheus - Collector

About

A collector is a metrics collector and is embedded in the prometheus server.

Management

Conf

The scrape_configs block of the prometheus.yml file controls what resources Prometheus monitors. The below example shows a single job, called prometheus, which scrapes the metrics (time series data) exposed by an exporter (below this is the internal Prometheus server exporter)

Example:

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['localhost:9090']
    scheme: 'https' 

where:

Ref Conf Doc

Relabeling

Relabeling permits:

Relabeling Configuration:

Extra labels:

Internal labels begin with two underscores and are removed after all relabeling steps are applied

Label name Description
__name__ The scraped metric’s name
__address__ host:port of the scrape target
__scheme__ URI scheme of the scrape target
__metrics_path__ Metrics endpoint of the scrape target
__param_<name> is the value of the first URL parameter passed to the target
__scrape_interval__ The target’s scrape interval (experimental)
__scrape_timeout__ The target’s timeout (experimental)
__meta_ Special labels set set by the Service Discovery mechanism
__tmp Special prefix used to temporarily store label values before discarding them

After relabeling, the instance label is set to the value of __address__ by default if it was not set during relabeling.

How and when to drop internal labels?

Don't delete the instance label on relabel_config or you get an error because the collector don't know where to connect:

msg="Creating target failed" err="instance 0 in group endpoints/com-datacadamia/com-datacadamia: no address"

If you want to drop it, drop it on metric_relabel_configs