问题
I'm using monit to monitor some services. However, I want to get an email which includes the output from top when this happens. Is there some way to get this information?
回答1:
Don't know if you can get it from the mail-format (which would be pretty nice) but they have the following example in the monit wiki:
check file myfile with path /tmp/foo.bar if changed timestamp then
exec "/bin/bash -c 'top -bn1 | mail -s top admin@foo.bar'"
来源:https://stackoverflow.com/questions/31513996/make-monit-mail-format-send-top-as-well