Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Blanc
scripts
Commits
4afa4dc0
Commit
4afa4dc0
authored
Apr 07, 2013
by
Valentin Samir
Browse files
[munin/ipset] On sépare macip des autres sets
parent
45eb7164
Changes
1
Hide whitespace changes
Inline
Side-by-side
munin/ipset
View file @
4afa4dc0
#!/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"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment