From 4afa4dc06575b9ecb92a29449dda2a4ea77c5ab9 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sun, 7 Apr 2013 21:41:58 +0200 Subject: [PATCH] =?UTF-8?q?[munin/ipset]=20On=20s=C3=A9pare=20macip=20des?= =?UTF-8?q?=20autres=20sets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- munin/ipset | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/munin/ipset b/munin/ipset index a9da7510..8b57650a 100755 --- a/munin/ipset +++ b/munin/ipset @@ -1,21 +1,28 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Compteur des règles iptables +# Compteur des sets ipset import sys,commands,string IPSET = "ipset -L " + +if sys.argv[0].endswith('macip'): + MACIP = True +else: + MACIP = False + try : arg = sys.argv[1] except : arg = '' CHAINS = commands.getoutput('%s | grep -- ^Name: | awk \'{print $2}\'' % IPSET).split('\n') +CHAINS = [ chain for chain in CHAINS if (not MACIP and not chain.startswith('MAC-IP')) or ( MACIP and chain.startswith('MAC-IP')) ] if arg == "config" : - print 'graph_title Ipset' + print 'graph_title Ipset' + (MACIP and ' test mac-ip' or '') print 'graph_args --base 1000 --lower-limit 0' print 'graph_category network' print "graph_vlabel nb de regles"