TickScript help for calculating port utilization

kapacitor
#1

I am pretty new to TICKScript.
what i m trying to do,fetch the last value and previous value of an measurement and then doing some calculation.Is this even correct or any other way to proceed.Plz guide me.

var current = stream
|from()
.database(dbname)
.measurement(‘interface’)
.groupBy()
|window()
.period(1m)
.every(2m)

var old = current
|shift(-1m)

|alert()
|eval(lambda: “current.ifInOctets” - “old.ifInOctets”)
.as(“ifInOctets”)
|eval(lambda: if(“ifInOctets” > 0))
|eval(lambda: “ifInOctets” + 4294967296)
.as(“InOctets”)
|eval(lambda: 60 * “current.ifSpeed”)
.as(“downValue”)
|eval(lambda: ((“ifInOctets” * 8 * 100) / “downValue”)
.as(“portUtilization”)
.info(lambda: “portUtilization” > 70)
.warn(lambda: “portUtilization” > 80)
.crit(lambda: “portUtilization” > 90)
.log(’/tmp/utilization.tmp’)

invalid TICKscript: parser: unexpected . line 22 char 9 in " .as(“portU”. expected: ")"