VictoriaMetrics Add-on for long-term storage and data source for Grafana

VictoriaMetrics Add-on for long-term storage and data source for Grafana

If you are looking for an efficient and easy to use way for long term storage of your Home Assistant data - just use VictoriaMetrics. I am still impressed how efficient this database stores all my sensor values an the database size stays so tiny compared to InfluxDB an others.

Grafana and VictoriaMetrics

Grafana and VictoriaMetrics are a dream team. I was using InfluxDB for some years and now switched to VictoriaMetrics. I tried Influx2 but it was not my friend and was no fun in combination with Grafana. I don’t want to write database queries when creating a simple visualization in Grafana. So the search for alternatives began and VictoriaMetrics is the way to go.

Replacement for InfluxDB and Prometheus

VictoriaMetrics Time Series Database is 100% compatible with the Prometheus and InfluxDB line protocol. So Homeassistant is able to connect to VictoriaMetrics with the InfluxDB. In Grafana you can use the Prometheus or InfluxDB data source.

Much better long term storage

VictoriaMetrics offers an ultra efficient compression for data storage, is highly optimized for time series data and has low RAM usage. So this is the perfect solution for long term storage of high amounts of data like all sensor values of your smart home.

VictoriaMetrics as Home Assistant Add-on

Because i am using Home Assistant OS (Hass.io) on a RaspberryPi 4 and wanted to run Victoria Metrics on the same system i created VictoriaMetrics as Add-on for Home Assistant.

I hope you enjoy this Add-on and it will make long-term data storage and visualization of your Home Assistant data a lot easier. The Add-on including documentation is available at GitHub.

6 Likes

Published new version 1.8.10 of the victoriametrics addon for home-assistant.

1 Like

This looks really interesting. Can you migrate data from InfluxDB to VictoriaMetrics?

Be careful when you use the addon. The retention value was not passed to vm thus the default retention of 1m ist active. I made a pull request.

You can migrate the data using vmctl tool which you can get in the Victoria Metrics website.

I also made a pull request for amd64 support.

2 Likes

How should I configure VictoriaMetrics on an already working HA with InfluxDB pre-existent?
I want to keep InfluxDB as is, at least for some time, and just append this new database of VictoriaMetrics to the system. Give it a try.

I think the configuration.yaml file should not contain two influxdb: main entries with child parameters different for the real InfluxDB and the VictoriaMetrics.
Not surprisingly HA log indicates duplicate entry in the config file.

@oetken Thanx for your fix of the retention setting and your optimizations - your stuff is merged and available as addon version 1.8.13!!!
You are very welcome as contributor if you have more great features to include.

I thing is is not possible to add two influxdb targets in homeassistant.
I used influxdb database before and archived everything. When i need the old data i start a docker-compose setup with influx and grafana to view the old data.
Since then i am using victoria-metrics and grafana without any problems and never regretted this decission. victoria-metrics is a rock solid and stable time series database for long term storage of all your homeassistant data.

How to do this if one is using Docker version of HA? Should we use the InfluxDB configuration, but pointing it to VictoriaMetrics?

Yes. Then you shouldn’t need this add-on. This add-on is only for running victoriametrics on a machine that runs Home Assistant OS.

1 Like

So I would deploy VictoriaMetrics via docker and point to it via config.yaml, using InfluxDB configuration.

Thanks,
anthonws.

(Apologies for the possible off topic and n00b questions)

EDIT: I found it :slightly_smiling_face: Still, would like to see other folks config using docker.

Hi all,

Can someone shortly describe what is the use of the file prometheus.yml?

Dockerfile has a couple of lines hinting to it’s use

# Run service with prometheus scraper
# CMD [ "/victoria-metrics-prod", "-storageDataPath", "/data", "-promscrape.config", "/prometheus.yml"]

So it’s a configuration file for a scraper?
If the HA influxdb integration is pushing the data to VictoriaMetrics, what would you need this scraper for?

I landed here after realising that the Influxdb add-on is no longer maintained. Of course a Prometheus add-on is actively being developed and could also fill this void: GitHub - hassio-addons/addon-prometheus: Prometheus - Home Assistant Community Add-ons
What I don’t get is why in our configuration.yaml we must use the Influxdb integration instead of the Prometheus integration, which is available for Home Assistant Prometheus - Home Assistant
VictoriaMetrics is supposed to be a replacement for Prometheus after all.

What gave you that idea?

Last release was in June.

https://github.com/hassio-addons/addon-influxdb/releases

What does “maintained no! (as of 2021)” mean here GitHub - hassio-addons/addon-influxdb: InfluxDB - Home Assistant Community Add-ons ?

Where does it say that?

Edit: oh I see it. Hmm not sure. I’ll check.

Edit 2: just spoke with Frenk on the community addons discord.

Basically the badge is broken. It is maintained.

Phew! :sweat_smile:

What? :sweat_smile: This is a first one for me… Is the badge autogenerated or what? It has to be fixed asap.
Anyway VictoriaMetrics seems a very good project and claims that it’s very faster than influxdb+less ram. I haven’t tested these claims, but I installed it and indeed it feeds Grafana just fine…

OK! Good to know. I also was looking for alternatives due to that badge!

The talk about influxdb 1.x vs 2.x is making me gravitate towards victoriametrics. In addition to the supposed low resource use.

I wouldn’t want to start an influxdb 1.x setup just to end up wondering if and how to move to 2.x later.

Haven’t really decided just yet which one to use and currently just using the inbuilt history…

Do you happen to know how we could change various options for this addon (scrape interval etc.) and perhaps add a couple more external scrapers (like node-exporter)? I can see the prometheus.yml file in /addons/git/8f49de54/victoria-metrics folder but it’s besides a Dockerfile and used for it, I don’t think it’s a file for options. I guess some parameters may be passed through command-line flags (VictoriaMetrics · The High Performance Open Source Time Series Database & Monitoring Solution) but it’s a little bit complicated and for external scrapers, they must be referred to in the prometheus.yml file.
I think prometheus.yml should be exposed to the host via a volume, so we could edit it, but it’s not.

(post deleted by author)