[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit] how to specify this tricky situation

From: David Blank-Edelman
Subject: [monit] how to specify this tricky situation
Date: Fri, 13 Jun 2008 16:21:57 -0400


I've been really happy with monit and appreciate all of the hard work put into it. I recently encountered a scenario for which I can't seem to find an elegant approach. I'm wondering if you have any suggestions about the following:

I have a piece of software I am trying to monitor which consists of two daemons which I'll call "spam" and "proxy".

I want to check that two things are always true:
  1) is the SMTP service on port 25 (provided by "proxy") available
  2) is the process "spam" running as per its pid file

That's all very easy to do using monit. Here is where it gets more interesting.

I have three vendor-supplied scripts available to me:
  restart-software (calls stop-software and then start-software)

start-software and stop-software always start and stop _both_ the daemons.

The place I am getting into trouble seems to be with the two stanzas of my config file fighting with each other. Let's say the "spam" process goes down. It attempts to restart, but this has the side effect of bringing down the proxy daemon and monit then attempts to correct the lack of SMTP service by, you guessed it, bringing down the spam process. And so on... The other part of this that I think is biting me is that at least part of the process is asynchronous and hence some of this corrective action is overlapping

Ideally I'd love to construct a single stanza that says (atomically) if either #1 or #2 is true, attempt a restart. I would think that I could use dependencies to help with this, but the problem is they are both (because of how they are started/stopped) dependent on each other. I also contemplated using the fact that both #1 and #2 could be put in the same group, but as far as I can tell groups aren't actually accessible from the config file (i.e. you can't say "restart group" from anything but the command line).

I know there are less great ways I could hack this like splitting out the the vendor-supplied scripts into scripts that deal with the individual daemons but I'd like to avoid that if I can (just to avoid problems when the vendor modifies the scripts).

Any ideas on an elegant way to handle this situation? Thanks in advance for any help you can offer.

     -- dNb

reply via email to

[Prev in Thread] Current Thread [Next in Thread]