Commit 4da99694 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Move instanciation of zabbix agentd to a dedicated method.

parent 706ccb3a
......@@ -79,35 +79,48 @@ class Recipe(BaseSlapRecipe):
self.path_list.append(wrapper)
return cron_d
def _install(self):
self.path_list = []
self.requirements, self.ws = self.egg.working_set()
# self.cron_d is a directory, where cron jobs can be registered
self.cron_d = self.installCrond()
self.logrotate_d, self.logrotate_backup = self.installLogrotate()
zabbix_log_file = os.path.join(self.log_directory, 'zabbix_agentd.log')
self.registerLogRotation('zabbix_agentd', [zabbix_log_file])
zabbix_agentd = dict(
def installZabbixAgentd(self, ip, port, hostname, server_ip):
log_file = os.path.join(self.log_directory, 'zabbix_agentd.log')
self.registerLogRotation('zabbix_agentd', [log_file])
zabbix_agentd_conf = dict(
pid_file=os.path.join(self.run_directory, "zabbix_agentd.pid"),
log_file=zabbix_log_file,
ip=self.getGlobalIPv6Address(),
server=self.parameter_dict['server'],
hostname=self.parameter_dict['hostname'],
port='10050'
)
zabbix_agentd_conf = self.createConfigurationFile("zabbix_agentd.conf",
pkg_resources.resource_string(__name__,
'template/zabbix_agentd.conf.in') % zabbix_agentd)
self.path_list.append(zabbix_agentd_conf)
log_file=log_file,
ip=ip,
server=server_ip,
hostname=hostname,
port=port)
zabbix_agentd_path = self.createConfigurationFile(
"zabbix_agentd.conf",
pkg_resources.resource_string(
__name__, 'template/zabbix_agentd.conf.in') % zabbix_agentd_conf)
self.path_list.append(zabbix_agentd_path)
wrapper = zc.buildout.easy_install.scripts([('zabbixagentd',
'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
self.bin_directory, arguments=[
self.options['zabbix_agentd_binary'].strip(), '-c',
zabbix_agentd_conf])[0]
zabbix_agentd_path])[0]
self.path_list.extend(zc.buildout.easy_install.scripts([
('zabbixagentd', __name__ + '.svcdaemon', 'svcdaemon')],
self.ws, sys.executable, self.wrapper_directory, arguments=[dict(
real_binary=wrapper, pid_file=zabbix_agentd['pid_file'])]))
self.setConnectionDict(dict(ip=zabbix_agentd['ip'],
name=zabbix_agentd['hostname'], port=zabbix_agentd['port']))
real_binary=wrapper, pid_file=zabbix_agentd_conf['pid_file'])]))
return zabbix_agentd_conf
def _install(self):
self.path_list = []
self.requirements, self.ws = self.egg.working_set()
# self.cron_d is a directory, where cron jobs can be registered
self.cron_d = self.installCrond()
self.logrotate_d, self.logrotate_backup = self.installLogrotate()
zabbix_agentd_conf = self.installZabbixAgentd(self.getGlobalIPv6Address(),
10050,
self.parameter_dict['hostname'],
self.parameter_dict['server'])
self.setConnectionDict(dict(ip=zabbix_agentd_conf['ip'],
name=zabbix_agentd_conf['hostname'], port=zabbix_agentd_conf['port']))
return self.path_list
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment