The invention discloses metal rust-preventive oil comprising coconut oil fatty acid diethanolamide. The oil is prepared from the raw materials of: No.120 solvent oil, a silane coupling agent KH540, a silane coupling agent KH 602, microcrystalline wax, isobutyl methacrylate, modified nano-grade shale powder, an antioxidant 1010, a composite film-forming material, polyethylene glycol, isobutyl alcohol, an antioxidant 1076, coconut oil fatty acid diethanolamide, barium petroleum sulfonate, petroleum sulfonate, benzotriazole, 2-aminoethyl heptadecenyl imidazoline, magnesium naphthenate, nonylphenol polyoxyethylene ether, Span 80, an antioxidant T501, and phenylethanolamine A. The rust-preventive oil provided by the invention has excellent contact rust resistance and good gas-phase rust resistance. The rust-preventive oil provided by the invention provides good gas-phase rust resistance and contact rust resistance for steel and brass.