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 -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
