Hi nathaniel,
I use window node in my tick script, like this:
|window()
.period(1m)
.every(1m)
|mean('value')
.as('value')
|window()
.period(2m)
.every(2m)
......
|alert()
......
|inlfuxDBOut()
......
When the data greater than the threshold two conseutive times, an alert is
triggered. Alert is OK (emit en email once only), but the record of the
alert into influxdb may be have a problem:
The alert will insert data into influxdb twice (same with the count
defined). I want to record an alert in the influxdb every time, What should
can I do?
Thanks!
在 2016年9月23日星期五 UTC+8下午11:42:45,[email protected]写道:
>
> To preserve tags across aggregation operations like sum and mean you need
> to group by those tags
>
>
>
> stream
> |from()
> .database('monitor')
> .measurement('system_memory')
> .where(lambda: "host" == 'dev1' AND "type_instance" ==
> 'memory.used')
> .groupBy('tag1', 'tag2')
>
> On Friday, September 23, 2016 at 3:42:58 AM UTC-6, guotao Yao wrote:
>>
>> Hi,
>> @nathaniel Thanks very much.
>>
>> I find out some issues when use the mean function or sum funciton, alert
>> is ok, but the trigger events output to influxdb may loss some tags.
>>
>> My tick script:
>> stream
>> |from()
>> .database('monitor')
>> .measurement('system_memory')
>> .where(lambda: "host" == 'dev1' AND "type_instance" ==
>> 'memory.used')
>> |window()
>> .period(1m)
>> .every(1m)
>> |mean('value')
>> .as('value')
>> |window()
>> .period(2m)
>> .every(2m)
>> |alert()
>> .id('{{index .Tags "host"}}.{{index .Tags "instance"}}')
>> .message('{{.TaskName}}')
>> .crit(lambda: "value" >= float(4200))
>> .all()
>> .levelTag('level')
>> .stateChangesOnly()
>> .log('/tmp/memoty-alert.log')
>> |influxDBOut()
>> .database('monitor')
>> .measurement('triggers_system')
>> .tag('id', 'memory-used-too-high')
>>
>> Influxdb data:(use mean function) (I want get tags, e.g.
>> 'type_instance', 'unit', 'host' .etc)
>> time host
>> id level
>> type_instance unit value
>> 2016-09-23T08:46:30Z
>> memory-used-too-high
>> CRITICAL 6134.3671875
>> 2016-09-23T08:44:30Z
>> memory-used-too-high
>> CRITICAL 6131.887890625
>>
>>
>> When I use max function: (the data in Influxdb are OK)
>> time host
>> id level
>> type_instance unit value
>> 2016-09-23T09:03:40Z dev1
>> memory-used-too-high CRITICAL memory.used MB
>> 6123.87109375
>> 2016-09-23T09:02:40Z dev1
>> memory-used-too-high CRITICAL memory.used MB
>> 6136.53125
>>
>> [NOTE]: function of sum also have this issue.
>>
>> Did I do something wrong??
>>
>> 在 2016-09-23 02:16:52,[email protected] 写道:
>>
>>
>> Three consecutive times means for 6 minutes total so:
>>
>> stream
>> |from()
>> .measurement('m')
>> |window()
>> .period(2m)
>> .every(2m)
>> |max('value')
>> |window()
>> .period(6m)
>> .every(6m)
>> |alert()
>> .crit(lambda: "max" >= threshold)
>> // mark that all points need to match the criteria
>> // in order to trigger the alert.
>> .all()
>>
>>
>>
>> On Thursday, September 22, 2016 at 2:54:22 AM UTC-6, guotao Yao wrote:
>>>
>>>
>>> I have a scenario like the next:
>>> Evaluate the max value every 2 minutes, if the max value greater than a
>>> threshold three consecutive times, alert will be triggered.
>>>
>>> How can I write the tick script?
>>>
>>> Thanks!
>>>
>>>
>>> 在 2016年9月21日星期三 UTC+8下午10:49:09,[email protected]写道:
>>>>
>>>> All data that is within the time now - period will be emitted into the
>>>> pipeline. This means data can be emitted more than once if the period is
>>>> longer than every.
>>>>
>>>> On Wednesday, September 21, 2016 at 12:08:02 AM UTC-6, guotao Yao wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>> I have some confusions when I use kapacitor window node,
>>>>>
>>>>> 1. the every property define how ofen the data is emitted into the
>>>>> pipeline.
>>>>> But, I want to know whether all data during the time will be
>>>>> emitted into the pipeline, or is it just a data will be emitted into
>>>>> the pipeline.
>>>>>
>>>>>
>>>>> Thanks!
>>>>>
>>>> --
>> 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/2b5b389a-6dac-4a56-9cca-7423b24b95c5%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/influxdb/2b5b389a-6dac-4a56-9cca-7423b24b95c5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>>
>
--
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/4911c667-ad57-47ee-bc99-c751fef453fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.