1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-29 12:25:02 +00:00

Simplify autoconf method

It's quite bogus, since any exceptions will be thrown during
initialization.
This commit is contained in:
Sandro 2022-06-07 23:11:53 +02:00
parent fe43112bc5
commit 682917ec36

View file

@ -262,21 +262,24 @@ class MuninNftCountersPlugin(MuninPlugin):
def autoconf(self):
"""
Implements Munin Plugin Auto-Configuration Option.
Returns
-------
bool
True if plugin can be auto-configured.
"""
Checks if nft command can be run (needs root) and if so,
if there any counters present in nftables
"""
# Any exceptions (e.g. insufficient permissions, missing dependencies)
# will already throw an exception when the plugin is initialized since
# the plugin reads all its data from nftables. So below should always
# return True (print "yes").
try:
counters = getCounters()
if len(counters) > 0:
return True
else:
return False
except:
return True
except ValueError:
return False