InfluxDB+Grafana persistence and graphing

I’m not sure, but in recent Grafana there should be the option to deactivate login via UI (not sitting at home now, so I can’t chack)

If you haven’t fixed it yet @juelicher, recently some documentation about this issue got added.

I’ve just clean installed Openhab 2.2 and used the install tool within openhabian-config to add influxDB and Grafana, but I too cannot find the .ini file to edit to enable anonymous login so the charts work in Basic UI.

I’ve got the data logging and persisting, but just can’t get the graphs to display in Basic UI.

I had this working in 2.1 but just can’t get it to in 2.2

did you try to find it yet?

sudo find / -name grafana.ini

would do the trick.

If there is none: Did you already start grafana once? Maybe the file is generated while first startup.

1 Like

Got it :slight_smile: I should have known to do that!
Thanks

Done that now, here: Persistence not working for GPS location formatted XX.XXX75788937955,-X.XXXX170208076405

1 Like

thx, now everything is fine

Sadly this doesn’t work anymore for me. Does anybody know why they would disable this?

Now I have to manually delete all entries by doing a SELECT before and getting the timestamps…

Thanks for pointing me to that part of the documentation, probably I have overlooked it. Installing nginx and configuring a reverse proxy, as described in the docs, solved the issue for me!

1 Like

hey guys, I came across a small issue: In habpanel, when I use the image that created by grafana’s direct link rendered image, the image can not auto refresh unless I hit F5 to refesh the page, I am not sure if this is even can call a bug… but how could u guys deal with this situation? Do we have a rules that can “trigger auto refresh(re-generate) the image” or do I somehow, I don’t know how, make grafana auto generate the image by a period of time say 5min? or should I deal with the “auto F5 refresh” thing to the browser side(chrome in this case)?

sorry, grafana works, inluxdb also. i see a my graph in grafana and also with

Direct link rendered image

in my browser
URL:

http://192.168.1.208:3000/render/dashboard-solo/db/gaszaehler?orgId=1&panelId=1&from=1516538410937&to=1516560010937&theme=light&width=1000&height=500&tz=UTC%2B01%3A00

OH:

Image refresh=60000 url="http://192.168.1.208:3000/render/dashboard-solo/db/new-dashboard-copy?orgId=1&panelId=1&from=1516535365910&to=1516556965911&width=1000&height=500&tz=UTC%2B01%3A00"

i had edit the /etc/grafana/grafana.ini file

[users]
# disable user signup / registration
allow_sign_up = false
[auth.anonymous]
# enable anonymous access
enabled = true

but no image in Openhab :frowning:

EDIT
runs now

seems there is a bug in grafana. if i rename my dashboard, the URL seems wrong.
in the url i find my old name.

Hi,
I’m also fighting a terrible fight against Grafana being used behind a nginx reverse proyx (openHABian image).
My problem is:

This address in the sitemap (Image url=)…

http://<my_local_ip_address>:3000/render/dashboard-solo/db/temperaturen?orgId=1&panelId=3&width=1000&height=500

mutates into this when I check the address of the image in Firefox under BasicUI:

http://<my_remote_dns_url>/proxy?sitemap=home.sitemap&widgetId=030101&t=1517183948343

I have no idea where this transformation happened and what I have to do to make the generated PNG file available for my sitemap. Webview works well, but I also want to have the graphs on my iPhone, so they are no option for me.
I tried it the past four hours and read more or less all tutorials and threads regarding this topic here, but maybe I missed something…

Any hint appreciated - thank you

Is anyone here successfully running Influx 1.4? I originally installed 1.2, which seemed ok. Someone had mentioned they used 1.4, so I switched to that. About that time, the zwave events stopped being stored, though LocalWeather values still persisted. Yet those also are now no longer persisting. Any thoughts, including a retreat to 1.2?

Hi
Is any one know how to unistal infux and grafana?
in openHABian Configuration Tool I can see only option to install.
Please

Thank you for great tutorial.

I have created java utility for conversion rrd file to InfluxDB line protocol file. Maybe it will be helpful to someone else too

More info can be found here:

2 Likes

any idea how to remove the Grafana title bar from the shared generated url for Habpanel frame widget?

EDIT: found, need to ‘add &kiosk’ to the end of the URL (grafana v4)

1 Like

Hey guys!

A couple of months ago I’ve added a section in how to maintain the influx database, namely how to move measurements data from one table to the other. This is often needed because measurements names follow the name of items, which you might change over time.

InfluxDB: Moving MEASUREMENTS after renaming an Item

Check the first post to find the basic commands. I found it to be cumbersome when mass-editing Items. Here is a simple bash script to move measurements quickly. Be aware, that this is a first draft and I’d ask whoever uses it, to post an improved version as payback :wink: Thanks


user='admin'
password='SuperSecretPassword123+'
db='openhab'

influx_execute() {
        influx -username $user -password $password -database=$db -execute "$1"
}

