|Subject:||Re: Conditional services|
|Date:||Fri, 5 Feb 2016 05:17:21 -0500|
It has come to my mind to have two different configs, but I was hoping monit had a more elegant solution. Thanks.
Sent from Android
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 offlineps -ef | grep -q 'my-service-name-here'# Return an appropriate exit codeif [ $? -eq 0 ] ; thenecho "Process exists, this is a failure"exit 1;elseecho "Process does NOT exist. This is a success."exit 0;fiOn 4 February 2016 at 11:52, Vadym Chepkov <address@hidden> wrote:
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.
|[Prev in Thread]||Current Thread||[Next in Thread]|