Add Prometheus-Documentation (#556)

* Add Prometheus-Documentation

* Prometheus-Documentation: Fix indentation

* format

Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
Marvin Gaube 2020-06-10 03:02:14 +02:00 committed by GitHub
parent f55151ac88
commit c3c2c75b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 1 deletions

View File

@ -30,13 +30,14 @@ interface are hosted by esphome.io. If you want to use your own service, use the
web_server:
port: 80
Configuration variables:
------------------------
- **port** (*Optional*, int): The port the web server should open its socket on.
- **css_url** (*Optional*, url): The URL that should be used for the CSS stylesheet. Defaults
to https://esphome.io/_static/webserver-v1.min.css (updates will go to ``v2``, ``v3``, etc). Can be set to empty string.
- **css_include** (*Optional*, local file): Path to local file to be included in web server index page.
- **css_include** (*Optional*, local file): Path to local file to be included in web server index page.
Contents of this file will be served as ``/0.css`` and used as CSS stylesheet by internal webserver.
Useful when building device without internet access, where you want to use built-in AP and webserver.
- **js_url** (*Optional*, url): The URL that should be used for the JS script. Defaults
@ -49,6 +50,7 @@ Configuration variables:
- **username** (**Required**, string): The username to use 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.
.. note::
@ -63,6 +65,7 @@ Configuration variables:
auth:
username: admin
password: !secret web_server_password
prometheus: true
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.
@ -77,6 +80,34 @@ Configuration variables:
js_include: "../../../esphome-docs/_static/webserver-v1.min.js"
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
--------