1
0
mirror of https://github.com/minio/docs.git synced 2025-06-08 18:02:00 +03:00

Clean up prometheus metric collection tutorial and references

This commit is contained in:
ravindk89 2021-07-28 12:43:41 -04:00 committed by Ravind Kumar
parent 773e5c67b7
commit ab25dd2059
3 changed files with 70 additions and 104 deletions

View File

@ -49,8 +49,9 @@ Procedure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MinIO by default requires authentication for requests made to the metrics MinIO by default requires authentication for requests made to the metrics
endpoints. This step is not required for MinIO deployments started with endpoints. While step is not required for MinIO deployments started with
:envvar:`MINIO_PROMETHEUS_AUTH_TYPE` set to ``"public"``. :envvar:`MINIO_PROMETHEUS_AUTH_TYPE` set to ``"public"``, you can still use the
command output for retrieving a Prometheus ``scrape_configs`` entry.
Use the :mc-cmd:`mc admin prometheus generate` command to generate a Use the :mc-cmd:`mc admin prometheus generate` command to generate a
JWT bearer token for use by Prometheus in making authenticated scraping JWT bearer token for use by Prometheus in making authenticated scraping
@ -77,30 +78,14 @@ The command returns output similar to the following:
static_configs: static_configs:
- targets: [minio.example.net] - targets: [minio.example.net]
You can specify the output block to the The ``targets`` array can contain the hostname for any node in the deployment.
For clusters with a load balancer managing connections between MinIO nodes,
specify the address of the load balancer.
Specify the output block to the
:prometheus-docs:`scrape_config :prometheus-docs:`scrape_config
<prometheus/latest/configuration/configuration/#scrape_config>` section of <prometheus/latest/configuration/configuration/#scrape_config>` section of
the Prometheus configuration. Change the ``job_name`` to match a label or the Prometheus configuration.
identifier for the MinIO cluster being scraped.
The :mc-cmd:`mc admin prometheus generate` command generates a scrape config
for only the ``/minio/v2/metrics/cluster`` endpoint. You can use the generated
config to create a node-level metric scraping job:
.. code-block:: yaml
:class: copyable
scrape_configs:
- job_name: minio-job
bearer_token: TOKEN
metrics_path: /minio/v2/metrics/node
scheme: https
static_configs:
- targets: [minio-01.example.net]
Change the ``job_name`` to match a label or identifier for the MinIO node
being scraped. Change the ``static_configs.targets`` to specify the
hostname for the node being scraped.
2) Configure and Run Prometheus 2) Configure and Run Prometheus
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -119,18 +104,12 @@ configuration file:
scrape_interval: 15s scrape_interval: 15s
scrape_configs: scrape_configs:
- job_name: minio-cluster-metrics - job_name: minio-job
bearer_token: TOKEN bearer_token: TOKEN
metrics_path: /minio/v2/metrics/cluster metrics_path: /minio/v2/metrics/cluster
scheme: https scheme: https
static_configs: static_configs:
- targets: [minio.example.net] - targets: [minio.example.net]
- job_name: minio-node-01-metrics
bearer_token: TOKEN
metrics_path: /minio/v2/metrics/node
scheme: https
static_configs:
- targets: [minio-01.example.net]
Start the Prometheus cluster using the configuration file: Start the Prometheus cluster using the configuration file:
@ -165,11 +144,6 @@ list of published metrics.
4) Visualize Collected Metrics 4) Visualize Collected Metrics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Prometheus includes a
:prometheus-docs:`graphing interface
<prometheus/latest/getting_started/#using-the-graphing-interface>` for
visualizing collected metrics.
The :minio-git:`MinIO Console <console>` supports visualizing collected metrics The :minio-git:`MinIO Console <console>` supports visualizing collected metrics
from Prometheus. Specify the URL of the Prometheus service to the from Prometheus. Specify the URL of the Prometheus service to the
:envvar:`MINIO_PROMETHEUS_URL` environment variable to each MinIO server :envvar:`MINIO_PROMETHEUS_URL` environment variable to each MinIO server
@ -178,7 +152,10 @@ in the deployment:
.. code-block:: shell .. code-block:: shell
:class: copyable :class: copyable
set MINIO_PROMETHEUS_URL="https://prometheus.example.net" export MINIO_PROMETHEUS_URL="https://prometheus.example.net"
If you set a custom ``job_name`` for the Prometheus scraping job, you must also
set :envvar:`MINIO_PROMETHEUS_JOB_ID` to match that job name.
Restart the deployment using :mc-cmd:`mc admin service restart` to apply the Restart the deployment using :mc-cmd:`mc admin service restart` to apply the
changes. changes.
@ -196,3 +173,7 @@ MinIO also publishes a `Grafana Dashboard
metrics. For more complete documentation on configuring a Prometheus data source metrics. For more complete documentation on configuring a Prometheus data source
for Grafana, see :prometheus-docs:`Grafana Support for Prometheus for Grafana, see :prometheus-docs:`Grafana Support for Prometheus
<visualization/grafana/>`. <visualization/grafana/>`.
Prometheus includes a :prometheus-docs:`graphing interface
<prometheus/latest/getting_started/#using-the-graphing-interface>` for
visualizing collected metrics.

