Example #1
0
function ProcessRequest($server_cfg, $game_cfg)
{
    $xhprofModelObject = new XhProfModel($server_cfg, $game_cfg);
    date_default_timezone_set('UTC');
    $result = $xhprofModelObject->generic_execute_get_query("get_release_list", array('table' => 'events', 'extra_params' => ""));
    echo json_encode($result);
}
Example #2
0
function ProcessRequest($server_cfg, $game_cfg)
{
    $columns = $_GET["columns"];
    //echo $columns;
    $wrapped_column_names = wrap_escape(explode(",", $columns), "`");
    //print_r($wrapped_column_names);
    $query = $_GET["query"];
    $xhprofModelObject = new XhProfModel($server_cfg, $game_cfg);
    date_default_timezone_set('UTC');
    $end_time = time();
    $start_time = $end_time - 12 * 7 * 24 * 60 * 60;
    # 12 weeks ago
    $implode_columns = implode(",", $wrapped_column_names);
    if (!$query || $query == "cto_get_top_pages_avg_load_time") {
        $chart_result = $xhprofModelObject->generic_execute_get_query_detail($query, array('table' => "apache_stats_flip_avg", 'end_time' => $end_time, 'start_time' => $start_time, 'columns' => $implode_columns));
    } else {
        if ($query == "cto_get_tracked_functions_by_column") {
            $page = $_GET['page'];
            $chart_result = $xhprofModelObject->generic_execute_get_query_detail($query, array('table' => "tracked_functions_flip_incl_time", 'end_time' => $end_time, 'start_time' => $start_time, 'page' => $page, 'columns' => $implode_columns));
        } else {
            echo json_encode("Illegal Query!");
            return;
        }
    }
    $tags = $xhprofModelObject->generic_execute_get_query("get_tag_range", array('table' => "events", 'end_time' => $end_time, 'start_time' => $start_time, 'extra_params' => ""));
    $chart_result["tags"] = $tags;
    echo json_encode($chart_result);
}
Example #3
0
function ProcessRequest($server_cfg, $game_cfg)
{
    $xhprofModelObject = new XhProfModel($server_cfg, $game_cfg);
    date_default_timezone_set('UTC');
    $end_time = (int) $_GET["end_time"];
    $start_time = (int) $_GET["start_time"];
    $result = $xhprofModelObject->generic_execute_get_query("get_last_profile_slots", array('table' => $game_cfg["xhprof_blob_table"], 'end_time' => $end_time, 'start_time' => $start_time, 'extra_params' => ""));
    echo json_encode($result);
}
Example #4
0
function getGameMapping($server_cfg)
{
    $cfg = get_report_cfg($server_cfg['report_conf_file']);
    $xhprofModelObject = new XhProfModel($server_cfg, $cfg, false, false);
    $gameMap = array();
    $result = $xhprofModelObject->generic_execute_get_query("get_game_name_by_id", array());
    foreach ($result as $value) {
        $gameMap[$value['id']] = $value['name'];
    }
    return $gameMap;
}
Example #5
0
function get_game_from_ip($ip)
{
    global $server_cfg;
    global $deployment;
    $rs_conf_file = $server_cfg['rs_conf_file'];
    $db_conf = get_rs_db_conf_ini($rs_conf_file);
    $db_hndl = new XhProfModel($server_cfg, $db_conf, false);
    $result = $db_hndl->generic_execute_get_query("get_deployment_from_ip", array('ip' => $ip));
    if ($result and isset($result[0])) {
        $deployment = $result[0]['deploy_id'];
        $gd_map = get_game_deploy_map($server_cfg);
        if (isset($gd_map[$deployment])) {
            return $gd_map[$deployment];
        }
    }
    return null;
}
Example #6
0
function ProcessRequest($server_cfg, $game_cfg, $params)
{
    $query = $_GET["query"];
    if (!$query) {
        $query = 'eu_web_chart_range';
    }
    if (!$query) {
        return json_encode("Illegal query.");
    }
    $xhprofModelObject = new XhProfModel($server_cfg, $game_cfg);
    date_default_timezone_set('UTC');
    $end_time = time();
    $start_time = time() - 12 * 7 * 24 * 60 * 60;
    # 12 weeks ago
    $chart_result = $xhprofModelObject->generic_execute_get_query_detail($query, array('table' => "vertica_stats_30min", 'end_time' => $end_time, 'start_time' => $start_time, 'prefix' => str_replace("-", "_", $params['hostgroup'])));
    $tags = $xhprofModelObject->generic_execute_get_query("get_tag_range", array('table' => "events", 'end_time' => $end_time, 'start_time' => $start_time, 'extra_params' => ""));
    $chart_result["tags"] = $tags;
    echo json_encode($chart_result);
}
Example #7
0
function ProcessRequest($server_cfg, $game_cfg)
{
    $query = $_GET["query"];
    if (!$query) {
        $query = 'bd_chart_range';
    }
    if (!$query) {
        return json_encode("Illegal query.");
    }
    $xhprofModelObject = new XhProfModel($server_cfg, $game_cfg);
    date_default_timezone_set('UTC');
    $end_time = time();
    $start_time = $end_time - 12 * 7 * 24 * 60 * 60;
    # 12 weeks ago
    $chart_result = $xhprofModelObject->generic_execute_get_query_detail($query, array('table' => $game_cfg["db_stats_table"], 'end_time' => $end_time, 'start_time' => $start_time, 'extra_params' => ""));
    $tags = $xhprofModelObject->generic_execute_get_query("get_tag_range", array('table' => "events", 'end_time' => $end_time, 'start_time' => $start_time, 'extra_params' => ""));
    $chart_result["tags"] = $tags;
    echo json_encode($chart_result);
}
Example #8
0
function insert_event($xhProfModelObject, $server_cfg = null, $game_cfg = null, $timestamp, $type, $text)
{
    if (!$xhProfModelObject) {
        return false;
    }
    $query_name = "event_insert";
    $result = null;
    $result = $xhProfModelObject->generic_execute_get_query($query_name, array('start' => $timestamp, 'type' => $type, 'text' => $text), false, false);
    //if its a array, just return, else if its a game ,fill the array dbs as well
    if (isset($game_cfg['parent'])) {
        //its an array, so our work here is done, return
        return $result;
    }
    $result_array = null;
    $arrays = get_array_id_map($server_cfg, $game_cfg);
    //for loop to put events in each array db
    foreach ($arrays as $array => $array_id) {
        $game_array_cfg = load_game_config($game_cfg['name'], $array_id);
        $xhProfModelObject = new XhProfModel($server_cfg, $game_array_cfg, false);
        $result_array = $xhProfModelObject->generic_execute_get_query($query_name, array('start' => $timestamp, 'type' => $type, 'text' => $text), false, false);
    }
    return $result;
}
Example #9
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#      distributed under the License is distributed on an "AS IS" BASIS,
#      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
require_once 'setup_page.php';
include_once 'XhProfModel.php';
include_once 'spyc.php';
include_once 'yml_conf.inc.php';
include_once 'game_config.php';
include_once 'server.cfg';
$xhProfModelObject = new XhProfModel($server_cfg, $game_cfg);
$result = $xhProfModelObject->generic_execute_get_query_detail('get_last_event', null);
$type = (string) $result['rows'][0][0];
$text = (string) $result['rows'][0][1];
# $event = "$type:$text";
$event = "{$text}";
$event = str_replace('"', '', $event);
if (!isset($arrayid)) {
    $arrayid = 'all';
}
?>

