We have moved at community.getvera.com

Author Topic: DataYours / Graphite / Vera / Grafana  (Read 5422 times)

Offline GL29

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
DataYours / Graphite / Vera / Grafana
« on: June 21, 2015, 12:48:28 pm »
Hi,
I have setup DataYours, it works very well.
I do store the graphite db file on a Synology NAS.
I am trying to connect Grafana (http://grafana.org) to "DataYours - Graphite" running on the Vera.
Within Grafana, there is an option to set a "Data Source" up with Graphite. A url seems to be required like "http://ip-address:port".

I have tried various things without any luck like "http://vera-ip-address:2003" or "http://vera-ip-address:3480" ....

I would appreciate any help.

Thanks

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: DataYours / Graphite / Vera / Grafana
« Reply #1 on: June 24, 2015, 02:12:27 am »
I'm not familiar with Grafana, but very keen to see third-party tools linked to DataYours (since GUIs are really a pain to develop, it's always a good plan to use something good someone else has crafted.)

I'll try to take a look and see what's required.  It may take an extra tweak of the code (or, I suppose, it might be a bit more than that) but let's find out.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline GL29

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: DataYours / Graphite / Vera / Grafana
« Reply #2 on: June 24, 2015, 03:06:32 am »
Excellent, thank you.
I am looking forwarding testing it.
GL

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: DataYours / Graphite / Vera / Grafana
« Reply #3 on: June 24, 2015, 03:44:45 am »
I have tried various things without any luck like "http://vera-ip-address:2003" or "http://vera-ip-address:3480" ....

OK, well at first sight it looks like it should be:
Code: [Select]
vera-ip-address:3480/data_request?id=lr_

...since the usual Graphite URL requests starts with "dashboard" "render" which it ought to append to the above.  It's possible that it won't like this syntax.  See if it gets you any further.

One thing I'm not sure of is what protocol it uses for directory browsing... it's apparent not in the extensive URL API documentation - I may have to delve into their source code.

------

[Edit: corrected "render" URL above]
« Last Edit: June 24, 2015, 12:33:29 pm by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline GL29

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: DataYours / Graphite / Vera / Grafana
« Reply #4 on: June 24, 2015, 04:49:47 am »
Please see attachment ...

Here is what I get with "vera-ip-address:3480/data_request?id=lr_"

No graph - error saying "Timeseries data request error"

and nothing else in the "Request" tab.


In the "JS error tab" we have:

Message: ""
 
Stack trace:
         http://192.168.10.5:3000/app/app.6e379bdb.js:20:13510
i@http://192.168.10.5:3000/app/app.6e379bdb.js:10:29775
http://192.168.10.5:3000/app/app.6e379bdb.js:10:29947
$eval@http://192.168.10.5:3000/app/app.6e379bdb.js:12:5251
$digest@http://192.168.10.5:3000/app/app.6e379bdb.js:12:3774
$apply@http://192.168.10.5:3000/app/app.6e379bdb.js:12:5514
h@http://192.168.10.5:3000/app/app.6e379bdb.js:10:14045
q@http://192.168.10.5:3000/app/app.6e379bdb.js:10:15390
v@http://192.168.10.5:3000/app/app.6e379bdb.js:10:15985

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: DataYours / Graphite / Vera / Grafana
« Reply #5 on: June 24, 2015, 12:47:02 pm »
OK, I see that it appends "/render", rather than just "render" to the request...

...I attach a modified version of DataGraph.lua (still compatible with everything else) which should get over this particular problem.  You now need to put the following into the Grafana URL box:

Code: [Select]
vera-ip-address:3480/data_request?id=lr_grafana

and I'm sure we''l hit the next hurdle then.
« Last Edit: June 24, 2015, 12:48:51 pm by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline GL29

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: DataYours / Graphite / Vera / Grafana
« Reply #6 on: June 25, 2015, 04:06:41 am »
Ok, just to be sure ... I have uploaded your file via Vera / Develop Apps / Luup Files / Upload.

I guess the original file gets overwritten ?

I have rebooted the VeraEdge box - just to be sure.

It dos not seem to work - yet ;-)

Here is the error reported via Safari  / Dev Console:

