Ejemplo n.º 1
0
 def test_create_custom_exec_script(self):
     """ test agent config creates custom_exec config """
     manager = ConfigManager()
     telegraf_configs = manager.getconfig(
         os.path.join(PATH, 'telegraf_mon.xml'), 'sometargethint')
     agent_config = AgentConfig(telegraf_configs[0], False)
     custom_exec_config = agent_config.create_custom_exec_script()
     with open(custom_exec_config, 'r') as custom_fname:
         data = custom_fname.read()
     assert (data.find("-0) curl -s 'http://localhost:6100/stat'") != -1)
Ejemplo n.º 2
0
 def test_create_startup_configs(self):
     """ test agent config creates startup config """
     manager = ConfigManager()
     telegraf_configs = manager.getconfig(
         os.path.join(PATH, 'telegraf_mon.xml'), 'sometargethint')
     agent_config = AgentConfig(telegraf_configs[0], False)
     startup = agent_config.create_startup_config()
     cfg_parser = RawConfigParser(strict=False)
     cfg_parser.read(startup)
     assert cfg_parser.has_section('startup')
Ejemplo n.º 3
0
 def test_create_startup_configs(self):
     """ test agent config creates startup config """
     manager = ConfigManager()
     telegraf_configs = manager.getconfig(
         'yandextank/plugins/Telegraf/tests/telegraf_mon.xml',
         'sometargethint')
     agent_config = AgentConfig(telegraf_configs[0], False)
     startup = agent_config.create_startup_config()
     cfg_parser = ConfigParser()
     cfg_parser.read(startup)
     assert cfg_parser.has_section('startup')
Ejemplo n.º 4
0
 def test_create_custom_exec_script(self):
     """ test agent config creates custom_exec config """
     manager = ConfigManager()
     telegraf_configs = manager.getconfig(
         'yandextank/plugins/Telegraf/tests/telegraf_mon.xml',
         'sometargethint')
     agent_config = AgentConfig(telegraf_configs[0], False)
     custom_exec_config = agent_config.create_custom_exec_script()
     with open(custom_exec_config, 'r') as custom_fname:
         data = custom_fname.read()
     assert (data.find("-0) curl -s 'http://localhost:6100/stat'") != -1)
Ejemplo n.º 5
0
 def test_create_startup_configs(self):
     """ test agent config creates startup config """
     manager = ConfigManager()
     telegraf_configs = manager.getconfig(
         'yandextank/plugins/Telegraf/tests/telegraf_mon.xml',
         'sometargethint')
     agent_config = AgentConfig(telegraf_configs[0], False)
     startup = agent_config.create_startup_config()
     cfg_parser = ConfigParser()
     cfg_parser.read(startup)
     assert cfg_parser.has_section('startup')
Ejemplo n.º 6
0
 def test_create_collector_configs(self):
     """ test agent config creates collector config """
     manager = ConfigManager()
     telegraf_configs = manager.getconfig(
         os.path.join(PATH, 'telegraf_mon.xml'), 'sometargethint')
     agent_config = AgentConfig(telegraf_configs[0], False)
     remote_workdir = '/path/to/workdir/temp'
     collector_config = agent_config.create_collector_config(remote_workdir)
     cfg_parser = RawConfigParser(strict=False)
     cfg_parser.read(collector_config)
     assert (cfg_parser.has_section('agent')
             and cfg_parser.get('agent', 'interval') == "'1s'"
             and cfg_parser.has_section('[outputs.file')
             and cfg_parser.get('[outputs.file', 'files')
             == "['{rmt}/monitoring.rawdata']".format(rmt=remote_workdir))
Ejemplo n.º 7
0
 def test_create_collector_configs(self):
     """ test agent config creates collector config """
     manager = ConfigManager()
     telegraf_configs = manager.getconfig(
         'yandextank/plugins/Telegraf/tests/telegraf_mon.xml',
         'sometargethint')
     agent_config = AgentConfig(telegraf_configs[0], False)
     remote_workdir = '/path/to/workdir/temp'
     collector_config = agent_config.create_collector_config(remote_workdir)
     cfg_parser = ConfigParser()
     cfg_parser.read(collector_config)
     assert (
         cfg_parser.has_section('agent') and
         cfg_parser.get('agent', 'interval') == "'1s'" and
         cfg_parser.has_section('[outputs.file') and
         cfg_parser.get('[outputs.file', 'files') ==
         "['{rmt}/monitoring.rawdata']".format(rmt=remote_workdir))