Basic googling usually shows articles with alerts via exec
. That makes configuration overcomplicated as you have to duplicate it for an alert and for a real action. However you can setup your sendmail to do the slack messaging.
- name: put monit config
copy:
dest: /etc/monit.d/foo.conf
content: |
set alert slack.monit@localhost but not on { instance }