How to join with kapacitor?


#1

code :
// Get errors stream data
var tes1 = stream
|from()
.measurement(‘sitescope.ip’)
.groupBy(‘ip’)

// Get views stream data
var tes2 = stream
|from()
.measurement(‘reference.ip’)
.groupBy(‘ip’)

// Join errors and views
tes1
|join(tes2)
.as(‘tes1’, ‘tes2’)
.fill(0.0)
.streamName(‘error_rate’)
|where(lambda: “tes1.ip” == “tes2.ip”)
|eval(lambda: “tes1”, lambda: “tes2”)
.as(‘tes1’, ‘tes2’)
|influxDBOut()
.database(‘telegraf’)
.retentionPolicy(‘autogen’)
.measurement(‘sitescope’)


#2

This is the case:
We have 2 measurement, sitescope and reference (we want to use this table to reference each ip belong to which service/location)

sitescope format: timestamp, ip as (tag), hostname as (tag), monitor_type as (tag), metric_name as (tag), and metric_value as (field)
Example data: 1526461228, 10.10.x.x, DMxxxx, CPU, utilization, 5

reference: timestamp, ip as (tag), service as (tag), location as (tag), and ref_status as (field)
Example: 1526461228, 10.10.x.x, Petshop, DC1, 1

How to combine / join the table so we can query metric_value based on service/location?