Home Assistant Community Add-on: InfluxDB

Top get the number of measurements per hour, you can do something like:

SELECT count("value") FROM /./ WHERE time >= now() - 6h GROUP BY time(1h) fill(null)

I could if it was runningā€¦

And to cut down on the measurements?

Same here, but mayby you reach a threshold at some point which causes this to happen.

Perhaps change the retention period? - can you do that globally?

Yes, in Influxdb:

1 Like

Well ā€¦ for the moment at least my problem has gone away :grinning:

While troubleshooting this I uninstalled InfluxDB and re-installed it. I wasnā€™t expecting it but this appears to have deleted my database :rofl:

Itā€™s no biggie, I only set up Influx to test out Grafana a few months ago so the database history was totally unimportant, but after creating a new DB and reconnecting Grafana InfluxDB (the current 3.7.1 version) is now back to normal performance. Iā€™ll see how long it lasts.

Also FWIW, itā€™s been a while since I tried restoring a snapshot, and I discovered that when you restore a snapshot now you get a checklist of things you can selectively restore, including the InfluxDB addon. I tried restoring that on its own and got a ā€˜successfully restoredā€™ message, but nothing appeared to change including the InfluxDB addon version number.

I believe you can only cut down the measurements by limiting what is being recorded i.e. by domain/entities. This should help especially in cases where you have entities that have very frequent state changes. I personally exclude everything but the specific domains I want to monitor. I considered per entity at one time but it would be too difficult to manage. The sensor domain is likely to have entities that update frequently so you might want to look in there for culprits as well.

1 Like

InfluxDB has done it again. 180% CPU.

This is really beginning to irritate me.

My Rpi 3 has been hanging recently, causing Teckin wall plug devices to reset when they lose connectivity. The temp and CPU usage has gone sky-high with recent InfluxDB updates.

Today I updated to 3.7.3 and I was hoping a fix had been in the works. Whilst it was disabled, process or use dropped to 8% and Swap Use down to 40%. Within seconds of InfluxDB being started up, weā€™re back up to 70% CPU usage, 60+ degrees c temp (last week it was 80+ and I installed a fan), and Swap Use of 100%.

The drop in temp in the attached image is when InfluxDB is disabled (it didnā€™t restart after an update). I also tried disabling all the other add-ones one at a time, and InfluxDB is the only one that has a huge impact. The rest are negligible (Grafana, ESPhome, Google Drive Backup).

1 Like

I think the issue is the InfluxDB container becoming full. I have reduced the retention period and my issues have gone away.

Iā€™m running off an external 250GB SSD drive, which shows its only 8% full at present.

Me too, but it is the size of the container that is perhaps the issue. All I can say, is reducing the amount of data retained solved the high CPU load for me.

I started having issues at the time that Home Assistant 0.108 came out with ram/cpu running high and my automations delayed seconds, minutes, or seemingly indefinitely. Itā€™s been driving me nuts for a while and while Iā€™ve always attributed it to the 0.108 update even though Iā€™ve been pretty certain InfluxDB was the issue. Figured HA just wasnā€™t handling Influx as well anymore. Iā€™ve also seen some people posting about similar cpu/ram issues some of whom didnā€™t have Influx installed, which also had me thinking that.

It got bad enough that I was more frustrated by HA in general, finding myself wanting to avoid it altogether. Recently I disabled the Influx add-on altogether figuring as much as I wanted the historical data Influx would give me and actually a lot of it would be incredibly valuable over time, none of that really matters if Iā€™m avoiding all of HA and automation.

HA and my automations have been running flawlessly and immediately. Thought to upgrade and try enabling Influx tonight, and almost immediately noticed CPU rocketing up and automations going to crap again. :frowning_face:

Iā€™m running on a Raspberry Pi 3B+. Iā€™ve offloaded the HA DB to my NASā€™ MySQL server, but Iā€™m unable to get InfluxDB running on it. Influxā€™s DB is located on the SD card which I donā€™t think is ideal, but itā€™s also one meant for read/write activity.

Iā€™m not really familiar with Docker so Iā€™ve had a hard time trying to sort out if the problem is DB size, i/o on the SD card, or some other thing. I do have the community SSH plugin installed allowing me to connect to the container- I donā€™t have Influx running currently or know if thereā€™s a way to access the container when itā€™s shut off, but I donā€™t recall seeing much indication that anything was excessively large.

Iā€™d really love to get this fixed if anyoneā€™s got some ideas.

1 Like

Is there a better avenue for discussing and getting help troubleshooting this?

Helo,

I am new here and have read the complete thread because i had some problems to read the database and got the warning in the log file that the database ā€œhomeassistantā€ could not been reach or something. I must check username, pass, ā€¦ I did alot of things what has been written here but nothing worked.
What i have done now is created a new database in influxdb with the name home instead of homeassistant. Change the config.yaml file also and then al the measerements went visible. How is this possible?? Now I can continue and hopefully this could be also a solution for somebody after 6h of nonestop searchingā€¦

influxdb:
  host: a0d7b954-influxdb
  port: 8086
  database: home
  username: homeassistant
  password: ****
  max_retries: 3
  default_measurement: state
2 Likes

This add-on does not run InfluxDB 2.0

iā€™m not using this addon, but installed influxdb myself in docker.

Right, but this topic is about the add-on. Please create a separate topic in those cases to prevent further confusion.

Iā€™m also very interested in this, and it seems that adding a new port mapping to allow outside world to reach the collectd listener (on 25826 UDP by default) would be enough since all other options can be configured using environment variables. Telegraf cannot be installed easily on average MIPS routers, but collectd is well supported.

I ended up using netdata. It was easy to install on my router and it worked immediately. Also there is built in sensor integration into Home Assistant for it: https://www.home-assistant.io/integrations/netdata/
And as I remember I only had to make one rule in the router firewall to enable inter-vlan communication so that Home Assistant can get the data from the router as they are on different vlans.
And the other thing is setting up the netdata sensor which can seem tricky at first but it is well documented in the HA docs.
Using the netdata sensors automatically adds the data to influxdb and grafana for vsualization.
Netdata is said to be more resourse hungry but I noticed that only while using itā€™s UI. When the data is read from HA it the stats seem normal :slight_smile:
Hope this helps.