@cryptotaxi247 / netdata-1 / commits / 1005176e1

remove python.d/tor (#18358)

Ilya Mashchenko committed Aug 18, 2024 at 20:37 UTC 1005176e13fb268f2fe182fd33ed3515ecd20db6
6 files changed -566
CMakeLists.txt
-2
@@ -2788,7 +2788,6 @@ install(FILES
2788 src/collectors/python.d.plugin/pandas/pandas.conf
2789 src/collectors/python.d.plugin/samba/samba.conf
2790 src/collectors/python.d.plugin/spigotmc/spigotmc.conf
2791 - src/collectors/python.d.plugin/tor/tor.conf
2791 src/collectors/python.d.plugin/traefik/traefik.conf
2792 src/collectors/python.d.plugin/varnish/varnish.conf
2793 src/collectors/python.d.plugin/w1sensor/w1sensor.conf
@@ -2810,7 +2809,6 @@ install(FILES
2809 src/collectors/python.d.plugin/pandas/pandas.chart.py
2810 src/collectors/python.d.plugin/samba/samba.chart.py
2811 src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
2813 - src/collectors/python.d.plugin/tor/tor.chart.py
2812 src/collectors/python.d.plugin/traefik/traefik.chart.py
2813 src/collectors/python.d.plugin/varnish/varnish.chart.py
2814 src/collectors/python.d.plugin/w1sensor/w1sensor.chart.py
src/collectors/python.d.plugin/tor/README.md deleted
-1
@@ -1 +0,0 @@
1 -integrations/tor.md
\ No newline at end of file
src/collectors/python.d.plugin/tor/integrations/tor.md deleted
-230
@@ -1,230 +0,0 @@
1 -<!--startmeta
2 -custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/tor/README.md"
3 -meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/tor/metadata.yaml"
4 -sidebar_label: "Tor"
5 -learn_status: "Published"
6 -learn_rel_path: "Collecting Metrics/VPNs"
7 -most_popular: False
8 -message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
9 -endmeta-->
10 -
11 -# Tor
12 -
13 -
14 -<img src="https://netdata.cloud/img/tor.svg" width="150"/>
15 -
16 -
17 -Plugin: python.d.plugin
18 -Module: tor
19 -
20 -<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
21 -
22 -## Overview
23 -
24 -This collector monitors Tor bandwidth traffic .
25 -
26 -It connects to the Tor control port to collect traffic statistics.
27 -
28 -This collector is supported on all platforms.
29 -
30 -This collector supports collecting metrics from multiple instances of this integration, including remote instances.
31 -
32 -
33 -### Default Behavior
34 -
35 -#### Auto-Detection
36 -
37 -If no configuration is provided the collector will try to connect to 127.0.0.1:9051 to detect a running tor instance.
38 -
39 -#### Limits
40 -
41 -The default configuration for this integration does not impose any limits on data collection.
42 -
43 -#### Performance Impact
44 -
45 -The default configuration for this integration is not expected to impose a significant performance impact on the system.
46 -
47 -
48 -## Metrics
49 -
50 -Metrics grouped by *scope*.
51 -
52 -The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
53 -
54 -
55 -
56 -### Per Tor instance
57 -
58 -These metrics refer to the entire monitored application.
59 -
60 -This scope has no labels.
61 -
62 -Metrics:
63 -
64 -| Metric | Dimensions | Unit |
65 -|:------|:----------|:----|
66 -| tor.traffic | read, write | KiB/s |
67 -
68 -
69 -
70 -## Alerts
71 -
72 -There are no alerts configured by default for this integration.
73 -
74 -
75 -## Setup
76 -
77 -### Prerequisites
78 -
79 -#### Required python module
80 -
81 -The `stem` python library needs to be installed.
82 -
83 -
84 -#### Required Tor configuration
85 -
86 -Add to /etc/tor/torrc:
87 -
88 -ControlPort 9051
89 -
90 -For more options please read the manual.
91 -
92 -
93 -
94 -### Configuration
95 -
96 -#### File
97 -
98 -The configuration file name for this integration is `python.d/tor.conf`.
99 -
100 -
101 -You can edit the configuration file using the `edit-config` script from the
102 -Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
103 -
104 -```bash
105 -cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
106 -sudo ./edit-config python.d/tor.conf
107 -```
108 -#### Options
109 -
110 -There are 2 sections:
111 -
112 -* Global variables
113 -* One or more JOBS that can define multiple different instances to monitor.
114 -
115 -The following options can be defined globally: priority, penalty, autodetection_retry, update_every, but can also be defined per JOB to override the global values.
116 -
117 -Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
118 -
119 -Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
120 -
121 -
122 -<details open><summary>Config options</summary>
123 -
124 -| Name | Description | Default | Required |
125 -|:----|:-----------|:-------|:--------:|
126 -| update_every | Sets the default data collection frequency. | 5 | no |
127 -| priority | Controls the order of charts at the netdata dashboard. | 60000 | no |
128 -| autodetection_retry | Sets the job re-check interval in seconds. | 0 | no |
129 -| penalty | Indicates whether to apply penalty to update_every in case of failures. | yes | no |
130 -| name | Job name. This value will overwrite the `job_name` value. JOBS with the same name are mutually exclusive. Only one of them will be allowed running at any time. This allows autodetection to try several alternatives and pick the one that works. | | no |
131 -| control_addr | Tor control IP address | 127.0.0.1 | no |
132 -| control_port | Tor control port. Can be either a tcp port, or a path to a socket file. | 9051 | no |
133 -| password | Tor control password | | no |
134 -
135 -</details>
136 -
137 -#### Examples
138 -
139 -##### Local TCP
140 -
141 -A basic TCP configuration. `local_addr` is ommited and will default to `127.0.0.1`
142 -
143 -<details open><summary>Config</summary>
144 -
145 -```yaml
146 -local_tcp:
147 - name: 'local'
148 - control_port: 9051
149 - password: <password> # if required
150 -
151 -```
152 -</details>
153 -
154 -##### Local socket
155 -
156 -A basic local socket configuration
157 -
158 -<details open><summary>Config</summary>
159 -
160 -```yaml
161 -local_socket:
162 - name: 'local'
163 - control_port: '/var/run/tor/control'
164 - password: <password> # if required
165 -
166 -```
167 -</details>
168 -
169 -
170 -
171 -## Troubleshooting
172 -
173 -### Debug Mode
174 -
175 -To troubleshoot issues with the `tor` collector, run the `python.d.plugin` with the debug option enabled. The output
176 -should give you clues as to why the collector isn't working.
177 -
178 -- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
179 - your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
180 -
181 - ```bash
182 - cd /usr/libexec/netdata/plugins.d/
183 - ```
184 -
185 -- Switch to the `netdata` user.
186 -
187 - ```bash
188 - sudo -u netdata -s
189 - ```
190 -
191 -- Run the `python.d.plugin` to debug the collector:
192 -
193 - ```bash
194 - ./python.d.plugin tor debug trace
195 - ```
196 -
197 -### Getting Logs
198 -
199 -If you're encountering problems with the `tor` collector, follow these steps to retrieve logs and identify potential issues:
200 -
201 -- **Run the command** specific to your system (systemd, non-systemd, or Docker container).
202 -- **Examine the output** for any warnings or error messages that might indicate issues. These messages should provide clues about the root cause of the problem.
203 -
204 -#### System with systemd
205 -
206 -Use the following command to view logs generated since the last Netdata service restart:
207 -
208 -```bash
209 -journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep tor
210 -```
211 -
212 -#### System without systemd
213 -
214 -Locate the collector log file, typically at `/var/log/netdata/collector.log`, and use `grep` to filter for collector's name:
215 -
216 -```bash
217 -grep tor /var/log/netdata/collector.log
218 -```
219 -
220 -**Note**: This method shows logs from all restarts. Focus on the **latest entries** for troubleshooting current issues.
221 -
222 -#### Docker Container
223 -
224 -If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:
225 -
226 -```bash
227 -docker logs netdata 2>&1 | grep tor
228 -```
229 -
230 -
src/collectors/python.d.plugin/tor/metadata.yaml deleted
-143
@@ -1,143 +0,0 @@
1 -plugin_name: python.d.plugin
2 -modules:
3 - - meta:
4 - plugin_name: python.d.plugin
5 - module_name: tor
6 - monitored_instance:
7 - name: Tor
8 - link: 'https://www.torproject.org/'
9 - categories:
10 - - data-collection.vpns
11 - icon_filename: 'tor.svg'
12 - related_resources:
13 - integrations:
14 - list: []
15 - info_provided_to_referring_integrations:
16 - description: ''
17 - keywords:
18 - - tor
19 - - traffic
20 - - vpn
21 - most_popular: false
22 - overview:
23 - data_collection:
24 - metrics_description: 'This collector monitors Tor bandwidth traffic .'
25 - method_description: 'It connects to the Tor control port to collect traffic statistics.'
26 - supported_platforms:
27 - include: []
28 - exclude: []
29 - multi_instance: true
30 - additional_permissions:
31 - description: ''
32 - default_behavior:
33 - auto_detection:
34 - description: 'If no configuration is provided the collector will try to connect to 127.0.0.1:9051 to detect a running tor instance.'
35 - limits:
36 - description: ''
37 - performance_impact:
38 - description: ''
39 - setup:
40 - prerequisites:
41 - list:
42 - - title: 'Required python module'
43 - description: |
44 - The `stem` python library needs to be installed.
45 - - title: 'Required Tor configuration'
46 - description: |
47 - Add to /etc/tor/torrc:
48 -
49 - ControlPort 9051
50 -
51 - For more options please read the manual.
52 - configuration:
53 - file:
54 - name: python.d/tor.conf
55 - options:
56 - description: |
57 - There are 2 sections:
58 -
59 - * Global variables
60 - * One or more JOBS that can define multiple different instances to monitor.
61 -
62 - The following options can be defined globally: priority, penalty, autodetection_retry, update_every, but can also be defined per JOB to override the global values.
63 -
64 - Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
65 -
66 - Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
67 - folding:
68 - title: "Config options"
69 - enabled: true
70 - list:
71 - - name: update_every
72 - description: Sets the default data collection frequency.
73 - default_value: 5
74 - required: false
75 - - name: priority
76 - description: Controls the order of charts at the netdata dashboard.
77 - default_value: 60000
78 - required: false
79 - - name: autodetection_retry
80 - description: Sets the job re-check interval in seconds.
81 - default_value: 0
82 - required: false
83 - - name: penalty
84 - description: Indicates whether to apply penalty to update_every in case of failures.
85 - default_value: yes
86 - required: false
87 - - name: name
88 - description: Job name. This value will overwrite the `job_name` value. JOBS with the same name are mutually exclusive. Only one of them will be allowed running at any time. This allows autodetection to try several alternatives and pick the one that works.
89 - default_value: ''
90 - required: false
91 - - name: control_addr
92 - description: Tor control IP address
93 - default_value: 127.0.0.1
94 - required: false
95 - - name: control_port
96 - description: Tor control port. Can be either a tcp port, or a path to a socket file.
97 - default_value: 9051
98 - required: false
99 - - name: password
100 - description: Tor control password
101 - default_value: ''
102 - required: false
103 - examples:
104 - folding:
105 - enabled: true
106 - title: "Config"
107 - list:
108 - - name: Local TCP
109 - description: A basic TCP configuration. `local_addr` is ommited and will default to `127.0.0.1`
110 - config: |
111 - local_tcp:
112 - name: 'local'
113 - control_port: 9051
114 - password: <password> # if required
115 - - name: Local socket
116 - description: A basic local socket configuration
117 - config: |
118 - local_socket:
119 - name: 'local'
120 - control_port: '/var/run/tor/control'
121 - password: <password> # if required
122 - troubleshooting:
123 - problems:
124 - list: []
125 - alerts: []
126 - metrics:
127 - folding:
128 - title: Metrics
129 - enabled: false
130 - description: ""
131 - availability: []
132 - scopes:
133 - - name: global
134 - description: "These metrics refer to the entire monitored application."
135 - labels: []
136 - metrics:
137 - - name: tor.traffic
138 - description: Tor Traffic
139 - unit: "KiB/s"
140 - chart_type: area
141 - dimensions:
142 - - name: read
143 - - name: write
src/collectors/python.d.plugin/tor/tor.chart.py deleted
-109
@@ -1,109 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: adaptec_raid netdata python.d module
3 -# Author: Federico Ceratto <federico.ceratto@gmail.com>
4 -# Author: Ilya Mashchenko (ilyam8)
5 -# SPDX-License-Identifier: GPL-3.0-or-later
6 -
7 -
8 -from bases.FrameworkServices.SimpleService import SimpleService
9 -
10 -try:
11 - import stem
12 - import stem.connection
13 - import stem.control
14 -
15 - STEM_AVAILABLE = True
16 -except ImportError:
17 - STEM_AVAILABLE = False
18 -
19 -DEF_PORT = 'default'
20 -DEF_ADDR = '127.0.0.1'
21 -
22 -ORDER = [
23 - 'traffic',
24 -]
25 -
26 -CHARTS = {
27 - 'traffic': {
28 - 'options': [None, 'Tor Traffic', 'KiB/s', 'traffic', 'tor.traffic', 'area'],
29 - 'lines': [
30 - ['read', 'read', 'incremental', 1, 1024],
31 - ['write', 'write', 'incremental', 1, -1024],
32 - ]
33 - }
34 -}
35 -
36 -
37 -class Service(SimpleService):
38 - """Provide netdata service for Tor"""
39 -
40 - def __init__(self, configuration=None, name=None):
41 - super(Service, self).__init__(configuration=configuration, name=name)
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
49 - self.alive = False
50 -
51 - def check(self):
52 - if not STEM_AVAILABLE:
53 - self.error('the stem library is missing')
54 - return False
55 -
56 - return self.connect()
57 -
58 - def get_data(self):
59 - if not self.alive and not self.reconnect():
60 - return None
61 -
62 - data = dict()
63 -
64 - try:
65 - data['read'] = self.conn.get_info('traffic/read')
66 - data['write'] = self.conn.get_info('traffic/written')
67 - except stem.ControllerError as error:
68 - self.debug(error)
69 - self.alive = False
70 -
71 - return data or None
72 -
73 - def authenticate(self):
74 - try:
75 - self.conn.authenticate(password=self.password)
76 - except stem.connection.AuthenticationFailure as error:
77 - self.error('authentication error: {0}'.format(error))
78 - return False
79 - return True
80 -
81 - def connect_via_port(self):
82 - try:
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 -
87 - def connect_via_socket(self):
88 - try:
89 - self.conn = stem.control.Controller.from_socket_file(path=self.port)
90 - except (stem.SocketError, ValueError) as error:
91 - self.error(error)
92 -
93 - def connect(self):
94 - if self.conn:
95 - self.conn.close()
96 - self.conn = None
97 -
98 - if self.use_socket:
99 - self.connect_via_socket()
100 - else:
101 - self.connect_via_port()
102 -
103 - if self.conn and self.authenticate():
104 - self.alive = True
105 -
106 - return self.alive
107 -
108 - def reconnect(self):
109 - return self.connect()
src/collectors/python.d.plugin/tor/tor.conf deleted
-81
@@ -1,81 +0,0 @@
1 -# netdata python.d.plugin configuration for tor
2 -#
3 -# This file is in YaML format. Generally the format is:
4 -#
5 -# name: value
6 -#
7 -# There are 2 sections:
8 -# - global variables
9 -# - one or more JOBS
10 -#
11 -# JOBS allow you to collect values from multiple sources.
12 -# Each source will have its own set of charts.
13 -#
14 -# JOB parameters have to be indented (using spaces only, example below).
15 -
16 -# ----------------------------------------------------------------------
17 -# Global Variables
18 -# These variables set the defaults for all JOBs, however each JOB
19 -# may define its own, overriding the defaults.
20 -
21 -# update_every sets the default data collection frequency.
22 -# If unset, the python.d.plugin default is used.
23 -# update_every: 1
24 -
25 -# priority controls the order of charts at the netdata dashboard.
26 -# Lower numbers move the charts towards the top of the page.
27 -# If unset, the default for python.d.plugin is used.
28 -# priority: 60000
29 -
30 -# penalty indicates whether to apply penalty to update_every in case of failures.
31 -# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes.
32 -# penalty: yes
33 -
34 -# autodetection_retry sets the job re-check interval in seconds.
35 -# The job is not deleted if check fails.
36 -# Attempts to start the job are made once every autodetection_retry.
37 -# This feature is disabled by default.
38 -# autodetection_retry: 0
39 -
40 -# ----------------------------------------------------------------------
41 -# JOBS (data collection sources)
42 -#
43 -# The default JOBS share the same *name*. JOBS with the same name
44 -# are mutually exclusive. Only one of them will be allowed running at
45 -# any time. This allows autodetection to try several alternatives and
46 -# pick the one that works.
47 -#
48 -# Any number of jobs is supported.
49 -#
50 -# All python.d.plugin JOBS (for all its modules) support a set of
51 -# predefined parameters. These are:
52 -#
53 -# job_name:
54 -# name: myname # the JOB's name as it will appear at the
55 -# # dashboard (by default is the job_name)
56 -# # JOBs sharing a name are mutually exclusive
57 -# update_every: 1 # the JOB's data collection frequency
58 -# priority: 60000 # the JOB's order on the dashboard
59 -# penalty: yes # the JOB's penalty
60 -# autodetection_retry: 0 # the JOB's re-check interval in seconds
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 -#
68 -# ----------------------------------------------------------------------
69 -# AUTO-DETECTION JOBS
70 -# only one of them will run (they have the same name)
71 -#
72 -# local_tcp:
73 -# name: 'local'
74 -# control_port: 9051
75 -# control_addr: 127.0.0.1
76 -# password: <password>
77 -#
78 -# local_socket:
79 -# name: 'local'
80 -# control_port: '/var/run/tor/control'
81 -# password: <password>