I can confirm postgres
data source is configured and tested OK. On postgres
client, the result set return is as follows:
SELECT
date_trunc('minute', to_timestamp(recvtime, 'YYYY-MM-DD HH24:MI:SS')) as time,
avg(attrvalue::float) as temperature
FROM
urbansense.new_table
WHERE
attrname='temperature'
AND attrvalue<>'null'
AND recvtime between '2015-07-09 12:00:00' and '2015-07-11 12:00:00'
GROUP BY time;
+---------------------------------------------+
| time | temperature |
| ------------------------+------------------ |
| 2015-07-09 17:05:00+00 | 27.7538461538462 |
| 2015-07-09 15:59:00+00 | 26.9214285714286 |
| 2015-07-09 02:01:00+00 | 22.6375 |
| 2015-07-09 00:34:00+00 | 23.35 |
| 2015-07-09 02:57:00+00 | 22.82 |
| 2015-07-09 15:17:00+00 | 26.9217391304348 |
| 2015-07-09 19:03:00+00 | 24.0615384615385 |
| 2015-07-09 15:53:00+00 | 27.2 |
| 2015-07-10 06:01:00+00 | 21.3625 |
| 2015-07-09 03:48:00+00 | 23.21875 |
| 2015-07-10 08:02:00+00 | 21.7 |
| 2015-07-09 22:18:00+00 | 21.7066666666667 |
| 2015-07-09 17:17:00+00 | 26.95 |
```
But then Grafana doesn't display data points on panel, instead shows Data points outside time range
Query Inspector:
Object
xhrStatus:"complete"
request:Object
method:"POST"
url:"api/tsdb/query"
data:Object
from:"1560827327529"
to:"1560848927529"
queries:Array[1]
response:Object
results:Object
A:Object
refId:"A"
meta:Object
series:Array[1]
0:Object
name:"temperature"
points:Array[2089]
0:Array[27.753846153846155,1436461500000]
1:Array[26.92142857142857,1436457540000]
2:Array[22.637499999999996,1436407260000]
3:Array[23.349999999999998,1436402040000]
4:Array[22.819999999999997,1436410620000]
5:Array[26.92173913043478,1436455020000]
6:Array[24.06153846153846,1436468580000]
7:Array[27.2,1436457180000]
8:Array[21.362499999999994,1436508060000]
9:Array[23.218750000000004,1436413680000]
10:Array[21.7,1436515320000]
11:Array[21.706666666666667,1436480280000]
12:Array[26.95,1436462220000]
13:Array[26.860000000000003,1436446500000]
14:Array[23.66875,1436422560000]
15:Array[24.28571428571429,1436467800000]
16:Array[22.756250000000005,1436418180000]
17:Array[23.8,1436400120000]
18:Array[26.750000000000004,1436442780000]
19:Array[21.224999999999998,1436500740000]
20:Array[26.139999999999997,1436439120000]
21:Array[21.606250000000003,1436510160000]
.
.
```
What is the problem here please? See attached image
![grafana|690x280](upload://3qIA1UaquS9a5HV5fuyKWfCwRbj.png)
**EDIT:**
Giving it another trial, query:
SELECT DISTINCT
date_trunc('minute', to_timestamp(recvtime, 'YYYY-MM-DD HH24:MI:SS')) as time,
count(attrvalue::float) as temperature
FROM
urbansense.new_table
WHERE
attrname='temperature'
AND attrvalue<>'null'
AND recvtime between '2015-07-09 12:00:00' and '2015-07-11 12:00:00'
GROUP BY time
ORDER BY time ASC;
*Panel-> More -> Panel JSON*
{
"type": "graph",
"title": "Panel Title",
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 8
},
"id": 8,
"targets": [
{
"refId": "A",
"format": "time_series",
"timeColumn": "time",
"metricColumn": "none",
"group": [],
"where": [
{
"type": "macro",
"name": "$__timeFilter",
"params": []
}
],
"select": [
[
{
"type": "column",
"params": [
"value"
]
}
]
],
"rawQuery": true,
"rawSql": "SELECT DISTINCT\n date_trunc('minute', to_timestamp(recvtime, 'YYYY-MM-DD HH24:MI:SS')) as time, \n count(attrvalue::float) as temperature\n FROM \n urbansense.new_table\nWHERE \n attrname='temperature'\n AND attrvalue<>'null'\n AND recvtime between '2015-07-09 12:00:00' and '2015-07-11 12:00:00'\n GROUP BY time\n ORDER BY time ASC;",
"hide": false
}
],
"options": {},
"renderer": "flot",
"yaxes": [
{
"label": null,
"show": true,
"logBase": 1,
"min": null,
"max": null,
"format": "short"
},
{
"label": null,
"show": true,
"logBase": 1,
"min": null,
"max": null,
"format": "short"
}
],
"xaxis": {
"show": true,
"mode": "time",
"name": null,
"values": [],
"buckets": null
},
"yaxis": {
"align": false,
"alignLevel": null
},
"lines": true,
"fill": 1,
"linewidth": 1,
"dashes": false,
"dashLength": 10,
"spaceLength": 10,
"points": false,
"pointradius": 2,
"bars": false,
"stack": false,
"percentage": false,
"legend": {
"show": true,
"values": false,
"min": false,
"max": false,
"current": false,
"total": false,
"avg": false
},
"nullPointMode": "null",
"steppedLine": false,
"tooltip": {
"value_type": "individual",
"shared": true,
"sort": 0
},
"timeFrom": null,
"timeShift": null,
"aliasColors": {},
"seriesOverrides": [],
"thresholds": [],
"timeRegions": [],
"links": []
}
Chrome Dev tools Network response check:
`{"results":{"A":{"refId":"A","meta":{"rowCount":0,"sql":"SELECT DISTINCT\n date_trunc('minute', to_timestamp(recvtime, 'YYYY-MM-DD HH24:MI:SS')) as time, \n count(attrvalue::float) as temperature\n FROM \n urbansense.new_table\nWHERE \n attrname='temperature'\n AND attrvalue\u003c\u003e'null'\n AND recvtime between '2015-07-09 12:00:00' and '2015-07-11 12:00:00'\n GROUP BY time\n ORDER BY time ASC;"},"series":[{"name":"temperature","points":[[18,1436400000000],[15,1436400.......`
Does someone has an idea what is going wrong here?