Révision b6bf8712
first version of the plugins
| plugins/minecraft/jsonapi/mcjsonplayers | ||
|---|---|---|
| 1 |
#!/usr/bin/php |
|
| 2 |
<?php |
|
| 3 |
########################################################### |
|
| 4 |
## - Bukkit player online Munin plugin - ## |
|
| 5 |
########################################################### |
|
| 6 |
## Script by: ## |
|
| 7 |
## Jonas Friedmann (@frdmn) ## |
|
| 8 |
## http://blog.frd.mn ## |
|
| 9 |
########################################################### |
|
| 10 |
## JSONAPI ## |
|
| 11 |
########################################################### |
|
| 12 |
|
|
| 13 |
$hostname = 'your-hostname'; |
|
| 14 |
$username = 'your-username'; |
|
| 15 |
$password = 'your-password'; |
|
| 16 |
$salt = 'your-salt'; |
|
| 17 |
$port = 20059; |
|
| 18 |
|
|
| 19 |
########################################################### |
|
| 20 |
## DON'T EDIT THIS ## |
|
| 21 |
########################################################### |
|
| 22 |
if ((count($argv) > 1) && ($argv[1] == 'config')) |
|
| 23 |
{
|
|
| 24 |
print("graph_title Bukkit / JSONAPI - players online
|
|
| 25 |
graph_category bukkit_jsonapi |
|
| 26 |
graph_vlabel players |
|
| 27 |
graph_args --base 1000 -l 0 |
|
| 28 |
players.type GAUGE |
|
| 29 |
players.label players |
|
| 30 |
"); |
|
| 31 |
exit(); |
|
| 32 |
} |
|
| 33 |
|
|
| 34 |
## Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php) |
|
| 35 |
require('/var/cache/munin/JSONAPI.php');
|
|
| 36 |
|
|
| 37 |
## Prepare API call |
|
| 38 |
$api = new JSONAPI($hostname, $port, $username, $password, $salt); |
|
| 39 |
$result = $api->call("getPlayerCount");
|
|
| 40 |
|
|
| 41 |
## Check for success |
|
| 42 |
if ($result['result'] == 'success'){
|
|
| 43 |
## Print values |
|
| 44 |
print('players.value ' . $result['success'] . "\n");
|
|
| 45 |
} |
|
| 46 |
?> |
|
| plugins/minecraft/jsonapi/mcjsonramusage | ||
|---|---|---|
| 1 |
#!/usr/bin/php |
|
| 2 |
<?php |
|
| 3 |
########################################################### |
|
| 4 |
## - Bukkit RAM usage Munin plugin - ## |
|
| 5 |
########################################################### |
|
| 6 |
## Script by: ## |
|
| 7 |
## Jonas Friedmann (@frdmn) ## |
|
| 8 |
## http://blog.frd.mn ## |
|
| 9 |
########################################################### |
|
| 10 |
## JSONAPI ## |
|
| 11 |
########################################################### |
|
| 12 |
|
|
| 13 |
$hostname = 'your-hostname'; |
|
| 14 |
$username = 'your-username'; |
|
| 15 |
$password = 'your-password'; |
|
| 16 |
$salt = 'your-salt'; |
|
| 17 |
$port = 20059; |
|
| 18 |
|
|
| 19 |
########################################################### |
|
| 20 |
## DON'T EDIT THIS ## |
|
| 21 |
########################################################### |
|
| 22 |
if ((count($argv) > 1) && ($argv[1] == 'config')) |
|
| 23 |
{
|
|
| 24 |
print("graph_title Bukkit / JSONAPI - RAM usage
|
|
| 25 |
graph_category bukkit_jsonapi |
|
| 26 |
graph_vlabel RAM usage in GB |
|
| 27 |
graph_args --base 1024 -l 0 |
|
| 28 |
total.label total |
|
| 29 |
total.type GAUGE |
|
| 30 |
used.label used |
|
| 31 |
used.type GAUGE |
|
| 32 |
"); |
|
| 33 |
exit(); |
|
| 34 |
} |
|
| 35 |
|
|
| 36 |
## Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php) |
|
| 37 |
require('/var/cache/munin/JSONAPI.php');
|
|
| 38 |
|
|
| 39 |
## Prepare API call |
|
| 40 |
$api = new JSONAPI($hostname, $port, $username, $password, $salt); |
|
| 41 |
$result = $api->callMultiple(array( |
|
| 42 |
"system.getJavaMemoryUsage", |
|
| 43 |
"system.getJavaMemoryTotal" |
|
| 44 |
), array( |
|
| 45 |
array(), |
|
| 46 |
array(), |
|
| 47 |
)); |
|
| 48 |
|
|
| 49 |
## Check for success |
|
| 50 |
if ($result['result'] == 'success'){
|
|
| 51 |
## Print values |
|
| 52 |
print('used.value ' . round($result['success'][0]['success']/1000,2) . "\n");
|
|
| 53 |
print('total.value ' . round($result['success'][1]['success']/1000,2) . "\n");
|
|
| 54 |
} |
|
| 55 |
?> |
|
| plugins/minecraft/jsonapi/mcjsontps | ||
|---|---|---|
| 1 |
#!/usr/bin/php |
|
| 2 |
<?php |
|
| 3 |
########################################################### |
|
| 4 |
## - Bukkit TPS Munin plugin - ## |
|
| 5 |
########################################################### |
|
| 6 |
## Script by: ## |
|
| 7 |
## Jonas Friedmann (@frdmn) ## |
|
| 8 |
## http://blog.frd.mn ## |
|
| 9 |
########################################################### |
|
| 10 |
## JSONAPI ## |
|
| 11 |
########################################################### |
|
| 12 |
|
|
| 13 |
$hostname = 'your-hostname'; |
|
| 14 |
$username = 'your-username'; |
|
| 15 |
$password = 'your-password'; |
|
| 16 |
$salt = 'your-salt'; |
|
| 17 |
$port = 20059; |
|
| 18 |
|
|
| 19 |
########################################################### |
|
| 20 |
## DON'T EDIT THIS ## |
|
| 21 |
########################################################### |
|
| 22 |
if ((count($argv) > 1) && ($argv[1] == 'config')) |
|
| 23 |
{
|
|
| 24 |
print("graph_title Bukkit / JSONAPI - ticks per second (TPS)
|
|
| 25 |
graph_category bukkit_jsonapi |
|
| 26 |
graph_vlabel ticks per second |
|
| 27 |
graph_args --base 1000 -l 0 |
|
| 28 |
tps.type GAUGE |
|
| 29 |
tps.label TPS |
|
| 30 |
"); |
|
| 31 |
exit(); |
|
| 32 |
} |
|
| 33 |
|
|
| 34 |
## Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php) |
|
| 35 |
require('/var/cache/munin/JSONAPI.php');
|
|
| 36 |
|
|
| 37 |
## Prepare API call |
|
| 38 |
$api = new JSONAPI($hostname, $port, $username, $password, $salt); |
|
| 39 |
$result = $api->call("system.getServerClockDebug");
|
|
| 40 |
|
|
| 41 |
## Check for success |
|
| 42 |
if ($result['result'] == 'success'){
|
|
| 43 |
## Print values |
|
| 44 |
print('tps.value ' . round($result['success']['clockRate'], 2) . "\n");
|
|
| 45 |
} |
|
| 46 |
?> |
|
Formats disponibles : Unified diff