mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 10:39:53 +00:00
first version of the plugins
This commit is contained in:
parent
a02e98adda
commit
b6bf87120c
3 changed files with 147 additions and 0 deletions
46
plugins/minecraft/jsonapi/mcjsonplayers
Normal file
46
plugins/minecraft/jsonapi/mcjsonplayers
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
###########################################################
|
||||||
|
## - Bukkit player online Munin plugin - ##
|
||||||
|
###########################################################
|
||||||
|
## Script by: ##
|
||||||
|
## Jonas Friedmann (@frdmn) ##
|
||||||
|
## http://blog.frd.mn ##
|
||||||
|
###########################################################
|
||||||
|
## JSONAPI ##
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
$hostname = 'your-hostname';
|
||||||
|
$username = 'your-username';
|
||||||
|
$password = 'your-password';
|
||||||
|
$salt = 'your-salt';
|
||||||
|
$port = 20059;
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
## DON'T EDIT THIS ##
|
||||||
|
###########################################################
|
||||||
|
if ((count($argv) > 1) && ($argv[1] == 'config'))
|
||||||
|
{
|
||||||
|
print("graph_title Bukkit / JSONAPI - players online
|
||||||
|
graph_category bukkit_jsonapi
|
||||||
|
graph_vlabel players
|
||||||
|
graph_args --base 1000 -l 0
|
||||||
|
players.type GAUGE
|
||||||
|
players.label players
|
||||||
|
");
|
||||||
|
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->call("getPlayerCount");
|
||||||
|
|
||||||
|
## Check for success
|
||||||
|
if ($result['result'] == 'success'){
|
||||||
|
## Print values
|
||||||
|
print('players.value ' . $result['success'] . "\n");
|
||||||
|
}
|
||||||
|
?>
|
55
plugins/minecraft/jsonapi/mcjsonramusage
Normal file
55
plugins/minecraft/jsonapi/mcjsonramusage
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
###########################################################
|
||||||
|
## - Bukkit RAM usage Munin plugin - ##
|
||||||
|
###########################################################
|
||||||
|
## Script by: ##
|
||||||
|
## Jonas Friedmann (@frdmn) ##
|
||||||
|
## http://blog.frd.mn ##
|
||||||
|
###########################################################
|
||||||
|
## JSONAPI ##
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
$hostname = 'your-hostname';
|
||||||
|
$username = 'your-username';
|
||||||
|
$password = 'your-password';
|
||||||
|
$salt = 'your-salt';
|
||||||
|
$port = 20059;
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
## DON'T EDIT THIS ##
|
||||||
|
###########################################################
|
||||||
|
if ((count($argv) > 1) && ($argv[1] == 'config'))
|
||||||
|
{
|
||||||
|
print("graph_title Bukkit / JSONAPI - RAM usage
|
||||||
|
graph_category bukkit_jsonapi
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
?>
|
46
plugins/minecraft/jsonapi/mcjsontps
Normal file
46
plugins/minecraft/jsonapi/mcjsontps
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
###########################################################
|
||||||
|
## - Bukkit TPS Munin plugin - ##
|
||||||
|
###########################################################
|
||||||
|
## Script by: ##
|
||||||
|
## Jonas Friedmann (@frdmn) ##
|
||||||
|
## http://blog.frd.mn ##
|
||||||
|
###########################################################
|
||||||
|
## JSONAPI ##
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
$hostname = 'your-hostname';
|
||||||
|
$username = 'your-username';
|
||||||
|
$password = 'your-password';
|
||||||
|
$salt = 'your-salt';
|
||||||
|
$port = 20059;
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
## DON'T EDIT THIS ##
|
||||||
|
###########################################################
|
||||||
|
if ((count($argv) > 1) && ($argv[1] == 'config'))
|
||||||
|
{
|
||||||
|
print("graph_title Bukkit / JSONAPI - ticks per second (TPS)
|
||||||
|
graph_category bukkit_jsonapi
|
||||||
|
graph_vlabel ticks per second
|
||||||
|
graph_args --base 1000 -l 0
|
||||||
|
tps.type GAUGE
|
||||||
|
tps.label TPS
|
||||||
|
");
|
||||||
|
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->call("system.getServerClockDebug");
|
||||||
|
|
||||||
|
## Check for success
|
||||||
|
if ($result['result'] == 'success'){
|
||||||
|
## Print values
|
||||||
|
print('tps.value ' . round($result['success']['clockRate'], 2) . "\n");
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue