Cholesterol scarcity increases p38 PMK-1 phosphorylation, primes immune effector induction in a manner that requires TIR-1/SARM1 oligomerization and its intrinsic NAD+ glycohydrolase activity, and reduces pathogen accumulation in the intestine during a subsequent infection. Here, SARM1 is linked to infection.