Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Data from InfluxDB #2

Closed
sgofferj opened this issue Sep 29, 2019 · 8 comments
Closed

Data from InfluxDB #2

sgofferj opened this issue Sep 29, 2019 · 8 comments

Comments

@sgofferj
Copy link

Not sure if this a support or feature request. I'm trying to visualize track data from an InfluxDB source. The data is stored in "longitude" and "latitude". I have tried the following queries without success:

SELECT "latitude" as lat, "longitude" as lon FROM "device_tracker.stefan" WHERE $timeFilter

time | lat | lon
2019-09-22T12:49:40+03:00 | 61.255785 | 24.051843333333
2019-09-22T12:54:41+03:00 | 61.259143333333 | 24.048593333333
2019-09-22T12:59:42+03:00 | 61.26173 | 24.045255
2019-09-22T13:04:43+03:00 | 61.262641666667 | 24.039211666667
2019-09-22T13:14:44+03:00 | 61.266065 | 24.031786666667
...

SELECT "latitude" as lat, "longitude" as lon,"time" as time_index FROM "device_tracker.stefan" WHERE $timeFilter

time_index | lat | lon
1569144879097 | 61.255483333333 | 24.055775
1569145180116 | 61.255128333333 | 24.055998333333
1569145780115 | 61.255785 | 24.051843333333
1569146081098 | 61.259143333333 | 24.048593333333
1569146382109 | 61.26173 | 24.045255
...

I'm not sure in which format the plugin is expecting the data. Would you kindly advise? In case, it's not yet possible to use data from InfluxDB, please consider this a feature request.

@Drazair
Copy link
Contributor

Drazair commented Sep 30, 2019

Hey Sqofferj, the panel should work with a influxDB datasource.

Have you set the Format as to Table instead of the default Time series?

@sgofferj
Copy link
Author

sgofferj commented Sep 30, 2019

@Drazair
Thanks! I just tried Table but I still don't get anything. I'm probably missing something basic. Could you advise on how exactly the query should look like?

@sgofferj
Copy link
Author

sgofferj commented Sep 30, 2019

Never mind... I wrote "longitude as lon" instead on "longitude" as lon... It works fine with Table.
Thanks a lot!

@sgofferj
Copy link
Author

sgofferj commented Oct 8, 2019

It just stopped working and I didn't change anything.
That's my query:

SELECT "latitude" as lat, "longitude" as lon, "time" as time_index FROM "device_tracker.ulefone_gps" WHERE $timeFilter

I selected "Format as table".
The query inspector shows that data is returned and the data looks good...

Object
xhrStatus:"complete"
request:Object
method:"GET"
url:"api/datasources/proxy/5/query"
params:Object
db:"home_assistant"
q:"SELECT "latitude" as lat, "longitude" as lon, "time" as time_index FROM "device_tracker.ulefone_gps" WHERE time >= now() - 24h"
epoch:"ms"
data:null
precision:"ms"
response:Object
results:Array[1]
0:Object
statement_id:0
series:Array[1]
0:Object
name:"device_tracker.ulefone_gps"
columns:Array[3]
0:"time_index"
1:"lat"
2:"lon"
values:Array[188]
0:Array[1570439118300,61.255225,24.05604166666667]
1:Array[1570439152205,61.25527666666667,24.055926666666664]
2:Array[1570439284125,61.25527666666667,24.055926666666664]
3:Array[1570439317209,61.25527666666667,24.055926666666664]
4:Array[1570439519238,61.25527666666667,24.055926666666664]
5:Array[1570439989218,61.25525833333333,24.055991666666667]
6:Array[1570440055118,61.25521666666667,24.056109999999997]
7:Array[1570440088349,61.255333333333326,24.056648333333335]
8:Array[1570440121152,61.255154999999995,24.056748333333335]
[...]

Browser console shows no error.
Grafana log shows no error.

@sgofferj sgofferj reopened this Oct 8, 2019
@sgofferj
Copy link
Author

sgofferj commented Oct 8, 2019

Updated to Grafana 6.4.2. Now I see an error in the console:

Panel data error: TypeError: "L.heatLayer is not a function"    metrics_panel_ctrl.ts:202:6
    value module.js:10
    value module.js:10
    emit index.js:129
    emit emitter.ts:11
    handleQueryResult sdk.ts:1
    next metrics_panel_ctrl.ts:82
    RxJS 8
        __tryOrUnsub
        next
        _next
        next
        _next
        next
        next
        nextInfiniteTimeWindow
    next PanelModel.ts:5
    RxJS 19
        __tryOrUnsub
        next
        _next
        next
        notifyNext
        _next
        next
        _next
        next
        next
        _next
        next
        _next
        next
        _next
        next
        _next
        next
        o
    Angular 6
        f
        f
        $digest
        evalAsync
        p
        n

@Drazair
Copy link
Contributor

Drazair commented Oct 21, 2019

Hey Sgofferj,

Sorry for the late reply, had some other assignments that took all my time.

I just tried downloading the newest version of Gafana, and I'm not getting any errors. Are you using any other plugins?

@sgofferj
Copy link
Author

That was a good hint... Yes, I am using the trackmap panel (https://github.com/pR0Ps/grafana-trackmap-panel) on the same dashboard. Deleted it for testing now and without it, Track Map works... I also tried 2 Track Map panels in one dashboard but that also doesn't work. Now the error message kinda makes sense also. I suppose, Track Map just uses a reference implementation of Leaflet, using "L" as the name. And trackmap probably does the same...

@Drazair
Copy link
Contributor

Drazair commented Nov 13, 2019

I'm going to close this issue since it's been solved, and the problem with the conflict between plugins have its own issue ( #5 )

@Drazair Drazair closed this as completed Nov 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants