Package zephir :: Package monitor :: Package agentmanager :: Module config
[hide private]
[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  try: 
23          from zephir.zephir_conf.zephir_conf import id_serveur 
24  except: 
25          id_serveur=0 
26   
27  DEFAULT_CONFIG = { 
28      'host_ref': str(id_serveur), #zephircfg.id_serveur 
29   
30      'webserver_port': 8090, 
31      'static_web_dir': os.path.join(os.path.curdir, 'static'), 
32      'static_base_url': '/static', 
33       
34      'tmp_data_dir': os.path.join(os.path.curdir, 'data'), 
35      'config_dir': os.path.join(os.path.curdir, 'configs'), 
36      'state_dir': os.path.join(os.path.curdir, 'stats'), 
37      'uucp_dir': os.path.join(os.path.curdir, 'uucp'), 
38   
39      'upload_period': 600, 
40      } 
41   
42   
43   
44 -def client_data_dir(config, client_name):
45 return os.path.join(config['state_dir'], 46 client_name)
47 48
49 -def agent_data_dir(config, client_name, agent_name):
50 return os.path.join(client_data_dir(config, client_name), 51 agent_name)
52 53
54 -def agent_metadata_file(config, client_name, agent_name):
55 return os.path.join(agent_data_dir(config, client_name, agent_name), 56 "agent.xml")
57 58 59 # internal constants 60 RRD_TIME_ORIGIN = datetime(1970,1,1) 61