InfluxDB+Grafana persistence and graphing

Thank you, it’s working :slight_smile:

Did you find a solution? Having the same problem …

No i havent. Actually i had remove influx and graphana. I will start a Second try in my christmas vacation. I have bought a new QNAP nas. I will try it with the nas :slight_smile:

Hi,

currently I am trying out the Library from https://github.com/wborn/smarthome-grafana (BTW: Great Library, thanks a lot!)

In debug mode I can see, that all links are generated correctly. In “normal” mode, the grafana panel is shown when first opening a page in the ui. When trying to change the time span, as in the demo, the grafana panel is not updated (also the links are updated correctly).

In the javascript console I see a “same origin error”, probably because grafana listens on port 3000 and my openhab on port 9080, so these don’t match. I wonder, if this might the reason for not updating the panel and what to do to fix it.

Thanks in advance for your help!

I’ve got a setup with Influxdb and Grafana implemented as two docker container, both using last version. I have a “production” base and a “test” base for my experimentation on a second OH2 instance. However, my test base is crippled with lots of measurements due to multiple test.

What are you doing to simply clean up sets of measurements when you removed things ?

I have installed the Influxdb admin plugin in grafana, but it’s not very efficient do to these kind of task.

Does anyone have Influxdb correctly persist locations, it seems not to work for me with 2.2 stable (and prior) ?

I’m persisting everything:

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

Items {
    * : strategy = everyChange, everyHour, everyDay, restoreOnStartup
}

I’m using the iCloud binding for all my devices like follows:

String          MacBookDadBatteryStatus         "Battery Status [%s]"           <battery>       (giCloudDadMacBook)     {channel="icloud:device:abc:def:batteryStatus"}
Number          MacBookBatteryLevel             "Battery Level [%.0f %%]"       <battery>       (giCloudDadMacBook)     {channel="icloud:device:abc:def:batteryLevel"}
Switch          MacBookDadFindMyPhone           "Find Dad MacBook"                              (giCloudDadMacBook)     ["Switchable"]  {channel="icloud:device:abc:def:findMyPhone"}
Location        MacBookDadLocation              "Coordinates"                                   (giCloudDadMacBook)     {channel="icloud:device:abc:def:location"}
String          MacBookDadLocationString        "[%s]"                          <place>
Number          MacBookDadLocationAccuracy      "Coordinates Accuracy [%.0f m]"                 (giCloudDadMacBook)     {channel="icloud:device:abc:def:locationAccuracy"}
DateTime        MacBookDadLocationLastUpdate    "Last Update [%1$td.%1$tm.%1$tY, %1$tH:%1$tM]"  (giCloudDadMacBook)     {channel="icloud:device:abc:def:locationLastUpdate"}

and I have the following rule to translate location into readable address:

rule "MacBook Dad formatted address"
when
        Item MacBookDadLocation changed
then
        val _url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + MacBookDadLocation.state.toString + "&key=abcdef"
        val _geocodeJSON = sendHttpGetRequest(_url)
        val _address = transform("JSONPATH", "$.results[0].formatted_address", _geocodeJSON)
        MacBookDadLocationString.postUpdate(_address)
end

persistence works fine for all the items except location, for example for changes to the LocationString I get the following in trace log:

2017-12-21 15:04:15.226 [vent.ItemStateChangedEvent] - MacBookDadLocationString changed from some street, some city, Germany to some street, some city, Germany
2017-12-21 15:04:15.404 [TRACE] [.internal.InfluxDBPersistenceService] - Tried to get item from item class class org.openhab.core.library.items.StringItem, state is some street, some city, Germany
2017-12-21 15:04:15.404 [DEBUG] [.internal.InfluxDBPersistenceService] - got String value some street, some city, Germany
2017-12-21 15:04:15.404 [TRACE] [.internal.InfluxDBPersistenceService] - storing MacBookDadLocationString in influxdb value some street, some city, Germany, MacBookDadLocationString (Type=StringItem, State=some street, some city, Germany)

while for changes to Location I only get something like this, it seems it doesnt even try to persist the value:

2017-12-21 15:09:16.622 [vent.ItemStateChangedEvent] - MacBookDadLocation changed from 57.16784242952166,14.695187186432912 to 52.16784165925779,12.695187517415263

1 Like

Maybe a dump question…but I am not able to find this grafana.ini on any folder of the installation :smiley: But I got access to the dashboard…!?

I have the same situation. I can’t make persist the iPhone location via the “icloud binding”

Simply seems to be ignored. I guess, as you do, that it’s to do with the location GPS tag persistance.

Same problem here. Grafana and influx are working great. But without anonymous access i am not able to display it on a wall mounted tablet :frowning: only on my personal computer logged in to grafana

1 Like

I’ve been trying to DEBUG but nothing of interest in the logs with DEBUG enabled. No information is thrown out whatsoever.

I have a thought on what could be failing. Maybe the iCloud plugin is not ready for persist and a method needs to be created?

I do not have any recommendations but I can say this is not the case. Persistence works with Items completely independently of the bindings those Items may be linked to.

1 Like

Good to know @rlkoshak and thanks for the information.

I don’t know where to look then. The influxdb.persist works with every other item, it logs without issues and displays in graphana, but no trace of any attempt or try of the icloud binding to persist the changes.

I am quite new to this world, so could anyone let me know how could I report such issue and where?

I recommend posting a new thread to address this specific issue. Post your relevant Item definitions and .persit file.

Look in your logs for errors.

Look in your events.log to verify that your Items are in fact being updated.

Yes, that’s all checked. No errors or warnings in the logs (after enabling those via cli). No trace of any error or attempt to persist that item, while everything else does get its way to Influx without issues.

@ThomDietrich any idea where Tiere find this ini?

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