mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
new Statistician and Ultrabans (SQL) plugins
This commit is contained in:
parent
ed43e06b40
commit
2b17468244
5 changed files with 533 additions and 0 deletions
151
plugins/minecraft/jsonapi/mcsqls2killshostile
Normal file
151
plugins/minecraft/jsonapi/mcsqls2killshostile
Normal file
|
@ -0,0 +1,151 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
###########################################################
|
||||
## - Bukkit hostile mob kills per day Munin plugin - ##
|
||||
###########################################################
|
||||
## Script by: ##
|
||||
## Jonas Friedmann (@frdmn) ##
|
||||
## http://frd.mn ##
|
||||
###########################################################
|
||||
## MySQL ##
|
||||
###########################################################
|
||||
|
||||
$hostname = 'localhost';
|
||||
$username = 'sql';
|
||||
$password = 'pass';
|
||||
$database = 'sql';
|
||||
$port = 3306;
|
||||
|
||||
###########################################################
|
||||
## DON'T EDIT THIS ##
|
||||
###########################################################
|
||||
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