It has come to my mind to have two different configs, but I was hoping
monit had a more elegant solution. Thanks.

Cheers,
Vadym

Sent from Android
On Feb 4, 2016 7:47 AM, "Phil Townes" <philtown...@gmail.com> wrote:

> I use two different monit configuration files. One for standby state, and
> one for active state.
> In the event that it is determined that a standby server is to become
> active, the monit configuration file is overwritten with the config file
> for an 'active' server, and monit is reloaded.
>
> I use a custom script for "should not be running" services in the standby
> state:
>
> #! /bin/bash
> # Look for a service that should be offline
> ps -ef | grep -q 'my-service-name-here'
>
> # Return an appropriate exit code
> if [ $? -eq 0 ] ; then
> echo "Process exists, this is a failure"
> exit 1;
> else
> echo "Process does NOT exist. This is a success."
> exit 0;
> fi
>
> On 4 February 2016 at 11:52, Vadym Chepkov <vchep...@gmail.com> wrote:
>
>> Hi,
>>
>> Can somebody give an advice how to implement active/standby configuration
>> using monit.
>>
>> There are some services which can't run from multiple locations for
>> various reasons. To solve this problem, we have a script, which can be used
>> to check if current location is active or standby via exit code. cron
>> wrapper uses it to determine if cron job should run or not, for instance.
>>
>> But how does one tell monit to start/monitor  services if server becomes
>> active and stop, make sure they are not running if server is in standby
>> mode.
>> This should be applied only to 'volatile' services, not all of them.
>> Thank you.
>>
>> Cheers,
>> Vadym
>>
>> --
>> To unsubscribe:
>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>
>
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
>
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to