hassio-addons / addon-prometheus

Prometheus - Home Assistant Community Add-ons
https://addons.community
MIT License
20 stars 31 forks source link

Unable to edit prometheus.yml configuration via web interface. #8

Closed traylenator closed 3 years ago

traylenator commented 3 years ago

Problem/Motivation

Trying to read metrics from home assistant I am unable. In particular seems no way to edit the configuration prometheus.yml file.

Background I'm just trying to set up this addon and prometheus history component.

I'm not seeing any metrics in promethesus with a integration config of

namespace: 245b
component_config_glob:
  sensor.*temp*:
    override_metric: temperature_c
filter:
  include_entities:
    - sensor.ben_temperature_temperature

https://www.home-assistant.io/integrations/prometheus/

I wanted to add the scrape config which I think should be.

- job_name: "hass"
    scrape_interval: 60s
    metrics_path: /api/prometheus
    scheme: https
    static_configs:
      - targets: ['HOSTNAME:8123']

as the default config has a scrape of /core/api/prometheus only

Expected behavior

Should be able to edit prometheus.yml via supervisor web interface.

Actual behavior

There is no configuration to edit.

Configuration is there in the running docker image /etc/prometheus/prometheus.yml but cannot be edited.

Steps to reproduce

Install prometheus addon , go to configuration tab. See attached screen shot.

image

Prometheus addon - 1.0.0-beta.0 Core version - core-2021.2.3 supervisor-2021.02.9 Home Assistant OS 5.11

Proposed changes

traylenator commented 3 years ago

Sorry just read this https://github.com/hassio-addons/addon-prometheus/blob/master/prometheus/DOCS.md#configuration

To add additional scrape targets you need to create a file per target in /share/prometheus/targets.

traylenator commented 3 years ago

Sorry for the noise - my real problem was chossing a prefix of 245b results in.

  File "/usr/local/lib/python3.8/site-packages/prometheus_client/metrics.py", line 94, in __init__
    raise ValueError('Invalid metric name: ' + self._name)
ValueError: Invalid metric name: 245b_temperature_c

fine with non-numerics.