diff options
author | Peter Gervai <grinapo@gmail.com> | 2021-01-11 17:19:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 19:19:30 +0300 |
commit | d6de81a4d6de0cc8f152162a72472c7d96d889b3 (patch) | |
tree | ddb6aeeb0d65d9dc6a84439d5701b74046b5b65e | |
parent | 2c389b5a2cec90d18b318d80ac3c748205b72bb6 (diff) |
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
-rw-r--r-- | collectors/python.d.plugin/fail2ban/fail2ban.chart.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/collectors/python.d.plugin/fail2ban/fail2ban.chart.py b/collectors/python.d.plugin/fail2ban/fail2ban.chart.py index d9a77dd0d6..99dbf79dd0 100644 --- a/collectors/python.d.plugin/fail2ban/fail2ban.chart.py +++ b/collectors/python.d.plugin/fail2ban/fail2ban.chart.py @@ -50,7 +50,7 @@ def charts(jails): return ch -RE_JAILS = re.compile(r'\[([a-zA-Z0-9_-]+)\][^\[\]]+?enabled\s+= (true|false)') +RE_JAILS = re.compile(r'\[([a-zA-Z0-9_-]+)\][^\[\]]+?enabled\s+= +(true|yes|false|no)') # Example: # 2018-09-12 11:45:53,715 fail2ban.actions[25029]: WARNING [ssh] Unban 195.201.88.33 @@ -196,9 +196,9 @@ class Service(LogService): if name in exclude: continue - if status == 'true' and name not in active_jails: + if status in ('true','yes') and name not in active_jails: active_jails.append(name) - elif status == 'false' and name in active_jails: + elif status in ('false','no') and name in active_jails: active_jails.remove(name) return active_jails or DEFAULT_JAILS |