mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 10:39:53 +00:00
Fix frdmn's minecraft plugins
- Get rid of duplicate plugins in "jsonapi/" folder - Rename - Reference to original GitHub repo
This commit is contained in:
parent
0743e6e5fb
commit
92abf3e3eb
17 changed files with 30 additions and 841 deletions
66
plugins/minecraft/bukkit-statistician-players
Normal file
66
plugins/minecraft/bukkit-statistician-players
Normal file
|
@ -0,0 +1,66 @@
|
|||
#!/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)
|
||||
* GitHub: https://github.com/yeahwhat-mc/munin-bukkit-plugins
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
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);
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue