remove python.d/spigotmc (#18889)
Ilya Mashchenko committed
Oct 29, 2024 at 14:59 UTC
84f6423310b0163fd59172fe9ac881923bf9ed0e
9 files changed
+1
-755
CMakeLists.txt
-2
@@ -3095,7 +3095,6 @@ if(ENABLE_PLUGIN_PYTHON)
3095
src/collectors/python.d.plugin/go_expvar/go_expvar.conf
3096
src/collectors/python.d.plugin/haproxy/haproxy.conf
3097
src/collectors/python.d.plugin/pandas/pandas.conf
3098
- src/collectors/python.d.plugin/spigotmc/spigotmc.conf
3098
src/collectors/python.d.plugin/traefik/traefik.conf
3099
src/collectors/python.d.plugin/zscores/zscores.conf
3100
COMPONENT plugin-pythond
@@ -3106,7 +3105,6 @@ if(ENABLE_PLUGIN_PYTHON)
3105
src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
3106
src/collectors/python.d.plugin/haproxy/haproxy.chart.py
3107
src/collectors/python.d.plugin/pandas/pandas.chart.py
3109
- src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
3108
src/collectors/python.d.plugin/traefik/traefik.chart.py
3109
src/collectors/python.d.plugin/zscores/zscores.chart.py
3110
COMPONENT plugin-pythond
REDISTRIBUTED.md
-1
@@ -43,7 +43,6 @@ connectivity is not available.
43
| [pako](http://nodeca.github.io/pako/) | Copyright 2014-2017 Vitaly Puzrin and Andrei Tuputcyn | [MIT](https://github.com/nodeca/pako/blob/master/LICENSE) |
44
| [clipboard-polyfill](https://github.com/lgarron/clipboard-polyfill) | Copyright (c) 2014 Lucas Garron | [MIT](https://github.com/lgarron/clipboard-polyfill/blob/master/LICENSE.md) |
45
| [Utilities for writing code that runs on Python 2 and 3](https://raw.githubusercontent.com/netdata/netdata/master/src/collectors/python.d.plugin/python_modules/urllib3/packages/six.py) | Copyright (c) 2010-2015 Benjamin Peterson | [MIT](https://github.com/benjaminp/six/blob/master/LICENSE) |
46
-| [mcrcon](https://github.com/barneygale/MCRcon) | Copyright (C) 2015 Barnaby Gale | [MIT](https://raw.githubusercontent.com/barneygale/MCRcon/master/COPYING.txt) |
46
| [monotonic](https://github.com/atdt/monotonic) | Copyright 2014, 2015, 2016 Ori Livneh | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
47
| [filelock](https://github.com/benediktschmitt/py-filelock) | Copyright 2015, Benedikt Schmitt | [Unlicense](https://unlicense.org/) |
48
| [Kolmogorov-Smirnov distribution](http://simul.iro.umontreal.ca/ksdir/) | Copyright March 2010 by Université de Montréal, Richard Simard and Pierre L'Ecuyer | [GPL 3.0](https://www.gnu.org/licenses/gpl-3.0.en.html) |
src/collectors/python.d.plugin/python.d.conf
+1
-1
@@ -32,7 +32,6 @@ go_expvar: no
32
# pandas: yes
33
# retroshare: yes
34
# smartd_log: yes
35
-# spigotmc: yes
35
# traefik: yes
36
# varnish: yes
37
# zscores: no
@@ -74,6 +73,7 @@ riakkv: no # Removed (replaced with go.d/riak).
73
samba: no # Removed (replaced with go.d/samba).
74
sensors: no # Removed (replaced with go.d/sensors).
75
squid: no # Removed (replaced with go.d/squid).
76
+spigotmc: no # Removed (replaced with go.d/spigotmc).
77
tomcat: no # Removed (replaced with go.d/tomcat)
78
tor: no # Removed (replaced with go.d/tor).
79
puppet: no # Removed (replaced with go.d/puppet).
src/collectors/python.d.plugin/python_modules/third_party/mcrcon.py
deleted
-74
@@ -1,74 +0,0 @@
1
-# Minecraft Remote Console module.
2
-#
3
-# Copyright (C) 2015 Barnaby Gale
4
-#
5
-# SPDX-License-Identifier: MIT
6
-
7
-import socket
8
-import select
9
-import struct
10
-import time
11
-
12
-
13
-class MCRconException(Exception):
14
- pass
15
-
16
-
17
-class MCRcon(object):
18
- socket = None
19
-
20
- def connect(self, host, port, password):
21
- if self.socket is not None:
22
- raise MCRconException("Already connected")
23
- self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
24
- self.socket.settimeout(0.9)
25
- self.socket.connect((host, port))
26
- self.send(3, password)
27
-
28
- def disconnect(self):
29
- if self.socket is None:
30
- raise MCRconException("Already disconnected")
31
- self.socket.close()
32
- self.socket = None
33
-
34
- def read(self, length):
35
- data = b""
36
- while len(data) < length:
37
- data += self.socket.recv(length - len(data))
38
- return data
39
-
40
- def send(self, out_type, out_data):
41
- if self.socket is None:
42
- raise MCRconException("Must connect before sending data")
43
-
44
- # Send a request packet
45
- out_payload = struct.pack('<ii', 0, out_type) + out_data.encode('utf8') + b'\x00\x00'
46
- out_length = struct.pack('<i', len(out_payload))
47
- self.socket.send(out_length + out_payload)
48
-
49
- # Read response packets
50
- in_data = ""
51
- while True:
52
- # Read a packet
53
- in_length, = struct.unpack('<i', self.read(4))
54
- in_payload = self.read(in_length)
55
- in_id = struct.unpack('<ii', in_payload[:8])
56
- in_data_partial, in_padding = in_payload[8:-2], in_payload[-2:]
57
-
58
- # Sanity checks
59
- if in_padding != b'\x00\x00':
60
- raise MCRconException("Incorrect padding")
61
- if in_id == -1:
62
- raise MCRconException("Login failed")
63
-
64
- # Record the response
65
- in_data += in_data_partial.decode('utf8')
66
-
67
- # If there's nothing more to receive, return the response
68
- if len(select.select([self.socket], [], [], 0)[0]) == 0:
69
- return in_data
70
-
71
- def command(self, command):
72
- result = self.send(2, command)
73
- time.sleep(0.003) # MC-72390 workaround
74
- return result
src/collectors/python.d.plugin/spigotmc/README.md
deleted
-1
@@ -1 +0,0 @@
1
-integrations/spigotmc.md
\ No newline at end of file
src/collectors/python.d.plugin/spigotmc/integrations/spigotmc.md
deleted
-250
@@ -1,250 +0,0 @@
1
-<!--startmeta
2
-custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/spigotmc/README.md"
3
-meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/spigotmc/metadata.yaml"
4
-sidebar_label: "SpigotMC"
5
-learn_status: "Published"
6
-learn_rel_path: "Collecting Metrics/Gaming"
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
-# SpigotMC
12
-
13
-
14
-<img src="https://netdata.cloud/img/spigot.jfif" width="150"/>
15
-
16
-
17
-Plugin: python.d.plugin
18
-Module: spigotmc
19
-
20
-<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
21
-
22
-## Overview
23
-
24
-This collector monitors SpigotMC server performance, in the form of ticks per second average, memory utilization, and active users.
25
-
26
-
27
-It sends the `tps`, `list` and `online` commands to the Server, and gathers the metrics from the responses.
28
-
29
-
30
-This collector is only supported on the following platforms:
31
-
32
-- Linux
33
-
34
-This collector supports collecting metrics from multiple instances of this integration, including remote instances.
35
-
36
-
37
-### Default Behavior
38
-
39
-#### Auto-Detection
40
-
41
-By default, this collector will attempt to connect to a Spigot server running on the local host on port `25575`.
42
-
43
-#### Limits
44
-
45
-The default configuration for this integration does not impose any limits on data collection.
46
-
47
-#### Performance Impact
48
-
49
-The default configuration for this integration is not expected to impose a significant performance impact on the system.
50
-
51
-
52
-## Metrics
53
-
54
-Metrics grouped by *scope*.
55
-
56
-The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
57
-
58
-
59
-
60
-### Per SpigotMC instance
61
-
62
-These metrics refer to the entire monitored application.
63
-
64
-This scope has no labels.
65
-
66
-Metrics:
67
-
68
-| Metric | Dimensions | Unit |
69
-|:------|:----------|:----|
70
-| spigotmc.tps | 1 Minute Average, 5 Minute Average, 15 Minute Average | ticks |
71
-| spigotmc.users | Users | users |
72
-| spigotmc.mem | used, allocated, max | MiB |
73
-
74
-
75
-
76
-## Alerts
77
-
78
-There are no alerts configured by default for this integration.
79
-
80
-
81
-## Setup
82
-
83
-### Prerequisites
84
-
85
-#### Enable the Remote Console Protocol
86
-
87
-Under your SpigotMC server's `server.properties` configuration file, you should set `enable-rcon` to `true`.
88
-
89
-This will allow the Server to listen and respond to queries over the rcon protocol.
90
-
91
-
92
-
93
-### Configuration
94
-
95
-#### File
96
-
97
-The configuration file name for this integration is `python.d/spigotmc.conf`.
98
-
99
-
100
-You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-a-configuration-file-using-edit-config) script from the
101
-Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
102
-
103
-```bash
104
-cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
105
-sudo ./edit-config python.d/spigotmc.conf
106
-```
107
-#### Options
108
-
109
-There are 2 sections:
110
-
111
-* Global variables
112
-* One or more JOBS that can define multiple different instances to monitor.
113
-
114
-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.
115
-
116
-Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
117
-
118
-Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
119
-
120
-
121
-<details open><summary>Config options</summary>
122
-
123
-| Name | Description | Default | Required |
124
-|:----|:-----------|:-------|:--------:|
125
-| update_every | Sets the default data collection frequency. | 1 | no |
126
-| priority | Controls the order of charts at the netdata dashboard. | 60000 | no |
127
-| autodetection_retry | Sets the job re-check interval in seconds. | 0 | no |
128
-| penalty | Indicates whether to apply penalty to update_every in case of failures. | yes | no |
129
-| 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 |
130
-| host | The host's IP to connect to. | localhost | yes |
131
-| port | The port the remote console is listening on. | 25575 | yes |
132
-| password | Remote console password if any. | | no |
133
-
134
-</details>
135
-
136
-#### Examples
137
-
138
-##### Basic
139
-
140
-A basic configuration example.
141
-
142
-```yaml
143
-local:
144
- name: local_server
145
- url: 127.0.0.1
146
- port: 25575
147
-
148
-```
149
-##### Basic Authentication
150
-
151
-An example using basic password for authentication with the remote console.
152
-
153
-<details open><summary>Config</summary>
154
-
155
-```yaml
156
-local:
157
- name: local_server_pass
158
- url: 127.0.0.1
159
- port: 25575
160
- password: 'foobar'
161
-
162
-```
163
-</details>
164
-
165
-##### Multi-instance
166
-
167
-> **Note**: When you define multiple jobs, their names must be unique.
168
-
169
-Collecting metrics from local and remote instances.
170
-
171
-
172
-<details open><summary>Config</summary>
173
-
174
-```yaml
175
-local_server:
176
- name : my_local_server
177
- url : 127.0.0.1
178
- port: 25575
179
-
180
-remote_server:
181
- name : another_remote_server
182
- url : 192.0.2.1
183
- port: 25575
184
-
185
-```
186
-</details>
187
-
188
-
189
-
190
-## Troubleshooting
191
-
192
-### Debug Mode
193
-
194
-
195
-To troubleshoot issues with the `spigotmc` collector, run the `python.d.plugin` with the debug option enabled. The output
196
-should give you clues as to why the collector isn't working.
197
-
198
-- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
199
- your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
200
-
201
- ```bash
202
- cd /usr/libexec/netdata/plugins.d/
203
- ```
204
-
205
-- Switch to the `netdata` user.
206
-
207
- ```bash
208
- sudo -u netdata -s
209
- ```
210
-
211
-- Run the `python.d.plugin` to debug the collector:
212
-
213
- ```bash
214
- ./python.d.plugin spigotmc debug trace
215
- ```
216
-
217
-### Getting Logs
218
-
219
-If you're encountering problems with the `spigotmc` collector, follow these steps to retrieve logs and identify potential issues:
220
-
221
-- **Run the command** specific to your system (systemd, non-systemd, or Docker container).
222
-- **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.
223
-
224
-#### System with systemd
225
-
226
-Use the following command to view logs generated since the last Netdata service restart:
227
-
228
-```bash
229
-journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep spigotmc
230
-```
231
-
232
-#### System without systemd
233
-
234
-Locate the collector log file, typically at `/var/log/netdata/collector.log`, and use `grep` to filter for collector's name:
235
-
236
-```bash
237
-grep spigotmc /var/log/netdata/collector.log
238
-```
239
-
240
-**Note**: This method shows logs from all restarts. Focus on the **latest entries** for troubleshooting current issues.
241
-
242
-#### Docker Container
243
-
244
-If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:
245
-
246
-```bash
247
-docker logs netdata 2>&1 | grep spigotmc
248
-```
249
-
250
-
src/collectors/python.d.plugin/spigotmc/metadata.yaml
deleted
-176
@@ -1,176 +0,0 @@
1
-plugin_name: python.d.plugin
2
-modules:
3
- - meta:
4
- plugin_name: python.d.plugin
5
- module_name: spigotmc
6
- monitored_instance:
7
- name: SpigotMC
8
- link: ""
9
- categories:
10
- - data-collection.gaming
11
- icon_filename: "spigot.jfif"
12
- related_resources:
13
- integrations:
14
- list: []
15
- info_provided_to_referring_integrations:
16
- description: ""
17
- keywords:
18
- - minecraft server
19
- - spigotmc server
20
- - spigot
21
- most_popular: false
22
- overview:
23
- data_collection:
24
- metrics_description: |
25
- This collector monitors SpigotMC server performance, in the form of ticks per second average, memory utilization, and active users.
26
- method_description: |
27
- It sends the `tps`, `list` and `online` commands to the Server, and gathers the metrics from the responses.
28
- supported_platforms:
29
- include:
30
- - Linux
31
- exclude: []
32
- multi_instance: true
33
- additional_permissions:
34
- description: ""
35
- default_behavior:
36
- auto_detection:
37
- description: By default, this collector will attempt to connect to a Spigot server running on the local host on port `25575`.
38
- limits:
39
- description: ""
40
- performance_impact:
41
- description: ""
42
- setup:
43
- prerequisites:
44
- list:
45
- - title: Enable the Remote Console Protocol
46
- description: |
47
- Under your SpigotMC server's `server.properties` configuration file, you should set `enable-rcon` to `true`.
48
-
49
- This will allow the Server to listen and respond to queries over the rcon protocol.
50
- configuration:
51
- file:
52
- name: "python.d/spigotmc.conf"
53
- options:
54
- description: |
55
- There are 2 sections:
56
-
57
- * Global variables
58
- * One or more JOBS that can define multiple different instances to monitor.
59
-
60
- 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.
61
-
62
- Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
63
-
64
- Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
65
- folding:
66
- title: "Config options"
67
- enabled: true
68
- list:
69
- - name: update_every
70
- description: Sets the default data collection frequency.
71
- default_value: 1
72
- required: false
73
- - name: priority
74
- description: Controls the order of charts at the netdata dashboard.
75
- default_value: 60000
76
- required: false
77
- - name: autodetection_retry
78
- description: Sets the job re-check interval in seconds.
79
- default_value: 0
80
- required: false
81
- - name: penalty
82
- description: Indicates whether to apply penalty to update_every in case of failures.
83
- default_value: yes
84
- required: false
85
- - name: name
86
- description: >
87
- 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
88
- 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: host
92
- description: The host's IP to connect to.
93
- default_value: localhost
94
- required: true
95
- - name: port
96
- description: The port the remote console is listening on.
97
- default_value: 25575
98
- required: true
99
- - name: password
100
- description: Remote console password if any.
101
- default_value: ""
102
- required: false
103
- examples:
104
- folding:
105
- enabled: true
106
- title: "Config"
107
- list:
108
- - name: Basic
109
- description: A basic configuration example.
110
- folding:
111
- enabled: false
112
- config: |
113
- local:
114
- name: local_server
115
- url: 127.0.0.1
116
- port: 25575
117
- - name: Basic Authentication
118
- description: An example using basic password for authentication with the remote console.
119
- config: |
120
- local:
121
- name: local_server_pass
122
- url: 127.0.0.1
123
- port: 25575
124
- password: 'foobar'
125
- - name: Multi-instance
126
- description: |
127
- > **Note**: When you define multiple jobs, their names must be unique.
128
-
129
- Collecting metrics from local and remote instances.
130
- config: |
131
- local_server:
132
- name : my_local_server
133
- url : 127.0.0.1
134
- port: 25575
135
-
136
- remote_server:
137
- name : another_remote_server
138
- url : 192.0.2.1
139
- port: 25575
140
- troubleshooting:
141
- problems:
142
- list: []
143
- alerts: []
144
- metrics:
145
- folding:
146
- title: Metrics
147
- enabled: false
148
- description: ""
149
- availability: []
150
- scopes:
151
- - name: global
152
- description: "These metrics refer to the entire monitored application."
153
- labels: []
154
- metrics:
155
- - name: spigotmc.tps
156
- description: Spigot Ticks Per Second
157
- unit: "ticks"
158
- chart_type: line
159
- dimensions:
160
- - name: 1 Minute Average
161
- - name: 5 Minute Average
162
- - name: 15 Minute Average
163
- - name: spigotmc.users
164
- description: Minecraft Users
165
- unit: "users"
166
- chart_type: area
167
- dimensions:
168
- - name: Users
169
- - name: spigotmc.mem
170
- description: Minecraft Memory Usage
171
- unit: "MiB"
172
- chart_type: line
173
- dimensions:
174
- - name: used
175
- - name: allocated
176
- - name: max
src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
deleted
-184
@@ -1,184 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-# Description: spigotmc netdata python.d module
3
-# Author: Austin S. Hemmelgarn (Ferroin)
4
-# SPDX-License-Identifier: GPL-3.0-or-later
5
-
6
-import platform
7
-import re
8
-import socket
9
-
10
-from bases.FrameworkServices.SimpleService import SimpleService
11
-from third_party import mcrcon
12
-
13
-# Update only every 5 seconds because collection takes in excess of
14
-# 100ms sometimes, and most people won't care about second-by-second data.
15
-update_every = 5
16
-
17
-PRECISION = 100
18
-
19
-COMMAND_TPS = 'tps'
20
-COMMAND_LIST = 'list'
21
-COMMAND_ONLINE = 'online'
22
-
23
-ORDER = [
24
- 'tps',
25
- 'mem',
26
- 'users',
27
-]
28
-
29
-CHARTS = {
30
- 'tps': {
31
- 'options': [None, 'Spigot Ticks Per Second', 'ticks', 'spigotmc', 'spigotmc.tps', 'line'],
32
- 'lines': [
33
- ['tps1', '1 Minute Average', 'absolute', 1, PRECISION],
34
- ['tps5', '5 Minute Average', 'absolute', 1, PRECISION],
35
- ['tps15', '15 Minute Average', 'absolute', 1, PRECISION]
36
- ]
37
- },
38
- 'users': {
39
- 'options': [None, 'Minecraft Users', 'users', 'spigotmc', 'spigotmc.users', 'area'],
40
- 'lines': [
41
- ['users', 'Users', 'absolute', 1, 1]
42
- ]
43
- },
44
- 'mem': {
45
- 'options': [None, 'Minecraft Memory Usage', 'MiB', 'spigotmc', 'spigotmc.mem', 'line'],
46
- 'lines': [
47
- ['mem_used', 'used', 'absolute', 1, 1],
48
- ['mem_alloc', 'allocated', 'absolute', 1, 1],
49
- ['mem_max', 'max', 'absolute', 1, 1]
50
- ]
51
- }
52
-}
53
-
54
-_TPS_REGEX = re.compile(
55
- # Examples:
56
- # §6TPS from last 1m, 5m, 15m: §a*20.0, §a*20.0, §a*20.0
57
- # §6Current Memory Usage: §a936/65536 mb (Max: 65536 mb)
58
- r'^.*: .*?' # Message lead-in
59
- r'(\d{1,2}.\d+), .*?' # 1-minute TPS value
60
- r'(\d{1,2}.\d+), .*?' # 5-minute TPS value
61
- r'(\d{1,2}\.\d+).*?' # 15-minute TPS value
62
- r'(\s.*?(\d+)\/(\d+).*?: (\d+).*)?', # Current Memory Usage / Total Memory (Max Memory)
63
- re.MULTILINE
64
-)
65
-_LIST_REGEX = re.compile(
66
- # Examples:
67
- # There are 4 of a max 50 players online: player1, player2, player3, player4
68
- # §6There are §c4§6 out of maximum §c50§6 players online.
69
- # §6There are §c3§6/§c1§6 out of maximum §c50§6 players online.
70
- # §6当前有 §c4§6 个玩家在线,最大在线人数为 §c50§6 个玩家.
71
- # §c4§6 人のプレイヤーが接続中です。最大接続可能人数\:§c 50
72
- r'[^§](\d+)(?:.*?(?=/).*?[^§](\d+))?', # Current user count.
73
- re.X
74
-)
75
-
76
-
77
-class Service(SimpleService):
78
- def __init__(self, configuration=None, name=None):
79
- SimpleService.__init__(self, configuration=configuration, name=name)
80
- self.order = ORDER
81
- self.definitions = CHARTS
82
- self.host = self.configuration.get('host', 'localhost')
83
- self.port = self.configuration.get('port', 25575)
84
- self.password = self.configuration.get('password', '')
85
- self.console = mcrcon.MCRcon()
86
- self.alive = True
87
-
88
- def check(self):
89
- if platform.system() != 'Linux':
90
- self.error('Only supported on Linux.')
91
- return False
92
- try:
93
- self.connect()
94
- except (mcrcon.MCRconException, socket.error) as err:
95
- self.error('Error connecting.')
96
- self.error(repr(err))
97
- return False
98
-
99
- return self._get_data()
100
-
101
- def connect(self):
102
- self.console.connect(self.host, self.port, self.password)
103
-
104
- def reconnect(self):
105
- self.error('try reconnect.')
106
- try:
107
- try:
108
- self.console.disconnect()
109
- except mcrcon.MCRconException:
110
- pass
111
- self.console.connect(self.host, self.port, self.password)
112
- self.alive = True
113
- except (mcrcon.MCRconException, socket.error) as err:
114
- self.error('Error connecting.')
115
- self.error(repr(err))
116
- return False
117
- return True
118
-
119
- def is_alive(self):
120
- if any(
121
- [
122
- not self.alive,
123
- self.console.socket.getsockopt(socket.IPPROTO_TCP, socket.TCP_INFO, 0) != 1
124
- ]
125
- ):
126
- return self.reconnect()
127
- return True
128
-
129
- def _get_data(self):
130
- if not self.is_alive():
131
- return None
132
-
133
- data = {}
134
-
135
- try:
136
- raw = self.console.command(COMMAND_TPS)
137
- match = _TPS_REGEX.match(raw)
138
- if match:
139
- data['tps1'] = int(float(match.group(1)) * PRECISION)
140
- data['tps5'] = int(float(match.group(2)) * PRECISION)
141
- data['tps15'] = int(float(match.group(3)) * PRECISION)
142
- if match.group(4):
143
- data['mem_used'] = int(match.group(5))
144
- data['mem_alloc'] = int(match.group(6))
145
- data['mem_max'] = int(match.group(7))
146
- else:
147
- self.error('Unable to process TPS values.')
148
- if not raw:
149
- self.error(
150
- "'{0}' command returned no value, make sure you set correct password".format(COMMAND_TPS))
151
- except mcrcon.MCRconException:
152
- self.error('Unable to fetch TPS values.')
153
- except socket.error:
154
- self.error('Connection is dead.')
155
- self.alive = False
156
- return None
157
-
158
- try:
159
- raw = self.console.command(COMMAND_LIST)
160
- match = _LIST_REGEX.search(raw)
161
- if not match:
162
- raw = self.console.command(COMMAND_ONLINE)
163
- match = _LIST_REGEX.search(raw)
164
- if match:
165
- users = int(match.group(1))
166
- hidden_users = match.group(2)
167
- if hidden_users:
168
- hidden_users = int(hidden_users)
169
- else:
170
- hidden_users = 0
171
- data['users'] = users + hidden_users
172
- else:
173
- if not raw:
174
- self.error("'{0}' and '{1}' commands returned no value, make sure you set correct password".format(
175
- COMMAND_LIST, COMMAND_ONLINE))
176
- self.error('Unable to process user counts.')
177
- except mcrcon.MCRconException:
178
- self.error('Unable to fetch user counts.')
179
- except socket.error:
180
- self.error('Connection is dead.')
181
- self.alive = False
182
- return None
183
-
184
- return data
src/collectors/python.d.plugin/spigotmc/spigotmc.conf
deleted
-66
@@ -1,66 +0,0 @@
1
-# netdata python.d.plugin configuration for spigotmc
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
-# In addition to the above, spigotmc supports the following:
63
-#
64
-# host: localhost # The host to connect to. Defaults to the local system.
65
-# port: 25575 # The port the remote console is listening on.
66
-# password: '' # The remote console password. Most be set correctly.