question

kevinc-63559 avatar image
kevinc-63559 asked

Grafana on Linux without docker?

I have Grafana up and running via Docker on a local web server, but would prefer to run the components native. Doing so would enable automatic software updates when the system is updated.

Obviously need Grafana installed, it is. Obviously need InfluxDB installed, it is. Easy enough to export my Grafana dashboard and import it to a new system. However I'm clueless how to link InfluxDB to my Cerbo to gather the statistics. Am I missing other parts? I see the (4) docker containers... Influx and Grafana are just two of those....

Anyone happen to have a walkthrough (or just hints) on doing this?

grafanalinux
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
johnny-brusevold avatar image
johnny-brusevold answered ·

I made a note for how to run grafana and influxdb with venus influx loader on a pi5 with raspberry pi os. Works perfectly for me.


influx  grafana  venus-influx-loader   on pi5  Raspberry Pi OS with desktop 64 bit
----------------------------------------------------------------------------------------------------------------------------------------

install influx

sudo apt update
sudo apt upgrade

curl https://repos.influxdata.com/influxdata-archive.key | gpg --dearmor | sudo tee /usr/share/keyrings/influxdb-archive-keyring.gpg >/dev/null

echo "deb [signed-by=/usr/share/keyrings/influxdb-archive-keyring.gpg] https://repos.influxdata.com/debian bullseye stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

sudo apt update
sudo apt install influxdb

sudo nano /etc/influxdb/influxdb.conf
edit line 15
# Bind address to use for the RPC service for backup and restore.
# bind-address = "127.0.0.1:8088"
bind-address = "127.0.0.1:8068"

save

sudo systemctl unmask influxdb
sudo systemctl enable influxdb
sudo systemctl start influxdb

--------------------------------------------------------------------------------

install grafana

curl https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/grafana-archive-keyrings.gpg >/dev/null

echo "deb [signed-by=/usr/share/keyrings/grafana-archive-keyrings.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

sudo apt update
sudo apt install grafana
sudo systemctl enable grafana-server
sudo systemctl start grafana-server

-------------------------------------------------------------------------

install npm

sudo apt install npm

sudo mkdir /etc/venus-influx-loader
sudo mkdir /etc/venus-influx-loader/config
sudo nano /etc/venus-influx-loader/config/config.json

add to config.jsom, change "hostName": " ip " to your other pi's ip, "change retention time to "inf")?"
------------------------------------------------------------------------
{
  "upnp": {
    "enabled": false,
    "enabledPortalIds": []
  },
  "vrm": {
    "enabled": false,
    "enabledPortalIds": []
  },
  "manual": {
    "enabled": true,
    "hosts": [
      {
        "hostName": "192.168.1.101",
        "enabled": true
      }
    ]
  },
  "influxdb": {
    "host": "127.0.0.1",
    "port": "8086",
    "username": "",
    "password": "",
    "database": "venus",
    "retention": "30d"
  }
}
--------------------------------------------------------

cd /usr/lib/
sudo git clone https://github.com/victronenergy/venus-influx-loader.git
cd venus-influx-loader
sudo npm install

----------------------------------------------------------

sudo nano /lib/systemd/system/influx-loader.service

add to file
----------------------------------------------------------
[Unit]
 Description=influx loader Service
 After=multi-user.target

 [Service]
 Type=idle
 ExecStart=/usr/lib/venus-influx-loader/bin/venus-influx-loader.js --disable-admin-api --disable-grafana-api -c /etc/venus-influx-loader/config

 [Install]
 WantedBy=multi-user.target
------------------------------------------------------------
save and exit
 
sudo chmod 644 /lib/systemd/system/influx-loader.service
sudo systemctl daemon-reload
sudo systemctl enable influx-loader.service

"enable MQTT on your venusOS pi"

sudo reboot

runing on port 3000
db venus
import your venus-grafana favorit dashboard
8 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

northtown2022 avatar image northtown2022 commented ·

@Johnny Brusevold I followed your directions and got everything installed on a Pi5. Thank you!

I did get some type of permission error trying to save the edited config.json but after searching it up found that adding 'sudo' before the command allowed it to work:

sudo nano /etc/venus-influx-loader/config/config.json


After everything was installed I imported a dashboard I'm currently running on a Pi4.

I also added Infulxdb as my data source in Grafana and edited in my credentials etc..


I am getting this error in my Grafana dashboard:

Datasource c0c900db-5de0-4efc-b633-5a3f4782db42 was not found

Any ideas?

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold northtown2022 commented ·

@NorthTown2022

Check your data source, with me it is set to venus, and data from venus_default

ikke-navngitt.jpg


Edit

Something I figured out on the fly, I had some problems with id, which was solved by selecting 'export for sharing externaly' under export


ikke-navngitt2.jpg


added sudo to the note

1 Like 1 ·
ikke-navngitt.jpg (184.5 KiB)
ikke-navngitt2.jpg (30.1 KiB)
northtown2022 avatar image northtown2022 commented ·

My limited understanding of Node-RED, Influx and Grafana has me stuck.

I'm trying to use my existing flow and influxdb data source but it's just not happening. This is the flow I'm currently using with the Pi4 and trying to use with the Pi5.node-red-flow.png

I don't have npm installed on Pi4. Is it used in place of Node-Red on Pi5?


0 Likes 0 ·
node-red-flow.png (36.9 KiB)
johnny-brusevold avatar image johnny-brusevold northtown2022 commented ·

@NorthTown2022

venus-influx-loader is the program that sets up the database in influx, and listens for the mqtt data stream that is sent from a venus device on port 8086 and forwards it to the database in influxdb


npm is the library used by venus-influx-loader


If you are not going to use venus-influx-loader, you must create the database manually.

1 Like 1 ·
northtown2022 avatar image northtown2022 johnny-brusevold commented ·

@Johnny Brusevold

I'm not planning to make things work differently, that's way beyond my scope! :) I thought I needed to use Node-RED as well but I'm pretty sure I've come to the conclusion that Venus OS Large is NOT needed here (unlike my other installation).

MQTT is enabled in the remote console of the Cerbo GX (192.168.2.104)

I've set the bind-address = "127.0.0.1:8068"

I set hostName = 192.168.2.104

I've imported several dashboards and keep getting the error 'database not found: venus' on all of them.

1710638982390.jpeg

Database is renamed to "venus". What am I missing here?1710638795412.jpeg

0 Likes 0 ·
1710638982390.jpeg (67.5 KiB)
johnny-brusevold avatar image johnny-brusevold northtown2022 commented ·

@NorthTown2022

I can't see all your settings from your screenshot,

but you need to enable 'Basic auth'


2024-03-17-1.png

2024-03-17-3.png


-1 Like -1 ·
2024-03-17-1.png (153.1 KiB)
2024-03-17-3.png (155.8 KiB)
northtown2022 avatar image northtown2022 johnny-brusevold commented ·

@Johnny Brusevold

I toggled 'Basic auth' on and rebooted but still the same error. I zoomed in on your screenshot best I could. Think my settings are the same.

1710683553077.png


I found some commands to find database but there is no venus?

1710683520958.png


0 Likes 0 ·
1710683520958.png (7.1 KiB)
1710683553077.png (111.2 KiB)
johnny-brusevold avatar image johnny-brusevold northtown2022 commented ·

I found a misspelling in the guide above, a missing 'l'

-c /etc/venus-influx-oader/config

should have been

-c /etc/venus-influx-loader/config


You can also create the database from the influx cli

CREATE DATABASE venus
1 Like 1 ·
northtown2022 avatar image
northtown2022 answered ·

@Johnny Brusevold

Success! I can see measurements now.

1710706892717.png




1710706892717.png (10.7 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

johnny-brusevold avatar image
johnny-brusevold answered ·

@KevinC_63559

It derailed a bit from what kevinc was asking, since I didn't have the answer.

But looked through a bit, and there wasn't much difference from pi5 to ubuntu/deb

The guide below has been tested on linux Ubuntu 22.04 lts and works flawlessly. I hope I haven't made any typos this time.


and you cannot use influxdb2


influx  grafana  venus-influx-loader   on Linux Ubuntu 22.04 64 bit
----------------------------------------------------------------------------------------------------------------------------------------

install influx

sudo apt update
sudo apt upgrade

curl -fsSL https://repos.influxdata.com/influxdata-archive_compat.key|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/influxdata.gpg

echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list

sudo apt update && sudo apt install influxdb


sudo nano /etc/influxdb/influxdb.conf
edit line 15
# Bind address to use for the RPC service for backup and restore.
# bind-address = "127.0.0.1:8088"
bind-address = "127.0.0.1:8068"

save

sudo systemctl enable --now influxdb

-------------------------------------------------------------------------------
note

TCP port 8068 is used for the RPC service for backup and restor

--------------------------------------------------------------------------------

install grafana

sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null

echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

sudo apt update
sudo apt install grafana
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl enable grafana-server.service

-------------------------------------------------------------------------
note
Default ubuntu 22.04 nodejs is to old for venus-influx-loader
Either you have to upgrade your existing node-js or uninstall it to install this upgraded one, or change version with nvm

The version below (20.x) has nvm built in
--------------------------------------------------

install node-js

cd ~
curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs
node -v

sudo mkdir /etc/venus-influx-loader
sudo mkdir /etc/venus-influx-loader/config
nano /etc/venus-influx-loader/config/config.json

add to config.jsom, change "hostName": " ip " to your other pi/venus device ip, "change retention time to "xxd" for numer of days or "inf" forever)?"
------------------------------------------------------------------------
{
  "upnp": {
    "enabled": false,
    "enabledPortalIds": []
  },
  "vrm": {
    "enabled": false,
    "enabledPortalIds": []
  },
  "manual": {
    "enabled": true,
    "hosts": [
      {
        "hostName": "192.168.1.101",
        "enabled": true
      }
    ]
  },
  "influxdb": {
    "host": "127.0.0.1",
    "port": "8086",
    "username": "",
    "password": "",
    "database": "venus",
    "retention": "30d"
  }
}
--------------------------------------------------------

cd /usr/lib/
sudo git clone https://github.com/victronenergy/venus-influx-loader.git
cd venus-influx-loader
sudo npm install
sudo npm install -g npm@10.5.0

----------------------------------------------------------

sudo nano /lib/systemd/system/influx-loader.service

add to file
----------------------------------------------------------
[Unit]
 Description=influx loader Service
 After=multi-user.target

 [Service]
 Type=idle
 ExecStart=/usr/lib/venus-influx-loader/bin/venus-influx-loader.js --disable-admin-api --disable-grafana-api -c /etc/venus-influx-oader/config

 [Install]
 WantedBy=multi-user.target

------------------------------------------------------------
save and exit
 
sudo chmod 644 /lib/systemd/system/influx-loader.service
sudo systemctl daemon-reload
sudo systemctl enable influx-loader.service

"enable MQTT on your venusOS pi"

sudo reboot

runing on port 3000
db venus
URL http://localhost:8086 (this is grayed out, so you have to fill in)
enable 'Basic auth'

import your venus-grafana favorit dashboard
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.