InfluxDB+Grafana persistence and graphing

My apologies,

A part of my original question was lost. I thought my persistence file was there but clearly it isn’t…

I currently have this:

Strategies {
    everyMinute : "0 * * ? * *"
}
Items {
    BroadlinkA1192168112_Temperature  : strategy = everyChange, everyMinute, restoreOnStartup
}

Seems to be working now, the problem was the refresh rate of the webif of grafana

Perhaps this tutorial needs to be updated a bit:

Raspberry PI is now officialy supported so I switched to the official repo instead of https://github.com/fg2it/grafana-on-raspberry.

When doing so, anonymous access was not working.
It needed two more changes in the configuration ini file to work with the latest version

[auth.anonymous]
# enable anonymous access
enabled = true
# specify organization name that should be used for unauthenticated users
org_name = YOURORGANIZATION
# specify role for unauthenticated users
org_role = Viewer

I don’t remember when the org name is set, but you can find it in the grafana settings, under server admin menu.

Aymeric

1 Like

A long thread …

I have running influx and grafana on my Raspberry, and was able to see a “live” graph (5s intervall) on a website (local PC), URL like:
http://192.168.:3000/d/Il-rTUzRk/e-power-kwh-live?orgId=1&panelId=2&fullscreen&from=now-5m&to=now&refresh=5s

I will use this “live graph” on a sitemap (actuall no habpanel), i this possible? How :wink:
Or do I need that Grafana create png-files and I have to show these (but: not easy for a 5s intervall …)

Also: On the PC I have also to login into Grafana to see the graph, is there a “good” way that this not needed?

The persistence for InfluxDB does impose some limitations: you can’t use the tags and the multiple values and different retention policies in InfluxDB. For example, you could have a measurement “Temperature” and the tags “Inside” and “Outside”. Or maybe you want some measurements saved forever and others for much less time. You can use continuous queries to down sample, but it doesn’t cover every case. Also, you can have a measurement “SensorValues” with values such as Temperature and Humidity all within that measurement. Fortunately there is quite an easy workaround with the HTTP post request. I’ve put a sample below for anyone who is interested. If you’ve used the authentication above, you’ll need to add it to the http val. And of course modify it to your liking.

The InfluxDB write documentation is here

I use a timer to not bog down the rules when the post request is running.

val String INFLUXDB_WRITE = "http://192.168.86.212:8086/write?db=openhab_db&rp=autogen"
var Timer influxWriteTimer = null

rule "End Peak"
when
    Time cron "0 0 20 ? * MON-FRI *"
then
    if (influxWriteTimer === null) {
        influxWriteTimer = createTimer(now, [|
	    sendHttpPostRequest(INFLUXDB_WRITE, "application/json", "KWHPeak value=" + KWHPeak.state.toString, 3000) // 
            influxWriteTimer = null
        ])
    } else {
        logWarn("eagle", "Influx write timer is still running, not creating another")
    }
en
1 Like

I want to implement a “Direct Link Rendered Image” into my Habpanel.

Problem is, that the background is black from the dark theme or white from the light theme.

In the thread of the matrix theme I saw that it should be possible to create a css file, which I have to implement into the index.html file under directly below the title tag.
I did this, but without success.

Is there somebody who solved this?

In Installed influxdb and grafana according to the describtion above, version 1.0.2. was installed (using an Pi 3+).
But i cannot go to the command line interface?

When I run influx, the answer is command not found.
I can start somethin running influxd. Then i get this:

[14:59:28] openhabian@openHABianPi:~$ influxd

8888888 .d888 888 8888888b. 888888b.
888 d88P" 888 888 "Y88b 888 "88b
888 888 888 888 888 888 .88P
888 88888b. 888888 888 888 888 888 888 888 888 8888888K.
888 888 "88b 888 888 888 888 Y8bd8P’ 888 888 888 "Y88b
888 888 888 888 888 888 888 X88K 888 888 888 888
888 888 888 888 888 Y88b 888 .d8"“8b. 888 .d88P 888 d88P
8888888 888 888 888 888 “Y88888 888 888 8888888P” 8888888P”

[run] 2019/02/10 14:59:29 InfluxDB starting, version 1.0.2, branch unknown, commit unknown
[run] 2019/02/10 14:59:29 Go version go1.7.3, GOMAXPROCS set to 4
[run] 2019/02/10 14:59:30 Using configuration at: /etc/influxdb/influxdb.conf
run: open server: listen: listen tcp :8088: bind: address already in use

but why cant i go to the cli?

influxd is the daemon (and already started… bind: address already in use)
if there is an influxd, there also should be an influx (which is the connection to the database command line)

Maybe you have to use

sudo influx

instead.

I would try this. I recently installed influxdb and got only the server and not the client on Ubuntu 18.04 server. Perhaps they have separated the server and the client in the latest package.

sudo apt-get install influxdb-client

finding the influx command was what hung me up trying to do this tutorial. Eventually I found info telling me to point my web browser at the web interface which can be found at
localhost:8083
after install
the web interface allows the creation of databases, users and permissions
hope it helps

Port 8083 for admin can work, but you need to enable it first in the influxdb.conf file in the admin section as the default is disabled. Also, it says that the interface is deprecated and will be removed in a future release.

Hope this is the correct location for my two questions …

I measure few temperatures, store the values every 5 minutes in an influxdb.
Now, the graph for 1 day (or less) view has “steps” because of less values.
But is there an option that Grafana interpolate (create a curve betwen the point) and the graph looks “smoother” ?
(Otherwise I have to save every minute the temperatues into the influxdb …)

And in Grafana under “Legend” I activate “Show” and “As table”:
But this will only show (the first) three temperature sensores I added (in the graph there are six shown, thats correct). See picture
When activating additionally “To the right”, than all six values are shown on the right part from the screen (but than the graph is to much shrinked). Is this a limitation, a Bug or a mistake on my side?

For the first question, select “connected” for the null value in the Display tab in Grafana. There’s a picture here.

1 Like

OK, for my second question I found out:
When moving over on the right part, a scroll line appear!
Without move-over there is NO hint that there are more lines!

But in my case it would bether to see all 6 lines directly, is there an option?

Hello All, i’m in need of a tiny bit of help…
I’m sure the issue will be obvious to someone, i can’t seem to put my finger on it.

I confess i ventured into installing InfluxDB and Grafana from the openhabian-config>optional components installation ( i thought: “it’s been 2 years ever since Thomas Dietrich wrote this tutorial, let’s be brave!” - btw the tutorial is definitely still relevant, so TY).
The automated setup process sets up most of the things for you, basically all there is left is to install the addon in paperui and schedule a persistence job.

I now have the follwoing situation:
Grafana says it has no issues in connecting to opehab_db from influx as datasource
image
Influx receives data from OH, as per the scheduled job, (with precision rfc3339)

…But when i go creating a graph in my first dashboard


i don’t get any result, except for a “no data points” written in the middle of the graph.

I’m sure i missed something silly (as usual for any first timer the amount of info can be overwhelming).
any pointers?
Thanks!!

EDIT: do i need to write SELECT * FROM … so influxdb CLI commands in the grafana query for it to work??
EDIT 2: i’ve tried logging into influx’s CLI with grafana’s credentials and reading the measurements, but got this error:


so i guess the automated process doesn’t do
image

EDIT for anybody who might face the same issue
if you install Grafana and InfluxDB from the automated procedure in the openhabian-config, you need to log into influx’s CLI as ‘admin’ with the ‘SuperSecretPassword123+’ you’ve set up during the process, and do the 2 GRANT commands above. otherwise it’s not going ot work XD

took me hours (-.-) XD

2 Likes

May i ask how did you achieve this?

I’m guyessing you’re feeding system stats to influxdb from somwhere…?

I’m not sure if I understand the question, but I basically just store values from Systeminfo Binding via influxdb persistance.

1 Like

XD that’s it!
didnt’ explore systeminfo yet, was checking nmon from time to time.
now with grafana makes a lot more sense.
ty!

Hi there!
How can i update Grafana? I’m on 5.1.4 - according to the grafana homepage there’s 6.0 available.
i’m trying to update because (maybe?) 6.0 solves my problem with scrollbars on habpanel :slight_smile:

cheers
Peter

Assuming you are using Debian or Ubuntu, the easiest method to upgrade Grafana is to use apt according to the instructions here: http://docs.grafana.org/installation/debian/

i’m on openhabian (raspberry),

sudo apt-get install grafana

is not working there :frowning: