2

I am setting up a server and have just installed "monit" to monitor processes and restart them (and alert me) when certain conditions are met. It works great.

My question is what happens when monit itself dies? Is there a correct way of ensuring that monit restarts itself when it dies? I currently have it restarting (even if it's already running) via a cron job but that doesn't seem very elegant.

What is considered the correct way to restart monit? I'm using Debian and installed it via apt-get (thus I have an /etc/init.d/monit script available). I have ensured it runs using the default levels using update-rc.d.

Thanks!

1 Answer 1

1

The Monit daemon doesn't really die.

Why do you assume it would?

Either way, the Monit service is managed by Puppet on my systems. But it's mainly to reload the service when I make configuration file changes.

  service { $monit_svc:
    ensure    => 'running',
    enable    => true,
    restart   => 'monit reload',
    subscribe => File[$monit_conf],
  }

While I don't advocate this, it is possible to run Monit from init. But the software is stable. This should not be necessary.

5
  • monit probably won't die, but what happens if it does and I didn't plan for it? My site goes down. I don't use Puppet so that unfortunately won't work in my case.
    – Phil
    Apr 22, 2015 at 3:14
  • Monit doesn't die... at least it hasn't in my 7 years of experience with it. While I don't think you should worry about this, your concern is address in the documentation.
    – ewwhite
    Apr 22, 2015 at 3:30
  • I've actually already followed those steps but it still doesn't return. If it is in fact meant to, then something else might be wrong.
    – Phil
    Apr 22, 2015 at 3:32
  • 3
    Actually, monit can die/be killed. It have happened to me on numerous occasions when a host has run out of RAM+swap. To be honest, this is in a fairly large server park.
    – Xyz
    Oct 15, 2015 at 13:29
  • @AronCederholm That's probably a situation that the people monitoring Monit or the systems should have resolved. I'd say it's an edge case.
    – ewwhite
    Oct 15, 2015 at 13:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .