Reputation: 78
I'm building a Grafana dashboard with some Stat panels that show average, minimum, and maximum time values (see below) for specific fields in my database. I'm storing the data in seconds and setting the value's units to seconds after which the panel displays the time in weeks, days, hours, etc. For the sake of consistency, I would like everything to be shown in days but I haven't been able to find a way to force units for the output value. If it's possible to do this, could someone please point me to some docs, or something that could show me which configurations to make in my panels?
So far, I've tried (without success):
Edit:
So I kept messing around with the dashboard and got a solution that works - i.e. it's a "good-enough" solution (see below) - but, now, I'm curious if it's possible to show the units along with the value without it converting it to some other unit. Does anyone have any ideas about this?
Upvotes: 2
Views: 3028
Reputation: 11
You can use a custom unit. It is a bit tricky to enter the unit in the UI because of the automatic selection but if you enter i.e. "days" (without the quotes) in the Unit field and instead of leaving the field with tab or mouse click use the scrollbar of the combobox and select the last entry "Custom Unit: days".
Hope it helps. And for the record: I am using Grafana version 7.1.4
Upvotes: 1
Reputation: 3166
In de settings: Standard options -> Unit-> enter: "Days (without quotes) and select "Custom units: days".
What Carpi2001 explained earlier.
But since the received amount is in seconds and not in days, I need to manually convert the values from seconds to days. I'm using InfluxDB query:
SELECT last("uptime")/3600/24 FROM "system" WHERE ("host" =~ /^$hostname$/) AND $timeFilter GROUP BY time($__interval)
Which will results into:
Upvotes: 1