prometheus component exposes metrics in a format which Prometheus can read.
To use the
prometheus component in your installation, add the following to your
# Example configuration.yaml entry prometheus:
(string)(Optional)The “namespace” that will be assigned to all the Prometheus metrics. This is the prefix of the metric name. E.g., having
myhassas the namespace will cause the device tracker metrics to be
myhass_device_tracker_state, the switch metrics to be
myhass_switch_stateand so on. The default is to not add any prefix to the metrics name. (available in version 0.73.0 and later)
(list)(Optional)Filtering directives for the components which should be included or excluded from recording.
(list)(Optional)Excluded from recording.
(list)(Optional)Included in recordings. If set, all other entities will not be recorded. Values set by the exclude option will prevail.
You can then configure Prometheus to fetch metrics from Home Assistant by adding to its
# Example Prometheus scrape_configs entry - job_name: 'hass' scrape_interval: 60s metrics_path: /api/prometheus # Legacy api password params: api_password: ['PASSWORD'] # Long-Lived Access Token bearer_token: 'your.longlived.token' scheme: https static_configs: - targets: ['HOSTNAME:8123']
When looking into the metrics on the Prometheus side, there will be:
- All Home Assistant domains, which can be easily found through the common namespace prefix, if defined.
- The client library provided metrics, which are a bunch of process_* and also a single pseudo-metric python_info which contains (not as value but as labels) information about the Python version of the client, i.e., the Home Assistant Python interpreter.
Typically, you will only be interested in the first set of metrics.