Setting up Home Assistant with InfluxDB/Grafana/Telegraf - Docker vs HA OS

Hi,

I am brand new to Home Assistant, but am reasonably experienced using Grafana and InfluxDB together for data monitoring. I have installed the Home Assistant OS on my Raspberry Pi 3B+ onto an external SSD connected by USB to the Pi.

In the past, I have set up InfluxDB and Grafana in Docker containers, and have configured Telegraf to run as a service. This means I could log all the health statistics of the Pi to InfluxDB (such as disk usage, CPU usage, etc). Now I would like to also log some data from home assistant as well (such as states of switches, and sensors, etc). So basically I want to pipe information into InfluxDB - some of which is directly from sensors in HA, but also some of it which has nothing to do with HA.

However, now that I am running the Home Assistant OS I’m not sure if it’s possible to run InfluxDB/Grafana/Telegraf in the background, and keep full control over them? (I know they can be installed as Add Ons). I would like to know if I’m barking up the wrong tree with this approach, and if I should instead be looking at running Home Assistant / Grafana / InfluxDB all in Docker containers (and not use the OS)?

I look forward to any advice that anyone can offer (it was difficult to find useful information online about this particular use case).

Thanks

Hi,

HASSOS can provide the RPI info (as can Glances). I run HASSOS/Grafana/Influx - here’s a bit of one of my dashboards.

Thanks Neil, that’s helpful to know that some data can be scraped.

I am still interested in the best way to go about it though. I have other systems that collect data that I don’t want to (or am unable to) pass through Home Assistant. There are also a bunch of other Telegraf plug-ins that I want to continue using. (Not to mention custom naming of measurements, to make the schema more easily accessible in Grafana).

Hi,

Well technically the add-on (influx) behaves just like any other install. I can connect directly to it from my PC using InfluxDB Studio.

Hi,

Is there a way that we can control which data is piped into InfluxDB from Home Assistant? For example, with just a basic set up after installing the InfluxDB add-on, I can see hundreds of time-series that are automatically being sent into the database:

Almost all of these time-series are not needed to be stored long-term (maybe only a couple of them need to be stored). Is it possible to choose what is stored when using the add-on?

Thanks!

Hi,

There is indeed - in your setup you add include/exclude i.e. :

influxdb:
  host: 192.168.1.25
  port: 8086
  database: home_assistant
  username: home_assistant
  password: *******
  ssl: false
  verify_ssl: false
  max_retries: 3
  default_measurement: state
  tags:
    instance: prod
    source: hass
  include:
    entities:
      - sensor.netatmo_brownlee_cottage_indoor_front_garden_rain_today
  exclude:
    entities:
      - sensor.air_quality_meter_humidity

You can also exclude domains.

Hi Neil,

This is really helpful and exactly what I was looking for, thank you for that. That helps to get InfluxDB working.

Back to the original question, is it possible to install something like Telegraf then when running the Home Assistant OS? If so, could it be done through the Terminal add on from the store?

Or is it not recommended to install your own services/software because Home Assistant OS is designed to be a managed OS, and you are not supposed to really be manually installing stuff?

So, if I wanted to install Telegraf would I need to do a different HA installation (i.e the Docker container version)?

Thanks for your advice.

Hi.
Did you actually found out how to do it, did you install Telegraf or not?

I’m about to try the same, I’m going to send lots of data to Mqtt running on ha and would like to store some topics to influx for long term storage

1 Like

Hi @chriztian ,

In the end, I ended up setting up Proxmox on my machine. It is configured to have a virtual machine for running Home Assistant (which means I can use the Home Assistant managed OS version), and is also configured with another LXC container. This second container runs docker, which has Telegraf, InfluxDB, and Grafana in seperate docker containers. The benefit of this is that I can keep these three services seperate from the Home Assistant OS, and can manage them independenly (just because I am more familiar with this, and so don’t need to use the add ons), and it’s also easier to back everything up, and manage the storage space for InfluxDB.

In the Home Assistant configuration, I am also supplementing this with some basic information using the System Monitor platform:

Clipboard02

1 Like