summaryrefslogtreecommitdiffstats
path: root/python.d/fail2ban.chart.py
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2017-12-19 23:39:27 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2017-12-19 23:39:27 +0000
commit6abdfdead1326ccca98dc4cf415c216f1bf25400 (patch)
tree70b803bd499fd45e89627c1b45b90ddf20e8e959 /python.d/fail2ban.chart.py
parentRelease v. 1.8.0+dfsg-1 to Unstable (diff)
parentNew upstream version 1.9.0+dfsg (diff)
downloadnetdata-6abdfdead1326ccca98dc4cf415c216f1bf25400.tar.xz
netdata-6abdfdead1326ccca98dc4cf415c216f1bf25400.zip
Update upstream source from tag 'upstream/1.9.0+dfsg'
Update to upstream version '1.9.0+dfsg' with Debian dir 28b8242a05f9ad26cd1cdbcf078be754fc7d6251
Diffstat (limited to 'python.d/fail2ban.chart.py')
-rw-r--r--python.d/fail2ban.chart.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/python.d/fail2ban.chart.py b/python.d/fail2ban.chart.py
index 5238fa16e..895833f87 100644
--- a/python.d/fail2ban.chart.py
+++ b/python.d/fail2ban.chart.py
@@ -2,12 +2,15 @@
# Description: fail2ban log netdata python.d module
# Author: l2isbad
+import bisect
+
+from glob import glob
from re import compile as r_compile
from os import access as is_accessible, R_OK
from os.path import isdir, getsize
-from glob import glob
-import bisect
-from base import LogService
+
+
+from bases.FrameworkServices.LogService import LogService
priority = 60000
retries = 60
@@ -180,8 +183,8 @@ def find_jails_in_files(list_of_files, print_error):
jails_list = list()
for conf in list_of_files:
if is_accessible(conf, R_OK):
- with open(conf, 'rt') as conf:
- raw_data = conf.readlines()
+ with open(conf, 'rt') as f:
+ raw_data = f.readlines()
data = ' '.join(line for line in raw_data if line.startswith(('[', 'enabled')))
jails_list.extend(REGEX_JAILS.findall(data))
else: