Generalized Onsager-Machlup's theory of thermal fluctuations for non-equilibrium systems