@cryptotaxi247 / netdata-1 / commits / d6de81a4d

python.d/fail2ban: Add handling "yes" and "no" as bool, match flexible spaces (#10400)

1. `enable = yes` is handled by fail2ban, so we shall, too 2. `enable = true` is valid, however stupid it looks

Peter Gervai committed Jan 11, 2021 at 17:19 UTC d6de81a4d6de0cc8f152162a72472c7d96d889b3
1 file changed +3 -3
collectors/python.d.plugin/fail2ban/fail2ban.chart.py
+3 -3
@@ -50,7 +50,7 @@ def charts(jails):
50 return ch
51
52
53 -RE_JAILS = re.compile(r'\[([a-zA-Z0-9_-]+)\][^\[\]]+?enabled\s+= (true|false)')
53 +RE_JAILS = re.compile(r'\[([a-zA-Z0-9_-]+)\][^\[\]]+?enabled\s+= +(true|yes|false|no)')
54
55 # Example:
56 # 2018-09-12 11:45:53,715 fail2ban.actions[25029]: WARNING [ssh] Unban 195.201.88.33
@@ -196,9 +196,9 @@ class Service(LogService):
196 if name in exclude:
197 continue
198
199 - if status == 'true' and name not in active_jails:
199 + if status in ('true','yes') and name not in active_jails:
200 active_jails.append(name)
201 - elif status == 'false' and name in active_jails:
201 + elif status in ('false','no') and name in active_jails:
202 active_jails.remove(name)
203
204 return active_jails or DEFAULT_JAILS