InfluxDB+Grafana persistence and graphing

Its a good way to try/test it. I´m very pleased with how Grafana runs on my windows server. Very fast and simple setup, and hardly take any resources. I´ll never ever again have it run on a Rpi or simular again…

When moving over on the right part, a scroll line appear!
Without move-over there is NO hint that there are more lines!

It’s even harder in the Android app, where the scroll bar never appears.
I did not yet find a full solution for this issue, but only some workarounds.
Most of them depend on the height of the graph.
In grafana web interface you can increase height by pulling the handle down.
When using the embedded image method, you can work with &height=700 or the like.
When using the webview library by wborn, you can play with the height parameter in html/panel-300px.css.
The higher the panel is, the more space you have in the legend…
If someone has a better solution for this (meaning that the legend is always shown completely), I’ll very interested in this.

Update:
I just found the root cause and in consequence another workaround:
The root cause can be found in /usr/share/grafana/public/sass/components/_panel_graph.scss. There you find the following (reduced to relevant lines):

.graph-panel__chart {
  min-height: 65%;
}
.graph-legend {
  max-height: 35%;
}

This implies, that the legend can only take 35% of the output. If you change this from 65/35 to 10/90, the legend will usually be displayed completely.
One little problem: the above sccs file seems to be there for information only but it has to be compiled first.
For this you can either install the source distribution and compile it yourself, or you go the ugly way, that I took for testing and this is to patch /usr/share/grafana/public/build/grafana.light.9d62d98149547e1107ad.css (or how the file you are using is named, maybe the dark one).
This isn’t very well readable, but with a good editor like emacs you will be able to find and replace the two numbers above.
Now a restart of grafana-server may be necessary.

To see an effect with the wborn webview, you need to set render=true (which breaks the horizontal scrolling in my Android app for the legend :frowning: )

Thanks for posting this. That really saved me a lot of time!

Hello,

I seem to have lost access to my Grafana reports some weeks ago (I believe it is as the occasion of the upgrade of Grafana via apt-get upgrade).

What I get is a white page when I access http://my.openhab.ip.address:3000
Some info on the status of the grafana server and the netstat:

[00:13:30] openhabian@openHABianPi:~$ sudo systemctl status grafana-server
● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled)
   Active: active (running) since Sun 2019-07-21 00:10:08 CEST; 7min ago
     Docs: http://docs.grafana.org
 Main PID: 23016 (grafana-server)
   CGroup: /system.slice/grafana-server.service
           └─23016 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:def...

Jul 21 00:10:09 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:09+0200 lvl=info msg="Starting DB migration" logger=migrator
Jul 21 00:10:09 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:09+0200 lvl=info msg="Executing migration" logger=migrator id="copy data account to org"
Jul 21 00:10:09 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:09+0200 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account to org"
Jul 21 00:10:09 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:09+0200 lvl=info msg="Executing migration" logger=migrator id="copy data account_user to org_user"
Jul 21 00:10:09 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:09+0200 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account_user to org_user"
Jul 21 00:10:09 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:09+0200 lvl=info msg="Starting plugin search" logger=plugins
Jul 21 00:10:10 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:10+0200 lvl=info msg="Initializing Alerting" logger=alerting.engine
Jul 21 00:10:10 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:10+0200 lvl=info msg="Initializing CleanUpService" logger=cleanup
Jul 21 00:10:10 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:10+0200 lvl=info msg="Initializing Stream Manager"
Jul 21 00:10:10 openHABianPi grafana-server[23016]: t=2019-07-21T00:10:10+0200 lvl=info msg="Initializing HTTP Server" logger=http.server address=0.0.0.0:3000 protocol=http subUrl= socket=
[00:17:42] openhabian@openHABianPi:~$ sudo netstat -tulpn4 | grep 3000
[00:17:56] openhabian@openHABianPi:~$

I guess something went wrong with the upgrade… and grafana is not restarting properly, and does not get to the point of listening on port 3000? Any opinion on what I should do to get back to normal?

Thanks,

I just realized after having ran “reinstall” for grafana, that it seems I’m still with version 5.1.4… I’m on a standard openhabian install, I’m not sure why the apt-get update & upgrade did not upgrade grafana?
Also, when I look at the reporsitory file for grafana, this is what I see… Not sure it is normal?

