mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Plugin tor_: handle missing dependency during "fetch" or "config"
This commit is contained in:
parent
f06ee36a05
commit
179f04721a
1 changed files with 7 additions and 2 deletions
|
@ -81,10 +81,11 @@ try:
|
||||||
import stem
|
import stem
|
||||||
import stem.control
|
import stem.control
|
||||||
import stem.connection
|
import stem.connection
|
||||||
except ImportError:
|
missing_dependency_error = None
|
||||||
|
except ImportError as exc:
|
||||||
# missing dependencies are reported via "autoconf"
|
# missing dependencies are reported via "autoconf"
|
||||||
# thus failure is acceptable here
|
# thus failure is acceptable here
|
||||||
pass
|
missing_dependency_error = str(exc)
|
||||||
|
|
||||||
default_torcachefile = 'munin_tor_country_stats.json'
|
default_torcachefile = 'munin_tor_country_stats.json'
|
||||||
default_torconnectmethod = 'port'
|
default_torconnectmethod = 'port'
|
||||||
|
@ -517,6 +518,10 @@ def main():
|
||||||
TorPlugin.suggest()
|
TorPlugin.suggest()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
else:
|
else:
|
||||||
|
if missing_dependency_error is not None:
|
||||||
|
print("Failed to run tor_ due to missing dependency: {}"
|
||||||
|
.format(missing_dependency_error), file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
# detect data provider
|
# detect data provider
|
||||||
if __file__.endswith('_bandwidth'):
|
if __file__.endswith('_bandwidth'):
|
||||||
provider = TorBandwidth()
|
provider = TorBandwidth()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue