diff --git a/surveillance/analyse.py b/surveillance/analyse.py index 9edaf8ba..9237e107 100755 --- a/surveillance/analyse.py +++ b/surveillance/analyse.py @@ -99,11 +99,6 @@ def stats(ip_crans=[], ip_ext=[], AND (date > timestamp 'now' - interval '%(begin_time)d hours') AND (date < timestamp 'now' - interval '%(end_time)d hours') GROUP BY %(show)s - ) UNION ( - SELECT %(select)s FROM upload6 WHERE (%(ip_crans)s) AND (%(ip_ext)s) - AND (date > timestamp 'now' - interval '%(begin_time)d hours') - AND (date < timestamp 'now' - interval '%(end_time)d hours') - GROUP BY %(show)s ) ) AS resultat_intemediaire WHERE %(sort_by)s >= '%(sort_mini)d' @@ -174,7 +169,6 @@ def stats(ip_crans=[], ip_ext=[], def stats_fork(stub='', ip_crans=[], - show=['ip_crans', 'ip_ext', 'port_crans', 'port_ext'], upload_mini=0, show_limit=10, begin_time=24, end_time=0, show_download=False,resolve_dns=False): if '/' in stub: diff --git a/surveillance/deconnexion.py b/surveillance/deconnexion.py index 4beedc1a..e0893464 100755 --- a/surveillance/deconnexion.py +++ b/surveillance/deconnexion.py @@ -83,7 +83,7 @@ def connectsmtp(): # Pour trouver la chambre où était la machine que l'on déconnecte. def reperage_chambre(mac): - pgsql = psycopg2.connect(database='mac_prises', user='crans') + pgsql = psycopg2.connect(host="thot.adm.crans.org", database='mac_prises', user='crans') # A priori, pas besoin, on ne fait que des select pgsql.set_session(autocommit=True) curseur = pgsql.cursor() @@ -100,8 +100,8 @@ def reperage_chambre(mac): ################################################################################ # upload par entité (adhérent/club/machine crans) -upload="""SELECT - SUM((agregat.total) as tot_upload, machines.type, machines.id +requete="""SELECT + SUM(agregat.total) as tot_upload, machines.type, machines.id FROM ( SELECT 'upload', sum(bytes)/1024/1024 AS total, mac_src @@ -205,7 +205,7 @@ for elupload, eltype, elid in uploadeurs: # On inscrit l'instance dans la table des avertis_hard ###################################################### curseur.execute("INSERT INTO avertis_upload_hard (type,id,date) VALUES ('%s','%d','now')"%(eltype,elid)) - analyse.stats_fork('-%s' % debut, ip_crans=[m.ip() for m in proprio.machines()], show_limit=1000) + #analyse.stats_fork('-%s' % debut, ip_crans=[m.ip() for m in proprio.machines()], show_limit=1000) except Exception as error: sys.stderr.write("Blacklist de id=%s pour %s Mo échoué, %s\n" % (proprio.id(), elupload, error)) continue