We will wait for issue 869 to be fixed.

Here is the output from influxdb where duration is zero. Someone else 
explained to me that duration will be non zero when we get an alertOK and 
that indicates how long the alert was valid for. If that is true, then I 
think I understand the duration field being zero when the alert is sent. My 
kapacitor script is copied below.

time duration host last_used_percent level mountpoint service
2016-09-02T23:25:30Z 0 us122.sjc.aristanetworks.com 90.15433216173895 
WARNING /persist userServer
2016-09-02T23:25:45Z 0 us128.sjc.aristanetworks.com 95.24056324480851 
CRITICAL / userServer
2016-09-02T23:26:00Z 0 us109.sjc.aristanetworks.com 97.90532456979625 
CRITICAL /persist userServer
2016-09-02T23:26:00Z 0 us112.sjc.aristanetworks.com 94.6398174872978 WARNING 
/persist userServer
2016-09-02T23:26:00Z 0 us106.sjc.aristanetworks.com 91.5023777746489 WARNING 
/persist userServer

batch
  |query('''
    SELECT last(used_percent) as last_used_percent, path as mountpoint
    FROM ServerStats."default".disk
    WHERE host =~ /^us/
  ''')
    .period(1m)
    .every(1m)
    .groupBy('host','path')
  |alert()
    .id('kapacitor/{{ .TaskName }}/{{ .Name }}/{{ .Group }}')
    .message('{{ .ID }} is at level {{ .Level }} last_used_percent:{{ index 
.Fields "last_used_percent" }}')
    .warn(lambda: "last_used_percent" > 90)
    .crit(lambda: "last_used_percent" > 95)
    .levelTag('level')
    .durationField('duration')
    .log('/Users/subhachandra/Data/kapacitor/alerts.log')
  |delete()
    .tag('path')
  |influxDBOut()
    .cluster('ServerStats')
    .database('alerts')
    .flushInterval(1s)
    .measurement('kapacitor')
    .tag('service','userServer')

Thanks
Subhachandra

On Friday, September 2, 2016 at 4:13:49 PM UTC-7, [email protected] 
wrote:
>
> Currently the message cannot be set as a field. See 
> https://github.com/influxdata/kapacitor/issues/869
>
> The duration value is working locally, Can you share steps to reproduce 
> the 0 duration value? Thanks
>
> On Friday, September 2, 2016 at 4:13:01 PM UTC-6, Subhachandra Chandra 
> wrote:
>>
>> Hi,
>>
>>   How do I send the "message: from an alert node to an influxdbOut node 
>> as a field? 
>>   Further the duration field is set to 0 in kapacitor-1.0.0~rc2-1. I 
>> remember it being non zero in 0.13. Is this a bug or how do I set this 
>> field or how is it calculated?
>>
>> Thanks
>> Subhachandra
>>
>

-- 
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/0df6427f-e2fc-4733-b870-0457a2ef0b54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to