From ec1feedbc25aa6f7e635e7ac88ec65ebbb15d689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20P=C3=A9rez-Aradros=20Herce?= Date: Tue, 22 Jan 2019 15:19:15 +0100 Subject: [PATCH] Update docs --- metricbeat/docs/modules/prometheus.asciidoc | 19 ++------ metricbeat/metricbeat.reference.yml | 15 ++---- .../prometheus/_meta/config.reference.yml | 20 -------- metricbeat/module/prometheus/_meta/config.yml | 2 - .../module/prometheus/_meta/docs.asciidoc | 4 +- .../prometheus/collector/_meta/docs.asciidoc | 46 +++++++++++++++++-- metricbeat/modules.d/prometheus.yml.disabled | 2 - 7 files changed, 50 insertions(+), 58 deletions(-) delete mode 100644 metricbeat/module/prometheus/_meta/config.reference.yml diff --git a/metricbeat/docs/modules/prometheus.asciidoc b/metricbeat/docs/modules/prometheus.asciidoc index 16f9716aeb91..a353c287dfd7 100644 --- a/metricbeat/docs/modules/prometheus.asciidoc +++ b/metricbeat/docs/modules/prometheus.asciidoc @@ -5,11 +5,9 @@ This file is generated! See scripts/docs_collector.py [[metricbeat-module-prometheus]] == Prometheus module -This module periodically fetches metrics from +This module periodically scrapes metrics from https://prometheus.io/docs/[Prometheus]. -The default metricset is `collector`. - [float] === Example configuration @@ -21,20 +19,11 @@ in <>. Here is an example configuration: ---- metricbeat.modules: - module: prometheus - metricsets: ["stats"] - enabled: true - period: 10s - hosts: ["localhost:9090"] - #metrics_path: /metrics - #namespace: example - -- module: prometheus - metricsets: ["collector"] - enabled: true period: 10s hosts: ["localhost:9090"] - #metrics_path: /metrics - #namespace: example + 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 diff --git a/metricbeat/metricbeat.reference.yml b/metricbeat/metricbeat.reference.yml index f1a7c6563c2d..2345cb3954aa 100644 --- a/metricbeat/metricbeat.reference.yml +++ b/metricbeat/metricbeat.reference.yml @@ -566,20 +566,11 @@ metricbeat.modules: #----------------------------- Prometheus Module ----------------------------- - module: prometheus - metricsets: ["stats"] - enabled: true - period: 10s - hosts: ["localhost:9090"] - #metrics_path: /metrics - #namespace: example - -- module: prometheus - metricsets: ["collector"] - enabled: true period: 10s hosts: ["localhost:9090"] - #metrics_path: /metrics - #namespace: example + 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 diff --git a/metricbeat/module/prometheus/_meta/config.reference.yml b/metricbeat/module/prometheus/_meta/config.reference.yml deleted file mode 100644 index 59680f2a901f..000000000000 --- a/metricbeat/module/prometheus/_meta/config.reference.yml +++ /dev/null @@ -1,20 +0,0 @@ -- module: prometheus - metricsets: ["stats"] - enabled: true - period: 10s - hosts: ["localhost:9090"] - #metrics_path: /metrics - #namespace: example - -- module: prometheus - metricsets: ["collector"] - enabled: true - period: 10s - hosts: ["localhost:9090"] - #metrics_path: /metrics - #namespace: example - - # 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 diff --git a/metricbeat/module/prometheus/_meta/config.yml b/metricbeat/module/prometheus/_meta/config.yml index 5a6107a61bb5..d322be32d5c2 100644 --- a/metricbeat/module/prometheus/_meta/config.yml +++ b/metricbeat/module/prometheus/_meta/config.yml @@ -1,6 +1,4 @@ - module: prometheus - #metricsets: - # - stats period: 10s hosts: ["localhost:9090"] metrics_path: /metrics diff --git a/metricbeat/module/prometheus/_meta/docs.asciidoc b/metricbeat/module/prometheus/_meta/docs.asciidoc index f15195df3c35..f6c7b148943f 100644 --- a/metricbeat/module/prometheus/_meta/docs.asciidoc +++ b/metricbeat/module/prometheus/_meta/docs.asciidoc @@ -1,4 +1,2 @@ -This module periodically fetches metrics from +This module periodically scrapes metrics from https://prometheus.io/docs/[Prometheus]. - -The default metricset is `collector`. diff --git a/metricbeat/module/prometheus/collector/_meta/docs.asciidoc b/metricbeat/module/prometheus/collector/_meta/docs.asciidoc index 8dbcf97d0497..e0c15efe7655 100644 --- a/metricbeat/module/prometheus/collector/_meta/docs.asciidoc +++ b/metricbeat/module/prometheus/collector/_meta/docs.asciidoc @@ -1,5 +1,43 @@ -The Prometheus `collector` metricset fetches data from https://prometheus.io/docs/instrumenting/exporters/[prometheus exporters]. +The Prometheus `collector` metricset scrapes data from https://prometheus.io/docs/instrumenting/exporters/[prometheus exporters]. -All events with the same labels are grouped together as one event. The fields -exported by this metricset vary depending on the Prometheus exporter that you're -using. + +[float] +=== Scraping from a Prometheus exporter + +To 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`. + +[source,yaml] +------------------------------------------------------------------------------------- +- module: prometheus + period: 10s + hosts: ["localhost:9090"] + 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 +------------------------------------------------------------------------------------- + + +[float] +=== Scraping all metrics from a Prometheus server + +This module can scrape all metrics stored in a Prometheus server, by using the +https://prometheus.io/docs/prometheus/latest/federation/[federation API]. By pointing this +config to the Prometheus server: + +[source,yaml] +------------------------------------------------------------------------------------- +metricbeat.modules: +- module: prometheus + period: 10s + hosts: ["localhost:9090"] + metrics_path: '/federate' + query: + 'match[]': '{__name__!=""}' +------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/metricbeat/modules.d/prometheus.yml.disabled b/metricbeat/modules.d/prometheus.yml.disabled index a080edd5643c..f5dfb80f21ed 100644 --- a/metricbeat/modules.d/prometheus.yml.disabled +++ b/metricbeat/modules.d/prometheus.yml.disabled @@ -2,8 +2,6 @@ # Docs: https://www.elastic.co/guide/en/beats/metricbeat/master/metricbeat-module-prometheus.html - module: prometheus - #metricsets: - # - stats period: 10s hosts: ["localhost:9090"] metrics_path: /metrics