How do you run a script upon a given failure?
What I am trying to do:
When I get a notification that “Linux server X” has updates, I know that apt update && apt -y upgrade
needs to be run. It’s a waste of human time to do this. If Icinga could run a script or command after this alarm is triggered, this could be avoided.
I get that the command might fail, and I would have to deal with that in a different way. It’s just that right now, it seems like this should be very doable … and may be so obvious that I have missed it…
Would it be possible to implement something using NotificationCommand and change that to be something that accepts args, which could then use something else to run a command to the remote box via ssh? ssh root@hostwithproblem "apt update && apt -y upgrade"
?
Thanks in advance.