mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
parent
069255eee2
commit
04ded0c6f5
1 changed files with 8 additions and 13 deletions
|
@ -158,29 +158,24 @@ class TorPlugin(object):
|
||||||
print('{}.{} {}'.format(label, key, val))
|
print('{}.{} {}'.format(label, key, val))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def autoconf():
|
def get_autoconf_status():
|
||||||
try:
|
try:
|
||||||
import stem
|
import stem
|
||||||
|
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print('no (failed to import the required python module "stem": {})'.format(e))
|
return 'no (failed to import the required python module "stem": {})'.format(e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import GeoIP # noqa: F401
|
import GeoIP # noqa: F401
|
||||||
|
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
print('no (failed to import the required python module "GeoIP": {})'.format(e))
|
return 'no (failed to import the required python module "GeoIP": {})'.format(e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with gen_controller() as controller:
|
with gen_controller() as controller:
|
||||||
try:
|
try:
|
||||||
authenticate(controller)
|
authenticate(controller)
|
||||||
print('yes')
|
return 'yes'
|
||||||
except stem.connection.AuthenticationFailure as e:
|
except stem.connection.AuthenticationFailure as e:
|
||||||
print('no (Authentication failed: {})'.format(e))
|
return 'no (Authentication failed: {})'.format(e)
|
||||||
|
except stem.SocketError:
|
||||||
except stem.connection:
|
return 'no (Connection failed)'
|
||||||
print('no (Connection failed)')
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def suggest():
|
def suggest():
|
||||||
|
@ -516,7 +511,7 @@ def main():
|
||||||
param = 'fetch'
|
param = 'fetch'
|
||||||
|
|
||||||
if param == 'autoconf':
|
if param == 'autoconf':
|
||||||
TorPlugin.autoconf()
|
print(TorPlugin.get_autoconf_status())
|
||||||
sys.exit()
|
sys.exit()
|
||||||
elif param == 'suggest':
|
elif param == 'suggest':
|
||||||
TorPlugin.suggest()
|
TorPlugin.suggest()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue