Mitochondrial function is challenged by toxic by-products of metabolism as well as by pathogen attack. Caenorhabditis elegans normally responds to mitochondrial dysfunction with activation of mitochondrial-repair, drug-detoxification and pathogen-response pathways. Here, from a genome-wide RNA interference (RNAi) screen, we identified 45 C. elegans genes that are required to upregulate detoxification, pathogen-response and mitochondrial-repair pathways after inhibition of mitochondrial function by drug-induced or genetic disruption. Animals defective in ceramide biosynthesis are deficient in mitochondrial surveillance, and addition of particular ceramides can rescue the surveillance defects. Ceramide can also rescue the mitochondrial surveillance defects of other gene inactivations, mapping these gene activities upstream of ceramide. Inhibition of the mevalonate pathway, either by RNAi or statin drugs, also disrupts mitochondrial surveillance. Growth of C. elegans with a significant fraction of bacterial species from their natural habitat causes mitochondrial dysfunction. Other bacterial species inhibit C. elegans defence responses to a mitochondrial toxin, revealing bacterial countermeasures to animal defence.