[Top][All Lists]

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

Re: [monit] Can monit do this ?

From: Martin Pala
Subject: Re: [monit] Can monit do this ?
Date: Thu, 15 May 2008 21:30:19 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20080313 Iceape/1.1.9 (Debian-1.1.9-5)


Several workarounds can be used:

1.) you can customize monit configuration. There are several option - either generate the configuration (using m4 for example) or using the "include" statement. The "include" statement allows to split configuration files.

For example including configuration of the service from specific file:

 include /etc/monit/service1

or including content of whole directory (you can have one file per service, this the main monit configuration will be same on all hosts, but just the particular service configuration susbset will be different):

 include /etc/monit/*

2.) or if you want common configuration with runtime checking, something like this can be used:

# definition of first alternative - mode is manual thus monit
# won't monitorthe service automatically
check process service_v1 with pidfile /var/run/<service>.pid
  mode manual

# if the pidfile of first alternative exists, enable monitoring
# of corresponding service
check file service_v1_pid with path /var/run/<service>.pid
  if size > 0 then exec "/usr/bin/monit monitor service_v1"

# second alternative
check process service_v2 with pidfile /var/run/<service>/<service>.pid
  mode manual

check file service_v2_pid with path /var/run/<service>/<service>.pid
  if size > 0 then exec "/usr/bin/monit monitor service_v2"


Most probably another workarounds can be used as well.


Donnell Lewis wrote:
Quick question,

I have monit installed 5.0beta1 and I have a .pid file for a service
that runs that can be located in two different spots dependent upon what
install I am doing for it.

My question is, can monit monitor and do this ?:

monitor /var/run/<service>.pid or if that doesn't exist look for
/var/run/<service>/<service>.pid else restart/start

This way it looks at either location for the .pid file for that service
and if it doesn't exist in either location it would start the service.
Can monit do a "and or" monitor of file locations ?


Don Lewis

To unsubscribe:

reply via email to

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