Hi There,
Past 10 Days i am struggling to resolve this issue
What is wrong in the below script.
dbrp “telegraf”.“myrp”
var cpu_user = batch
|query('SELECT 100 - last(Percent_Idle_Time) FROM "telegraf"."myrp".win_cpu where bu=\'D\' and instance=\'_Total\'')
.period(30m)
.every(5m)
.groupBy('bu','solution','service','environment','host')
.align()
.fill(0.0)
|log()
|sideload()
.source('file:/home/influx/kapacitor/conf/load/tasks/sideload')
.order('{{.host}}.yml')
.field('cpuval', 10.0)
var memusage = batch
|query('select last(memHealth) from "telegraf"."myrp".win_mem_calc where bu=\'D\' ')
.period(30m)
.every(5m)
.groupBy('bu','solution','service','environment','host')
.align()
.fill(0.0)
|log()
|sideload()
.source('file:/home/influx/kapacitor/conf/load/tasks/sideload')
.order('{{.host}}.yml')
.field('memval', 10.0)
var swapusage = batch
|query('SELECT last(Percent_Usage) FROM "telegraf"."myrp".win_swap where bu=\'D\'')
.period(30m)
.every(5m)
.groupBy('bu','solution','service','environment','host')
.align()
.fill(0.0)
|log()
|sideload()
.source('file:/home/influx/kapacitor/conf/load/tasks/sideload')
.order('{{.host}}.yml')
.field('swapval', 10.0)
var cpuUsage=cpu_user
var memUsage=memusage
var swapUsage=swapusage
var Health_Score = cpuUsage
|join(memUsage,swapUsage)
.as('cpuUsage','memUsage','swapUsage')
.fill(0.0)
|eval(
lambda: (100.0-("cpuUsage.last" * "cpuUsage.cpuval")/10.0),
lambda: (100.0-("memUsage.last" * "memUsage.memval")/10.0),
lambda: (100.0-("swapUsage.last" * "swapUsage.swapval")/10.0)
).as('cpuHealth','memhealth','swaphealth')
|eval(
lambda: ("cpuHealth" + 100.0 + "swaphealth")/3.0,
lambda: "cpuHealth",lambda: "memhealth",lambda: "swaphealth"
).as('overallHealth','cpuHealth','memhealth','swaphealth')
|log()
|influxDBOut()
.cluster('abcd0000123')
.create()
.database('telegraf')
.retentionPolicy('myrp')
.measurement('WindowsHealth')
FYI- When i remove memusage batch script it is working perfectly
While inspecting the log i found some error like below:
ts=2019-10-16T11:20:00.429+02:00 lvl=error msg=“error evaluating expression” service=kapacitor task_master=main task=wincalculator node=influxdb_out15 err=“mismatched type to binary operator. got float * missing. see bool(), int(), float(), string(), duration()”