Kapacitor 1.4.0 (git: HEAD fcce3ee9e6abcee5595fd61066bfc904edb1e113)
Where did you look before opening the issue?
A thorough google search, various trials
What am i trying to achieve: I am trying to have different CPU, Memory alerting thresholds on various server groups using Batch data. The problem I am facing is getting the "where clause" in batch working. Stream works fine and works as expected. Below is the code snippet i am trying to get it work.
Note that, hard coding values in where clause works.
--->>>>>>>>>
var triggerType = 'threshold'
var whereFilter = lambda: ("hostname" == 'host-id3-403' OR "hostname" == 'host-id3-402' OR "hostname" == 'host-id3-401' OR "hostname" == 'host-id3-400')
var whereClause = ''' ("hostname"='host-id3-403' OR "hostname"='host-id3-402' OR "hostname"='host-id3-401' OR "hostname"='host-id3-400') '''
var crit = 2
var period = 5m
var data = batch
// WHERE "hostname"="whereFilter" <~ Not working
// WHERE "hostname"='whereFilter' <~ Not Working
// WHERE ("hostname"='host-id3-403' OR "hostname"='host-id3-402' OR "hostname"='host-id3-401' OR "hostname"='host-id3-400') <~ Not Working
// WHERE (whereClause) <~ Not Working
// WHERE (\'' + whereClause + '\') <~ Not Working
|query('''
SELECT "load1"
FROM "hostingdev"."one_week"."system"
WHERE ("hostname"='host-id3-403' OR "hostname"='host-id3-402' OR "hostname"='host-id3-401' OR "hostname"='host-id3-400')
''')
.period(period)
.every(1m)
.groupBy(groupBy)
|eval(lambda: "load1")
.as('value')
var trigger = data
|alert()
.all()
.crit(lambda: "value" > crit)
// .stateChangesOnly()
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.email('validid@domain.com')
What products and version are you using?
Kapacitor 1.4.0 (git: HEAD fcce3ee9e6abcee5595fd61066bfc904edb1e113)
Where did you look before opening the issue?
A thorough google search, various trials
What am i trying to achieve: I am trying to have different CPU, Memory alerting thresholds on various server groups using Batch data. The problem I am facing is getting the "where clause" in batch working. Stream works fine and works as expected. Below is the code snippet i am trying to get it work.
Note that, hard coding values in where clause works. --->>>>>>>>> var triggerType = 'threshold'
var whereFilter = lambda: ("hostname" == 'host-id3-403' OR "hostname" == 'host-id3-402' OR "hostname" == 'host-id3-401' OR "hostname" == 'host-id3-400')
var whereClause = ''' ("hostname"='host-id3-403' OR "hostname"='host-id3-402' OR "hostname"='host-id3-401' OR "hostname"='host-id3-400') '''
var crit = 2
var period = 5m
var data = batch // WHERE "hostname"="whereFilter" <~ Not working // WHERE "hostname"='whereFilter' <~ Not Working // WHERE ("hostname"='host-id3-403' OR "hostname"='host-id3-402' OR "hostname"='host-id3-401' OR "hostname"='host-id3-400') <~ Not Working // WHERE (whereClause) <~ Not Working // WHERE (\'' + whereClause + '\') <~ Not Working |query(''' SELECT "load1" FROM "hostingdev"."one_week"."system" WHERE ("hostname"='host-id3-403' OR "hostname"='host-id3-402' OR "hostname"='host-id3-401' OR "hostname"='host-id3-400') ''') .period(period) .every(1m) .groupBy(groupBy) |eval(lambda: "load1") .as('value')
var trigger = data |alert() .all() .crit(lambda: "value" > crit) // .stateChangesOnly() .message(message) .id(idVar) .idTag(idTag) .levelTag(levelTag) .messageField(messageField) .durationField(durationField) .email('validid@domain.com')
<<<<<<<<<<<<<<------