> [12:14:38] openhabian@openHABianPi:~$ more /etc/apt/sources.list.d/gra*
> deb https://dl.bintray.com/fg2it/deb jessie main
> [12:15:10] openhabian@openHABianPi:~$

Ok, I followed this info and ran apt-get upgrade, it installed grafana 6.2 and all seems ok, I have again access to my Grafana dashboards… Not exactly sure of why and how I got there, but all seems ok now.

Hi. Why do not I see all the sources in Grafana? There is only part of Items.
My Influxdb.persist:

Strategies
{
everyMinute : "0 * * * * ?"
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
default = everyChange
}

Items {
* : strategy = everyChange 
}

In order to see an item in Grafana, make sure the item has updated. Then it should be available.

How to check?

If you got a sitemap, look to see if the items has updated.
Otherweise you could use the API Docs.

I do not know why but the addition of new items and another reboot helped. Earlier reboots did not help.

Well I silently read (and learned) tons of stuff here in the openhab community forums.

Now I am at a point where I need help (and actually feel pretty dumb):
I followed @pahansen Tutorial on 'webview element" for implementing my grafana output rather than letting my RPi render images (which takes very long and sometimes they do not refresh in the app).

I have the chartshour, -day and week.html as well as the charts.css in my conf/html folder.
I added the suggested part in my sitemap-file and changed filepaths from relative to absolute.
The logs give me the following output after updating my sitemap:

[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Charts' for widget org.eclipse.smarthome.model.sitemap.Text
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Charts' for widget org.eclipse.smarthome.model.sitemap.Text
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Charts' for widget org.eclipse.smarthome.model.sitemap.Text
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
[WARN ] [basic.internal.render.SwitchRenderer] - Cannot determine item type of 'weatherChartPeriod'
org.eclipse.smarthome.core.items.ItemNotFoundException: Item 'weatherChartPeriod' could not be found in the item registry

{loads of java error, removed for better readability}

[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'weatherChartPeriod' for widget org.eclipse.smarthome.model.sitemap.Switch
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'weatherChartPeriod' for widget org.eclipse.smarthome.model.sitemap.Switch
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'weatherChartPeriod' for widget org.eclipse.smarthome.model.sitemap.Switch
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'weatherChartPeriod' for widget org.eclipse.smarthome.model.sitemap.Switch
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve visibility item weatherChartPeriod for widget org.eclipse.smarthome.model.sitemap.Webview
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve visibility item weatherChartPeriod for widget org.eclipse.smarthome.model.sitemap.Webview
[ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve visibility item weatherChartPeriod for widget org.eclipse.smarthome.model.sitemap.Webview

and this is the result in basic ui:

In the OH App at least the switch at the top shows “Hour Day Week” and inside the frames it gives error

net::ERR_BLOCKED_BY_RESPONSE

What am I missing? Thanks for your help and have a nice weekend!

Ok, so the net::ERR_BLOCKED_BY_RESPONSE could be solved with uncommenting “allow_embedding=true” in grafana.ini and restarting grafana-server (sudo systemctl restart grafana-server)

Somehow I still can’t get the switch to work (I don’t need it but I am curious about what the heck I am missing)

It is a icon that is missing in OH2. You can either add a icon=“none” to your sitemap-item or download the respective icon:

wget "https://raw.githubusercontent.com/elementary/icons/master/status/128/dialog-information.svg" -O /etc/openhab2/icons/classic/webview.svg
1 Like

You’ve named an Item in your sitemap that doesn’t exist in openHAB. Item names are case sensitive.

Are there any workarounds or issues which standout that could be integrated or fixed within the openHABian project?
Anyone mind summerise it for me?

Thank you - thats it!:slightly_smiling_face:

Item names are case sensitive

Damn, classical typo :smiley:
Thanks for pointing out

What’s the fastest way with curl to see if items are recording the values?

Querying the database directly with curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=mydb" --data-urlencode "q=SELECT * FROM \"cpu_load_short\"

otherwise using the cli is even faster. If you don’t see any response or the there are not the values that you expect, then you know that it’s not being recorded

1 Like