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:
parent
fe43112bc5
commit
682917ec36
1 changed files with 13 additions and 10 deletions
|
@ -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:
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue