Prometheus add-on?

I’d like to send Home Assistant metrics to a Grafana cloud instance. From what I can tell, HA has a built-in exporter but I need to run my own Prometheus instance somewhere to scrape it.

Grafana actually has a guide for this on their website, but it does not explain where to run the Grafana Agent. I don’t think it’s possible with Hass.io.

I found this addon on Github but I can’t find it in the addon store:

Does anyone have Prometheus running successfully as an add-on?

If I understand the Grafana Cloud doc you referred to, you don’t need Prometheus.
The Grafana Agent will use the prometheus endpoint provided by the HA exporter to pull the data.

I didn’t get where that Grafana Agent is running, either, but I assume it’s part of the Grafana Cloud solution, somehow.

Yeah the docs are pretty confusing. From what I can tell, Grafana Agent is not part of their cloud service, it has to be installed somewhere in your own environment.
I believe Grafana Agent is meant to be an easier install that includes Prometheus, Loki, and a few other services wrapped up into one package.

watching this thread - stuck on the same issue

1 Like

I have it working now, with Grafana Agent running on a separate server. I don’t think that piece is built into HA at all.

Back to the initial issue, there is someone that have found the prometheus addon in the repository? There is another way to install it?

The project is archived, so basically abandoned. That explains it has been removed from the addon store.
If you want to use it, you’ll have to create your own store and add the addon to it.

Shame, it could be in my view very useful. I’ll try to create my own repo, thanks for the reply.

1 Like

It would be great to have the ability to deploy simple and small monitoring stack in HA. @frenck There is no chance probably that addon-prometheus/prometheus/DOCS.md at c112b76edaa2ad5137a9fbfb6ed29dcf1c9307f0 · hassio-addons/addon-prometheus · GitHub will get a second life? :slight_smile:

I recently built an addon to send stats and logs from home assistant directly to Grafana Clloud, just add GitHub - grafana/home-assistant-addons: Grafana Home Assistant Addon Repository as an addon repository in your HA and follow the instructions to set up the Grafana Cloud addon.

I’ve just done this but I have unraid running so I installed prometheus on there using the prometheus-docker app.
That is a requirement, you need prometheus setup somewhere with access to HA.

Chucked my prometheus.yml in the config dir with my home assistant scrape config inside

# my global config
global:
  scrape_interval: 60s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 60s # Evaluate rules every 15 seconds. The default is every 1 minute.

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
scrape_configs:
  - job_name: "hass"
    metrics_path: '/api/prometheus'
    bearer_token: "FROM_USER_SECURITY_IN_HA"
    scheme: 'http'
    static_configs:
      - targets: ['HA_URL_INC_PORT_IF_NEEDED']

On the home assistant side, I just have this in my configuration.yaml

prometheus:
  filter:
#    include_domains:
#      - alarm_control_panel
#      - light
    include_entity_globs:
      - sensor.weather_*
      - light.light_*
      - binary_sensor.magnet_*
      - switch.plug_*
      - sensor.valetudo_robot_current_*
      - sensor.valetudo_robot_main_*
      - sensor.steam_*
      - sensor.system_*
#    exclude_entities:
      - light.kitchen_light

To get CPU and Host metrics, you’ll need this - hassos-addons/prometheus_node_exporter at main · loganmarchione/hassos-addons · GitHub

To get host metrics, you need to use the System Monitor, you can add this via Devices in HA.
Once that’s working the config above with - sensor.system_* will let prometheus scrape those metrics.

There’s a lot of junk to filter in your queries, check this prom query as a starting point to give you cpu usage:
homeassistant_sensor_unit_percent{entity=“sensor.system_monitor_processor_use”}

Any questions please @ me and I’ll try and help.