influx_execute 'SHOW MEASUREMENTS'

# Single MEASUREMENT
influx_execute "SELECT * INTO Balcony_Temperature FROM Balcony_TempSensor12"
influx_execute "DROP MEASUREMENT Balcony_TempSensor12"

#Multiple MEASUREMENTs based on Search&Replace
existing=$(influx_execute 'SHOW MEASUREMENTS')
old="LivingRoom_"
new="LR_"
for measurement in $existing; do
       if [[ "$measurement" =~ ^$old.* ]]; then
                   measurement_new=${measurement/$old/$new}
                   echo "Rename $measurement to $measurement_new"
                   if [[ $existing = *"$measurement_new"* ]]; then
                        echo "It's there! Let's do this!"
                        influx_execute "SELECT * INTO $measurement_new FROM $measurement"
                        influx_execute "DROP MEASUREMENT $measurement"
                   else
                        echo "New measurement name doesn't exist. Skip"
                   fi
           fi
done

Known issue! If the new measurement table doesn’t exist, the drop will happen anyhow.

6 Likes

@Dangar that’s amazing! You should post your own short Tutorial so more users become aware!
Edit: I’ve added your script to the first post.

Hello guys,
I’m total beginner with openhab2 and influxdb. I set up my dashboard that shows data from my ESP8266 with DHT22 sensor. I also set up influxdb persistence few weeks ago but I found that data in database was only from 13.2.2018 between 00:00 and 20:00, even that sensor was sending data few days. I made another fresh installation of all components but now everything seems ok, but there is no measurements or data in database. In Grafana, I successfuly added data source. I remember that when I was doing it for th first time then my measurements were visible in grafana graph metrics/FROM row but now it seems like no measurements are created and also there is no data in DB.
Log file …/openhab2.log shows:

2018-02-26 20:15:06.452 [INFO ] [er.internal.HomeBuilderDashboardTile] - Started Home Builder at /homebuilder
2018-02-26 20:15:09.000 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at http://192.168.1.129:8080
2018-02-26 20:15:09.017 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at https://192.168.1.129:8443
2018-02-26 20:15:23.206 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'DHT22_1.items'
2018-02-26 20:15:24.347 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'influxdb.persist'
2018-02-26 20:15:29.571 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-02-26 20:15:32.002 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.sitemap'
2018-02-26 20:15:38.209 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-02-26 20:15:38.390 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-02-26 20:15:38.579 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-02-26 20:15:39.185 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-02-26 20:15:39.193 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mosquitto'
2018-02-26 20:15:39.801 [DEBUG] [org.openhab.persistence.influxdb    ] - BundleEvent STARTING - org.openhab.persistence.influxdb
2018-02-26 20:15:39.824 [DEBUG] [.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.
2018-02-26 20:15:39.840 [DEBUG] [org.openhab.persistence.influxdb    ] - BundleEvent STARTED - org.openhab.persistence.influxdb
2018-02-26 20:15:39.890 [DEBUG] [.internal.InfluxDBPersistenceService] - influxdb persistence service activated
2018-02-26 20:15:40.995 [DEBUG] [.internal.InfluxDBPersistenceService] - database status is OK, version is 1.4.2
2018-02-26 20:15:41.571 [DEBUG] [org.openhab.persistence.influxdb    ] - ServiceEvent REGISTERED - {org.openhab.core.persistence.PersistenceService, org.openhab.core.persistence.QueryablePersistenceService}={service.pid=org.openhab.influxdb, db=openhab_db, user=openhab, url=http://192.168.1.129:8086, password=mypassword, component.name=org.openhab.persistence.influxdb, retentionPolicy=autogen, component.id=191, service.id=314, service.bundleid=210, service.scope=bundle} - org.openhab.persistence.influxdb

My items file:

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
}

Items {
    Sensor_1_temperature*, Sensor_1_humidity*, Sensor_1_switch*   : strategy = everyMinute, everyHour, restoreOnStartup
}

My items:

String Sensor_1_temperature "temp [%s]▒C" (Sensor_1) {mqtt="<[mosquitto:Sensor_1/temperature:state:default]"}
String Sensor_1_humidity "hum [%s%%]" (Sensor_1) {mqtt="<[mosquitto:Sensor_1/humidity:state:default]"}
Switch Sensor_1_switch {mqtt="<[mosquitto:Sensor_1/out/status:state:ON:1],<[mosquitto:Sensor_1/out/status:state:OFF:0],>[mosquitto:Sensor_1/out/switch:command:ON:1],>[mosquitto:Sensor_1/out/switch:command:OFF:0]"}

Could anybody be so kind and help me find the reason for my problem ? I read and tryed many things from this page but so far I made no progress. And it really drives me crazy …:smiley:

use a new thread to describe the issue (not many will see the issue within a tutorial thread)

try to remove the * from the .persist (not items) file
(or put the items in a group and then persist the group*)