[munin/ipset] On sépare macip des autres sets
This commit is contained in:
parent
45eb716481
commit
4afa4dc065
1 changed files with 9 additions and 2 deletions
11
munin/ipset
11
munin/ipset
|
@ -1,21 +1,28 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Compteur des règles iptables
|
# Compteur des sets ipset
|
||||||
|
|
||||||
import sys,commands,string
|
import sys,commands,string
|
||||||
|
|
||||||
IPSET = "ipset -L "
|
IPSET = "ipset -L "
|
||||||
|
|
||||||
|
|
||||||
|
if sys.argv[0].endswith('macip'):
|
||||||
|
MACIP = True
|
||||||
|
else:
|
||||||
|
MACIP = False
|
||||||
|
|
||||||
try :
|
try :
|
||||||
arg = sys.argv[1]
|
arg = sys.argv[1]
|
||||||
except :
|
except :
|
||||||
arg = ''
|
arg = ''
|
||||||
|
|
||||||
CHAINS = commands.getoutput('%s | grep -- ^Name: | awk \'{print $2}\'' % IPSET).split('\n')
|
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" :
|
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_args --base 1000 --lower-limit 0'
|
||||||
print 'graph_category network'
|
print 'graph_category network'
|
||||||
print "graph_vlabel nb de regles"
|
print "graph_vlabel nb de regles"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue