Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

How about something like this, from the monit wiki?

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

Link: http://mmonit.com/wiki/Monit/ConfigurationExamples (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! –  Pambo Paschalides Feb 28 '12 at 15:19
add comment

Your Answer

 
discard

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.