mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
#!/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");
|
|
}
|
|
?>
|