Repository
Munin (contrib)
Last change
2018-08-02
Graph Categories
Keywords
Language
PHP
Authors

bukkit-jsonapi-tps

Sadly there is no documentation for this plugin.

#!/usr/bin/php
<?php
/**
 * Bukkit TPS Munin plugin
 * ---------------------------------
 *
 * Shows the current TPS (ticks per second) of your
 * Minecraft server (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 - ticks per second (TPS)
graph_category games
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");
}
?>