From ab6cc70394844265350000b87cada3daa00889ba Mon Sep 17 00:00:00 2001 From: salles Date: Sat, 1 Sep 2007 17:22:43 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9composition=20de=20l'analyse=20des=20reg?= =?UTF-8?q?les=20pour=20detecter=20plus=20facilement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit une desynchronisation des firewalls, en attendant de trouver un moyen plus automatique. darcs-hash:20070901152243-72cb0-4ef3180254ceaba433de7d38c567c3c85531e788.gz --- munin/iptables_ | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/munin/iptables_ b/munin/iptables_ index fe66d8ab..03c6caa1 100755 --- a/munin/iptables_ +++ b/munin/iptables_ @@ -28,17 +28,38 @@ if arg == "config" : for chain in CHAINS : nom = string.lower(chain.replace('_', '').replace('-', '').replace('.','').replace('/', '')) label = chain.replace('_', '-').replace('.','-').replace('/','-') - print "%s.label %s" % (nom, label) - if CHAINS.index(chain) == 0 : - print "%s.draw AREA" % nom + if label != "TEST-MAC-IP" : + print "%s.label %s" % (nom, label) + if CHAINS.index(chain) == 0 : + print "%s.draw AREA" % nom + else : + print "%s.draw STACK" % nom else : - print "%s.draw STACK" % nom - if label == "TEST-MAC-IP" : + print "%sadm.label %s-adm" % (nom, label) + print "%sadm.draw STACK" % nom + for subnet in range(136,152): + print "%s%s.label %s-%s" % (nom, subnet, label, subnet) + print "%s%s.draw STACK" % (nom, subnet) + print "%s.label %s" % (nom, label) print "%s.warning 100:2500" % nom print "%s.critical 1:3000" % nom else : for chain in CHAINS : nom = string.lower(chain.replace('_', '').replace('-', '').replace('.','').replace('/', '')) - value = int(commands.getoutput('%s %s | wc -l' % (IPTABLES, chain))) - 2 - print "%s.value %d" % (nom, value) + label = chain.replace('_', '-').replace('.','-').replace('/','-') + if label == "TEST-MAC-IP" : + data = commands.getoutput("%s %s | awk '{print $4}' | grep 231 | awk -F '.' '{print $1$2$3}' | sort | uniq -c | grep 231" % (IPTABLES, chain)).split('\n') + total = 0 + for line in data : + value, subnet = line.split() + total += int(value) + if subnet[:8] == "10231136": + print "%sadm.value %s" % (nom, value) + for x in range(136,152): + if subnet[:9] == ("138231%d" % x): + print "%s%d.value %s" % (nom, x, value) + print "%s.value %d" % (nom, total) + else : + value = int(commands.getoutput('%s %s | wc -l' % (IPTABLES, chain))) - 2 + print "%s.value %d" % (nom, value)