Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to customize the Monit's alert message, so that whenever I get an alert, the email also includes the output of a command like top, so that I will already know more details about what might have caused the problem.

Is there a way to do this? The documentation doesn't include anything relevant, and searching wasn't helpful either.

Thanks for the help!

share|improve this question

How about something like this, from the monit wiki?

# Getting top otput by mail on event
check file myfile with path /tmp/
  if changed timestamp then exec "/bin/bash -c 'top -bn1 | mail -s top'"

Link: (scroll to very bottom)

share|improve this answer
Henry, I would have preferred a more "centralized" solution, that would enable me to add top's output in the mail-format parameter, so that I would get it in every mail alert sent. From what I read though, this is impossible. Your solution is an excellent workaround though! – Charalambos Paschalides Feb 28 '12 at 15:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.