Révision 2b174682
new Statistician and Ultrabans (SQL) plugins
| plugins/minecraft/jsonapi/mcsqls2killshostile | ||
|---|---|---|
| 1 |
#!/usr/bin/php |
|
| 2 |
<?php |
|
| 3 |
########################################################### |
|
| 4 |
## - Bukkit hostile mob kills per day Munin plugin - ## |
|
| 5 |
########################################################### |
|
| 6 |
## Script by: ## |
|
| 7 |
## Jonas Friedmann (@frdmn) ## |
|
| 8 |
## http://frd.mn ## |
|
| 9 |
########################################################### |
|
| 10 |
## MySQL ## |
|
| 11 |
########################################################### |
|
| 12 |
|
|
| 13 |
$hostname = 'localhost'; |
|
| 14 |
$username = 'sql'; |
|
| 15 |
$password = 'pass'; |
|
| 16 |
$database = 'sql'; |
|
| 17 |
$port = 3306; |
|
| 18 |
|
|
| 19 |
########################################################### |
|
| 20 |
## DON'T EDIT THIS ## |
|
| 21 |
########################################################### |
|
| 22 |
if ((count($argv) > 1) && ($argv[1] == 'config')) |
|
| 23 |
{
|
|
| 24 |
print("graph_title Bukkit / Statistician - hostile mob kills per day
|
|
| 25 |
graph_category bukkit_sql_kills |
|
| 26 |
graph_vlabel hostile mob kills per day |
|
| 27 |
graph_args --base 1000 -l 0 |
|
| 28 |
blaze.type GAUGE |
|
| 29 |
blaze.label killed blazes |
|
| 30 |
spider.type GAUGE |
|
| 31 |
spider.label killed spiders |
|
| 32 |
creeper.type GAUGE |
|
| 33 |
creeper.label killed creepers |
|
| 34 |
ghast.type GAUGE |
|
| 35 |
ghast.label killed ghasts |
|
| 36 |
magmacube.type GAUGE |
|
| 37 |
magmacube.label killed magma cubes |
|
| 38 |
silverfish.type GAUGE |
|
| 39 |
silverfish.label killed silverfish |
|
| 40 |
skeleton.type GAUGE |
|
| 41 |
skeleton.label killed skeletons |
|
| 42 |
slime.type GAUGE |
|
| 43 |
slime.label killed slimes |
|
| 44 |
witch.type GAUGE |
|
| 45 |
witch.label killed witches |
|
| 46 |
zombie.type GAUGE |
|
| 47 |
zombie.label killed zombies |
|
| 48 |
irongolem.type GAUGE |
|
| 49 |
irongolem.label killed iron golems |
|
| 50 |
enderdragon.type GAUGE |
|
| 51 |
enderdragon.label killed ender dragons |
|
| 52 |
wither.type GAUGE |
|
| 53 |
wither.label killed withers |
|
| 54 |
"); |
|
| 55 |
exit(); |
|
| 56 |
} |
|
| 57 |
|
|
| 58 |
## Construct 'minumum' timstamp |
|
| 59 |
$current = mktime(); |
|
| 60 |
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
|
|
| 61 |
|
|
| 62 |
## Initiate connection |
|
| 63 |
$connection = mysqli_connect($hostname, $username, $password, $database, $port); |
|
| 64 |
|
|
| 65 |
## Check connection |
|
| 66 |
if (mysqli_connect_errno()) {
|
|
| 67 |
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
| 68 |
exit(); |
|
| 69 |
} |
|
| 70 |
|
|
| 71 |
## Select queries for blaze kills and return the amount of rows |
|
| 72 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Blaze'")) {
|
|
| 73 |
## Print values |
|
| 74 |
print('blaze.value ' . mysqli_num_rows($result) . "\n");
|
|
| 75 |
} |
|
| 76 |
|
|
| 77 |
## Select queries for spider kills and return the amount of rows |
|
| 78 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = '%Spider'")) {
|
|
| 79 |
## Print values |
|
| 80 |
print('spider.value ' . mysqli_num_rows($result) . "\n");
|
|
| 81 |
} |
|
| 82 |
|
|
| 83 |
## Select queries for creeper kills and return the amount of rows |
|
| 84 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = '%reeper%'")) {
|
|
| 85 |
## Print values |
|
| 86 |
print('creeper.value ' . mysqli_num_rows($result) . "\n");
|
|
| 87 |
} |
|
| 88 |
|
|
| 89 |
## Select queries for ghast kills and return the amount of rows |
|
| 90 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Ghast'")) {
|
|
| 91 |
## Print values |
|
| 92 |
print('ghast.value ' . mysqli_num_rows($result) . "\n");
|
|
| 93 |
} |
|
| 94 |
|
|
| 95 |
## Select queries for magma cube kills and return the amount of rows |
|
| 96 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'MagmaCube'")) {
|
|
| 97 |
## Print values |
|
| 98 |
print('magmacube.value ' . mysqli_num_rows($result) . "\n");
|
|
| 99 |
} |
|
| 100 |
|
|
| 101 |
## Select queries for silverfish and return the amount of rows |
|
| 102 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Silverfish'")) {
|
|
| 103 |
## Print values |
|
| 104 |
print('silverfish.value ' . mysqli_num_rows($result) . "\n");
|
|
| 105 |
} |
|
| 106 |
|
|
| 107 |
## Select queries for skeleton kills and return the amount of rows |
|
| 108 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Skeleton'")) {
|
|
| 109 |
## Print values |
|
| 110 |
print('skeleton.value ' . mysqli_num_rows($result) . "\n");
|
|
| 111 |
} |
|
| 112 |
|
|
| 113 |
## Select queries for slime kills and return the amount of rows |
|
| 114 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Slime'")) {
|
|
| 115 |
## Print values |
|
| 116 |
print('slime.value ' . mysqli_num_rows($result) . "\n");
|
|
| 117 |
} |
|
| 118 |
|
|
| 119 |
## Select queries for witch kills and return the amount of rows |
|
| 120 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Witch'")) {
|
|
| 121 |
## Print values |
|
| 122 |
print('witch.value ' . mysqli_num_rows($result) . "\n");
|
|
| 123 |
} |
|
| 124 |
|
|
| 125 |
## Select queries for zombie kills and return the amount of rows |
|
| 126 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Zombie'")) {
|
|
| 127 |
## Print values |
|
| 128 |
print('zombie.value ' . mysqli_num_rows($result) . "\n");
|
|
| 129 |
} |
|
| 130 |
|
|
| 131 |
## Select queries for iron golem kills and return the amount of rows |
|
| 132 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = '%ron%'")) {
|
|
| 133 |
## Print values |
|
| 134 |
print('irongolem.value ' . mysqli_num_rows($result) . "\n");
|
|
| 135 |
} |
|
| 136 |
|
|
| 137 |
## Select queries for ender dragon kills and return the amount of rows |
|
| 138 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'EnderDragon'")) {
|
|
| 139 |
## Print values |
|
| 140 |
print('enderdragon.value ' . mysqli_num_rows($result) . "\n");
|
|
| 141 |
} |
|
| 142 |
|
|
| 143 |
## Select queries for wither kills and return the amount of rows |
|
| 144 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Wither'")) {
|
|
| 145 |
## Print values |
|
| 146 |
print('wither.value ' . mysqli_num_rows($result) . "\n");
|
|
| 147 |
} |
|
| 148 |
|
|
| 149 |
## Close connection |
|
| 150 |
mysqli_close($connection); |
|
| 151 |
?> |
|
| plugins/minecraft/jsonapi/mcsqls2killsneutral | ||
|---|---|---|
| 1 |
#!/usr/bin/php |
|
| 2 |
<?php |
|
| 3 |
########################################################### |
|
| 4 |
## - Bukkit neutral mob kills per day Munin plugin - ## |
|
| 5 |
########################################################### |
|
| 6 |
## Script by: ## |
|
| 7 |
## Jonas Friedmann (@frdmn) ## |
|
| 8 |
## http://frd.mn ## |
|
| 9 |
########################################################### |
|
| 10 |
## MySQL ## |
|
| 11 |
########################################################### |
|
| 12 |
|
|
| 13 |
$hostname = 'localhost'; |
|
| 14 |
$username = 'sql'; |
|
| 15 |
$password = 'pass'; |
|
| 16 |
$database = 'sql'; |
|
| 17 |
$port = 3306; |
|
| 18 |
|
|
| 19 |
########################################################### |
|
| 20 |
## DON'T EDIT THIS ## |
|
| 21 |
########################################################### |
|
| 22 |
if ((count($argv) > 1) && ($argv[1] == 'config')) |
|
| 23 |
{
|
|
| 24 |
print("graph_title Bukkit / Statistician - neutral mob kills per day
|
|
| 25 |
graph_category bukkit_sql_kills |
|
| 26 |
graph_vlabel neutral mob kills per day |
|
| 27 |
graph_args --base 1000 -l 0 |
|
| 28 |
enderman.type GAUGE |
|
| 29 |
enderman.label killed endermen |
|
| 30 |
wolf.type GAUGE |
|
| 31 |
wolf.label killed wolf |
|
| 32 |
zombiepigman.type GAUGE |
|
| 33 |
zombiepigman.label killed zombie pigmen |
|
| 34 |
snowman.type GAUGE |
|
| 35 |
snowman.label killed snowmen |
|
| 36 |
"); |
|
| 37 |
exit(); |
|
| 38 |
} |
|
| 39 |
|
|
| 40 |
## Construct 'minumum' timstamp |
|
| 41 |
$current = mktime(); |
|
| 42 |
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
|
|
| 43 |
|
|
| 44 |
## Initiate connection |
|
| 45 |
$connection = mysqli_connect($hostname, $username, $password, $database, $port); |
|
| 46 |
|
|
| 47 |
## Check connection |
|
| 48 |
if (mysqli_connect_errno()) {
|
|
| 49 |
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
| 50 |
exit(); |
|
| 51 |
} |
|
| 52 |
|
|
| 53 |
## Select queries for enderman and return the amount of rows |
|
| 54 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Enderman'")) {
|
|
| 55 |
## Print values |
|
| 56 |
print('enderman.value ' . mysqli_num_rows($result) . "\n");
|
|
| 57 |
} |
|
| 58 |
|
|
| 59 |
## Select queries for wolf kills and return the amount of rows |
|
| 60 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Wolf'")) {
|
|
| 61 |
## Print values |
|
| 62 |
print('wolf.value ' . mysqli_num_rows($result) . "\n");
|
|
| 63 |
} |
|
| 64 |
|
|
| 65 |
## Select queries for zombie pigman kills and return the amount of rows |
|
| 66 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Zombie Pigman'")) {
|
|
| 67 |
## Print values |
|
| 68 |
print('zombiepigman.value ' . mysqli_num_rows($result) . "\n");
|
|
| 69 |
} |
|
| 70 |
|
|
| 71 |
## Select queries for zombie snowman kills and return the amount of rows |
|
| 72 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Snowman'")) {
|
|
| 73 |
## Print values |
|
| 74 |
print('snowman.value ' . mysqli_num_rows($result) . "\n");
|
|
| 75 |
} |
|
| 76 |
|
|
| 77 |
## Close connection |
|
| 78 |
mysqli_close($connection); |
|
| 79 |
?> |
|
| plugins/minecraft/jsonapi/mcsqls2killspassive | ||
|---|---|---|
| 1 |
#!/usr/bin/php |
|
| 2 |
<?php |
|
| 3 |
########################################################### |
|
| 4 |
## - Bukkit passive mob kills per day Munin plugin - ## |
|
| 5 |
########################################################### |
|
| 6 |
## Script by: ## |
|
| 7 |
## Jonas Friedmann (@frdmn) ## |
|
| 8 |
## http://frd.mn ## |
|
| 9 |
########################################################### |
|
| 10 |
## MySQL ## |
|
| 11 |
########################################################### |
|
| 12 |
|
|
| 13 |
$hostname = 'localhost'; |
|
| 14 |
$username = 'sql'; |
|
| 15 |
$password = 'pass'; |
|
| 16 |
$database = 'sql'; |
|
| 17 |
$port = 3306; |
|
| 18 |
|
|
| 19 |
########################################################### |
|
| 20 |
## DON'T EDIT THIS ## |
|
| 21 |
########################################################### |
|
| 22 |
if ((count($argv) > 1) && ($argv[1] == 'config')) |
|
| 23 |
{
|
|
| 24 |
print("graph_title Bukkit / Statistician - passive mob kills per day
|
|
| 25 |
graph_category bukkit_sql_kills |
|
| 26 |
graph_vlabel passive mob kills per day |
|
| 27 |
graph_args --base 1000 -l 0 |
|
| 28 |
bat.type GAUGE |
|
| 29 |
bat.label killed bats |
|
| 30 |
chicken.type GAUGE |
|
| 31 |
chicken.label killed chickens |
|
| 32 |
cow.type GAUGE |
|
| 33 |
cow.label killed cows |
|
| 34 |
mooshroom.type GAUGE |
|
| 35 |
mooshroom.label killed mooshrooms |
|
| 36 |
ocelot.type GAUGE |
|
| 37 |
ocelot.label killed magma ocelots |
|
| 38 |
pig.type GAUGE |
|
| 39 |
pig.label killed pigs |
|
| 40 |
sheep.type GAUGE |
|
| 41 |
sheep.label killed sheeps |
|
| 42 |
squid.type GAUGE |
|
| 43 |
squid.label killed squids |
|
| 44 |
villager.type GAUGE |
|
| 45 |
villager.label killed villager |
|
| 46 |
"); |
|
| 47 |
exit(); |
|
| 48 |
} |
|
| 49 |
|
|
| 50 |
## Construct 'minumum' timstamp |
|
| 51 |
$current = mktime(); |
|
| 52 |
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
|
|
| 53 |
|
|
| 54 |
## Initiate connection |
|
| 55 |
$connection = mysqli_connect($hostname, $username, $password, $database, $port); |
|
| 56 |
|
|
| 57 |
## Check connection |
|
| 58 |
if (mysqli_connect_errno()) {
|
|
| 59 |
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
| 60 |
exit(); |
|
| 61 |
} |
|
| 62 |
|
|
| 63 |
## Select queries for bat kills and return the amount of rows |
|
| 64 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Bat'")) {
|
|
| 65 |
## Print values |
|
| 66 |
print('bat.value ' . mysqli_num_rows($result) . "\n");
|
|
| 67 |
} |
|
| 68 |
|
|
| 69 |
## Select queries for chicken kills and return the amount of rows |
|
| 70 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Chicken'")) {
|
|
| 71 |
## Print values |
|
| 72 |
print('chicken.value ' . mysqli_num_rows($result) . "\n");
|
|
| 73 |
} |
|
| 74 |
|
|
| 75 |
## Select queries for mooshroom kills and return the amount of rows |
|
| 76 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'MushroomCow'")) {
|
|
| 77 |
## Print values |
|
| 78 |
print('mooshroom.value ' . mysqli_num_rows($result) . "\n");
|
|
| 79 |
} |
|
| 80 |
|
|
| 81 |
## Select queries for cow kills and return the amount of rows |
|
| 82 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Cow'")) {
|
|
| 83 |
## Print values |
|
| 84 |
print('cow.value ' . mysqli_num_rows($result) . "\n");
|
|
| 85 |
} |
|
| 86 |
|
|
| 87 |
## Select queries for ocelot kills and return the amount of rows |
|
| 88 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Ocelot'")) {
|
|
| 89 |
## Print values |
|
| 90 |
print('ocelot.value ' . mysqli_num_rows($result) . "\n");
|
|
| 91 |
} |
|
| 92 |
|
|
| 93 |
## Select queries for pig kills and return the amount of rows |
|
| 94 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Pig'")) {
|
|
| 95 |
## Print values |
|
| 96 |
print('pig.value ' . mysqli_num_rows($result) . "\n");
|
|
| 97 |
} |
|
| 98 |
|
|
| 99 |
## Select queries for sheep and return the amount of rows |
|
| 100 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Sheep'")) {
|
|
| 101 |
## Print values |
|
| 102 |
print('sheep.value ' . mysqli_num_rows($result) . "\n");
|
|
| 103 |
} |
|
| 104 |
|
|
| 105 |
## Select queries for squid kills and return the amount of rows |
|
| 106 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Squid'")) {
|
|
| 107 |
## Print values |
|
| 108 |
print('squid.value ' . mysqli_num_rows($result) . "\n");
|
|
| 109 |
} |
|
| 110 |
|
|
| 111 |
## Select queries for villager and return the amount of rows |
|
| 112 |
if ($result = mysqli_query($connection, "SELECT id FROM killchart WHERE time > $today AND killed_creature_type = 'Villager'")) {
|
|
| 113 |
## Print values |
|
| 114 |
print('villager.value ' . mysqli_num_rows($result) . "\n");
|
|
| 115 |
} |
|
| 116 |
|
|
| 117 |
## Close connection |
|
| 118 |
mysqli_close($connection); |
|
| 119 |
?> |
|
| plugins/minecraft/jsonapi/mcsqls2players | ||
|---|---|---|
| 1 |
#!/usr/bin/php |
|
| 2 |
<?php |
|
| 3 |
########################################################### |
|
| 4 |
## - Bukkit new players per day Munin plugin - ## |
|
| 5 |
########################################################### |
|
| 6 |
## Script by: ## |
|
| 7 |
## Jonas Friedmann (@frdmn) ## |
|
| 8 |
## http://frd.mn ## |
|
| 9 |
########################################################### |
|
| 10 |
## MySQL ## |
|
| 11 |
########################################################### |
|
| 12 |
|
|
| 13 |
$hostname = 'localhost'; |
|
| 14 |
$username = 'sql'; |
|
| 15 |
$password = 'pass'; |
|
| 16 |
$database = 'sql'; |
|
| 17 |
$port = 3306; |
|
| 18 |
|
|
| 19 |
########################################################### |
|
| 20 |
## DON'T EDIT THIS ## |
|
| 21 |
########################################################### |
|
| 22 |
if ((count($argv) > 1) && ($argv[1] == 'config')) |
|
| 23 |
{
|
|
| 24 |
print("graph_title Bukkit / Statistician - new players per day
|
|
| 25 |
graph_category bukkit_sql |
|
| 26 |
graph_vlabel new players per day |
|
| 27 |
graph_args --base 1000 -l 0 |
|
| 28 |
players.type GAUGE |
|
| 29 |
players.label new players |
|
| 30 |
"); |
|
| 31 |
exit(); |
|
| 32 |
} |
|
| 33 |
|
|
| 34 |
## Construct 'minumum' timstamp |
|
| 35 |
$current = mktime(); |
|
| 36 |
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
|
|
| 37 |
|
|
| 38 |
## Initiate connection |
|
| 39 |
$connection = mysqli_connect($hostname, $username, $password, $database, $port); |
|
| 40 |
|
|
| 41 |
## Check connection |
|
| 42 |
if (mysqli_connect_errno()) {
|
|
| 43 |
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
| 44 |
exit(); |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
## Select queries return the amount of rows |
|
| 48 |
if ($result = mysqli_query($connection, "SELECT player_name FROM players WHERE firstever_login > $today")) {
|
|
| 49 |
## Print values |
|
| 50 |
print('players.value ' . mysqli_num_rows($result) . "\n");
|
|
| 51 |
} |
|
| 52 |
|
|
| 53 |
## Close connection |
|
| 54 |
mysqli_close($connection); |
|
| 55 |
?> |
|
| plugins/minecraft/jsonapi/mcsqlubshame | ||
|---|---|---|
| 1 |
#!/usr/bin/php |
|
| 2 |
<?php |
|
| 3 |
########################################################### |
|
| 4 |
## - Bukkit shame per day Munin plugin - ## |
|
| 5 |
########################################################### |
|
| 6 |
## Script by: ## |
|
| 7 |
## Jonas Friedmann (@frdmn) ## |
|
| 8 |
## http://frd.mn ## |
|
| 9 |
########################################################### |
|
| 10 |
## MySQL ## |
|
| 11 |
########################################################### |
|
| 12 |
|
|
| 13 |
$hostname = 'localhost'; |
|
| 14 |
$username = 'sql'; |
|
| 15 |
$password = 'pass'; |
|
| 16 |
$database = 'sql'; |
|
| 17 |
$port = 3306; |
|
| 18 |
|
|
| 19 |
########################################################### |
|
| 20 |
## DON'T EDIT THIS ## |
|
| 21 |
########################################################### |
|
| 22 |
if ((count($argv) > 1) && ($argv[1] == 'config')) |
|
| 23 |
{
|
|
| 24 |
print("graph_title Bukkit / Ultrabans - shame per day
|
|
| 25 |
graph_category bukkit_sql |
|
| 26 |
graph_vlabel amount of shame per day |
|
| 27 |
graph_args --base 1000 -l 0 |
|
| 28 |
unban.type GAUGE |
|
| 29 |
unban.label unbans |
|
| 30 |
kick.type GAUGE |
|
| 31 |
kick.label kicks |
|
| 32 |
warning.type GAUGE |
|
| 33 |
warning.label warnings |
|
| 34 |
ban.type GAUGE |
|
| 35 |
ban.label bans |
|
| 36 |
ipban.type GAUGE |
|
| 37 |
ipban.label ipbans |
|
| 38 |
fine.type GAUGE |
|
| 39 |
fine.label fines |
|
| 40 |
jail.type GAUGE |
|
| 41 |
jail.label jails |
|
| 42 |
permban.type GAUGE |
|
| 43 |
permban.label permbans |
|
| 44 |
mute.type GAUGE |
|
| 45 |
mute.label mutes |
|
| 46 |
"); |
|
| 47 |
exit(); |
|
| 48 |
} |
|
| 49 |
|
|
| 50 |
## Construct 'minumum' timstamp |
|
| 51 |
$current = mktime(); |
|
| 52 |
$today = mktime(0, 0, 0, date("n", $current), date("j", $current), date("Y", $current));
|
|
| 53 |
|
|
| 54 |
## Initiate connection |
|
| 55 |
$connection = mysqli_connect($hostname, $username, $password, $database, $port); |
|
| 56 |
|
|
| 57 |
## Check connection |
|
| 58 |
if (mysqli_connect_errno()) {
|
|
| 59 |
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
| 60 |
exit(); |
|
| 61 |
} |
|
| 62 |
|
|
| 63 |
## Select queries for unbans return the amount of rows |
|
| 64 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 5 AND time > $today")) {
|
|
| 65 |
## Print values |
|
| 66 |
print('unban.value ' . mysqli_num_rows($result) . "\n");
|
|
| 67 |
} |
|
| 68 |
|
|
| 69 |
## Select queries for kicks return the amount of rows |
|
| 70 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 3 AND time > $today")) {
|
|
| 71 |
## Print values |
|
| 72 |
print('kick.value ' . mysqli_num_rows($result) . "\n");
|
|
| 73 |
} |
|
| 74 |
|
|
| 75 |
## Select queries for warnings return the amount of rows |
|
| 76 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 2 AND time > $today")) {
|
|
| 77 |
## Print values |
|
| 78 |
print('warning.value ' . mysqli_num_rows($result) . "\n");
|
|
| 79 |
} |
|
| 80 |
|
|
| 81 |
## Select queries for bans return the amount of rows |
|
| 82 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 0 AND time > $today")) {
|
|
| 83 |
## Print values |
|
| 84 |
print('ban.value ' . mysqli_num_rows($result) . "\n");
|
|
| 85 |
} |
|
| 86 |
|
|
| 87 |
## Select queries for ipbans return the amount of rows |
|
| 88 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 1 AND time > $today")) {
|
|
| 89 |
## Print values |
|
| 90 |
print('ipban.value ' . mysqli_num_rows($result) . "\n");
|
|
| 91 |
} |
|
| 92 |
|
|
| 93 |
## Select queries for fines return the amount of rows |
|
| 94 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 4 AND time > $today")) {
|
|
| 95 |
## Print values |
|
| 96 |
print('fine.value ' . mysqli_num_rows($result) . "\n");
|
|
| 97 |
} |
|
| 98 |
|
|
| 99 |
## Select queries for jails return the amount of rows |
|
| 100 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 6 AND time > $today")) {
|
|
| 101 |
## Print values |
|
| 102 |
print('jail.value ' . mysqli_num_rows($result) . "\n");
|
|
| 103 |
} |
|
| 104 |
|
|
| 105 |
## Select queries for permbans return the amount of rows |
|
| 106 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 9 AND time > $today")) {
|
|
| 107 |
## Print values |
|
| 108 |
print('permban.value ' . mysqli_num_rows($result) . "\n");
|
|
| 109 |
} |
|
| 110 |
|
|
| 111 |
## Select queries for mutes - part 1 return the amount of rows |
|
| 112 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 7 AND time > $today")) {
|
|
| 113 |
## Store result |
|
| 114 |
$tmp1 = mysqli_num_rows($result); |
|
| 115 |
} |
|
| 116 |
|
|
| 117 |
## Select queries for mutes - part 2 return the amount of rows |
|
| 118 |
if ($result = mysqli_query($connection, "SELECT name FROM banlist WHERE type = 8 AND time > $today")) {
|
|
| 119 |
## Store result |
|
| 120 |
$tmp2 = mysqli_num_rows($result); |
|
| 121 |
} |
|
| 122 |
|
|
| 123 |
$mutes = $tmp1 + $tmp2; |
|
| 124 |
|
|
| 125 |
print('mute.value ' . $mutes . "\n");
|
|
| 126 |
|
|
| 127 |
## Close connection |
|
| 128 |
mysqli_close($connection); |
|
| 129 |
?> |
|
Formats disponibles : Unified diff