New prometheus configuration (#713)

This commit is contained in:
Otto Winter 2020-07-27 12:06:56 +02:00 committed by GitHub
parent 1c73114705
commit 94e1608202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 49 additions and 30 deletions

46
components/prometheus.rst Normal file
View File

@ -0,0 +1,46 @@
Prometheus Component
====================
.. seo::
:description: Instructions for setting up a prometheus exporter with ESPHome.
:image: prometheus.png
The ``prometheus`` component enables an HTTP endpoint for the
:doc:`web_server` in order to integrate a `Prometheus <https://prometheus.io/>`__ installation.
This can be used to scrape data directly into your Prometheus-based monitoring and alerting-system,
without the need of any other software.
The list of available metrics can be found by directly browsing your node under
``<ip or node_name.local>/metrics``, and may be increased in the future.
.. code-block:: yaml
# Example configuration entry
web_server:
# Activates prometheus /metrics endpoint
prometheus:
Configuration variables:
------------------------
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
.. note::
Example integration into the configuration of your prometheus:
.. code-block:: yaml
scrape_configs:
- job_name: esphome
static_configs:
- targets: [<ip or node_name.local>]
See Also
--------
- :apiref:`prometheus/prometheus_handler.h`
- :ghedit:`Edit`

View File

@ -50,7 +50,6 @@ Configuration variables:
- **username** (**Required**, string): The username to use for authentication. - **username** (**Required**, string): The username to use for authentication.
- **password** (**Required**, string): The password to check for authentication. - **password** (**Required**, string): The password to check for authentication.
- **prometheus** (*Optional*, boolean): Enable the prometheus-endpoint. See :ref:`prometheus-exporter`.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation. - **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
.. note:: .. note::
@ -65,7 +64,6 @@ Configuration variables:
auth: auth:
username: admin username: admin
password: !secret web_server_password password: !secret web_server_password
prometheus: true
Example web_server configuration with CSS and JS included from esphome-docs. Example web_server configuration with CSS and JS included from esphome-docs.
CSS and JS URL's are set to empty value, so no internet access is needed for this device to show it's web interface. CSS and JS URL's are set to empty value, so no internet access is needed for this device to show it's web interface.
@ -80,36 +78,9 @@ Configuration variables:
js_include: "../../../esphome-docs/_static/webserver-v1.min.js" js_include: "../../../esphome-docs/_static/webserver-v1.min.js"
js_url: "" js_url: ""
.. _prometheus-exporter:
Prometheus Exporter:
--------------------
The webserver can provide an `Prometheus <https://prometheus.io/>`__-Exporter under ``/metrics``.
This can be used to scrape data directly into your Prometheus-based monitoring and alerting-system,
without the need of any other software.
The prometheus-endpoint is activated by setting ``prometheus: true`` in the ``web_server``-area of
the configuration.
The list of available metrics can be found by directly browsing your node under
``<ip or node_name.local>/metrics``, and may be increased in the future.
.. note::
Example integration into the configuration of your prometheus:
.. code-block:: yaml
scrape_configs:
- job_name: esphome
static_configs:
- targets: [<ip or node_name.local>]
See Also See Also
-------- --------
- :apiref:`web_server/web_server.h` - :apiref:`web_server/web_server.h`
- :doc:`prometheus`
- :ghedit:`Edit` - :ghedit:`Edit`

1
images/prometheus.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="115.333" height="114"><path d="M56.667.667C25.372.667 0 26.036 0 57.332c0 31.295 25.372 56.666 56.667 56.666s56.666-25.371 56.666-56.666c0-31.296-25.372-56.665-56.666-56.665zm0 106.055c-8.904 0-16.123-5.948-16.123-13.283H72.79c0 7.334-7.219 13.283-16.123 13.283zm26.63-17.682H30.034v-9.658h53.264v9.658zm-.191-14.629h-52.92c-.176-.203-.356-.403-.526-.609-5.452-6.62-6.736-10.076-7.983-13.598-.021-.116 6.611 1.355 11.314 2.413 0 0 2.42.56 5.958 1.205-3.397-3.982-5.414-9.044-5.414-14.218 0-11.359 8.712-21.285 5.569-29.308 3.059.249 6.331 6.456 6.552 16.161 3.252-4.494 4.613-12.701 4.613-17.733 0-5.21 3.433-11.262 6.867-11.469-3.061 5.045.793 9.37 4.219 20.099 1.285 4.03 1.121 10.812 2.113 15.113C63.797 33.534 65.333 20.5 71 16c-2.5 5.667.37 12.758 2.333 16.167 3.167 5.5 5.087 9.667 5.087 17.548 0 5.284-1.951 10.259-5.242 14.148 3.742-.702 6.326-1.335 6.326-1.335l12.152-2.371c.001-.001-1.765 7.261-8.55 14.254z" fill="#e6522c"/></svg>

After

Width:  |  Height:  |  Size: 988 B

View File

@ -353,6 +353,7 @@ Misc Components
Tuya MCU, components/tuya, tuya.png Tuya MCU, components/tuya, tuya.png
Exposure Notifications, components/exposure_notifications, exposure_notifications.png Exposure Notifications, components/exposure_notifications, exposure_notifications.png
RTTTL Buzzer, components/rtttl, buzzer.jpg RTTTL Buzzer, components/rtttl, buzzer.jpg
Prometheus, components/prometheus, prometheus.svg
Additional Custom Components Additional Custom Components
---------------------------- ----------------------------

BIN
svg2png/prometheus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB