Use version key for Monit group
@@ -36,6 +36,7 @@ def create_config_file(watch, start_cmd, pidfile, port=None, env_vars=None,
assert port is not None, 'When using check_port, port must be defined'
process_name = watch
+ version_group = watch.rsplit(VERSION_PATH_SEPARATOR, 1)[0]
if port is not None:
process_name += '-{}'.format(port)
@@ -56,12 +57,11 @@ def create_config_file(watch, start_cmd, pidfile, port=None, env_vars=None,
bash_exec = 'exec env {vars} {start_cmd} >> {log} 2>&1'.format(
vars=env_vars_str, start_cmd=start_cmd, log=logfile)
else:
- version_key = watch.rsplit(VERSION_PATH_SEPARATOR, 1)[0]
bash_exec = (
'exec env {vars} {start_cmd} 2>&1 | tee -a {log} | '
'logger -t {version} -u /tmp/ignored -n {syslog_server} -P 514'
).format(vars=env_vars_str, start_cmd=start_cmd, log=logfile,
- version=version_key, syslog_server=syslog_server)
+ version=version_group, syslog_server=syslog_server)
start_line = ' '.join([
start_stop_daemon,
@@ -76,7 +76,7 @@ def create_config_file(watch, start_cmd, pidfile, port=None, env_vars=None,
output = template.read()
output = output.format(
process_name=process_name, match_clause='PIDFILE "{}"'.format(pidfile),
- group=watch, start_line=start_line, stop_line=stop_line)
+ group=version_group, start_line=start_line, stop_line=stop_line)
if max_memory is not None:
output += ' if totalmem > {} MB for 10 cycles then restart\n'.format(
