Update tor.chart.py (#15041)
Co-authored-by: ilyam8 <ilya@netdata.cloud>
jmphilippe committed
May 11, 2023 at 00:18 UTC
9c200178f23e43145f62b7dc00853ddd42ecefb7
2 files changed
+5
-1
collectors/python.d.plugin/tor/tor.chart.py
+3
-1
@@ -17,6 +17,7 @@ except ImportError:
17
STEM_AVAILABLE = False
18
19
DEF_PORT = 'default'
20
+DEF_ADDR = '127.0.0.1'
21
22
ORDER = [
23
'traffic',
@@ -41,6 +42,7 @@ class Service(SimpleService):
42
self.order = ORDER
43
self.definitions = CHARTS
44
self.port = self.configuration.get('control_port', DEF_PORT)
45
+ self.addr = self.configuration.get('control_addr', DEF_ADDR)
46
self.password = self.configuration.get('password')
47
self.use_socket = isinstance(self.port, str) and self.port != DEF_PORT and not self.port.isdigit()
48
self.conn = None
@@ -78,7 +80,7 @@ class Service(SimpleService):
80
81
def connect_via_port(self):
82
try:
81
- self.conn = stem.control.Controller.from_port(port=self.port)
83
+ self.conn = stem.control.Controller.from_port(address=self.addr, port=self.port)
84
except (stem.SocketError, ValueError) as error:
85
self.error(error)
86
collectors/python.d.plugin/tor/tor.conf
+2
@@ -61,6 +61,7 @@
61
#
62
# Additionally to the above, tor plugin also supports the following:
63
#
64
+# control_addr: 'address' # tor control IP address (defaults to '127.0.0.1')
65
# control_port: 'port' # tor control port
66
# password: 'password' # tor control password
67
#
@@ -71,6 +72,7 @@
72
# local_tcp:
73
# name: 'local'
74
# control_port: 9051
75
+# control_addr: 127.0.0.1
76
# password: <password>
77
#
78
# local_socket: