I think this is what you are looking
for. https://docs.influxdata.com/kapacitor/v1.1/nodes/alert_node/#levelfield
In combination with an eval node you can convert the level string to a 0,1,
or 2 value.
On Friday, November 11, 2016 at 10:42:53 AM UTC-7, Rishma Gupta wrote:
>
> Thanks Nate for your quick reply.
>
> This is what I am doing. I am written the below script to send the alerts
> if mem used is increasing thresholds. I want to send the new variable
> Severity in the alerts. Lets say this alert is warning alert; it should
> send the severity as "1" in the message or if it is Critical it should
> send the severity as "2" otherwise send the severity as "0".
>
> var WARN_THRESHOLD = 20
>
> var CRIT_THRESHOLD = 21
>
> var period = 10s
>
> var every = 10s
>
> stream
>
> |from().database('processes_status').measurement('mem').groupBy('host')
>
> |window()
>
> .period(period)
>
> .every(every)
>
> |mean('used_percent').as('mean')
>
> |alert()
>
> .id('{{ .TaskName }}/{{ index .Tags "host" }}/mean')
>
> //.details('{{ index .Fields "mean" }}')
>
> .details('{{ .ID }} is {{ .Level }} value: {{ index .Fields "mean" }}
> (threshold of {{ if eq .Level "WARNING" }}WARN_THRESHOLD{{ else if eq
> .Level "CRITICAL" }}CRIT_THRESHOLD{{ end }})')
>
> .warn(lambda: "mean" > WARN_THRESHOLD)
>
> .crit(lambda: "mean" > CRIT_THRESHOLD)
>
> .stateChangesOnly()
>
> On Friday, November 11, 2016 at 8:24:22 AM UTC-8, [email protected]
> wrote:
>>
>> It is not clear to me what you are trying to do. Can you provide some
>> examples? And perhaps some TICKscript you have tried and why they didn't
>> work? Thanks
>>
>> On Thursday, November 10, 2016 at 8:50:11 PM UTC-7, Rishma Gupta wrote:
>>>
>>> I am writing the script to declare new variable severity and set the
>>> severity based on the .level and send it in the alert using stream . Please
>>> guide,
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups
"InfluxData" 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/78e7bcf0-c499-44bd-86ca-70d25d3c84f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.