config test

This commit is contained in:
David 2023-01-04 11:42:47 +01:00
parent 5fbabd60e9
commit 29212e609e

View File

@ -13,9 +13,9 @@ import sqlite3
STAT_DIR = '/srv/visio.chapril.org/statistiques/' 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_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_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 = ['largest_conference',] STATS_MAX_FIELDS = ['total_participants','largest_conference',]
STATS_FR_MAX_FIELDS = ['plus grande conference',] STATS_FR_MAX_FIELDS = ['plus grand nombre de connexions simultanées','plus grande conference',]
dbPath = '/srv/visio.chapril.org/statistiques/stats_sqlite.db' dbPath = '/srv/visio.chapril.org/statistiques/stats_sqlite.db'
dbName = 'jitsi_stats' dbName = 'jitsi_stats'
@ -82,11 +82,15 @@ class Stats:
return octets,unit return octets,unit
def parse(self): def parse(self):
res = self.db.dbQuery(f"""SELECT * FROM {dbName} WHERE timestamp > {self.startDate} AND timestamp < {self.endDate} ORDER by id""") res = None
consolided = {} while res is None:
moy_conf_by_day = 0 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: if res is None:
sys.exit('Traitement en cours, base de données indisponible') sys.exit('Traitement en cours, base de données indisponible')
consolided = {}
moy_conf_by_day = 0
for line in res: for line in res:
field = line[2] field = line[2]
if field in STATS_TOT_FIELDS: if field in STATS_TOT_FIELDS: