Package zephir :: Package monitor :: Package agentmanager :: Module config
[frames] | no frames]

Source Code for Module zephir.monitor.agentmanager.config

 1  # -*- coding: UTF-8 -*- 
 2  ########################################################################### 
 3  # Eole NG - 2007 
 4  # Copyright Pole de Competence Eole  (Ministere Education - Academie Dijon) 
 5  # Licence CeCill  cf /root/LicenceEole.txt 
 6  # eole@ac-dijon.fr 
 7  ########################################################################### 
 8   
 9  """ 
10  Singleton contenant les données globales de configuration. 
11   
12  Usage : 
13    from zephir.monitor.agentmanager import config as cfg 
14    cfg.whatever_you_need 
15  """ 
16   
17  try: _ # localized string fetch function 
18  except NameError: _ = str 
19   
20  import os 
21  from datetime import datetime 
22  from creole.fonctionseole import get_module_name 
23  try: 
24          from zephir.zephir_conf.zephir_conf import id_serveur 
25  except: 
26          id_serveur=0 
27   
28   
29  # VERSION DE DISTRIBUTION EOLE 
30  distrib_version = 4 
31   
32  DEFAULT_CONFIG = { 
33      'host_ref': str(id_serveur), #zephircfg.id_serveur 
34   
35      'webserver_port': 8090, 
36      'static_web_dir': os.path.join(os.path.curdir, 'static'), 
37      'static_base_url': '/static', 
38       
39      'tmp_data_dir': os.path.join(os.path.curdir, 'data'), 
40      'config_dir': os.path.join(os.path.curdir, 'configs'), 
41      'state_dir': os.path.join(os.path.curdir, 'stats'), 
42      'uucp_dir': os.path.join(os.path.curdir, 'uucp'), 
43      'action_dir':  os.path.join(os.path.curdir, 'actions'), 
44   
45      'upload_period': 600, 
46      } 
47   
48  # dans le cas de zephir, on garde toujours le répertoire 0 au lieu de 
49  # l'identifiant zephir pour éviter un conflit avec les serveurs clients enregistrés 
50  if get_module_name().startswith('zephir'): 
51      DEFAULT_CONFIG['host_ref'] = "0" 
52   
53   
54 -def client_data_dir(config, client_name):
55 return os.path.join(config['state_dir'], 56 client_name)
57 58
59 -def agent_data_dir(config, client_name, agent_name):
60 return os.path.join(client_data_dir(config, client_name), 61 agent_name)
62 63
64 -def agent_metadata_file(config, client_name, agent_name):
65 return os.path.join(agent_data_dir(config, client_name, agent_name), 66 "agent.xml")
67 68 69 # internal constants 70 RRD_TIME_ORIGIN = datetime(1970,1,1) 71