mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Fix frdmn's minecraft plugins
- Get rid of duplicate plugins in "jsonapi/" folder - Rename - Reference to original GitHub repo
This commit is contained in:
parent
0743e6e5fb
commit
92abf3e3eb
17 changed files with 30 additions and 841 deletions
65
plugins/minecraft/bukkit-jsonapi-ramusage
Normal file
65
plugins/minecraft/bukkit-jsonapi-ramusage
Normal file
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* Bukkit RAM usage Munin plugin
|
||||
* ---------------------------------
|
||||
*
|
||||
* Shows the current RAM usage of your Minecraft process
|
||||
* an the total RAM (parsed via JSONAPI)
|
||||
*
|
||||
* Read more about my plugins on my blog:
|
||||
* http://s.frd.mn/XJsryR
|
||||
*
|
||||
* Author: Jonas Friedmann (http://frd.mn)
|
||||
* GitHub: https://github.com/yeahwhat-mc/munin-bukkit-plugins
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* JSONAPI configuration
|
||||
*/
|
||||
|
||||
$hostname = 'your-hostname';
|
||||
$username = 'your-username';
|
||||
$password = 'your-password';
|
||||
$salt = 'your-salt';
|
||||
$port = 20059;
|
||||
|
||||
/**
|
||||
* !!! DO NOT EDIT THIS PART BELOW !!!
|
||||
*/
|
||||
|
||||
if ((count($argv) > 1) && ($argv[1] == 'config'))
|
||||
{
|
||||
print("graph_title Bukkit / JSONAPI - RAM usage
|
||||
graph_category bukkit
|
||||
graph_vlabel RAM usage in GB
|
||||
graph_args --base 1024 -l 0
|
||||
total.label total
|
||||
total.type GAUGE
|
||||
used.label used
|
||||
used.type GAUGE
|
||||
");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php)
|
||||
require('/var/cache/munin/JSONAPI.php');
|
||||
|
||||
// Prepare API call
|
||||
$api = new JSONAPI($hostname, $port, $username, $password, $salt);
|
||||
$result = $api->callMultiple(array(
|
||||
"system.getJavaMemoryUsage",
|
||||
"system.getJavaMemoryTotal"
|
||||
), array(
|
||||
array(),
|
||||
array(),
|
||||
));
|
||||
|
||||
// Check for success
|
||||
if ($result['result'] == 'success'){
|
||||
// Print values
|
||||
print('used.value ' . round($result['success'][0]['success']/1000,2) . "\n");
|
||||
print('total.value ' . round($result['success'][1]['success']/1000,2) . "\n");
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue