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:
parent
46d1dcc987
commit
bed5815230
8 changed files with 758 additions and 0 deletions
161
plugins/minecraft/minecraft-sql-statistician-hostile-kills
Normal file
161
plugins/minecraft/minecraft-sql-statistician-hostile-kills
Normal file
|
@ -0,0 +1,161 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* Bukkit/MySQL Munin plugin
|
||||
* ---------------------------------
|
||||
* Hostile mob kills per day
|
||||
*
|
||||
* Shows the daily kills of hostile mobs
|
||||
* 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 - hostile mob kills per day
|
||||
graph_category bukkit_sql_kills
|
||||
graph_vlabel hostile mob kills per day
|
||||
graph_args --base 1000 -l 0
|
||||
blaze.type GAUGE
|
||||
blaze.label killed blazes
|
||||
spider.type GAUGE
|
||||
spider.label killed spiders
|
||||
creeper.type GAUGE
|
||||
creeper.label killed creepers
|
||||
ghast.type GAUGE
|
||||
ghast.label killed ghasts
|
||||
magmacube.type GAUGE
|
||||
magmacube.label killed magma cubes
|
||||
silverfish.type GAUGE
|
||||
silverfish.label killed silverfish
|
||||
skeleton.type GAUGE
|
||||
skeleton.label killed skeletons
|
||||
slime.type GAUGE
|
||||
slime.label killed slimes
|
||||
witch.type GAUGE
|
||||
witch.label killed witches
|
||||
zombie.type GAUGE
|
||||
zombie.label killed zombies
|
||||
irongolem.type GAUGE
|
||||
irongolem.label killed iron golems
|
||||
enderdragon.type GAUGE
|
||||
enderdragon.label killed ender dragons
|
||||
wither.type GAUGE
|
||||
wither.label killed withers
|
||||
");
|
||||
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 for blaze kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Blaze'")) {
|
||||
## Print values
|
||||
print('blaze.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for spider kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = '%Spider'")) {
|
||||
## Print values
|
||||
print('spider.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for creeper kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = '%reeper%'")) {
|
||||
## Print values
|
||||
print('creeper.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for ghast kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Ghast'")) {
|
||||
## Print values
|
||||
print('ghast.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for magma cube kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'MagmaCube'")) {
|
||||
## Print values
|
||||
print('magmacube.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for silverfish and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Silverfish'")) {
|
||||
## Print values
|
||||
print('silverfish.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for skeleton kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Skeleton'")) {
|
||||
## Print values
|
||||
print('skeleton.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for slime kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Slime'")) {
|
||||
## Print values
|
||||
print('slime.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for witch kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Witch'")) {
|
||||
## Print values
|
||||
print('witch.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for zombie kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Zombie'")) {
|
||||
## Print values
|
||||
print('zombie.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for iron golem kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = '%ron%'")) {
|
||||
## Print values
|
||||
print('irongolem.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for ender dragon kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'EnderDragon'")) {
|
||||
## Print values
|
||||
print('enderdragon.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Select queries for wither kills and return the amount of rows
|
||||
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Wither'")) {
|
||||
## Print values
|
||||
print('wither.value ' . mysqli_num_rows($result) . "\n");
|
||||
}
|
||||
|
||||
## Close connection
|
||||
mysqli_close($connection);
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue