Threshold engine for monitoring