When you say previous day do you mean, previous 24 hours, or the previous 
period of midnight to midnight? If its the previous 24 hours then using 
`.offset(1d)` will work.

If you want the previous midnight-midnight period then you can use an 
intermediate measurement. The steps would be:

1. At the end of each day compute the sum(diff_eEC_h) for the day and save 
it to a new measurement (Kapacitor or CQs can be used to do this)
2. In your Kapacitor script select the last(sum) value from the measurement 
in step #1, this will always be the previous days total.

Does that make sense?

On Wednesday, September 7, 2016 at 8:50:24 AM UTC-6, wug wrote:
>
> Hello,
>
> Thank you for the answer!  It works now. The next step is that I would 
> like to query the data from the previous day. I wanted to use 
> node.offset(value time.Duration). But I am doing my query each hour, and I 
> want always all the data from the previous day. Therefore, I would like a 
> offset variable like:
>
> offset = current_hour
> then:
>
> var error_eEC_h = batch
>
>      |query('''
>
>      SELECT sum(diff_eEC_h) as value1 FROM FMV_calcul."default"."error"
>
>      ''')
>
>      .period(1d)
>
>      .cron('0 0 * * * * *')
>
>      .groupBy(time(1d))
>      .offset(current_hour)
>
> Is there a way to do that?
>
> Thank you
>
> wug
>
> kapacitor 0.13
>
>    
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>       .groupBy(time(1d))
>
>
>
> Le vendredi 2 septembre 2016 19:02:28 UTC+2, [email protected] a 
> écrit :
>>
>> The script looks correct. The cron uses local time for the timezone of 
>> the Kapacitor process. To change the timezone for the process use the TZ 
>> env var on Unix like systems.
>>
>> On Friday, September 2, 2016 at 8:18:28 AM UTC-6, wug wrote:
>>>
>>>   I am trying to define a batch task with Kapacitor which is execute 
>>> each day at a certain time. First I am just trying to do a select using 
>>> cron but this is not working (I have enabled the task).  Here the code: 
>>>
>>>
>>>     batch
>>>
>>>         |query('''
>>>
>>>         SELECT distinct(value) as value FROM  
>>> FMV_energy."default"."puissance.electricite"
>>>
>>>         WHERE "source" = 'FMV' AND "station" = 'siesa.consommation.PCV' 
>>> AND "typeof" = 'forecast'
>>>
>>>         ''')
>>>
>>>         .period(2d)
>>>
>>>         .cron('0 5 16 * * * *')
>>>
>>>         .groupBy(time(15m))
>>>
>>>         .fill(0)
>>>
>>>
>>> What am I doing wrong?
>>>
>>>
>>> How have  I to manage the timezone in Kapacitor? It should be the 
>>> problem?
>>>
>>>
>>> Thank you
>>>
>>>
>>> wug
>>>
>>>
>>>
>>>
>>>

-- 
Remember to include the InfluxDB version number with all issue reports
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/1f1bdd0f-05b1-41d4-a572-855be25d878f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to