So, Lydia_K, any suggestions for getting only today's values? And preferably (max) today's - (min) today's
Lydia_K
That is a tricky one..
blizzkid
I know, I've been strugling with it for days.
Currently I'm thinking of doing it in bash
Lydia_K
all my influx ends up being a DB for grafana on the front end, which nicely does the "today" thing already, but that's cause it just passes explicit time values.
I would probably do it in bash, then you can easily get yourself a start and end time and supply that.
I'm not an influxdb expert, but I can't think of a way offhand to get that out of influx without specifying the start/stop times (or at least the start)
blizzkid
but it feels like hacking something that shouldn't have to be hacked :)
Lydia_K
That looks pretty good.
Lydia_K shrugs, "Sometimes you just need it to work."
blizzkid
yeah, well
I'll probably re-inject these values into influx and then retrieve them for my single stat
But it feels wrong
Lydia_K
If you are using Grafana on the front end then it can get you "today" time slice data you are looking for.
But I mean, that will affect the entire dashboard.
nicolas17
I wish grafana or influxdb supported time shift for one query
grafana can do time shift for an entire graph
blizzkid
Lydia_K: hmmm, does today in Grafana calculate the difference between the first and the last point? Beacuse the series is "Total"
nicolas17
and I saw a grafana example that overlayed current values with 24h-shifted values, but it relied on a feature of another DB engine
blizzkid
nicolas17: there's also a proxy for influx on github that does the same
blizzkid: Ahhh, let me think about that for a minute
nicolas17
oh time shift is super useful but it's a different thing
blizzkid
Lydia_K: have a look at the bash script, it's quite self-explanatory ;)
nicolas17
time shift is useful if you want a query doing "select x" for current data, and you want to add another graph with "select x" 24 hours shifted, so you can visually compare current values with yesterday's and notice anomalies
something completely different is when you have a retention policy that deletes data after 24 hours, and a continuous query that aggregates older data into a different RP, and you want to see data from both in the same graph so you can just scroll backwards in time
Lydia_K
oh oh, I totally misunderstood what you were looking for.
nicolas17
Lydia_K: I want the time shift too for something else, so your link is still useful :)
Lydia_K
Sorry, company holiday party last night, out late drinking heavily -.-
blizzkid: I see what you are trying to do now, Umm, There *might* be a way to do that, let me try something. (Otherwise I've achived the same idea via the meta query plugin)
chronos joined the channel
nicolas17: I have wondered about that too, downsampling in general doesn't work the way I want it to :(
nicolas17
currently I'm not downsampling or expiring data
and I better do something about it before I run out of disk space
retention: FOREVER
I don't particularly care about CPU usage every 5 seconds going back months :P
Lydia_K
Yeah, I've been writing a script to set up basic retention policies and downsampling continuous queries cause there's so many things to do to set that all up.
ZombieTwiglet joined the channel
blizzkid
Lydia_K: it seems SELECT difference(max("value")) FROM "SDM530A_Total_kWh" WHERE time >= now() - 1d GROUP BY time(1d) fill(null) comes pretty close
Lindrian has quit
Guest50782 has quit
Twiglet has quit
rymdkarl has quit
monrad has quit
elfurbe has quit
Drorb has quit
M-geemili has quit
xthexder has quit
Lydia_K
Yeah, even with subqueries I can't get this to work because it requires arithmetic on the two results.
I feel like I'm close, but it might not be possible
Take a look at the meta query plugin, that will do it for you for sure
blizzkid
hmm, the query I gave is absolutely very close
Lydia_K
you have have a query that gets the first value, a query that gets the last value, then the meta query that subtracts one from the other.
blizzkid
As in I have the same result now as my bash script
SELECT difference(max("value")) FROM "SDM530A_Total_kWh" WHERE time >= now() - 1d GROUP BY time(1d) fill(null)
Lydia_K
I do that same thing to calculate days till full on our storage based on the average consumption per day
wolfshappen has quit
blizzkid
gives the same outcome as my bash script for the moment