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

It should work AFAIK with x86-64. I am not sure if it has been tested.
But the dockerfile should download the correct binary according to arch.

See here: homeassistant-addon-victoriametrics/Dockerfile at ff8f304286cd2d820a0dcd433308d16026478b19 Β· fuslwusl/homeassistant-addon-victoriametrics Β· GitHub

1 Like

Thank you. Indeed it works on x86-64 (intel NUC).

In the past I was struggling with the second step (per instruction below, copied from VM addon git), because no local add-ons were shown when clicking on this button.

  • Just copy the folder victoria-metrics to your homeassistant/addons/
  • Install the Add-on
    Open your Home Assistant instance and show the Supervisor add-on store.

When opened in different browser, the add-on appeared.
I guess it has something to do with browser cache.

Perhaps this will also help someone else.

1 Like

Can we make it to use SSL?

Cool that X86-64 is supported now, as i first read about victoria metrics the addon only worked on arm64.
I am trying to import my influxdb data to victoria metrics and have the first problem:
I used vmctl as mentioned above, the last version from the vm homepage.

./vmctl-prod influx --influx-user homeassistant --influx-password mysupersecretpw --influx-database homeassistant

This should copy the autogen policy data to vm (at least i would think that). It gives me the following error:

2023/01/01 15:03:52 Exploring scheme for database "homeassistant"
2023/01/01 15:03:52 fetching fields: command: "show field keys"; database: "homeassistant"; retention: "autogen"
2023/01/01 15:03:52 found 80 fields; skipped 99 non-numeric fields
2023/01/01 15:03:52 fetching series: command: "show series"; database: "homeassistant"; retention: "autogen"
2023/01/01 15:03:52 found 404 series
2023/01/01 15:03:52 explore query failed: can't find field keys for measurement "ETHUSD"

I googled the error and came up to a thread with a similar problem, but since i use the influxdb addon i don’t know where i find the influxdb.conf (i would even guess it’s inside the docker container and cannot be changed). Anyone here who imported his influxdb into vm this way and has a hint?

And second question, is it possible in this addon to downsample the data

1 Like

Hi!
For migration you can use vmctl tool - see Migrating data from InfluxDB
If you have any question - feel free to ask it on github, twitter, telegram and slack community

1 Like

Is there any way to scrape Prometheus / OpenTelemetry metrics and push them into VictoriaMetrics? For my legacy VM installation i know vmagent. Would you mind creating a vmagent addon which can be used to scrape metrics and ingest them into VictoriaMetrics?

Single-node VictoriaMetrics can scrape Prometheus metrics on its own in the same way as vmagent does - see how to scrape metrics from Prometheus-compatible targets in VictoriaMetrics

Ah perfect, thank you!

An update of the VictoriaMetrics add-on for Home Assistant is out now that includes the latest version of the VictoriaMetrics time series database:

2 Likes

Is there any benefit when using this addon instead of just using the prometheus or influx exporter (which are official) to get data into VictoriaMetrics?

The addon runs VM. You don’t need it if you already have VM installed somewhere else.

1 Like

Thanks for the clarification!

At least i sorted the problem out. If anyone else runs into it, here is the solution.
I have 3 retention policies, and in the autogen policy (the one that would be imported by default) there were no measurements for β€œETHUSD”. In this case vmctl throws an error, to use it, every measurement has to have at least one entry.

But after importing i can’t see any data, not in grafana or the vmui.
I tried it again with one entity, import runned fine.

InfluxDB import mode
2023/02/04 12:39:40 Exploring scheme for database "homeassistant"
2023/02/04 12:39:40 fetching fields: command: "show field keys"; database: "homeassistant"; retention: "y2_5m"
2023/02/04 12:39:40 found 9 fields
2023/02/04 12:39:40 fetching series: command: "show series from people where entity_id = 'sk_hamburg_count'"; database: "homeassistant"; retention: "y2_5m"
2023/02/04 12:39:40 found 1 series
Found 1 timeseries to import. Continue? [Y/n]
2023/02/04 12:39:50 Import finished!
2023/02/04 12:39:50 VictoriaMetrics importer stats:
  idle duration: 0s;
  time spent while importing: 142.880858ms;
  total samples: 1216;
  samples/s: 8510.59;
  total bytes: 25.2 kB;
  bytes/s: 176.2 kB;
  import requests: 1;
  import requests retries: 0;
