I am using Grafana 4.5.2. with ES data source and have a dashboard that displays single stats and graphs for server status overview.
I want to display current value in all single stats. Meaning, get the most latest value according to time from the query results.
It is not clear to me how to do that as using ES the queries contain time range and there are options to display max/min/count etc. but not last/current value.
I thought to limit the number of received results to just one based on interval template parameter. But what I do not understand is the relation between the refresh interval and step count.
Single stat query (no option to choose current/latest, based on time range):
currently the refresh rate is 1 min and the data in ES is updated every 1 min.
up-time get query:
{“search_type”:“query_then_fetch”,“ignore_unavailable”:true,“index”:“beaconindex”} {“size”:0,“query”:{“bool”:{“filter”:[{“range”:{“private_data.timestamp”:{“gte”:“1516269112707”,“lte”:“1516269172707”,“format”:“epoch_millis”}}},{“query_string”:{“analyze_wildcard”:true,“query”:“private_data.kes_hostname.keyword:lilach\-centos\-vm.com”}}]}},“aggs”:{“2”:{“date_histogram”:{“interval”:“2m”,“field”:“private_data.timestamp”,“min_doc_count”:0,“extended_bounds”:{“min”:“1516269112707”,“max”:“1516269172707”},“format”:“epoch_millis”},“aggs”:{“1”:{“max”:{“field”:“private_data.systemMetrics.systemData.system.uptime”}}}}}}
What is the relations between the step count and the refresh/query interval?
Thanks.
Currently I am working with the Average, but as far as I understand it is an average operation on all received values in query result.
Isn’t that the case?
Do you get it when not using override relative time? Does it make a difference changing it to 5m? Please refer to How To Use Grafana's Query Inspector to troubleshoot issues and include the complete request/response from query inspector.
Not really sure what you mean. The max is per given time unit if that makes sense, You group by date histogram which result in several max values per time unit. I would sugugest you to refer to How To Use Grafana's Query Inspector to troubleshoot issues and inspect the data coming back. That will hopefully give you a greater understanding. Or use the same query in a graph panel.
I am was having similar issue, using the 6.0.x I was able to display the “single stat” value, But when I migrated to 7.0, It gives me count, (since the singlestat panel is depreceated in 7.0)