1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Added several Minecraft/Bukkit plugins (depending on JSONAPI, Statistician and Ultrabans) to show the current online players, the RAM usage, the current TPS (ticks per second), hostile/neutral/passive mob kills per day, new players/visitors per day and kicks/ban/mutes/jail/unban/etc. per day - http://s.frd.mn/XJsryR for more informations

This commit is contained in:
Jonas Friedmann 2013-03-28 16:12:15 +01:00
parent 46d1dcc987
commit bed5815230
8 changed files with 758 additions and 0 deletions

View file

@ -0,0 +1,65 @@
#!/usr/bin/php
<?php
/**
* Bukkit/MySQL Munin plugin
* ---------------------------------
* New players per day
*
* Shows the new players / visitors per day
* via Statistician (http://s.frd.mn/14qKXTM)
*
* Read more about my plugins on my blog:
* http://s.frd.mn/XJsryR
*
* Author: Jonas Friedmann (http://frd.mn)
*
*/
/**
* MySQL configuration
*/
$hostname = 'localhost';
$username = 'sql';
$password = 'pass';
$database = 'sql';
$port = 3306;
/**
* !!! DO NOT EDIT THIS PART BELOW !!!
*/
if ((count($argv) > 1) && ($argv[1] == 'config'))
{
print("graph_title Bukkit / Statistician - new players per day
graph_category bukkit_sql
graph_vlabel new players per day
graph_args --base 1000 -l 0
players.type GAUGE
players.label new players
");
exit();
}
// Construct 'minumum' timstamp
$current = mktime();
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
// Initiate connection
$connection = mysqli_connect($hostname, $username, $password, $database, $port);
// Check connection
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
// Select queries return the amount of rows
if ($result = mysqli_query($connection, "SELECT player_name FROM players WHERE firstever_login > $today")) {
// Print values
print('players.value ' . mysqli_num_rows($result) . "\n");
}
// Close connection
mysqli_close($connection);
?>