TICKscript Variable - String Concatenation

#1

Hi All,
In a Kapacitor’s TICKscript, I wanted to declare a string variable that will take the value of another variable (see below).

I tried =>
var mem_threshold = 65.0
var alert_msg = 'MEMORY resource is lower than 'mem_threshold

However, the “mem_threshold” value is not retrieved causing the “alert_msg” to only contain =>
'MEMORY resource is lower than ’

How do I fix this? Thanks!

0 Likes

#2

I think you just have to use the addition + for string concatenation. For example:

var mem_threshold = 65.0
var alert_msg = "MEMORY resource is lower than ' + mem_threshold
0 Likes

#3

@sebito91
Thanks so much. It works!!

0 Likes