Moving "monit" configuration into icinga2

We are using of course icinga2 for all our monitoring but we are still using “monit” on our Linux machine to restart services if they stop responding.

How can we migrate this into icinga2 instead ?

Right now if monit detect that the smtp service is not answering, it try 3 times, if still failed, it stop / start the service using the appropriate command…

There are some examples on how to do this under the Event Commands section of this document.

Two things to highlight before you dive in,

  • Event handlers run on the same endpoint as the event command, so in this case an smtp check would need to be running on the mail server and not the master/satellite.
  • Event handlers run every time the state changes or a retry runs. Take note in the examples regarding passing service state to your scripts so they only take action under your desired circumstances.