1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-08-06 22:23:21 +00:00

comment format renewal

This commit is contained in:
Jonas Friedmann 2013-03-28 16:06:49 +01:00 committed by Steve Schnepp
parent 22436814ea
commit 4192c14f76
8 changed files with 250 additions and 172 deletions

View file

@ -1,14 +1,23 @@
#!/usr/bin/php
<?php
###########################################################
## - Bukkit new players per day Munin plugin - ##
###########################################################
## Script by: ##
## Jonas Friedmann (@frdmn) ##
## http://frd.mn ##
###########################################################
## MySQL ##
###########################################################
/**
* 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';
@ -16,9 +25,10 @@ $password = 'pass';
$database = 'sql';
$port = 3306;
###########################################################
## DON'T EDIT THIS ##
###########################################################
/**
* !!! DO NOT EDIT THIS PART BELOW !!!
*/
if ((count($argv) > 1) && ($argv[1] == 'config'))
{
print("graph_title Bukkit / Statistician - new players per day
@ -31,25 +41,25 @@ players.label new players
exit();
}
## Construct 'minumum' timstamp
// Construct 'minumum' timstamp
$current = mktime();
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
## Initiate connection
// Initiate connection
$connection = mysqli_connect($hostname, $username, $password, $database, $port);
## Check connection
// Check connection
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
## Select queries return the amount of rows
// Select queries return the amount of rows
if ($result = mysqli_query($connection, "SELECT player_name FROM players WHERE firstever_login > $today")) {
## Print values
// Print values
print('players.value ' . mysqli_num_rows($result) . "\n");
}
## Close connection
// Close connection
mysqli_close($connection);
?>