mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Added support to show the interface traffic graphs through the metaconsole and improved the ACL
This commit is contained in:
parent
9b9a3797cd
commit
da8570d3b9
@ -46,6 +46,7 @@ class Tree {
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
include_once($config['homedir']."/include/functions_servers.php");
|
include_once($config['homedir']."/include/functions_servers.php");
|
||||||
|
include_once($config['homedir']."/include/functions_modules.php");
|
||||||
|
|
||||||
if (defined("METACONSOLE"))
|
if (defined("METACONSOLE"))
|
||||||
enterprise_include_once("meta/include/functions_ui_meta.php");
|
enterprise_include_once("meta/include/functions_ui_meta.php");
|
||||||
@ -1306,31 +1307,35 @@ class Tree {
|
|||||||
$module['serverTypeHTML'] = servers_show_type($module['server_type']);
|
$module['serverTypeHTML'] = servers_show_type($module['server_type']);
|
||||||
|
|
||||||
// Link to the Module graph
|
// Link to the Module graph
|
||||||
|
$group_id = (int) modules_get_agent_group($module['id']);
|
||||||
|
$module["showGraphs"] = 0;
|
||||||
|
|
||||||
|
// ACL
|
||||||
|
if (!empty($group_id) {
|
||||||
|
$module["showGraphs"] = (int) check_acl($config['id_user'], $group_id, "RR");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($module["showGraphs"]) {
|
||||||
$graphType = return_graphtype($module['id_module_type']);
|
$graphType = return_graphtype($module['id_module_type']);
|
||||||
|
$url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false);
|
||||||
$winHandle = dechex(crc32($module['id'].$module['name']));
|
$winHandle = dechex(crc32($module['id'].$module['name']));
|
||||||
|
|
||||||
if (!defined('METACONSOLE')) {
|
$graph_params = array(
|
||||||
$moduleGraphURL = $config['homeurl'] .
|
"type" => $graphType,
|
||||||
"/operation/agentes/stat_win.php?" .
|
"period" => SECONDS_1DAY,
|
||||||
"type=$graphType&" .
|
"id" => $module['id'],
|
||||||
"period=" . SECONDS_1DAY . "&" .
|
"label" => rawurlencode(urlencode(base64_encode($module['name']))),
|
||||||
"id=" . $module['id'] . "&" .
|
"refresh" => SECONDS_10MINUTES
|
||||||
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
|
);
|
||||||
"refresh=" . SECONDS_10MINUTES;
|
|
||||||
}
|
if (defined('METACONSOLE') && !empty($server)) {
|
||||||
else if (!empty($server)) {
|
// Set the server id
|
||||||
$moduleGraphURL = ui_meta_get_url_console_child(
|
$graph_params["server"] = $module['serverID'];
|
||||||
$server, null, null, null, null,
|
|
||||||
"operation/agentes/stat_win.php?" .
|
|
||||||
"type=$graphType&" .
|
|
||||||
"period=" . SECONDS_1DAY . "&" .
|
|
||||||
"id=" . $module["id"] . "&" .
|
|
||||||
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
|
|
||||||
"refresh=" . SECONDS_10MINUTES . "&" .
|
|
||||||
"avg_only=1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($moduleGraphURL)) {
|
$graph_params_str = http_build_query($graph_params);
|
||||||
|
$moduleGraphURL = "$url?$graph_params_str";
|
||||||
|
|
||||||
$module['moduleGraph'] = array(
|
$module['moduleGraph'] = array(
|
||||||
'url' => $moduleGraphURL,
|
'url' => $moduleGraphURL,
|
||||||
'handle' => $winHandle
|
'handle' => $winHandle
|
||||||
|
@ -2033,36 +2033,42 @@ function events_page_details ($event, $server = "") {
|
|||||||
}
|
}
|
||||||
$table_details->data[] = $data;
|
$table_details->data[] = $data;
|
||||||
|
|
||||||
|
if (check_acl($config['id_user'], $agent['id_grupo'], "RR")) {
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Graph').'</div>';
|
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Graph').'</div>';
|
||||||
$module_module_type = -1;
|
|
||||||
|
$module_type = -1;
|
||||||
if (isset($module["module_type"])) {
|
if (isset($module["module_type"])) {
|
||||||
$module_module_type = $module["module_type"];
|
$module_type = $module["module_type"];
|
||||||
}
|
}
|
||||||
$graph_type = return_graphtype ($module_module_type);
|
$graph_type = return_graphtype ($module_type);
|
||||||
|
$url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false);
|
||||||
|
$handle = dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
|
||||||
|
$win_handle = "day_$handle";
|
||||||
|
|
||||||
$win_handle=dechex(crc32($module["id_agente_modulo"] .
|
$graph_params = array(
|
||||||
$module["nombre"]));
|
"type" => $graph_type,
|
||||||
|
"period" => SECONDS_1DAY,
|
||||||
|
"id" => $module["id_agente_modulo"],
|
||||||
|
"label" => rawurlencode(urlencode(base64_encode($module["nombre"]))),
|
||||||
|
"refresh" => SECONDS_10MINUTES
|
||||||
|
);
|
||||||
|
|
||||||
$module_module_name = '';
|
if (defined('METACONSOLE')) {
|
||||||
if (isset($module["module_name"])) {
|
// Set the server id
|
||||||
$module_module_name = $module["module_name"];
|
$graph_params["server"] = $server["id"];
|
||||||
}
|
}
|
||||||
$link ="winopeng('" . $serverstring .
|
|
||||||
"operation/agentes/stat_win.php?type=" . $graph_type."&" .
|
$graph_params_str = http_build_query($graph_params);
|
||||||
"period=" . SECONDS_1DAY . "&" .
|
|
||||||
"id=" . $module["id_agente_modulo"] . "&" .
|
$link = "winopeng('$url?$graph_params_str','$win_handle')";
|
||||||
"label=" . rawurlencode(
|
|
||||||
urlencode(
|
|
||||||
base64_encode($module_module_name))) . $hashstring . "&" .
|
|
||||||
(!empty($server) ? "avg_only=1&" : "") .
|
|
||||||
"refresh=" . SECONDS_10MINUTES . "','day_".$win_handle."')";
|
|
||||||
|
|
||||||
$data[1] = '<a href="javascript:'.$link.'">';
|
$data[1] = '<a href="javascript:'.$link.'">';
|
||||||
$data[1] .= html_print_image('images/chart_curve.png',true);
|
$data[1] .= html_print_image('images/chart_curve.png',true);
|
||||||
$data[1] .= '</a>';
|
$data[1] .= '</a>';
|
||||||
$table_details->data[] = $data;
|
$table_details->data[] = $data;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = __('Alert details');
|
$data[0] = __('Alert details');
|
||||||
|
@ -356,6 +356,7 @@ TreeController = {
|
|||||||
$content.append($serverTypeImage);
|
$content.append($serverTypeImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof element.showGraphs != 'undefined' && element.showGraphs != 0) {
|
||||||
// Graph pop-up
|
// Graph pop-up
|
||||||
if (typeof element.moduleGraph != 'undefined') {
|
if (typeof element.moduleGraph != 'undefined') {
|
||||||
var $graphImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
|
var $graphImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
|
||||||
@ -398,6 +399,7 @@ TreeController = {
|
|||||||
|
|
||||||
$content.append($dataImage);
|
$content.append($dataImage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Alerts
|
// Alerts
|
||||||
if (typeof element.alertsImageHTML != 'undefined'
|
if (typeof element.alertsImageHTML != 'undefined'
|
||||||
|
@ -1197,11 +1197,11 @@ foreach ($result as $row) {
|
|||||||
|
|
||||||
$data[7] = "";
|
$data[7] = "";
|
||||||
|
|
||||||
if ($row['history_data'] == 1) {
|
if ($row['history_data'] == 1 && check_acl($config['id_user'], $row['id_group'], "RR") {
|
||||||
|
|
||||||
$graph_type = return_graphtype ($row["module_type"]);
|
$graph_type = return_graphtype ($row["module_type"]);
|
||||||
|
|
||||||
$url = "operation/agentes/stat_win.php";
|
$url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false);
|
||||||
$handle = dechex(crc32($row["id_agente_modulo"].$row["module_name"]));
|
$handle = dechex(crc32($row["id_agente_modulo"].$row["module_name"]));
|
||||||
$win_handle = "day_$handle";
|
$win_handle = "day_$handle";
|
||||||
|
|
||||||
@ -1214,8 +1214,6 @@ foreach ($result as $row) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (defined('METACONSOLE') && isset($row["server_id"])) {
|
if (defined('METACONSOLE') && isset($row["server_id"])) {
|
||||||
// Force the search of this url from the pandora_console's root homeurl
|
|
||||||
$url = "../../$url";
|
|
||||||
// Set the server id
|
// Set the server id
|
||||||
$graph_params["server"] = $row["server_id"];
|
$graph_params["server"] = $row["server_id"];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user