Home Assistant Community Add-on: InfluxDB

Hi, in HA log I get an error where Influx is referenced with double port references (:8086:8086)

ERROR (SyncWorker_12) [homeassistant.components.influxdb.sensor] Cannot connect to InfluxDB due to 'Failed to parse: http://my_local_ip_address:8086:8086/query'. Please check that the provided connection details (host, port, etc.) are correct and that your InfluxDB server is running and accessible.

I have jumped back and forward among the configs now, and do not understund where this double reference to the port, comes from!
Anyone having an idea, that can help me find the source to the error?

is there any chance to make InfluxDB work with the recent HA? What else should i use for Grafana?

If you use Home Assitant OS, there is the influxdb add-on (that this thread is about). You can use this add-on to setup and run Influxdb under the Home Assistant OS.

Otherwise, you can setup influxdb on whatever server (or the machine running Home Assistant) and then use the influxdb integration to connect.

But, as far as I know, the add-on is not maintained anymore, and it is using an outdated version of influxdb. It should still work though.

I use HAOS and would like to set up a more current version of influxdb. I see two options

  1. Just set influxdb up on another machine
  2. Create my own add-on with the newest version of influxdb and run it in Home Assistant OS

I’m starting to lean towards option 2, but it might be out of my league :smiley:

both are not too good options for me, hmm, probably i will go for option one but that will mean another animal in the zoo.

The InfluxDB addon for HA is dead, isn’t it? Seems to be unmaintained with issues sitting and waiting… :frowning:

If you need a replacement for InfluxDB you can check out the VictoriaMetrics Addon for Homeassistant.

[GitHub - fuslwusl/homeassistant-addon-victoriametrics](https://Victoria Metrics Add-On for Home Assistant)

It is 100% compatible with InfluxDB and Prometheus and has many advantages like 20x better compression, lower RAM usage and higher performance. It is also directly usable in Grafana with Prometheus or InfluxDB Data source - so it is a drop-in replacement for Prometheus and InfluxDB.

In Home Assistant OS / Supervisor you can backup the victoria-metrics-data folder located in the shared folder.

1 Like

Thank you for making this add-on. I think it would deserve it’s own thread here. Haven’t tried it yet but super interested.

Edit: because the add-on is so new and seemingly not used by many yet I tried to verify the contents. However when I diffed the victoriametrics inside the addon against the release I got a mismatch. Could you please specify which release was used in this add-on? I probably just chose the wrong release package…

I used WinMerge to check the victoria-metrics-prod file in this add-on versus the release victoria-metrics-linux-arm64-v1.81.2.tar.gz but they are different. Also checked some other versions but none matched.

Did you compile victoriametrics yourself or can you point to the binary version being used?

I am using the victoriametrics version from the original dockerhub image “victoriametrics/victoria-metrics:v1.81.2”. I copied the binary from this docker image after running the container successfully on an ARM MacBook Pro M1. This binary is running on my Raspberry 4 without problems.
Do you think I should use another binary?

1 Like

I updated the image a minute ago. Now the Add-on uses InfluxDB integration to get data from home assistant. The integration has an option to use the entity_id as metric name - this is great when using Grafana - just one click and you get the data you want.
With the influxdb integration homeassistant pushes every change directly to the database. This is an advantage because you get every change and not only the states every 20 seconds when scraping was used.
GitHub: HASSIO VictoriaMetrics Add-On

2 Likes

It seems the victoriametrics-prod file in the official docker image is different from the official arm64 image then. Need to investigate how to hash that now.

Use what image you want, no problem. It is just me trying to verify what I install :slight_smile:

An own thread for this add-on would be great!

I thought the official docker image would be a good choice. But i could change the binary to the one you recommended. I just wanted to avoid compile sessions and missed the binary downloads.
You meant these binary versions i think: Releases · VictoriaMetrics/VictoriaMetrics · GitHub

Here is the thread for the VictoriaMetrics Add-on:

2 Likes

After some research i am still at a loss and partly confused. Hopefully one of you can help.

I am running Home Assistant OS on a Raspberry pi 4, collecting data for almost a year with the current InfluxDB add-on V4.5.0. I finally wanted to set up a visualization with grafana, but got the same view and stumbled upon the same problems as Dingle:

So, as Dingle, I’m really keen to move to InfluxDB 2.x but haven’t figured out how to set this up with my Home Assistant OS environment and without losing the data I already collected in my InfluxDB V1.x database.

It seems there are (at least) two options to proceed for me:

Option 1: Continue using the community InfluxDB add-on and switch from api_version 1 to api_version 2

  • As far as I understood, the InfluxDB add-on has the ability to run as InfluxDB 2.x installation. Key is the switch api_version which has to be set from 1 to 2 (and some other parameters). But I found no guidance to perform an upgrade/migration in case a InfluxDB 1.x installation is already been used.
  • There is a guide for an automatic upgrade procedure available on the official influxdata documentation at https://docs.influxdata.com/influxdb/v2/install/upgrade/v1-to-v2/automatic-upgrade/. But is it at all sufficient or necessary for my environment?
  • How do I keep my data when switching from InfluxDB 1.x to a InfluxDB 2.x installation?

Option 2: Go with InfluxDB2 add-on instead of community InfluxDB add-on

Maybe someone has already gone through the same topic and can give me a few hints.

2 Likes

I’ve not looked at it myself yet, but I am going to investigate VictoriaMetrics as the Db to use for this sort of thing. VictoriaMetrics Add-on for long-term storage and data source for Grafana

Anyone figure out how to solve the InfluxDB add-on running out of memory?

runtime: out of memory: cannot allocate 8192-byte block (564428800 in use)
fatal error: out of memory
goroutine 1357 [running]:
runtime.throw(0xfebdde, 0xd)
        /usr/local/go/src/runtime/panic.go:774 +0x5c fp=0x47f9324 sp=0x47f9310 pc=0x41644

The memory in use, assuming 564363264 is in bytes not blocks, is only 0.525GB.

I’ve increased swap to 6GB, so I have over 5GB of swap available but it still fails allocating at that point.

Is the add-on limiting the amount of memory available to the container?

I tried changing the index from the default inmem to tsi1 by adding the following envvar to the add-on config. But I can’t tell whether it actually changed anything as Influx still dies on the same out of memory error.

- name: INFLUXDB_DATA_INDEX_VERSION
  value: tsi1

Great Addon - makes it much easier for rookies like myself :wink:

Some questions though:

On the Admin board I just see the _internal DB. Is this the influx internal or the homeassistant internal (SQlite)?
Means: Do I need to create a DB manually and if so, where is this to be found (path)?

EDIT:
One more question:
Is the configuration in configuration.yaml still needed or is this hidden somewhere in the background by the Community AddOn?

EDIT II:
Sorry for my RTFM question. :wink:
I will check out the docs and might come back with reasonable questions.

This add-on will run influxdb on your Home Assistant OS. You could also run influxdb on another server machine somewhere. In that case you don’t need this add-on and can just install influxdb on the other server using influxdb’s own installation instructions.

In any case, you need to put the influxdb integration in configuration.yaml in order to send data from Home Assistant to influxdb.

The database should be created by influxdb itself (whether it is running in the add-on or on it’s own somewhere).

I have not used influxdb myself though so take this with a grain of salt.

Got it.
So basically, the add on does the (linux) installation, but the activation / configuration is up to the HA admin.
Thank you!

1 Like

Hi all,

Anyone know how i can enable RPC service in influxdb addon? i have HAOS with some addons, one of them is influxdb.
I’m trying making a remote database backup, but connection is refused because rpc port is closed.

Regards!