VM worker 0:β†– ? p/s
VM worker 1:β†– ? p/s
Processing series: 1 / 1 [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] 100.00%
2023/02/04 12:39:50 Total time: 9.402037448

But when i look in vmui i can see only the measurements that came from homeassistant since switching to vm and not the imported data. Anyone here who also imported from influxdb and know wether there is more to do than simply importing?

Hi!
Could you please describe your problem by creation new issue at Issues Β· VictoriaMetrics/VictoriaMetrics Β· GitHub ?

Hi! I can’t figure out how to run the β€œvmctl” command to import my InfluxDB data. When I log with ssh, I can see where the VM data is stored, but I can’t find the vmctl executable anywhere.

Hi,
This looks like an interesting replacement to InfluxDB. However, I do see their β€˜open’ philosophy is starting to pivot just like Google and Android, whith new features only supported on enterprise.

For example, one key option is Downsampling, which is only support in enterprise as per GitHub - VictoriaMetrics/VictoriaMetrics: VictoriaMetrics: fast, cost-effective monitoring solution and time series database yet it is crucial for a compromise between real β€˜long-term storage’ and database size/performance, which is exactly the key rationale for suggesting a switch from influxdb to VictoriaM.

  • Is there any known approach to impementing downsampling in VictoriaM with the community edition?

Thanks.

1 Like

In my knowledge the vmctl command isn’t part of the addon (correct me if i am wrong).
I downloaded the binary from the victoriametrics site (Releases Β· VictoriaMetrics/VictoriaMetrics Β· GitHub), you need the vmutils package for the architecture you are using and just the vmctl-prod file.
When using it, the name changed to vmctl-prod, remember to change it in you commands to import the data.

@diamant-x
+1 on this, the downsampling part is my last piece of the puzzle. I’m hoping that it will be part of the community edition (this is the one that the addon runs, i did not find it anywhere in the description) since we reach 2 years.

@dengolius
I opened 2 issues at github:

Tell me how to make a database size sensor?

EDIT:

Most simple way to get the size of the database, idea from Scott below. Just make a command_line sensor:

command_line:
  - sensor:
        name: "VictoriaMetricsDB Size New"
        command: "/usr/bin/du -s /share/victoria-metrics-data | cut -f -1" # read data from du cronjob
        value_template: "{{ (value.split('\t')[0]|int/1000)|round(1) }}"
        unit_of_measurement: "MB"
        unique_id: "victoria_metrics_db_size_unique_id"
        scan_interval: 600

Maybe you have to change the path of the database to your needs, mine is from a supervised install.

For this i used the same as for influxdb (i found a time ago in this forum), don’t know if it works on HAOS since im using a debian install with ha supervised.
I created a cronjob for this:
</s> <s>*/10 * * * * /usr/bin/du -s /usr/share/hassio/share/victoria-metrics-data | cut -f -1 > /usr/share/hassio/homeassistant/victoriametrics_db_size</s> <s>
This makes a textfile every 10 minutes in the homeassistant directory with the size of the db (you will have to adept it according to your pathes to the config directory and the share directoy).
Then make a sensor:
</s> <s>- platform: command_line</s> <s> name: "VictoriaMetricsDB Size"</s> <s> command: cat /config/victoriametrics_db_size # read data from du cronjob</s> <s> value_template: "{{ (value.split('\t')[0]|int/1000)|round(1) }}"</s> <s> unit_of_measurement: "MB"</s> <s>
This reads the text file and voila, you have another sensor with the db size of victoria metrics.

2 Likes