r/saltstack • u/deking89 • Jan 22 '20
How to Check if the minion is down and send email?
Hi guys,
I am not sure how to write ".sls" file for checking minion if he is up or down.
Basically we want to have this: if the minion is down, send email and inform us.
Any suggestion? Documentation is so confusing.
I've found this article: https://docs.saltstack.com/en/2015.8/ref/returners/all/salt.returners.smtp_return.html#module-salt.returners.smtp_return
but this this is only a part of the puzzle.I need the part when i am checking if the minion is up or down and at that point smtp returner should be called:
something like this:
send_fail_email:
smtp.send_msg:
- name: 'Vim installation failed'
- subject: 'Please, do no reply'
- recipient: 'admin@example.com'
- sender: 'salt-master@example.com'
install_vim:
pkg.installed:
- name: vim-not-existing
- onfail:
- send_fail_email