How to display the last value in Grafana Gauge - elasticsearch

I'm new to using Grafana and I'm trying to display the last value of a table that's organized by dates in a Gauge visualization.
All the options I'm seeing to displaying the data are grouping methods like max, average, sum and so on.
Is there a way to get only the latest most updated value from that table? And to always display it?
I'm using Grafana v7.1.3 and ES.

Choose "Last" or "Last (not null)" from the "Display" option:

Related

How can I sort the date in the X axis properly on a Bar Chart in Kibana?

I'm trying to order the date ascendantly in the X axis of the chart. And I've set it up that way here:
However, this happens:
Is there a way to work around this? 25 January should be the last bar. I've tried changing data formats to see if it would order properly but with no success.
You haven't specified how you are generating this graph, but it looks like you've done a Terms aggregation on the date field. The order by you are showing is then for the terms count. If you look right above that, it probably says order by: Metric count. What you want it to say is Order by: term.
In any event, in general, you don't want to aggregate by date like that. Instead choose a Date Histogram aggregation. That will allow the time filter/aggregation bucket size to be changed.

Vega-Lite / Kibana : How can I make a table that shows calculations between aggregations?

I want to do a data table in kibana like the following:
see image
That means, the 2 first columns are the sum of price and quantity and the 3rd column divides both sums to get a ratio.
Also I want this to be dynamic to changes in time range.
As far as I've seen getting the ratio is not possible in kibana, but I've noticed that there is a plugin were you can create Vega-Lite graphs in kibana.
I am new both in Vega-Lite and in kibana, so is there an example of code that creates a data table?
The Vega-Lite site did not help me a lot...
Thank you!
I believe you could add a scripted field to calculate this ratio and then u can have the column you want :D
https://www.elastic.co/guide/en/kibana/current/scripted-fields.html

Grafana graph total count shown as list?

I have a Grafana dashboard, where I am currently getting my query shown as a "Gauge"-graph showing the total hits.
As you can see on the screenshot, it shows total number of hits - but I would like to have them on a list, with the details of each hit (NOT the Kibana way).
I've looked at some of the other graph models that Grafana provide and the "Table"-model is the one I find best, but it only shows the columns "time" and "count", which isn't that useful.
Is there some way to manipulate the columns shown on the table, so it isnt "time" and "count" but more custom values?
Or do others have better ways to do it?
I have already looked at the tutorial/guidelines provided by Grafana here but I find them quite low on details.
I've also tried to pull out the "Raw document" to find the JSON-columns, that I want shown, but then it crashes and I get the same error message as the one reported in Grafans github here saying
"Grafana has likely been updated. Please try reloading the page."
hmm... Quite frustrating to be honest.
// In short: I want to add some metrics from the query that is shown in the JSON, which I can place in the table, as I want.
UPDATE 22nd Oct. 2019
Regarding the error message from Grafana
"Grafana has likely been updated. Please try reloading the page."
Updating it to the newest version 6.4.3 fixed this problem, even though it should have been fixed in 6.4.2.
This enables me to see raw JSON formatted data, so that is done. Now I need to find out how to fetch and work with some of these data inside the JSON, so that I can see them on the table.
Found out that I just had to use the metric "Unique Count" or "Count" from where I choose a indexed metric which will then give me a count value.
Please double check that you are not getting an average value, but a total. If it fx shows 0.4 and you only have integers, then you are probably getting an average value.
Also if you want to play around with the different metrics, so they show in the panel, a solution would be to choose the metric "Raw Document". Then inside visualization you can choose to add the metrics you want shown under "Column". Press the '+' mark and add the different metrics.
If you want to give it a better name, you can configure it under "Column Styles".
And finally - always stay up to date with the newest grafana version, so you don't end up getting frustated over a error which is only there because you haven't updated.

Kibana 5.5 visualization data aggregation percentage

I'm using Kibana 5.5 and would like to create a visualization that shows percentage of successful transactions made to my server.
In order to do that I have a field in the document named "httpCode" and I would like to get the percentage of "httpCode: 200" out of the total transactions made.
I managed to put this in visulalization that does separate lines, but I would like to get percentage over time and not count.
Thanks,
Moshe
Create a new bar or area chart and choose count as aggregation, set your field for Date Histogram. Next in buckets tab add Split Series and choose Filters as Sub Aggregation. Your first filter should look like that:
Filter 1
httpCode:200
Use http.keyword instead if is available.
Filter 2
NOT httpCode:200
Go to Metrics & Axes tab, expand LeftAxis-1 and change mode to percentage:
On my exmaple it should look like that:

Grafana Templating

I am wondering if there is a way to limit the number of rows generated from grafana templating.
I can have a drop down variable "$x"on my grafana page and I can select the row editor and say repeat row for every value under $x.
Based on different criteria, I can have x anywhere between 1 and like 160 rows. I need to only be looking at about 10 at a time. I am wondering if I can control the number of rows shown/change the rows shown somewhere in grafana.
I can manually select items from the $x drop down to show only a few items of course, but its a matter of selecting only say.. 10 items right when the page loads.
Please let me know if I am not describing the problem correctly or if I need to clarify more.
Thanks,
Karan
As far as I know there is no direct option for this but there are some ways you may be able to achieve what you want.
You could select your ~10 default entries and then save the dashboard this will save the selected ones in the dashboards JSON. (or modify the JSON of the dashboard directly)
You could use the regex field in the template settings to filter some of your values and split them in groups this way. (one variable per regex group)
You could change your data in elasticsearch in order to use multiple fields where you can split on.
see PR #5616 as #Daniel Lee mentioned
In general I think you get a faster response to this in grafana directly at github.

Resources