Make stats retrieval more configurable

This commit is contained in:
Ciaran Gultnieks 2014-09-02 18:53:22 +01:00
parent 27edbd56a7
commit b454ea3c6f
3 changed files with 10 additions and 2 deletions

View file

@ -169,6 +169,12 @@ update_stats = False
# calculation purposes. # calculation purposes.
stats_ignore = [] stats_ignore = []
# Server stats logs are retrieved from. Required when update_stats is True.
stats_server = "example.com"
# User stats logs are retrieved from. Required when update_stats is True.
stats_user = "bob"
# Use the following to push stats to a Carbon instance: # Use the following to push stats to a Carbon instance:
stats_to_carbon = False stats_to_carbon = False
carbon_host = '0.0.0.0' carbon_host = '0.0.0.0'

View file

@ -50,6 +50,8 @@ def get_default_config():
'sync_from_local_copy_dir': False, 'sync_from_local_copy_dir': False,
'update_stats': False, 'update_stats': False,
'stats_ignore': [], 'stats_ignore': [],
'stats_server': None,
'stats_user': None,
'stats_to_carbon': False, 'stats_to_carbon': False,
'repo_maxage': 0, 'repo_maxage': 0,
'build_server_always': False, 'build_server_always': False,

View file

@ -91,8 +91,8 @@ def main():
logging.info('Retrieving logs') logging.info('Retrieving logs')
ssh = paramiko.SSHClient() ssh = paramiko.SSHClient()
ssh.load_system_host_keys() ssh.load_system_host_keys()
ssh.connect('f-droid.org', username='fdroid', timeout=10, ssh.connect(config['stats_server'], username=config['stats_user'],
key_filename=config['webserver_keyfile']) timeout=10, key_filename=config['webserver_keyfile'])
ftp = ssh.open_sftp() ftp = ssh.open_sftp()
ftp.get_channel().settimeout(60) ftp.get_channel().settimeout(60)
logging.info("...connected") logging.info("...connected")