monit-general
[Top][All Lists]
Advanced

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

Sharing control files


From: Michael Thomas
Subject: Sharing control files
Date: Wed, 14 Nov 2012 10:12:51 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2

We are using monit to monitor a set of diskless hosts that share the
same root filesystem over NFS.  Different hostnames are assigned to each
host using a short shell script in /etc/rc.local that looks up the ip
address in /etc/hosts.

Since the hosts all share the same filesystem the monit id file
$HOME/monit.id is also shared.  This becomes a problem when the hosts
start reporting to mmonit because mmonit wants each reporting host to
have a different id.

One workaround is to create different monitrc control file for each host
and specify a unique 'idfile' setting in each monitrc file.  Then we
would use the -c flag to point to the correct monitrc file when starting
up the monit service.

But since the monit control files are identical for all hosts (except
for the idfile setting), we'd really like to be able to use some sort of
environment variable or other parameterized setting to specify the
idfile.  For example:

set idfile $HOME/.monit.$HOSTNAME.id

...or...

set idfile $HOME/.monit.`hostname`.id

Is there any way to use the current host's name or IP as part of the
value for the 'idfile' attribute in the monit control file?  Or should
we just revert to some clever shell tricks to maintain the monitrc files
for every single host?

--Mike



reply via email to

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