View File

@ -8,7 +8,7 @@ Metrics and Alerts
.. contents:: Table of Contents .. contents:: Table of Contents
:local: :local:
:depth: 1 :depth: 2
MinIO leverages `Prometheus <https://prometheus.io/>`__ for metrics and alerts. MinIO leverages `Prometheus <https://prometheus.io/>`__ for metrics and alerts.
Prometheus is an Open-Source systems and service monitoring system which Prometheus is an Open-Source systems and service monitoring system which
@ -36,39 +36,24 @@ process MinIO metrics for analysis, visualization, and alerting.
Metrics Metrics
------- -------
MinIO provides a scraping endpoint for both cluster and node-level metrics. MinIO provides a scraping endpoint for cluster-level metrics:
Create a new :prometheus-docs:`scraping configuration
<prometheus/latest/configuration/configuration/#scrape_config>` for either or
both endpoints to begin collecting metrics from the MinIO deployment.
MinIO also publishes a `Grafana Dashboard
<https://grafana.com/grafana/dashboards/13502>`_ for visualizing collected
metrics. For more complete documentation on configuring a Prometheus data source
for Grafana, see :prometheus-docs:`Grafana Support for Prometheus
<visualization/grafana/>`.
MinIO by default requires authentication for scraping the metrics endpoints.
Use the :mc-cmd:`mc admin prometheus generate` command to generate the
necessary bearer tokens for use with configuring the
``scrape_configs.bearer_token`` field. You can alternatively disable
metrics endpoint authentication by setting
:envvar:`MINIO_PROMETHEUS_AUTH_TYPE` to ``public``.
Cluster Metrics
~~~~~~~~~~~~~~~
MinIO publishes cluster-level metrics to the following endpoint:
.. code-block:: shell .. code-block:: shell
:class: copyable :class: copyable
http://minio.example.net:9000/minio/v2/metrics/cluster http://minio.example.net:9000/minio/v2/metrics/cluster
Replace ``http://minio.example.net`` with the hostname for the MinIO Replace ``http://minio.example.net`` with the hostname of any node in the MinIO
node. deployment. For deployments with a load balancer managing connections between
MinIO nodes, specify the address of the load balancer.
Create a new :prometheus-docs:`scraping configuration
<prometheus/latest/configuration/configuration/#scrape_config>` to begin
collecting metrics from the MinIO deployment. See
:ref:`minio-metrics-collect-using-prometheus` for a complete tutorial.
The following example describes a ``scrape_configs`` entry for collecting The following example describes a ``scrape_configs`` entry for collecting
cluster metrics: cluster metrics.
.. code-block:: yaml .. code-block:: yaml
:class: copyable :class: copyable
@ -83,7 +68,7 @@ cluster metrics:
.. list-table:: .. list-table::
:stub-columns: 1 :stub-columns: 1
:widths: 30 70 :widths: 20 80
:width: 100% :width: 100%
* - ``job_name`` * - ``job_name``
@ -95,55 +80,40 @@ cluster metrics:
Omit this field if the MinIO deployment was started with Omit this field if the MinIO deployment was started with
:envvar:`MINIO_PROMETHEUS_AUTH_TYPE` set to ``public``. :envvar:`MINIO_PROMETHEUS_AUTH_TYPE` set to ``public``.
* - ``static_configs[n].targets`` * - ``targets``
- The endpoint for the MinIO deployment. You can specify any node in the - The endpoint for the MinIO deployment. You can specify any node in the
deployment for collecting cluster metrics. For clusters with a load deployment for collecting cluster metrics. For clusters with a load
balancer managing connections between MinIO nodes, specify the balancer managing connections between MinIO nodes, specify the
address of the load balancer. address of the load balancer.
Node Metrics MinIO by default requires authentication for scraping the metrics endpoints.
~~~~~~~~~~~~ Use the :mc-cmd:`mc admin prometheus generate` command to generate the
necessary bearer tokens for use with configuring the
``scrape_configs.bearer_token`` field. You can alternatively disable
metrics endpoint authentication by setting
:envvar:`MINIO_PROMETHEUS_AUTH_TYPE` to ``public``.
MinIO publishes node-level metrics to the following endpoint: Visualizing Metrics
~~~~~~~~~~~~~~~~~~~
.. code-block:: yaml The MinIO Console uses the metrics collected by Prometheus to populate the
:class: copyable Dashboard metrics:
http://minio.example.net:9000/minio/v2/metrics/node .. image:: /images/minio-console-dashboard.png
:width: 600px
:alt: MinIO Console Dashboard displaying Monitoring Data
:align: center
Replace ``http://minio.example.net`` with the hostname for the MinIO Set the :envvar:`MINIO_PROMETHEUS_URL` environment variable to the URL of the
node. Prometheus service to allow the Console to retrieve and display collected
metrics. See :ref:`minio-metrics-collect-using-prometheus` for a complete
example.
The following example describes a ``scrape_configs`` entry for collecting MinIO also publishes a `Grafana Dashboard
node metrics. You must specify one job for each node in the MinIO deployment: <https://grafana.com/grafana/dashboards/13502>`_ for visualizing collected
metrics. For more complete documentation on configuring a Prometheus data source
.. code-block:: shell for Grafana, see :prometheus-docs:`Grafana Support for Prometheus
:class: copyable <visualization/grafana/>`.
scrape_configs:
- job_name: minio-job
bearer_token: <secret>
metrics_path: /minio/v2/metrics/node
scheme: https
static_configs:
- targets: ['minio.example.net:9000']
.. list-table::
:stub-columns: 1
:widths: 30 70
:width: 100%
* - ``job_name``
- The name of the scraping job.
* - ``bearer_token``
- The JWT token generated by :mc-cmd:`mc admin prometheus generate`.
Omit this field if the MinIO node was started with
:envvar:`MINIO_PROMETHEUS_AUTH_TYPE` set to ``public``.
* - ``static_configs[n].targets``
- The endpoint for the MinIO node.
.. _minio-metrics-and-alerts-available-metrics: .. _minio-metrics-and-alerts-available-metrics:

View File

@ -279,6 +279,21 @@ MinIO Console:
The MinIO Console populates the :guilabel:`Dashboard` with cluster metrics The MinIO Console populates the :guilabel:`Dashboard` with cluster metrics
using the ``minio-job`` Prometheus scraping job. using the ``minio-job`` Prometheus scraping job.
If you are using a standalone MinIO Console process, this variable
corresponds to ``CONSOLE_PROMETHEUS_URL``.
.. envvar:: MINIO_PROMETHEUS_JOB_ID
*Optional*
Specify the custom Prometheus job ID used for
:ref:`scraping MinIO metrics <minio-metrics-collect-using-prometheus>`.
MinIO defaults to ``minio-job``.
If you are using a standalone MinIO Console process, this variable
corresponds to ``CONSOLE_PROMETHEUS_JOB_ID``.
.. envvar:: MINIO_LOG_QUERY_URL .. envvar:: MINIO_LOG_QUERY_URL
*Optional* *Optional*