1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +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,24 @@
#!/usr/bin/php
<?php
###########################################################
## - Bukkit shame per day Munin plugin - ##
###########################################################
## Script by: ##
## Jonas Friedmann (@frdmn) ##
## http://frd.mn ##
###########################################################
## MySQL ##
###########################################################
/**
* Bukkit/MySQL Munin plugin
* ---------------------------------
* Kicks/bans/jails/etc. per day
*
* Shows the amount and kind of shame that
* happens on your server via Ultrabans
* (http://s.frd.mn/14qLR2B)
*
* 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 +26,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 / Ultrabans - shame per day
@ -47,76 +58,76 @@ mute.label mutes
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 for unbans return the amount of rows
// Select queries for unbans return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 5 AND time > $today")) {
## Print values
// Print values
print('unban.value ' . mysqli_num_rows($result) . "\n");
}
## Select queries for kicks return the amount of rows
// Select queries for kicks return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 3 AND time > $today")) {
## Print values
// Print values
print('kick.value ' . mysqli_num_rows($result) . "\n");
}
## Select queries for warnings return the amount of rows
// Select queries for warnings return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 2 AND time > $today")) {
## Print values
// Print values
print('warning.value ' . mysqli_num_rows($result) . "\n");
}
## Select queries for bans return the amount of rows
// Select queries for bans return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 0 AND time > $today")) {
## Print values
// Print values
print('ban.value ' . mysqli_num_rows($result) . "\n");
}
## Select queries for ipbans return the amount of rows
// Select queries for ipbans return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 1 AND time > $today")) {
## Print values
// Print values
print('ipban.value ' . mysqli_num_rows($result) . "\n");
}
## Select queries for fines return the amount of rows
// Select queries for fines return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 4 AND time > $today")) {
## Print values
// Print values
print('fine.value ' . mysqli_num_rows($result) . "\n");
}
## Select queries for jails return the amount of rows
// Select queries for jails return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 6 AND time > $today")) {
## Print values
// Print values
print('jail.value ' . mysqli_num_rows($result) . "\n");
}
## Select queries for permbans return the amount of rows
// Select queries for permbans return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 9 AND time > $today")) {
## Print values
// Print values
print('permban.value ' . mysqli_num_rows($result) . "\n");
}
## Select queries for mutes - part 1 return the amount of rows
// Select queries for mutes - part 1 return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 7 AND time > $today")) {
## Store result
// Store result
$tmp1 = mysqli_num_rows($result);
}
## Select queries for mutes - part 2 return the amount of rows
// Select queries for mutes - part 2 return the amount of rows
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 8 AND time > $today")) {
## Store result
// Store result
$tmp2 = mysqli_num_rows($result);
}
@ -124,6 +135,6 @@ $mutes = $tmp1 + $tmp2;
print('mute.value ' . $mutes . "\n");
## Close connection
// Close connection
mysqli_close($connection);
?>