[Error] XMLHttpRequest cannot load http://192.168.10.51:3480/data_request?id=lr_grafana/render. Origin http://192.168.10.5:3000 is not allowed by Access-Control-Allow-Origin. (new-dashboard, line 0)
[Error] Object
   (fonction anonyme) (app.6e379bdb.js, line 10)
   (fonction anonyme) (app.6e379bdb.js, line 10)
   i (app.6e379bdb.js, line 10)
   (fonction anonyme) (app.6e379bdb.js, line 10)
   $eval (app.6e379bdb.js, line 12)
   $digest (app.6e379bdb.js, line 12)
   $apply (app.6e379bdb.js, line 12)
   h (app.6e379bdb.js, line 10)
   q (app.6e379bdb.js, line 10)
   v (app.6e379bdb.js, line 10)
[Error] Object
   (fonction anonyme) (app.6e379bdb.js, line 10)
   (fonction anonyme) (app.6e379bdb.js, line 10)
   i (app.6e379bdb.js, line 10)
   (fonction anonyme) (app.6e379bdb.js, line 10)
   $eval (app.6e379bdb.js, line 12)
   $digest (app.6e379bdb.js, line 12)
   $apply (app.6e379bdb.js, line 12)
   h (app.6e379bdb.js, line 10)
   q (app.6e379bdb.js, line 10)
   v (app.6e379bdb.js, line 10)
[Log] Panel data error:  (app.6e379bdb.js, line 23)
Object

« Last Edit: June 25, 2015, 04:12:00 am by GL29 »

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: DataYours / Graphite / Vera / Grafana
« Reply #7 on: June 25, 2015, 04:57:08 am »
Ok, just to be sure ... I have uploaded your file via Vera / Develop Apps / Luup Files / Upload.

I guess the original file gets overwritten ?

I have rebooted the VeraEdge box - just to be sure.
Yes, that's all correct.

Quote
It dos not seem to work - yet ;-)

Here is the error reported via Safari  / Dev Console:

I'm sorry, but this means nothing to me - I don't do JavaScript or much web stuff at all.

I do note that the URL is using a POST method, and I'm not sure that Vera's request handler routine copes with that.  Most usually, requests to port 3480 are made with GET methods.  Maybe someone else can help us out here.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline mcalistair

  • Full Member
  • ***
  • Posts: 179
  • Karma: +6/-3
  • "Luctor et Emergo"
Re: DataYours / Graphite / Vera / Grafana
« Reply #8 on: June 25, 2015, 01:00:28 pm »

Here is the error reported via Safari  / Dev Console:

[Error] XMLHttpRequest cannot load http://192.168.10.51:3480/data_request?id=lr_grafana/render. Origin http://192.168.10.5:3000 is not allowed by Access-Control-Allow-Origin. (new-dashboard, line 0)

This is a generic Web (not Vera nor Plugin) issue...
See:  http://www.w3.org/TR/cors/
And for example
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
« Last Edit: June 25, 2015, 01:03:37 pm by mcalistair »
1x Vera3@UI5 = PROD (1x Edge@UI7 = SandBox ), 15x ZWAVE Devices, 8x 'legacy' X10 devices controlled via Visonic PowerMax Alarm Panel Plugin, 5x Philips HUE devices, 1x iTach IP2CC, 1x Netatmo Weather Station, AltUI

Offline mike0xff

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: DataYours / Graphite / Vera / Grafana
« Reply #9 on: January 18, 2016, 04:55:43 pm »
I'm also trying to get DataYours to work with Grafana.  I'm new to both products, so I'm not a font of knowledge on the subject but when I installed your patched lua, Grafana is not able to pull the metrics from the DataYours web UI and on the Vera I see the following message in the LuaUPnP.log:

LuaUPnP.log:02   01/18/16 16:44:03.435   JobHandler_LuaUPnP::REQ_Handler no handler for lr_grafana/metrics/find/?query=* <0x74b6c520>

When I try opening that URL in my browser I also get a "No handler" message.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: DataYours / Graphite / Vera / Grafana
« Reply #10 on: January 20, 2016, 06:04:17 am »
I know nothing about Grafana, although would love to learn.  The mod I made previously was for a specific request which is not the one you showed.

What is the whole syntax of requests you're wanting to use (and their semantics) ?
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.