Commit 9b5fca9a authored by glondu's avatar glondu

Je trouvais ca louche que ce soit toujours les memes machines dans les

statistiques de traffic adherent. Apparemment, la table avertis_upload
n'est plus utilisee.

darcs-hash:20060522161212-68412-9a45e0377196783b9b7bc3d9b540e0050b77b206.gz
parent 8fb47d4e
......@@ -33,6 +33,12 @@ pgsql = PgSQL.connect(host='/var/run/postgresql', database='filtrage', user='cra
curseur = pgsql.cursor()
mail = smtplib.SMTP('localhost')
# Probablement mettre ailleurs
def gethostname(s):
try:
return socket.gethostbyaddr(s)[0]
except:
return s
###########################
# Statistiques d'upload : #
......@@ -42,9 +48,11 @@ mail = smtplib.SMTP('localhost')
# Liste des uploads :
#####################
requete = "SELECT ip_crans,sum(upload) as somme,sum(download) FROM upload WHERE ip_crans IN (SELECT ip_crans FROM avertis_upload where hard='1' or soft='1') and date > timestamp 'now' - interval '1 day' GROUP BY ip_crans ORDER BY somme DESC"
requete = "SELECT ip_crans,sum(upload) as somme,sum(download) FROM upload WHERE date > timestamp 'now' - interval '1 day' GROUP BY ip_crans ORDER BY somme DESC"
curseur.execute(requete)
liste_upload = tableau(data = [ [l[1], l[2], socket.gethostbyaddr(str(l[0]))[0]] for l in curseur.fetchall() ],
liste_upload = tableau(data = [ (l[1], l[2], gethostname(str(l[0])))
for l in curseur.fetchall()
if int(l[1]) > 100*1024*1024 ],
titre = ['upload', 'download', 'machine'],
largeur = [10, 10, 30],
format = ['o', 'o', 's'],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment