06.02.2018, 17:12 (This post was last modified: 06.02.2018, 17:18 by baggins.)
(06.02.2018, 16:40)admin Wrote: You have to specify correct resolution in seconds, by default it is set to 1 day - 86400 seconds.
I'm still confused...
I took the example of the documentation and adapted where necessary:
Code:
123456789
require('trends')
dates = {
['start'] = { year = 2018, month = 2, day = 5},
['end'] = { year = 2018, month = 2, day = 6 },
}
--fetch current valueday = trends.fetch('CPU load', dates,300)
fori, vinipairs(day) dolog(i,v) end
This gives me 4 results. If I compare those results with the data in the trend, they don't match.
Result from script: 0,19, 0,12, 0,28, 0,34
Last 4 results in trend graph: 0,38, 0,33, 0.41, 0.33
I want to obtain the last result (0.33)...
Edit: if I run "day = trends.fetchone('CPU load', dates)" it returns 0.31 when at the same time in the graph is shows 0.1 as the latest value
I've tested Trends API some time ago and I've found that to have some data from today you must type not today timestamp but tomorrow and also 1 day before. The last value is the last measured value before midnight e.g. for 5minute resolution 23:55. For taking your maximum resolution you can type instead 86400 only 1. And then you should define undefined value from RRD db and ylou should look from 00:00 to first data which will appear