Err="invalid math operator + for type missing"

Hi ,

Anyone assists me with this issue …

dbrp “testdb”.“myrp”

var cpu_user = batch
|query(‘SELECT last(usage_idle) FROM “testdb”.“myrp”.cpu’)
.period(1m)
.every(1m)
.groupBy(‘host’,‘service’)
.align()
|log()

var memusage = batch
|query(‘SELECT last(user_percent) FROM “testdb”.“myrp”.mem’)
.period(1m)
.every(1m)
.groupBy(‘host’,‘service’)
.align()
|log()

var cpuUsage=cpu_user
var memUsage=memusage

var Health_Score = cpuUsage
|join(memUsage)
.as(‘cpuUsage’,‘memUsage’)
.fill(‘null’)
|eval(lambda: “cpuUsage.value” + “memUsage.value”)
.as(‘Health_Score’)
|influxDBOut()
.database(‘testdb’)
.retentionPolicy(‘myrp’)
.measurement(‘testmes’)
.precision(‘s’)

Err:
ts=2019-06-17T20:16:00.003+02:00 lvl=error msg=“error evaluating expression” service=kapacitor task_master=main task=test node=eval7 err=“invalid math operator / for type missing”

hi @parimalan welcome !

Does this link help ?
Invalid math

Hi MarcV,

Happy day!

I have already referred this link, Still am not getting what is the issue here…

And my goal is to calculate the metrics like(cpu+mem+disk) and to show some health score to user

Does it work with .fill(0) or .fill(0.0) in the joinnode ?

I tried with both marcV

dbrp “testdb”.“myrp”

var cpu_user = batch
|query(‘SELECT last(usage_idle) FROM “testdb”.“myrp”.cpu’)
.period(1m)
.every(1m)
.groupBy(‘host’,‘service’)
.align()
|log()

var memusage = batch
|query(‘SELECT last(user_percent) FROM “testdb”.“myrp”.mem’)
.period(1m)
.every(1m)
.groupBy(‘host’,‘service’)
.align()
|log()

var cpuUsage=cpu_user
var memUsage=memusage

var Health_Score = cpuUsage
|join(memUsage)
.as(‘cpuUsage’,‘memUsage’)
.fill(0.0)
|eval(lambda: “cpuUsage.value” + “memUsage.value”)
.as(‘Health_Score’)
|influxDBOut()
.database(‘testdb’)
.retentionPolicy(‘myrp’)
.measurement(‘testmes’)
.precision(‘s’)

still getting same issue

err=“invalid math operator + for type missing”

I think I found it …

|eval(lambda: “cpuUsage.value” + “memUsage.value”)

should be :

|eval(lambda: “cpuUsage.last” + “memUsage.last”)

1 Like

Wow finally got out of struggle coz of you thank you very much marcV…

And i have another question which i have already raised in thread “tickscript have the option to read/write data into normal text file?”