InfluxDB vs VictoriaMetrics

Hey all,
I work as a DevRel over at InfluxData. Hearing your pain over the 1.X to 2.X move of InfluxDB OSS. If you have any questions or ideas to pass on happy to take them back to the team.

To help answer some of your questions:

  1. 2.X still has influxql support available: Use Grafana with InfluxDB OSS | InfluxDB OSS 2.6 Documentation

  2. 2.X also provides inbuilt dashboarding capabilities and automation via tasks.

  3. 1.8.10 or InfluxDB is also alive and well but completely understand if Victoria Metrics fits your use case better.

1 Like

would I be right in assuming the excludes/filters are that are listed for influx will be applied to VM as well?

eg:

influxdb:
  [[...]]
  exclude:
    domains:
      - alarm_control_panel
      - sun
      - updater
      - media_player
      - zone
      - device_tracker
      - remote
      - weather

in my current docker-compose (pre your changes), I only have the following:

    command:
      - "--selfScrapeInterval=60s"      # to enable self-monitoring => Grafana dashboard
      - "--retentionPeriod=3y"          # default is "1 m"
      - "--storageDataPath=/storage"
      - "--httpListenAddr=:8428" 

I would assume that since the filtering is done before pushing, and we only change where the data is pushed.

1 Like

I don’t have this line.

1 Like

I got it working!
Here is my docker and HA configuration.yaml for anyone else…

docker-compose.yaml - note: vmagent no longer needed…

# uses InfluxDb integration in HA to push changes to VM's listening port: 8428
  victoriametrics: # http://dietpi:8428
    container_name: victoriametrics
    image: victoriametrics/victoria-metrics:latest
    volumes:
      - ./vm/vmdata:/storage
      - /etc/localtime:/etc/localtime:ro  # only for RPi (Docker Mac is a VM)
    command:
      - "--selfScrapeInterval=60s"        # to enable self-monitoring ➜ Grafana
      - "--retentionPeriod=3y"            # default is "1m"
      - "--storageDataPath=/storage"
      - "--httpListenAddr=:8428"          # Influx HA config must also use 8428
    network_mode: host
    restart: unless-stopped

configuration.yaml (HA) note: prometheus no longer needed

influxdb:  # for VictoriaMetrics
  api_version: 2
  ssl: false
  host: 192.168.1.100
  port: 8428                            # VM docker command: --httpListenAddr=:8428
  token: !secret influxdb_token
  organization: !secret influxdb_org
  bucket: !secret influxdb_bucket
  tags:
    source: HA
  tags_attributes:
    - friendly_name
    - device_class
  default_measurement: units
  exclude:
    entities:
      - sensor.date
      - sensor.time
    domains:
      - sun
      - updater
      - media_player
      - zone
      - device_tracker
      - remote
      - weather
    entity_globs:
      - sensor.anniversary_*
      - sensor.count*
      - sensor.speedtest_*
      - sensor.pirateweather_*
1 Like

FYI, recent versions of VictoriaMetrics allow controlling the frequency of disk write operations with the -inmemoryDataFlushInterval command-line flag. This may help saving the lifetime for commodity SD cards with limited number of write cycles. See CHANGELOG · VictoriaMetrics for more details.

Thankyou fuslwusl for this add-on and thank-you @fuslwusl , @jchh and others for all the development to this topic and advice.

I upgraded to a raspberry PI4 (4GB) and now have Victoria Metrics and Grafna running, using the HA Influx integration. (Graphs on steriods and long term statistics here I come :slight_smile: )

For anyone with some experience of HA, its a minimal effort. I have offered @fuslwusl some tweaks to the installation instructions based on my experience.

For the record: HA says the Victoria metrics add-on is using 1.1% “add-on RAM usage” that would be 4.5% of 1GB I guess.
And Grafna: 1.5% ie 6% of 1GB
The added CPU is apparently 0.3% (of a PI4)
(The whole rPI4 (4GB) is running at 31% RAM utilisation and zero swap file use, :slight_smile: )

2 Likes

Hey, I’m trying to set up VictoriaMetrics now and I’m struggling to understand the token, organization and bucket settings. I cannot find any of these in any place in VM? I seem to remember these from way back when I meddled with Influxdb, but are these needed when working with VM?

VictoriaMetrics doesn’t need any of that, the setup is trivial in the VM side, there is no configuration at all, you just pass the retention period in the docker command line, that’s it, in the HA side you use the config for influx v1 without org, bucket, token ok r password, see the link below.

Thanks to this thread I discovered VM while researching options for long term storage, and I got VM/grafana running in 10 minutes, it’s fantastic. All in a raspberry pi with a just-installed crucial x6 ssd. Also running frigate with a coral accelerator, all dockerized.

Ha! …I’m using the config for influx v2 - still works!

Hi!
+1 to your question.

Looks like it is not needed, see GitHub - fuslwusl/homeassistant-addon-victoriametrics: VictoriaMetrics Add-on for Home Assistant OS is the perfect solution for long term data storage of your smart home sensor data and visualization with Grafana.

Do I understand the configuration correct and I can use InfluxDB (I use InluxDB2) and VictoriaMetrics parallel.
So I could test if VM suits my needs and have written all data also to my old InfluxDB instance in case I would stay with InfluxDB after my tests?

1 Like

Yes, you can!

2 Likes

Sorry. I have tried to get both (InfluxDB2 and VM) running at the same time. For me with HA OS 2023.02 it was not possible. Home Assistant could only have a connection to one InfluxDB instance. If I try to configure a second instance I get HTTP connection errors from InfluxDB integration.

I’m using HA container (docker) so maybe that’s the difference, but only have 1 InfluxDb instance - not sure why you are trying to configure a 2nd.

One InfluxDB and one VictoriaMetrics. So I could test Vm while using InfluxDB as main storage until test and validation of VM is finished.

OK, must be that I am using docker then.

Hi there, I ran across this thread while looking for the best way to store long term data from my HA installation and I’m considering victoriametrics after some reading.
For the time being, I increased the retention period for HA’s recorder, but I want to migrate asap as my DB keeps on growing. Preferably, without losing historical data.
Does anyone have a recommendation for getting the HA data into victoriametrics? Is there a direct export possibility from HA to victoriametrics or do I need to migrate to InfluxDB first and then use this script: GitHub - Maaxion/homeassistant2influxdb: Migration of Home Assistant's log database to InfluxDB ?