DataMiner Mod v1.2
dataminer (by sorcerykid)
DataMiner is an analytical tool for Minetest server operators and administrators, providing comprehensive player and server statistics within a graphical user-interface, in addition to an API for custom-tailored log analysis and reporting within command-line Lua scripts. DataMiner is intended to be compatible with all versions of Minetest 0.4.14+, and has been tested under CentOS/Red Hat Linux.
Repository:
https://bitbucket.org/sorcerykid/dataminer
Download Archive (.zip)
Download Archive (.tar.gz)
Dependencies:
Auth Redux Mod
https://bitbucket.org/sorcerykid/auth_rx
ActiveFormspecs Mod
https://bitbucket.org/sorcerykid/formspecs
Polygraph Mod
https://bitbucket.org/sorcerykid/polygraph
Source Code License:
The MIT License (MIT)
Chat Command Usage:
There are two ways to generate reports, both in-game and from the command line. This section will show you how to use the chat command from within Minetest. After logging into your server as an administrator, press F5 and enter "/statmon" into chat. A screen like the one below will appear, showing a chart of player activity alongside a variety of player and server statistics for the past 24-hours.
The drop-down menu in the upper-left allows you to chart alternate datasets:
- Total Players
Total number of unique players that joined per hour - Total Player Sessions
Total number of player sessions per hour - Total Login Failures
Total number of failed logins per hour - Total Login Attempts
Total number of attempted logins per hour
Maximum Connected Clients
Maximum number of connected clients per hour
Minimum Connected Clients
Minimum number of connected clients per hour
At the bottom of the screen is a summary of statistics for the entire 24-hour period. Most are derived from those above, with a few additions:
- Maximum Player Lifetime
Maximum session duration amongst all players per day - Average Player Lifetime
Average session duration amongst all players per day - Total New Players
Total number of new players that joined per day - Overall Server Uptime
Aggregate uptime percentage of the server per day
Command Line Usage:
The command-line interface offers a convenient alternative to the chat command if you only have access to a terminal, but not the Minetest client. From the shell, change to the tools subdirectory. Then, issue the following command:
Code: Select all
cd dataminer/tools
lua statmon.lua days=1 ~/.minetest/worlds/world/auth.dbx
When you are finished, the Q key will return you to the shell. You can also keep the statmon.lua script running in the background. The journal is opened in read-only mode, so it will not interfere with the Minetest server
Technical Information:
Mod and game developers, as well as server operators, can interface programmatically with DataMiner, allowing for a any number of applications. This section describes the API in detail.
The JournalIndex object contains all of the logic for indexing and analyzing the database transaction log (using an algorithm that I'd devised from an earlier incarnation of the same mod from the JT2 server).
The following function will instantiate a new JournalIndex object:
- catalog = JournalIndex( path, name )
Next, you will need to index the journal, using the process( ) method. This is a one-time operation. It could take a few seconds depending on the size of the file (I tested over 16 months worth of data from the JT2 server, and it clocked on average about 9 seconds).
- catalog.prepare( )
- results = catalog.analyze( days )
- total_players
- total_players_new
- total_sessions
- total_failures
- total_attempts
- server_uptime
- max_clients
- max_clients
- max_player_lifetime
- avg_lifetime
- player_stats
- hourly_stats
- sessions
- players
- failures
- attempts