<html>
<head>
<title> Administrator </title>
<link rel="stylesheet" href="/zperfmon/css/jquery.autocomplete.css" />
function get_config_file($game, $server_cfg)
{
    $game_cfg = load_game_config($game);
    if (isset($game_cfg['cloud_name']) && $game_cfg['cloud_name'] == 'zcloud') {
        return $server_cfg['common_config_zcloud_file'];
    } else {
        return $server_cfg['common_config_file'];
    }
}
function get_report_cfg($report_conf_file)
{
    $config = parse_ini_file($report_conf_file, true);
    return array("db_host" => $config["DB"]["host"], "db_user" => $config["DB"]["user"], "db_pass" => $config["DB"]["password"], "db_name" => $config['DB']["database"]);
}
$report_cfg = get_report_cfg($server_cfg['report_conf_file']);
$xhprofModelObject = new XhProfModel($server_cfg, $report_cfg, false, false);
$result = $xhprofModelObject->generic_execute_get_query("get_instance_class_name", array());
foreach ($result as $value) {
    $db_class[$value['class_id']] = $value['class_name'];
}
/*
 * load config for all the games
*/
$games = $server_cfg['game_list'];
$class = array();
/* 
 * cycle through all games and find all class name by reading hostgroup
*/
foreach ($games as $game) {
    $hostgroup = new HostgroupConfig($server_cfg, $game);
    $class = array_merge($class, $hostgroup->get_class_name());