From 13349d2573464d672ec5ce663cc88d595c2a25c4 Mon Sep 17 00:00:00 2001 From: Stephane Glondu Date: Mon, 28 Dec 2009 17:56:04 +0100 Subject: [PATCH] [statistiques] statistiques pour l'IPv6 darcs-hash:20091228165604-61eff-703cc75ae6eb9610b4eda49f1c2a27fd6a28be47.gz --- surveillance/statistiques.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/surveillance/statistiques.py b/surveillance/statistiques.py index 152f29c0..ada15094 100644 --- a/surveillance/statistiques.py +++ b/surveillance/statistiques.py @@ -98,13 +98,20 @@ WHERE GROUP BY ip_crans ORDER BY somme DESC""" curseur2.execute(requete) -liste_upload2 = tableau(data = [ (l[1], l[2], gethostname(str(l[0]))) + +def ipv4or6(addr): + if ':' in addr: + return "IPv6" + else: + return "IPv4" + +liste_upload2 = tableau(data = [ (l[1], l[2], ipv4or6(str(l[0])), gethostname(str(l[0]))) for l in curseur2.fetchall() - if int(l[1]) > 100*1024*1024 ], - titre = ['upload', 'download', 'machine'], - largeur = [10, 10, 30], - format = ['o', 'o', 's'], - alignement = ['d', 'd', 'c']).encode('iso-8859-15') + if int(l[1]) > 100*1024*1024 or ':' in l[0]], + titre = ['upload', 'download', 'proto', 'machine'], + largeur = [10, 10, 10, 40], + format = ['o', 'o', 's', 's'], + alignement = ['d', 'd', 'c', 'c']).encode('iso-8859-15') # Trafic exempté :