Пример #1
0
function main($server_cfg)
{
    $game_cfg = null;
    $options = getopt("g:n:p:");
    //
    // parameters needed to read zrt varaibles;
    // such as XHPRO_ENABLE_IPLIST
    //
    $parameters['product'] = $options['p'];
    $parameters['namespace'] = $options['n'];
    if (isset($options['g'])) {
        $game_cfg = load_game_config($options['g']);
    } else {
        echo "pass game name as parameter with option -g";
        exit(Monitor::UNKNOWN);
    }
    if (!isset($game_cfg)) {
        echo "game configuration is not loaded";
        exit(Monitor::UNKNOWN);
    }
    $time_slot = (int) (time() / 1800);
    $monitor = new Monitor($server_cfg, $game_cfg);
    $result = $monitor->monitor_metrics($time_slot - 1, $parameters);
    exit($result);
}