diff --git a/statistiques/parseStats.py b/statistiques/parseStats.py index 6accca7..521b2a6 100755 --- a/statistiques/parseStats.py +++ b/statistiques/parseStats.py @@ -13,9 +13,9 @@ import sqlite3 STAT_DIR = '/srv/visio.chapril.org/statistiques/' STATS_TOT_FIELDS = ['total_conferences_created','total_failed_conferences','total_conferences_completed','total_conference_seconds','total_bytes_received','total_bytes_sent','total_participants','conferences','videochannels','endpoints_sending_audio', 'total_conference', 'average conferences by day', 'total_conference_time', ] -STATS_FR_TOT_FIELDS = ['conferences creees total','conferences totalement echouees','conferences terminees total','duree totale conferences','total octets reçus','total octets envoyés','total participants','nombre de conferences','canaux video','canaux audio', 'Conferences total', 'moyenne de conferences par jour', 'duree totale conferences', ] -STATS_MAX_FIELDS = ['largest_conference',] -STATS_FR_MAX_FIELDS = ['plus grande conference',] +STATS_FR_TOT_FIELDS = ['conferences creees total','conferences totalement echouees','conferences terminees total','duree totale conferences','total octets reçus','total octets envoyés','plus grand nombre de connexions simultanees total','nombre de conferences','canaux video','canaux audio', 'Conferences total', 'moyenne de conferences par jour', 'duree totale conferences', ] +STATS_MAX_FIELDS = ['total_participants','largest_conference',] +STATS_FR_MAX_FIELDS = ['plus grand nombre de connexions simultanées','plus grande conference',] dbPath = '/srv/visio.chapril.org/statistiques/stats_sqlite.db' dbName = 'jitsi_stats' @@ -82,11 +82,15 @@ class Stats: return octets,unit def parse(self): - res = self.db.dbQuery(f"""SELECT * FROM {dbName} WHERE timestamp > {self.startDate} AND timestamp < {self.endDate} ORDER by id""") - consolided = {} - moy_conf_by_day = 0 + res = None + while res is None: + res = self.db.dbQuery(f"""SELECT * FROM {dbName} WHERE timestamp > {self.startDate} AND timestamp < {self.endDate} ORDER by id""") + time.sleep(60) if res is None: sys.exit('Traitement en cours, base de données indisponible') + + consolided = {} + moy_conf_by_day = 0 for line in res: field = line[2] if field in STATS_TOT_FIELDS: