How write Monitor Script?