I think you might be missing the naming on errors.error
and totals.total
does the below work for you?
var data = stream
|from()
.measurement('MTP')
|window()
.period(2m)
.every(1m)
var total = data
|count('status')
var error = data
|where(lambda: "status" != '0')
|count('status')
error
|join(total)
.fill(0)
.as('errors', 'totals')
|eval(lambda: "errors.count" / "totals.count")
.as('value')
|alert()
.id('{{ .TaskName }}')
.crit(lambda: "value" > 0)
.message('Value: {{index .Fields "value"}}')
.log('/tmp/total.log')