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
This commit is contained in:
parent
8fb47d4e9b
commit
9b5fca9aad
1 changed files with 10 additions and 2 deletions
|
@ -33,6 +33,12 @@ pgsql = PgSQL.connect(host='/var/run/postgresql', database='filtrage', user='cra
|
||||||
curseur = pgsql.cursor()
|
curseur = pgsql.cursor()
|
||||||
mail = smtplib.SMTP('localhost')
|
mail = smtplib.SMTP('localhost')
|
||||||
|
|
||||||
|
# Probablement à mettre ailleurs
|
||||||
|
def gethostname(s):
|
||||||
|
try:
|
||||||
|
return socket.gethostbyaddr(s)[0]
|
||||||
|
except:
|
||||||
|
return s
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# Statistiques d'upload : #
|
# Statistiques d'upload : #
|
||||||
|
@ -42,9 +48,11 @@ mail = smtplib.SMTP('localhost')
|
||||||
|
|
||||||
# Liste des uploads :
|
# 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)
|
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'],
|
titre = ['upload', 'download', 'machine'],
|
||||||
largeur = [10, 10, 30],
|
largeur = [10, 10, 30],
|
||||||
format = ['o', 'o', 's'],
|
format = ['o', 'o', 's'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue