IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Prometheus collector metricset
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Prometheus collector metricset
editThe Prometheus collector metricset scrapes data from prometheus exporters.
Scraping from a Prometheus exporter
editTo scrape metrics from a Prometheus exporter, configure the hosts field to it. The path
to retrieve the metrics from (/metrics by default) can be configured with metrics_path.
- module: prometheus period: 10s hosts: ["node:9100"] metrics_path: /metrics #username: "user" #password: "secret" # This can be used for service account based authorization: #bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token #ssl.certificate_authorities: # - /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
Scraping all metrics from a Prometheus server
editThis module can scrape all metrics stored in a Prometheus server, by using the federation API. By pointing this config to the Prometheus server:
metricbeat.modules:
- module: prometheus
period: 10s
hosts: ["localhost:9090"]
metrics_path: '/federate'
query:
'match[]': '{__name__!=""}'
This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.
Fields
editFor a description of each field in the metricset, see the exported fields section.
Here is an example document generated by this metricset:
{
"@timestamp": "2019-03-01T08:05:34.853Z",
"event": {
"dataset": "prometheus.collector",
"duration": 115000,
"module": "prometheus"
},
"metricset": {
"name": "collector",
"period": 10000
},
"prometheus": {
"labels": {
"listener_name": "http"
},
"metrics": {
"net_conntrack_listener_conn_accepted_total": 3,
"net_conntrack_listener_conn_closed_total": 0
}
},
"service": {
"address": "127.0.0.1:55555",
"type": "prometheus"
}
}