Hi all!
I would like to make a threshold alert were I have to check (e.g) if CPUs and memories are over a specified value, the following is an example of the script:
var warning_m0 = stream
|from()
.measurement(‘cpu’)
.groupBy([‘host’, ‘cpu’])
.where(lambda: “host” == ‘test’)
|window()
.period(60s)
|mean(‘usage_user’)
.as(‘value’)
var warning_m1 = stream
|from()
.measurement(‘mem’)
.groupBy([‘host’])
.where(lambda: “how” == ‘test’)
|window()
.period(60s)
|mean(‘free’)
.as(‘value’)
var warning_data = warning_m0
|join(warning_m1)
.as(‘w1’, ‘w2’)
var trigger = warning_data
| alert()
.warn(lambda: “w1.value” > 90 AND “w2.value” < 100)
[…]
The join is not working because GroupBy tags are not matching, so I ask you how can I check values of two different measurements that need grouping ? If it was be another language I would just put the series in two different vars and then used the vars in the logic, but can I do this with Kapacitor TICK script language ? Thank you very much