summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/spigotmc
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/python.d.plugin/spigotmc')
-rw-r--r--collectors/python.d.plugin/spigotmc/README.md20
-rw-r--r--collectors/python.d.plugin/spigotmc/spigotmc.chart.py17
2 files changed, 25 insertions, 12 deletions
diff --git a/collectors/python.d.plugin/spigotmc/README.md b/collectors/python.d.plugin/spigotmc/README.md
index 8b74913de..9b297f639 100644
--- a/collectors/python.d.plugin/spigotmc/README.md
+++ b/collectors/python.d.plugin/spigotmc/README.md
@@ -1,6 +1,12 @@
-# spigotmc
+<!--
+title: "SpigotMC monitoring with Netdata"
+custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/spigotmc/README.md
+sidebar_label: "SpigotMC"
+-->
-This module does some really basic monitoring for Spigot Minecraft servers.
+# SpigotMC monitoring with Netdata
+
+Performs basic monitoring for Spigot Minecraft servers.
It provides two charts, one tracking server-side ticks-per-second in
1, 5 and 15 minute averages, and one tracking the number of currently
@@ -9,7 +15,15 @@ active users.
This is not compatible with Spigot plugins which change the format of
the data returned by the `tps` or `list` console commands.
-## configuration
+## Configuration
+
+Edit the `python.d/spigotmc.conf` configuration file using `edit-config` from the Netdata [config
+directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`.
+
+```bash
+cd /etc/netdata # Replace this path with your Netdata config directory, if different
+sudo ./edit-config python.d/spigotmc.conf
+```
```yaml
host: localhost
diff --git a/collectors/python.d.plugin/spigotmc/spigotmc.chart.py b/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
index 79d17058c..f334113e4 100644
--- a/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
+++ b/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
@@ -3,12 +3,11 @@
# Author: Austin S. Hemmelgarn (Ferroin)
# SPDX-License-Identifier: GPL-3.0-or-later
-import socket
import platform
import re
+import socket
from bases.FrameworkServices.SimpleService import SimpleService
-
from third_party import mcrcon
# Update only every 5 seconds because collection takes in excess of
@@ -43,9 +42,8 @@ CHARTS = {
}
}
-
_TPS_REGEX = re.compile(
- r'^.*: .*?' # Message lead-in
+ r'^.*: .*?' # Message lead-in
r'(\d{1,2}.\d+), .*?' # 1-minute TPS value
r'(\d{1,2}.\d+), .*?' # 5-minute TPS value
r'(\d{1,2}\.\d+).*$', # 15-minute TPS value
@@ -107,10 +105,10 @@ class Service(SimpleService):
def is_alive(self):
if any(
- [
- not self.alive,
- self.console.socket.getsockopt(socket.IPPROTO_TCP, socket.TCP_INFO, 0) != 1
- ]
+ [
+ not self.alive,
+ self.console.socket.getsockopt(socket.IPPROTO_TCP, socket.TCP_INFO, 0) != 1
+ ]
):
return self.reconnect()
return True
@@ -131,7 +129,8 @@ class Service(SimpleService):
else:
self.error('Unable to process TPS values.')
if not raw:
- self.error("'{0}' command returned no value, make sure you set correct password".format(COMMAND_TPS))
+ self.error(
+ "'{0}' command returned no value, make sure you set correct password".format(COMMAND_TPS))
except mcrcon.MCRconException:
self.error('Unable to fetch TPS values.')
except socket.error: