[Guide] InfluxDB / Grafana on Windows

Going to slowly add to this as we go. Hopefully will be a full guide by the end.

1. Install InfluxDB (we will use the latest version)

The Influx Docs are good, follow this guide: Install InfluxDB | InfluxDB OSS 2.4 Documentation

  • Select the Windows option at the top
  • You will need to get the CLI executable as well and set that up.
  • For the Set up InfluxDB section, do the UI Setup.
    • Do not worry about creating new tokens yet
    • For Oganization I am using "home"
    • For Bucket I am using "hubitat_events"
  • (Optional) Set up and use the influx CLI - Recommended for later use in setting up the compatibility mappings
  • Bookmark the login page so you have it handy later

DO NOT delete the Operator Token, I did this by mistake once, not fun. I have since renamed it to prevent future blundering.
image

You should now be able to run Influx from the command line (we will setup as a service later)

2. Install Grafana (latest version)

Grafana docs are also good: Install on Windows | Grafana documentation

  • Get the latest Open Source (OSS), Windows Installer version when you go to download
  • Bookmark the login page so you have it handy later

After Installing you can then follow up with the Getting Started to log in and setup your password: Build your first dashboard | Grafana documentation

This should setup Grafana as a system service so you are all set and it should launch itself in the background on reboot.

8 Likes

Jeff, appreciate you putting this together. I started to install InfluxDB and Grafana today along with the InfluxDB Logger in HE. I'm running into two noob issues that I can't seem to find answers to....

  1. After I installed InfluxDB, I went to install the Influx CLI. It installed no problem. After installation, there are instructions to "Provide required authentication credentials". The instructions give you the commands (clear enough), but not where to issue them. Doesn't seem to work from Powershell or from the windows command prompt. Confused about where to issue these commands?

  2. Recognizing the Influx CLI is optional, I pushed ahead anyway. I setup the logger app in HE,--the log shows this error: Values of types "BOOLEAN" and "INTEGER" are not comparable; SQL statement: SELECT COUNT() FROM EVENT_SUBSCRIPTION WHERE FILTER = ? AND HANDLER = ? AND INSTALLED_APP_ID = ? AND SUBSCRIBED_INST_APP_ID = ? [90110-214] Query: SELECT COUNT() FROM EVENT_SUBSCRIPTION WHERE FILTER = ? AND HANDLER = ? AND INSTALLED_APP_ID = ? AND SUBSCRIBED_INST_APP_ID = ? Parameters: [0, handleAppTouch, 1921, 1921] on line 876 (method updated). I suspect I'm doing something wrong on the Influx side with loading a data source.

Sorry for the noob questions. I'll take any pointers you've got!

Since no one was showing interest I had not added to this. I will have to follow it along myself and see how it goes. I will see if I can get into to within the next couple of days.

1 Like

I did this with Docker containers, one for Grafana, that I had from another thing I play with (Tesla logging), and another for InfluxDB. This provides a lot more flexibility when it comes to modifying settings, and backup. My primary Win11 machine that's on 24/7 isn't required to run the containers. I can restore my backups to any of my machines, NAS, etc, without dealing with config/install junk.

I used to run both on Windows directly, and it just caused issues as things changed over the years.

1 Like

I'm interested in this, It's just been towards the bottom of the to-do list. I always willing to be a guinea pig if you are ok working with me..

Would you be interested in running it on Docker for Windows? As I look into this more, setting up both apps and then configuring Influx to run as a system service is a hassle in windows. Now that I have experience with docker, a single docker compose file could install and launch both applications with minimal effort. It is also cross-platform and could work on any system with Docker.

1 Like

Do you know how you want it to run. There are a ton of ways to get this stack potentially. Some are much simpler to setup then others.

I know he wants to run it on Windows. I really think Docker is going to be the way to go for an "easy" install. Not a pre-compiled image but just a pre-configured stack/compose file. I was looking at the options for Influx and you can specify in a compose file the default login / org and bucket. Might be able to pre-load Grafana with a data source pointing to Influx as well, need to check into that. That would make it a very simple install.

If people do not want to use docker honestly both Influx and Grafana have really good docs so its not hard to figure out on your own.

1 Like

I've never even looked at Docker, but Im willing to learn something new if you are game to guide me along in that too.

Ok so I am investigating Docker and just about have it figured out. Can pre-configure most of it with a docker-compose file. The one side effect of using Docker on Windows is by default it will allocate 2Gb of RAM to the WSL virtual system that runs the linux for Docker. Sort of makes me want to flop back to just doing a regular install.

I could use some help setting up InfluxDB via Docker Compose. I'm following this guide.

I have an influxDB folder created in my windows home directory (C:\Users\Justin). I also have three files in the home directory

image

In the influxDB directory, i have put the compose.yaml file exactly as they have it.

image

But I'm getting this error when running the compose command:

Not sure what to do with that. Help? (I don't know much at all about Docker....)

The thing that is suspicious to me is " error mounting "/run/desktop/mnt/host/c/Users/Justin/.env.influxdb2-admin-password" to rootfs" since that's not a valid path. How do I change it to where it goes for c/Users/Justin/.env.influxdb2-admin-password instead of starting with /run/desktop/mnt/host

(in case it matters, I already have a Docker container running an Obico server for my 3d printer)

I would just get rid of all that extra garbage and just put your admin username and password right into the compose file. Leave the token blank and it will generate one, unless you really want to make your own. After the container is up you could remove that stuff from the compose file as it will be saved within the database.

I am not sure if the "org" and "bucket" are required, otherwise it may just ask you when you log in the first time, thats how I have always done it.

I actually think you could just skip the entire "environment" section and just fire it up blank. If I remember correctly there is a web setup that walks you through it the first time if not setup already.

services:
  influxdb2:
    image: influxdb:2
    ports:
      - 8086:8086
    environment:
      DOCKER_INFLUXDB_INIT_MODE: setup
      DOCKER_INFLUXDB_INIT_USERNAME=<USERNAME>
      DOCKER_INFLUXDB_INIT_PASSWORD=<PASSWORD>
      DOCKER_INFLUXDB_INIT_ORG: home
      DOCKER_INFLUXDB_INIT_BUCKET: hubitat
    volumes:
      - type: volume
        source: influxdb2-data
        target: /var/lib/influxdb2
      - type: volume
        source: influxdb2-config
        target: /etc/influxdb2
volumes:
  influxdb2-data:
  influxdb2-config:

Ok that worked to get an instance up and running. :+1: When I enter the credentials into the web UI, though, it logs user unauthorized. Not sure what to do about that

If you tried it with setting the user/pass in the compose file, try blowing the container away and them removing the environment section totally and then start it up again. I suspect it will walk you through the setup when you first go to the web UI.

Hm. Didn't seem to start any setup in the web UI. Still just the login screen. In the log it says "msg=Unauthorized log_id=0rOpmiqW000 error="token required""

I've also tried the apparent default credentials of Administrator and Administrator1. (or Administrator1). But no luck. Sheesh.

One potential red flag is that there are no files created in my influxDB folder. But obviously something is running right because I get the UI when I go to the URL at port 8086. And Docker Desktop shows a container running.

Thanks for this guide. :grinning:

I chose to run InfluxDB on a Windows machine about a year ago. Data come from Hubitat Elevation and Home Assistant. I run the InfluxDB and Grafana add-ons inside Home Assistant, which is easy to configure.

One note for folks thinking of running Influx DB on Windows. When Windows runs an update and forces a reboot, Influx does not receive data until login is performed. This has happened to me a couple of times when I've been out of town. So I have a few gaps of 1-2 weeks in my data. It is possible to postpone automatic updates, but it's just one more thing to remember.

Caveat emptor.

1 Like

So...if you're running Home Assistant Add-Ons for InfluxDB and Grafana, does this imply that you're actually running Home Assistant Operating System (HAOS) in a Virtual Machine on top of MS Windows? If so, which Hypervisor are you using?

I run HAOS on a HA Yellow, and run InfluxDB, Grafana, Node-RED, NUT, etc... as HA Add-Ons. This is the easiest way I have found to run these containers. Previously, I ran both InfluxDB and Grafana directly on MS Windows as native x86 executables. They ran very well for years that way. I just wanted an easier to maintain solution for upgrades, as well as a lower electrical power solution. For my needs, the HA Yellow with a RPi CM4 module and a 1TB NVMe SSD has been working great.

Hi Dan @ogiewon

I'm running HAOS on an ODROID N2+ (HA Blue equivalent). I've since added an external SSD to the N2+, so perhaps I'll try to move InFluxDB to that drive some day. I just need to get motivated and re-learn how to move a database.

The PC is intended for a future project using Blue Iris to record camera footage etc. So, I figured, why not run Influx there? It seemed like a good idea at the time. :neutral_face: