Example #1
0
        # Ask for a telnet command on a cluster
        if (isset($_GET['request_server']) && ($cluster = $_ini->cluster($_GET['request_server']))) {
            foreach ($cluster as $server) {
                # Dumping server telnet command response
                echo Library_HTML_Components::serverResponse($server['hostname'], $server['port'], Library_Command_Factory::api('Server')->telnet($server['hostname'], $server['port'], $_GET['request_telnet']));
            }
        } elseif (isset($_GET['request_server']) && ($server = $_ini->server($_GET['request_server']))) {
            # Dumping server telnet command response
            echo Library_HTML_Components::serverResponse($server['hostname'], $server['port'], Library_Command_Factory::api('Server')->telnet($server['hostname'], $server['port'], $_GET['request_telnet']));
        } else {
            # Looking into each cluster
            foreach ($_ini->get('servers') as $cluster => $servers) {
                # Asking for each server stats
                foreach ($servers as $server) {
                    # Dumping server telnet command response
                    echo Library_HTML_Components::serverResponse($server['hostname'], $server['port'], Library_Command_Factory::api('Server')->telnet($server['hostname'], $server['port'], $_GET['request_telnet']));
                }
            }
        }
        break;
        # Default : No command
    # Default : No command
    default:
        # Showing header
        include 'View/Header.phtml';
        # Showing formulary
        include 'View/Commands/Commands.phtml';
        # Showing footer
        include 'View/Footer.phtml';
        break;
}
Example #2
0
include 'View/Header.tpl';
# Display by request type
switch ($request) {
    # Items : Display of all items for a single slab for a single server
    case 'items':
        # Initializing items array
        $server = null;
        $items = false;
        $response = array();
        # Ask for one server and one slabs items
        if (isset($_GET['server']) && ($server = $_ini->server($_GET['server']))) {
            $items = Library_Command_Factory::instance('items_api')->items($server['hostname'], $server['port'], $_GET['slab']);
        }
        # Cheking if asking an item
        if (isset($_GET['request_key'])) {
            $response[$server_name] = Library_HTML_Components::serverResponse($server['hostname'], $server['port'], Library_Command_Factory::instance('get_api')->get($server['hostname'], $server['port'], $_GET['request_key']));
        }
        # Getting stats to calculate server boot time
        $stats = Library_Command_Factory::instance('stats_api')->stats($server['hostname'], $server['port']);
        $infinite = isset($stats['time'], $stats['uptime']) ? $stats['time'] - $stats['uptime'] : 0;
        # Items are well formed
        if ($items !== false) {
            # Showing items
            include 'View/Stats/Items.tpl';
        } else {
            include 'View/Stats/Error.tpl';
        }
        unset($items);
        break;
        # Slabs : Display of all slabs for a single server
    # Slabs : Display of all slabs for a single server