InfluxDB+Grafana persistence and graphing

influxdb
graphs
grafana
Tags: #<Tag:0x00007fd30e1a7050> #<Tag:0x00007fd30e1a6f10> #<Tag:0x00007fd30e1a6d80>

(Renan Muniz) #508

Hello everyone, I’m having trouble setting up the dynamic webview element with javascript. I have already changed the panelPath in the smarthome-grafana.js file, but it still continues to display the panelPath: “/dashboard-solo/db/” but in my grafana it is “/d-solo/WPd-KqmRz/”.
I appreciate who can help.

EDIT:
I was doing it the right way, just my browser that was caching the wrong url.


(Max Bec) #509

Is there a chance to automatically reload the sitemap, when I change a Switch.
For example if I change the From-Date.

At the moment I always have to press reload in the browser.


(Jonas) #510

Hi! I am a litte stuck at the setup … I created db and users like described and edited the infulxdb.conf with the "sudo nano /usr/local/etc/influxdb.conf on my mac to:

  # Determines whether HTTP endpoint is enabled.
   enabled = true

  # The bind address used by the HTTP service.
   bind-address = ":8086"

  # Determines whether user authentication is enabled over HTTP/HTTPS.
   auth-enabled = true

but after a restart when i send “influx” to the terminal it does not want a pw.
when i try it with:

influx -username admin -password SuperSecretPassword123+ -host localhost

(of course with my pw)
it works as well - but again: i don’t need to enter username and pw, just influx and it connects …

installed influx with brew and the only thing i did differently is the launch at startup. i pasted what brew told me to do to launch at startup (using brew services) and not what is written on the influx-page


(John Schmitz) #511

It connects and you can query the database? Or have you only tried connecting? At the command line you can get connected without specifying a password, but you shouldn’t be able to query the data without supplying an “auth” command. See https://docs.influxdata.com/influxdb/v1.5/query_language/authentication_and_authorization/

What InfluxDB version are you using?


(Christos) #512

I have the same issue

Version 1.5.2


(John Schmitz) #513

And you have an “admin” user? InfluxDB says it won’t enforce authentication unless there is an admin user.

InfluxDB was restarted? Anything interesting in the /var/log/syslog file?


(Jonas) #514

thanks for pointing me to that …
i could not use the db. but admin can so everything is working properly. i feel dumb now :wink:


(Immo Compas) #515

I’m using Grafana with MariaDB. So far, Grafana works ok, but I don’t get any graphs included in HABPanels.
I have frame defined and as URL:

http://192.168.2.100:3000/d-solo/g9kwn_ZRk/daten-warmwasserpumpe?orgId=1&from=1528760963085&to=1528782563087&panelId=4

But there is nothing displayed.
Also, as webview with a local web page, I can not get anything displayed.

<!DOCTYPE html>
<html>
<head>
        <meta http-equiv="Content-type" CONTENT="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="charts.css" />
</head>

    <div class="container">
        <iframe src="http://192.168.2.100:3000/d-solo/g9kwn_ZRk/daten-warmwasserpumpe?orgId=1&panelId=4&from=1528715508468&to=1528737108468" width="450" height="200" frameborder="0"></iframe>
    </div>
</html>

Widget definition looks like this:

<div>
	<iframe style=" width: 100%;height: 500px; frameborder = 0" src="/static/chartLeistung.html" ></iframe>
</div>

(Kim Andersen) #516

I´m installing influxdb and Grafana on a Rpi3. I followed the tutorial, from message 84 installing influx and grafana on an Rpi3. I got no erros.
I came as far as the above step, (this quote). And I can not reach grafana using http://monitoring-host:3000.

But I´m confused wether I should continue to follow the instructions for grafana first, as mentioned above in this quote, or was it done when I installed it from message 84?


(Vincent Regaud) #517

@Kim_Andersen

replace monitoring-host with the IP where grafana is installed. eg: http://192.168.0.47:3000


(Kim Andersen) #518

Ohh I did. I end up with an timeout in chrome. Guess either Grafana isn´t running or something is wrong. I did start the service according to message 84, without any erros…

My worries is, wether I´m suppose to “Follow the installation instructions , to install Grafana on your monitoring-host .” , as mentioned in message 1, when I have done the installation according to message 84 (Rpi installation). I havn´t “Follow the installation instructions , to install Grafana on your monitoring-host .” , which might explain why I end up with an timeout. I just find it difficult, as I thought I was installing Grafana in Message 84.


(John Schmitz) #519

Message 84 describes installing both InfluxDB and Grafana. You should probably recheck each step in the Grafana installation section and make sure it gets installed without errors.

Note that Grafana is now supporting ARM directly with their new beta 5.2 release, but you may want to work with the known working version. Here’s the 5.2 beta:


(Kim Andersen) #520

These are the steps I followed from message 84 regarding Grafana: (I took a copy of the cli terminal).

[00:38:22] openhabian@openHABianPi:~$ echo "deb https://dl.bintray.com/fg2it/deb jessie main" | sudo tee /etc/apt/sources.list.d/grafana-fg2it.list
deb https://dl.bintray.com/fg2it/deb jessie main
[00:39:00] openhabian@openHABianPi:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.NI1N4lsw81 --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61
gpg: requesting key D401AB61 from hkp server keyserver.ubuntu.com
gpg: key D401AB61: public key "Bintray (by JFrog) <bintray@bintray.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
[00:39:19] openhabian@openHABianPi:~$ sudo apt-get update && sudo apt-get install grafana
Hit http://mirrordirector.raspbian.org jessie InRelease
Hit http://archive.raspberrypi.org jessie InRelease
Hit https://deb.nodesource.com jessie InRelease
Ign http://repos.azulsystems.com stable InRelease
Hit https://repos.influxdata.com jessie InRelease
Get:1 https://dl.bintray.com jessie InRelease
Ign https://dl.bintray.com jessie InRelease
Hit http://repos.azulsystems.com stable Release.gpg
Get:2 https://dl.bintray.com stable InRelease
Ign https://dl.bintray.com stable InRelease
Hit http://repos.azulsystems.com stable Release
Get:3 https://dl.bintray.com jessie Release.gpg [821 B]
Hit http://mirrordirector.raspbian.org jessie/main armhf Packages
Hit https://dl.bintray.com stable Release.gpg
Hit http://mirrordirector.raspbian.org jessie/contrib armhf Packages
Get:4 https://dl.bintray.com jessie Release [5,298 B]
Hit http://archive.raspberrypi.org jessie/main armhf Packages
Hit https://deb.nodesource.com jessie/main Sources
Hit https://dl.bintray.com stable Release
Hit http://mirrordirector.raspbian.org jessie/non-free armhf Packages
Hit https://deb.nodesource.com jessie/main armhf Packages
Hit http://archive.raspberrypi.org jessie/ui armhf Packages
Hit http://mirrordirector.raspbian.org jessie/rpi armhf Packages
Get:5 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
Hit https://repos.influxdata.com jessie/stable armhf Packages
Hit http://repos.azulsystems.com stable/main armhf Packages
Get:6 https://repos.influxdata.com jessie/stable Translation-en_US [151 B]
Get:7 https://repos.influxdata.com jessie/stable Translation-en [151 B]
Get:8 https://deb.nodesource.com jessie/main Translation-en [162 B]
Get:9 https://dl.bintray.com jessie/main armhf Packages [6,316 B]
Get:10 https://repos.influxdata.com jessie/stable Translation-en_US.UTF-8 [151 B]
Get:11 https://repos.influxdata.com jessie/stable Translation-en_US [151 B]
Get:12 https://repos.influxdata.com jessie/stable Translation-en [151 B]
Get:13 https://dl.bintray.com jessie/main Translation-en_US
Get:14 https://dl.bintray.com jessie/main Translation-en
Get:15 https://deb.nodesource.com jessie/main Translation-en_US.UTF-8 [162 B]
Get:16 https://dl.bintray.com jessie/main Translation-en_US.UTF-8
Get:17 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
Hit https://dl.bintray.com stable/main armhf Packages
Get:18 https://deb.nodesource.com jessie/main Translation-en [162 B]
Get:19 https://dl.bintray.com stable/main Translation-en_US
Get:20 https://dl.bintray.com stable/main Translation-en
Get:21 https://dl.bintray.com stable/main Translation-en_US.UTF-8
Get:22 https://repos.influxdata.com jessie/stable Translation-en_US.UTF-8 [151 B]
Get:23 https://repos.influxdata.com jessie/stable Translation-en_US [151 B]
Get:24 https://dl.bintray.com jessie/main Translation-en_US
Get:25 https://repos.influxdata.com jessie/stable Translation-en [151 B]
Get:26 https://dl.bintray.com jessie/main Translation-en
Get:27 https://dl.bintray.com jessie/main Translation-en_US.UTF-8
Get:28 https://dl.bintray.com stable/main Translation-en_US
Get:29 https://dl.bintray.com stable/main Translation-en
Get:30 https://repos.influxdata.com jessie/stable Translation-en_US.UTF-8 [151 B]
Get:31 https://dl.bintray.com stable/main Translation-en_US.UTF-8
Get:32 https://repos.influxdata.com jessie/stable Translation-en_US [151 B]
Get:33 https://repos.influxdata.com jessie/stable Translation-en [151 B]
Get:34 https://deb.nodesource.com jessie/main Translation-en_US.UTF-8 [162 B]
Get:35 https://dl.bintray.com jessie/main Translation-en_US
Get:36 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
Get:37 https://dl.bintray.com jessie/main Translation-en
Get:38 https://deb.nodesource.com jessie/main Translation-en [162 B]
Get:39 https://dl.bintray.com jessie/main Translation-en_US.UTF-8
Get:40 https://dl.bintray.com stable/main Translation-en_US
Get:41 https://repos.influxdata.com jessie/stable Translation-en_US.UTF-8 [151 B]
Get:42 https://dl.bintray.com stable/main Translation-en
Get:43 https://repos.influxdata.com jessie/stable Translation-en_US [151 B]
Ign https://repos.influxdata.com jessie/stable Translation-en_US
Get:44 https://repos.influxdata.com jessie/stable Translation-en [151 B]
Ign https://repos.influxdata.com jessie/stable Translation-en
Get:45 https://dl.bintray.com stable/main Translation-en_US.UTF-8
Get:46 https://dl.bintray.com jessie/main Translation-en_US
Get:47 https://dl.bintray.com jessie/main Translation-en
Get:48 https://dl.bintray.com jessie/main Translation-en_US.UTF-8
Get:49 https://repos.influxdata.com jessie/stable Translation-en_US.UTF-8 [151 B]
Ign https://repos.influxdata.com jessie/stable Translation-en_US.UTF-8
Get:50 https://dl.bintray.com stable/main Translation-en_US
Get:51 https://dl.bintray.com stable/main Translation-en
Get:52 https://deb.nodesource.com jessie/main Translation-en_US.UTF-8 [162 B]
Get:53 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
Get:54 https://dl.bintray.com stable/main Translation-en_US.UTF-8
Get:55 https://deb.nodesource.com jessie/main Translation-en [162 B]
Ign http://archive.raspberrypi.org jessie/main Translation-en_US
Get:56 https://dl.bintray.com jessie/main Translation-en_US
Ign https://dl.bintray.com jessie/main Translation-en_US
Ign http://archive.raspberrypi.org jessie/main Translation-en
Get:57 https://dl.bintray.com jessie/main Translation-en
Ign https://dl.bintray.com jessie/main Translation-en
Get:58 https://dl.bintray.com jessie/main Translation-en_US.UTF-8
Ign https://dl.bintray.com jessie/main Translation-en_US.UTF-8
Ign http://archive.raspberrypi.org jessie/main Translation-en_US.UTF-8
Get:59 https://dl.bintray.com stable/main Translation-en_US
Ign https://dl.bintray.com stable/main Translation-en_US
Ign http://archive.raspberrypi.org jessie/ui Translation-en_US
Get:60 https://dl.bintray.com stable/main Translation-en
Ign https://dl.bintray.com stable/main Translation-en
Get:61 https://deb.nodesource.com jessie/main Translation-en_US.UTF-8 [162 B]
Get:62 https://deb.nodesource.com jessie/main Translation-en_US [162 B]
Ign https://deb.nodesource.com jessie/main Translation-en_US
Get:63 https://dl.bintray.com stable/main Translation-en_US.UTF-8
Get:64 https://deb.nodesource.com jessie/main Translation-en [162 B]
Ign https://dl.bintray.com stable/main Translation-en_US.UTF-8
Ign https://deb.nodesource.com jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_US.UTF-8
Get:65 https://deb.nodesource.com jessie/main Translation-en_US.UTF-8 [162 B]
Ign https://deb.nodesource.com jessie/main Translation-en_US.UTF-8
Ign http://repos.azulsystems.com stable/main Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_US.UTF-8
Ign http://repos.azulsystems.com stable/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_US.UTF-8
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://repos.azulsystems.com stable/main Translation-en_US.UTF-8
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_US.UTF-8
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_US.UTF-8
Fetched 12.4 kB in 7s (1,670 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  triggerhappy
Use 'apt-get autoremove' to remove it.
The following NEW packages will be installed:
  grafana
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 48.5 MB of archives.
After this operation, 131 MB of additional disk space will be used.
Get:1 https://dl.bintray.com/fg2it/deb/ jessie/main grafana armhf 5.1.3 [48.5 MB]
Fetched 48.5 MB in 12s (3,788 kB/s)
[master 2d90ed7] saving uncommitted changes in /etc prior to apt run
 Author: openhabian <openhabian@openHABianPi>
 3 files changed, 2 insertions(+)
 create mode 100644 apt/sources.list.d/grafana-fg2it.list
Selecting previously unselected package grafana.
(Reading database ... 43404 files and directories currently installed.)
Preparing to unpack .../grafana_5.1.3_armhf.deb ...
Unpacking grafana (5.1.3) ...
Processing triggers for systemd (215-17+deb8u7) ...
Setting up grafana (5.1.3) ...
Adding system user `grafana' (UID 111) ...
Adding new user `grafana' (UID 111) with group `grafana' ...
Not creating home directory `/usr/share/grafana'.
### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd
 sudo /bin/systemctl daemon-reload
 sudo /bin/systemctl enable grafana-server
### You can start grafana-server by executing
 sudo /bin/systemctl start grafana-server
Processing triggers for systemd (215-17+deb8u7) ...
[master 528cd84] committing changes in /etc after apt run
 Author: openhabian <openhabian@openHABianPi>
 19 files changed, 799 insertions(+)
 create mode 100644 default/grafana-server
 create mode 100644 grafana/grafana.ini
 create mode 100644 grafana/ldap.toml
 create mode 100644 grafana/provisioning/dashboards/sample.yaml
 create mode 100644 grafana/provisioning/datasources/sample.yaml
 create mode 100755 init.d/grafana-server
Updating FireMotD available updates count ...
[00:40:45] openhabian@openHABianPi:~$ sudo systemctl daemon-reload
[00:41:01] openhabian@openHABianPi:~$ sudo systemctl enable grafana-server.service
Synchronizing state for grafana-server.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d grafana-server defaults
Executing /usr/sbin/update-rc.d grafana-server enable
Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service.
[00:41:11] openhabian@openHABianPi:~$ sudo systemctl start grafana-server.service

To me, this looks like Grafana is started.
But I get an timeout when i try: (IP of my Rpi).
http://10.4.28.137:3000

EDIT…
Damit, ignore the above. Grafana is running just fine. Just me testing the wrong IP… Sorry for taking your time… Saw it as soon as I had written the above… IP is not 137, but 237… No wonder why I´d get an timeout :frowning:


(Udo Hartmann) #521

What’s the output of

systemctl status grafana-server.service

?

Ah. Problem solved already…


(Kim Andersen) #522

Sorry Udo… My mistake… Grafana is running… I made an typo mistake in chrome… Wrong IP :frowning:


(Kim Andersen) #523

Did you get your problem fixed?
I have the same problem. Image not showing in sitemap…
I think it might be due to user restrictions. If I put the url in the adress line of the browser, I´m beeing promted for user details.

Not really sure why.
This is what I would suspect allowed anonymous access to the link (from my grafana.ini)

#################################### Anonymous Auth ##########################
[auth.anonymous]
# enable anonymous access
enabled = true

(John Schmitz) #524

check your grafana.log - maybe you are seeing this issue and need to set the organization? Or the grafana.log will tell you something else is wrong.


(Kim Andersen) #525

Hmm, tried to set the organisation to Openhab… No go…

This is grafana.log

t=2018-06-16T17:09:58+0200 lvl=info msg="Stopped Alerting" logger=alerting.engine reason="context canceled"
t=2018-06-16T17:09:58+0200 lvl=info msg="Grafana shutdown completed." code=0
t=2018-06-16T17:09:58+0200 lvl=info msg="Starting Grafana" logger=server version=5.1.3 commit=0871432 compiled=2018-05-16T17:39:55+0200
t=2018-06-16T17:09:58+0200 lvl=info msg="Config loaded from" logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2018-06-16T17:09:58+0200 lvl=info msg="Config loaded from" logger=settings file=/etc/grafana/grafana.ini
t=2018-06-16T17:09:58+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.data=/var/lib/grafana"
t=2018-06-16T17:09:58+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.logs=/var/log/grafana"
t=2018-06-16T17:09:58+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.plugins=/var/lib/grafana/plugins"
t=2018-06-16T17:09:58+0200 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.provisioning=/etc/grafana/provisioning"
t=2018-06-16T17:09:58+0200 lvl=info msg="Path Home" logger=settings path=/usr/share/grafana
t=2018-06-16T17:09:58+0200 lvl=info msg="Path Data" logger=settings path=/var/lib/grafana
t=2018-06-16T17:09:58+0200 lvl=info msg="Path Logs" logger=settings path=/var/log/grafana
t=2018-06-16T17:09:58+0200 lvl=info msg="Path Plugins" logger=settings path=/var/lib/grafana/plugins
t=2018-06-16T17:09:58+0200 lvl=info msg="Path Provisioning" logger=settings path=/etc/grafana/provisioning
t=2018-06-16T17:09:58+0200 lvl=info msg="App mode production" logger=settings
t=2018-06-16T17:09:58+0200 lvl=info msg="Writing PID file" logger=server path=/var/run/grafana/grafana-server.pid pid=11812
t=2018-06-16T17:09:58+0200 lvl=info msg="Initializing DB" logger=sqlstore dbtype=sqlite3
t=2018-06-16T17:09:58+0200 lvl=info msg="Starting DB migration" logger=migrator
t=2018-06-16T17:09:58+0200 lvl=info msg="Executing migration" logger=migrator id="copy data account to org"
t=2018-06-16T17:09:58+0200 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account to org"
t=2018-06-16T17:09:58+0200 lvl=info msg="Executing migration" logger=migrator id="copy data account_user to org_user"
t=2018-06-16T17:09:58+0200 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account_user to org_user"
t=2018-06-16T17:09:58+0200 lvl=info msg="Starting plugin search" logger=plugins
t=2018-06-16T17:09:58+0200 lvl=info msg="Initializing Alerting" logger=alerting.engine
t=2018-06-16T17:09:58+0200 lvl=info msg="Initializing CleanUpService" logger=cleanup
t=2018-06-16T17:09:58+0200 lvl=info msg="Initializing Stream Manager"
t=2018-06-16T17:09:58+0200 lvl=info msg="Initializing HTTP Server" logger=http.server address=0.0.0.0:3000 protocol=http subUrl= socket=
t=2018-06-16T17:11:19+0200 lvl=eror msg="Failed to get user with id" logger=context userId=1 error="User not found"
t=2018-06-16T17:11:19+0200 lvl=eror msg="Anonymous access organization error: 'openhab': Organization not found"
t=2018-06-16T17:11:19+0200 lvl=info msg="Request Completed" logger=context userId=0 orgId=0 uname= method=GET path=/api/annotations status=401 remote_addr=10.4.28.30 time_ms=22 size=26 r$



(John Schmitz) #526

Pretty clear that the organization is a problem, but I’m not an expert on this:

eror msg="Failed to get user with id" logger=context userId=1 error="User not found"
eror msg="Anonymous access organization error: 'openhab': Organization not found"

I think you may want to make the organization name in your Configuration/Preferences to match the organization you are using in the auth.anonymous section.


(Kim Andersen) #527

Tried, and still no go. At least I get no errors in the logfile, but BasicUI wont show the dashboard.