Victoria metrics persistence service

Hello everyone,

I’m happy to announce that I’m working on a VictoriaMetrics persistence binding for openHAB!

VictoriaMetrics is an efficient and highly performant time-series database, often regarded as a superior alternative to InfluxDB due to its performance and simplicity. While VictoriaMetrics supports the same InfluxDB V1 write API (/write endpoint), it currently lacks direct compatibility with openHAB for querying data, meaning graphs and historical data won’t be readily available in openHAB without a dedicated binding.

Given the limited support and future uncertainty around InfluxDB 3.x, VictoriaMetrics presents an excellent alternative solution. A native persistence binding will leverage VictoriaMetrics’ powerful query capabilities, enabling full integration with openHAB, including proper historical data visualization and analysis.

This discussion in the community forum highlights why VictoriaMetrics might be preferable:
https://community.openhab.org/t/what-database-to-use-instead-of-influxdb/149874/21

Additionally, there’s an ongoing proposal to use micrometer persistence services, underscoring the importance of efficient metrics handling:
https://community.openhab.org/t/proposal-micrometer-persistence-service/147306

Pull request is available here: [victoriametrics] Initial contribution of VictoriaMetrics Persistence Binding by johnuopini · Pull Request #18759 · openhab/openhab-addons · GitHub

I am happy to see this development.

I am currently using InfluxDB 1 and would consider replacing it with this new service. Which brings me to the following:

  • it is easy enough to change my persistence service and copy over the configuration from InfluxDB persistence to VictoriaMetrics.
  • Is there a mechanism to migrate existing InfluxDB 1 (or 2) data to VictoriaMetrics?
  • I am using Grafana on top of InfluxDB 1. How easy is it to rebuild my dashboards for an underlying VictoriaMetrics database? Or would it mean starting from scratch.

Thanks for checking this out!

The only difference between the 2 is that influxdb uses the “influxdb” optional metadata tag while this service uses “victoriametrics” so if you are using custom names or tags for persistence you will need to change that, nothing else. If you use text based items this sould be quick, otherwise you might need to spend some time on the UI or edit jsondb directly.

Yes it should be quite straightforward, you can use vmctl and do something like:

vmctl influx -influx-url http://localhost:8086 -influx-database openhab \
  -vm-url http://localhost:8428 \
  -retention-period=30d

This will import 30d data to influx, you can check docs for more options. Nice thing is that you can easily try this out safely without affecting anything.

Unfortunately Victoria Metrics supports the Prometheus and VictoriaMetrics data source plugins in Grafana. If your dashboards use InfluxQL you’ll have to rewrite queries using PromQL or MetricsQL, this is the hardest part.

@johnuopini any updates here? Looks like your PR has some code revisions requested.

Hi all,

Franz (@johnuopini) started a VictoriaMetrics persistence service last year, but the PR stalled and was closed. I picked it up, worked through all the review comments and opened a new PR: openhab-addons#22155. Big thanks to Franz for the groundwork!

What’s new compared to the first version

  • Seamless switch from InfluxDB: many of us already point the InfluxDB persistence at VictoriaMetrics (its InfluxDB-compatible endpoint). Those series are named MyItem_value{item="MyItem"}. Set metricSuffix=_value and the new service reads your complete existing history and simply continues writing to it. No migration, and charts, previousState and restore just keep working.
  • InfluxDB 1.x data can be imported with vmctl influx, and the same metricSuffix=_value setting picks it up.
  • Fast: restoring the last state of an item with years of minute data takes about 15 ms instead of exporting the whole history.
  • Complete persistence support: all filter operators, paging, aliases, historic and future states (forecasts).
  • Item metadata (victoriametrics="name" [floor="groundfloor"]) and the category, label and type tags work exactly as with InfluxDB, plus an optional unit tag.
  • Tiny: no extra libraries, the jar is about 45 KB.

Things to know

  • VictoriaMetrics stores numbers only. Number, Dimmer, Rollershutter, Switch, Contact and DateTime items are persisted. String, Color, Location, Image and Player items are not.
  • Check your VictoriaMetrics settings: the default -retentionPeriod is 1 month, and forecasts more than 2 days ahead need -futureRetention.
  • Removing data only works for an item’s complete history (a VictoriaMetrics limitation).
  • Grafana: InfluxQL dashboards need to be rewritten in PromQL or MetricsQL. The README has a few examples.

Test it (openHAB 5.2.x)

  1. Download: 2026-11-02 - org.openhab.persistence.victoriametrics-5.2.x-SNAPSHOT.jar.zip
  2. Unzip it and drop the jar into your addons folder.
  3. Configure it under Settings → Add-ons → VictoriaMetrics Persistence: set the url, plus metricSuffix=_value if you come from InfluxDB-on-VictoriaMetrics. Use the same addTypeTag, addLabelTag and addCategoryTag settings as before to continue the same series.
  4. Add your items and strategies under “Configure Persistence Policies”.

Tip: you can run it in parallel with your InfluxDB persistence first. With addUnitTag enabled, its series are kept apart from the InfluxDB ones, so you can compare both in VMUI or Grafana.

I’m running it against my own installation with about 500 series. Feedback, bug reports and test results are very welcome, here or in the PR. Let me know how it works for you!

Michael

Now in Marketplace VictoriaMetrics Persistence Service [5.2.0.0;6.0.0.0)