2012-12-11 Miguel de Dios <miguel.dedios@artica.es>

* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
	extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
	extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
	pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
	"tlayout_data" added the column "id_metaconsole" for to show
	visualmaps in the metaconsole.
	
	* operation/visual_console/render_view.php,
	include/functions_visual_map.php, operation/agentes/ver_agente.php,
	godmode/reporting/visual_console_builder.wizard.php,
	godmode/reporting/visual_console_builder.php,
	godmode/reporting/visual_console_builder.data.php,
	godmode/reporting/visual_console_builder.editor.js,
	godmode/reporting/visual_console_builder.elements.php,
	godmode/reporting/visual_console_builder.editor.php,
	godmode/reporting/map_builder.php,
	include/ajax/visual_console_builder.ajax.php,
	include/ajax/agent.php, include/functions_visual_map_editor.php,
	
	
	* operation/agentes/datos_agente.php,
	include/functions_netflow.php: cleaned source code style.
	
	* include/functions_ui.php: in function 
	"ui_require_javascript_file_enterprise" fixed when need a
	enterprise javascript instead metaconsole enterprise path.
	
	* include/javascript/pandora.js: fixed the function
	"agent_changed_by_multiple_agents" that needs in the metaconsole.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-12-11 15:01:45 +00:00
parent 602928a927
commit 57be759cea
24 changed files with 1535 additions and 483 deletions

View File

@ -1,3 +1,35 @@
2012-12-11 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql: in the table
"tlayout_data" added the column "id_metaconsole" for to show
visualmaps in the metaconsole.
* operation/visual_console/render_view.php,
include/functions_visual_map.php, operation/agentes/ver_agente.php,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/visual_console_builder.data.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
godmode/reporting/visual_console_builder.editor.php,
godmode/reporting/map_builder.php,
include/ajax/visual_console_builder.ajax.php,
include/ajax/agent.php, include/functions_visual_map_editor.php,
* operation/agentes/datos_agente.php,
include/functions_netflow.php: cleaned source code style.
* include/functions_ui.php: in function
"ui_require_javascript_file_enterprise" fixed when need a
enterprise javascript instead metaconsole enterprise path.
* include/javascript/pandora.js: fixed the function
"agent_changed_by_multiple_agents" that needs in the metaconsole.
2012-12-11 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_groups.php: Fixed propagate parameter in

View File

@ -326,6 +326,7 @@ ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT '';
-- Table `tlayout_data
------------------------------------------------------------------------
ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL default 1;
ALTER TABLE tlayout_data ADD COLUMN `id_metaconsole` int(10) NOT NULL default 0;
------------------------------------------------------------------------
-- Table `tnetwork_map`

View File

@ -336,6 +336,7 @@ ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL;
-- Table tlayout_data
-- -----------------------------------------------------
ALTER TABLE tlayout_data ADD (enable_link NUMBER(5, 0) NOT NULL default 1);
ALTER TABLE tlayout_data ADD (id_metaconsole NUMBER(10, 0) default 0 NOT NULL);
-- -----------------------------------------------------
-- Table tagente_modulo

View File

@ -32,7 +32,7 @@ CREATE TABLE "tnetflow_filter" (
"advanced_filter" TEXT NOT NULL,
"filter_args" TEXT NOT NULL,
"aggregate" varchar(60),
"output" varchar(60)
"output" varchar(60)
);
-- -----------------------------------------------------
@ -339,6 +339,7 @@ ALTER TABLE "trecon_task" ALTER COLUMN "field1" TYPE TEXT;
-- Table "tlayout_data"
------------------------------------------------------------------------
ALTER TABLE "tlayout_data" ADD COLUMN "enable_link" SMALLINT NOT NULL default 1;
ALTER TABLE "tlayout_data" ADD COLUMN "id_metaconsole" INTEGER NOT NULL default 0;
------------------------------------------------------------------------
-- Table "tnetwork_component"

View File

@ -15,9 +15,16 @@
global $config;
require_once ('include/functions_visual_map.php');
require_once ($config['homedir'] . '/include/functions_visual_map.php');
ui_print_page_header (__('Reporting').' &raquo; '.__('Visual Console'), "images/reporting.png", false, "map_builder");
$pure = (int)get_parameter('pure', 0);
$hack_metaconsole = '';
if (defined('METACONSOLE'))
$hack_metaconsole = '../../';
if (!defined('METACONSOLE')) {
ui_print_page_header (__('Reporting') .' &raquo; ' . __('Visual Console'), "images/reporting.png", false, "map_builder");
}
$id_layout = (int) get_parameter ('id_layout');
$copy_layout = (bool) get_parameter ('copy_layout');
@ -144,6 +151,7 @@ if (check_acl ($config['id_user'], 0, "IW")) {
}
$table->align = array ();
$table->align[0] = 'left';
$table->align[1] = 'center';
$table->align[2] = 'center';
$table->align[3] = 'center';
@ -164,23 +172,40 @@ else {
$data = array ();
$data[0] = '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;id='.
$map['id'].'&amp;refr=' . $refr . '">'.$map['name'].'</a>';
if (!defined('METACONSOLE')) {
$data[0] = '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;id='.
$map['id'].'&amp;refr=' . $refr . '">'.$map['name'].'</a>';
}
else {
$data[0] = '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure .
'&id_visualmap=' . $map['id'].'&amp;refr=' . $refr . '">'.$map['name'].'</a>';
}
$data[1] = ui_print_group_icon ($map['id_group'], true);
$data[2] = db_get_sql ("SELECT COUNT(*) FROM tlayout_data WHERE id_layout = ".$map['id']);
if (check_acl ($config['id_user'], 0, "IW")) {
$data[3] = '<a href="index.php?sec=reporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
$data[4] = '<a href="index.php?sec=reporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
if (!defined('METACONSOLE')) {
$data[3] = '<a href="index.php?sec=reporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
$data[4] = '<a href="index.php?sec=reporting&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
}
else {
$data[3] = '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
$data[4] = '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
}
}
array_push ($table->data, $data);
}
html_print_table ($table);
}
if (!$maps) {
echo '<div class="action-buttons" style="width: 0px;">';
if (!defined('METACONSOLE'))
echo '<div class="action-buttons" style="width: 0px;">';
else
echo '<div class="action-buttons" style="width: 500px; text-align: right;">';
}
else {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
@ -188,7 +213,11 @@ else {
//Only for IW flag
if (check_acl ($config['id_user'], 0, "IW")) {
echo '<form action="index.php?sec=reporting&amp;sec2=godmode/reporting/visual_console_builder" method="post">';
if (!defined('METACONSOLE'))
echo '<form action="index.php?sec=reporting&amp;sec2=godmode/reporting/visual_console_builder" method="post">';
else {
echo '<form action="index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '" method="post">';
}
html_print_input_hidden ('edit_layout', 1);
html_print_submit_button (__('Create'), '', false, 'class="sub next"');
echo '</form>';

View File

@ -24,26 +24,52 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once ('include/functions_visual_map.php');
require_once ('include/functions_users.php');
require_once ($config['homedir'] . '/include/functions_visual_map.php');
require_once ($config['homedir'] . '/include/functions_users.php');
$pure = get_parameter('pure', 0);
switch ($action) {
case 'new':
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "'>";
html_print_input_hidden('action', 'save');
if (!defined('METACONSOLE')) {
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "'>";
html_print_input_hidden('action', 'save');
}
else {
echo '<form action="index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '" method="post">';
html_print_input_hidden('action2', 'save');
}
break;
case 'update':
case 'save':
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "'>";
html_print_input_hidden('action', 'update');
if (!defined('METACONSOLE')) {
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "'>";
html_print_input_hidden('action', 'update');
}
else {
//echo '<form action="index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '" method="post">';
echo "<form action='index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "&action=visualmap' method='post' >";
html_print_input_hidden('action2', 'update');
}
break;
case 'edit':
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "'>";
html_print_input_hidden('action', 'update');
if (!defined('METACONSOLE')) {
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "'>";
html_print_input_hidden('action', 'update');
}
else {
echo "<form action='index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&tab=" . $activeTab . "&id_visual_console=" . $idVisualConsole . "&action=visualmap' method='post' >";
html_print_input_hidden('action2', 'update');
}
break;
}
$table->width = '98%';
if (defined('METACONSOLE')) {
$table->align[0] = 'left';
$table->align[1] = 'left';
}
$table->data = array ();
$table->data[0][0] = __('Name:'). ui_print_help_tip (__("Use [ or ( as first character, for example '[*] Map name', to render this map name in main menu"), true);
@ -59,8 +85,8 @@ else
$display_all_group = false;
$table->data[1][1] = html_print_select_groups($config['id_user'], "AR", $display_all_group, 'id_group', $idGroup, '', '', '', true);
$backgrounds_list = list_files ('images/console/background/', "jpg", 1, 0);
$backgrounds_list = array_merge ($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
$backgrounds_list = list_files ($config['homedir'] . '/images/console/background/', "jpg", 1, 0);
$backgrounds_list = array_merge ($backgrounds_list, list_files ($config['homedir'] . '/images/console/background/', "png", 1, 0));
$table->data[2][0] = __('Background');
$table->data[2][1] = html_print_select ($backgrounds_list, 'background', $background, '', '', 0, true);
if ($action == 'new') {

View File

@ -57,6 +57,13 @@ function cancel_button_palette_callback() {
}
function update_button_palette_callback() {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
var values = {};
values = readFields();
@ -81,7 +88,7 @@ function update_button_palette_callback() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: url_ajax,
async: false,
timeout: 10000,
success: function (data) {
@ -142,7 +149,7 @@ function update_button_palette_callback() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: url_ajax,
async: false,
timeout: 10000,
success: function (data) {
@ -177,6 +184,8 @@ function update_button_palette_callback() {
}
function readFields() {
metaconsole = $("input[name='metaconsole']").val();
var values = {};
values['label'] = $("input[name=label]").val();
@ -199,7 +208,16 @@ function readFields() {
values['height_module_graph'] = $("input[name=height_module_graph]").val();
values['type_percentile'] = $("input[name=type_percentile]:checked").val();
values['value_show'] = $("input[name=value_show]:checked").val();
values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0;
values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0;
if (metaconsole) {
values['metaconsole'] = 1;
values['id_agent'] = $("#hidden-agent").val();
values['server_name'] = $("#id_server_name").val();
}
else {
values['metaconsole'] = 0;
}
if (typeof(enterprise_readFields) == 'function') {
//The parameter is a object and the function can change or add
@ -365,6 +383,13 @@ function toggle_item_palette() {
}
function loadFieldsFromDB(item) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "load"});
@ -374,7 +399,7 @@ function loadFieldsFromDB(item) {
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -461,6 +486,15 @@ function loadFieldsFromDB(item) {
.attr("checked", "checked");
}
}
if (metaconsole) {
if (key == 'id_agent') {
$("#hidden-agent").val(val);
}
if (key == 'id_server_name') {
$("#id_server_name").val(val);
}
}
});
if (typeof(enterprise_loadFieldsFromDB) == 'function') {
@ -628,6 +662,13 @@ function cleanFields() {
}
function getModuleGraph(id_data) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
@ -635,7 +676,7 @@ function getModuleGraph(id_data) {
parameter.push ({name: "id_element", value: id_data});
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -646,6 +687,9 @@ function getModuleGraph(id_data) {
height = data['height'];
width = data['width'];
period = data['period'];
if (metaconsole) {
id_metaconsole = data['id_metaconsole'];
}
}
});
@ -655,12 +699,15 @@ function getModuleGraph(id_data) {
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_image_sparse"});
parameter.push ({name: "id_agent_module", value: id_agente_modulo});
if (metaconsole) {
parameter.push ({name: "id_metaconsole", value: id_metaconsole});
}
parameter.push ({name: "height", value: height});
parameter.push ({name: "width", value: width});
parameter.push ({name: "period", value: period});
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'text', //The ajax return the data as text.
@ -674,6 +721,13 @@ function getModuleGraph(id_data) {
}
function getModuleValue(id_data, process_simple_value, period) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"});
@ -684,7 +738,7 @@ function getModuleValue(id_data, process_simple_value, period) {
}
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -698,6 +752,15 @@ function getModuleValue(id_data, process_simple_value, period) {
}
function getPercentileBar(id_data, values) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
var url_hack_metaconsole = '';
if (metaconsole) {
url_ajax = "../../ajax.php";
url_hack_metaconsole = '../../';
}
max_percentile = values['max_percentile'];
width_percentile = values['width_percentile'];
@ -709,7 +772,7 @@ function getPercentileBar(id_data, values) {
parameter.push ({name: "value_show", value: values['value_show']});
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -735,7 +798,7 @@ function getPercentileBar(id_data, values) {
parameter.push ({name: "action", value: "get_font"});
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -758,7 +821,7 @@ function getPercentileBar(id_data, values) {
value_text = module_value + " " + unit_text;
}
var img = 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&height=15&' +
var img = url_hack_metaconsole + 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&height=15&' +
'width=' + width_percentile + '&mode=1&progress=' + percentile +
'&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB;
@ -766,6 +829,15 @@ function getPercentileBar(id_data, values) {
}
function getPercentileBubble(id_data, values) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
var url_hack_metaconsole = '';
if (metaconsole) {
url_ajax = "../../ajax.php";
url_hack_metaconsole = '../../';
}
max_percentile = values['max_percentile'];
width_percentile = values['width_percentile'];
@ -777,7 +849,7 @@ function getPercentileBubble(id_data, values) {
parameter.push ({name: "value_show", value: values['value_show']});
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -800,7 +872,7 @@ function getPercentileBubble(id_data, values) {
parameter.push ({name: "action", value: "get_font"});
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -823,7 +895,7 @@ function getPercentileBubble(id_data, values) {
value_text = module_value + " " + unit_text;
}
var img = 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbubble&height=' + width_percentile + '&' +
var img = url_hack_metaconsole + 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbubble&height=' + width_percentile + '&' +
'width=' + width_percentile + '&mode=1&progress=' + percentile +
'&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB;
@ -832,6 +904,13 @@ function getPercentileBubble(id_data, values) {
}
function getImageElement(id_data) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_image"});
@ -841,7 +920,7 @@ function getImageElement(id_data) {
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -855,6 +934,13 @@ function getImageElement(id_data) {
}
function visual_map_get_color_line_status(id) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_color_line"});
@ -864,7 +950,7 @@ function visual_map_get_color_line_status(id) {
jQuery.ajax({
async: false,
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'json',
@ -882,6 +968,12 @@ function createItem(type, values, id_data) {
var imageSize = '';
var item = null;
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
switch (type) {
case 'static_graph':
if ((values['width'] == 0) && (values['height'] == 0)) {
@ -899,9 +991,16 @@ function createItem(type, values, id_data) {
parameter.push ({name: "get_element_status", value: "1"});
parameter.push ({name: "id_element", value: id_data});
if (metaconsole) {
parameter.push ({name: "metaconsole", value: 1});
}
else {
parameter.push ({name: "metaconsole", value: 0});
}
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
url: url_ajax,
data: parameter,
async: false,
timeout: 10000,
@ -919,7 +1018,7 @@ function createItem(type, values, id_data) {
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
url: url_ajax,
data: parameter,
async: false,
timeout: 10000,
@ -1005,7 +1104,7 @@ function createItem(type, values, id_data) {
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
url: url_ajax,
data: parameter,
async: false,
timeout: 10000,
@ -1049,6 +1148,13 @@ function addItemSelectParents(id_data, text) {
}
function insertDB(type, values) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
var id = null;
parameter = Array();
@ -1061,7 +1167,7 @@ function insertDB(type, values) {
});
jQuery.ajax({
url: "ajax.php",
url: url_ajax,
async: false,
data: parameter,
type: "POST",
@ -1083,6 +1189,12 @@ function insertDB(type, values) {
}
function updateDB_visual(type, idElement , values, event, top, left) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
switch (type) {
case 'module_graph':
$("#image_" + idElement).attr("src", getModuleGraph(idElement));
@ -1094,9 +1206,16 @@ function updateDB_visual(type, idElement , values, event, top, left) {
parameter.push ({name: "get_element_status", value: "1"});
parameter.push ({name: "id_element", value: idElement});
if (metaconsole) {
parameter.push ({name: "metaconsole", value: 1});
}
else {
parameter.push ({name: "metaconsole", value: 0});
}
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
url: url_ajax,
data: parameter,
async: false,
timeout: 10000,
@ -1137,7 +1256,7 @@ function updateDB_visual(type, idElement , values, event, top, left) {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: url_ajax,
async: false,
timeout: 10000,
success: function (data) {
@ -1202,6 +1321,13 @@ function updateDB_visual(type, idElement , values, event, top, left) {
}
function updateDB(type, idElement , values, event) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
var top = 0;
var left = 0;
@ -1261,7 +1387,7 @@ function updateDB(type, idElement , values, event) {
}
else {
jQuery.ajax({
url: "ajax.php",
url: url_ajax,
data: parameter,
type: "POST",
dataType: 'text',
@ -1274,6 +1400,13 @@ function updateDB(type, idElement , values, event) {
}
function deleteDB(idElement) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "delete"});
@ -1281,7 +1414,7 @@ function deleteDB(idElement) {
parameter.push ({name: "id_element", value: idElement});
jQuery.ajax({
url: "ajax.php",
url: url_ajax,
async: false,
data: parameter,
type: "POST",
@ -1682,6 +1815,8 @@ function click_button_toolbox(id) {
}
function showPreview(image) {
metaconsole = $("input[name='metaconsole']").val();
switch (toolbuttonActive) {
case 'static_graph':
showPreviewStaticGraph(image);
@ -1693,6 +1828,13 @@ function showPreview(image) {
}
function showPreviewStaticGraph(staticGraph) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
$("#preview").empty();
$("#preview").css('text-align', 'right');
@ -1706,7 +1848,7 @@ function showPreviewStaticGraph(staticGraph) {
jQuery.ajax ({
type: 'POST',
url: action="ajax.php",
url: url_ajax,
data: parameter,
async: false,
dataType: 'json',
@ -1721,6 +1863,13 @@ function showPreviewStaticGraph(staticGraph) {
}
function showPreviewIcon(icon) {
metaconsole = $("input[name='metaconsole']").val();
var url_ajax = "ajax.php";
if (metaconsole) {
url_ajax = "../../ajax.php";
}
$("#preview").empty();
$("#preview").css('text-align', 'left');
@ -1734,7 +1883,7 @@ function showPreviewIcon(icon) {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: url_ajax,
async: false,
timeout: 10000,
success: function (data) {
@ -1745,12 +1894,20 @@ function showPreviewIcon(icon) {
}
function showGrid() {
metaconsole = $("input[name='metaconsole']").val();
var url_hack_metaconsole = '';
if (metaconsole) {
url_hack_metaconsole = '../../';
}
var display = $("#background_grid").css('display');
if (display == 'none') {
$("#background_grid").css('display', '');
$("#background_img").css('opacity', '0.55');
$("#background_img").css('filter', 'alpha(opacity=55)');
$("#background_grid").css('background', 'url("images/console/background/white_boxed.jpg")');
$("#background_grid").css('background',
'url("' + url_hack_metaconsole + 'images/console/background/white_boxed.jpg")');
//Snap to grid all elements.
jQuery.each($(".item"), function(key, value) {

View File

@ -24,8 +24,14 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once ('include/functions_visual_map.php');
require_once ('include/functions_visual_map_editor.php');
$metaconsole_hack = '';
if (defined('METACONSOLE')) {
$metaconsole_hack = '../../';
}
require_once($config['homedir'] . '/include/functions_visual_map.php');
require_once($config['homedir'] . '/include/functions_visual_map_editor.php');
enterprise_include_once('include/functions_visual_map_editor.php');
visual_map_editor_print_toolbox();
@ -39,10 +45,22 @@ $layoutDatas = db_get_all_rows_field_filter ('tlayout_data',
if ($layoutDatas === false)
$layoutDatas = array();
//Set the hidden value for the javascript
if (defined('METACONSOLE')) {
html_print_input_hidden('metaconsole', 1);
}
else {
html_print_input_hidden('metaconsole', 0);
}
visual_map_editor_print_item_palette($visualConsole['id'], $background);
echo '<div id="frame_view" style="width: 100%; height: 500px; overflow: scroll;">';
if (!defined('METACONSOLE')) {
echo '<div id="frame_view" style="width: 100%; height: 500px; overflow: scroll;">';
}
else {
echo '<div id="frame_view" style="width: 700px; height: 500px; overflow: scroll;">';
}
echo '<div id="background" class="" style="
margin: 0px auto;border: 2px black solid; width: ' . $widthBackground . 'px; height: ' . $heightBackground . 'px;">';
echo "<div id='background_grid'
@ -57,14 +75,14 @@ foreach ($layoutDatas as $layoutData) {
$delete_pending_module = db_get_value ("delete_pending", "tagente_modulo", "id_agente_modulo", $layoutData["id_agente_modulo"]);
$disabled_module = db_get_value ("disabled", "tagente_modulo", "id_agente_modulo", $layoutData["id_agente_modulo"]);
if($delete_pending_module == 1 || $disabled_module == 1)
if ($delete_pending_module == 1 || $disabled_module == 1)
continue;
visual_map_print_item($layoutData);
html_print_input_hidden('status_'.$layoutData['id'], visual_map_get_status_element($layoutData));
}
echo "<img style='position: absolute; top: 0px; left: 0px;' id='background_img' src='images/console/background/" . $background . "' width='100%' height='100%' />";
echo "<img style='position: absolute; top: 0px; left: 0px;' id='background_img' src='" . $metaconsole_hack . "images/console/background/" . $background . "' width='100%' height='100%' />";
echo '</div>';
echo '</div>';
@ -72,7 +90,7 @@ echo '</div>';
html_print_input_hidden('background_width', $widthBackground);
html_print_input_hidden('background_height', $heightBackground);
$backgroundSizes = getimagesize('images/console/background/' . $background);
$backgroundSizes = getimagesize($config['homedir'] . '/images/console/background/' . $background);
html_print_input_hidden('background_original_width', $backgroundSizes[0]);
html_print_input_hidden('background_original_height', $backgroundSizes[1]);
@ -88,7 +106,7 @@ ui_require_jquery_file('colorpicker');
ui_require_javascript_file('wz_jsgraphics');
ui_require_javascript_file('pandora_visual_console');
ui_require_javascript_file('visual_console_builder.editor', 'godmode/reporting/');
ui_require_javascript_file_enterprise('functions_visualmap');
ui_require_javascript_file_enterprise('functions_visualmap', true);
// Javascript file for base 64 encoding of label parameter
ui_require_javascript_file ('encode_decode_base64');

View File

@ -24,16 +24,18 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once ('include/functions_visual_map.php');
require_once ($config['homedir'].'/include/functions_visual_map.php');
require_once ($config['homedir'].'/include/functions_agents.php');
enterprise_include_once('include/functions_visual_map.php');
enterprise_include_once('meta/include/functions_agents_meta.php');
enterprise_include_once('meta/include/functions_users_meta.php');
//Arrays for select box.
$backgrounds_list = list_files('images/console/background/', "jpg", 1, 0);
$backgrounds_list = array_merge($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
$backgrounds_list = list_files($config['homedir'] . '/images/console/background/', "jpg", 1, 0);
$backgrounds_list = array_merge($backgrounds_list, list_files ($config['homedir'] . '/images/console/background/', "png", 1, 0));
$images_list = array ();
$all_images = list_files ('images/console/icons/', "png", 1, 0);
$all_images = list_files ($config['homedir'] . '/images/console/icons/', "png", 1, 0);
foreach ($all_images as $image_file) {
if (strpos ($image_file, "_bad"))
continue;
@ -45,7 +47,12 @@ foreach ($all_images as $image_file) {
$images_list[$image_file] = $image_file;
}
$table->width = '100%';
if (!defined('METACONSOLE')) {
$table->width = '100%';
}
else {
$table->width = '780';
}
$table->head = array();
$table->head['icon'] = '';
$table->head[0] = __('Label') . ' / ' . __('Agent');
@ -53,13 +60,22 @@ $table->head[1] = __('Image') . ' / ' . __('Module');
$table->head[2] = __('Width x Height<br>Max value');
$table->head[3] = __('Period') . ' / ' . __('Position');
$table->head[4] = __('Parent') . ' / ' . __('Map linked');
$table->head[5] = __('Action');
$table->head[5] = '<span title="' . __('Action') . '">' .
__('A.') . '</span>';
$table->align[0] = "center";
$table->align[1] = "center";
$table->size = array();
$table->size['icon'] = '1%';
$table->size[0] = '25%';
$table->style = array();
$table->style[1] = 'background-color: #ffffff;';
$table->align = array();
$table->align[0] = "left";
$table->align[1] = "right";
$table->align[2] = "center";
$table->align[3] = "center";
$table->align[4] = "center";
$table->align[4] = "right";
$table->align[5] = "center";
$table->data = array();
@ -67,7 +83,7 @@ $table->data = array();
//Background
$table->data[0]['icon'] = '';
$table->data[0][0] = __('Background');
$table->data[0][1] = html_print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true, false, true, '', false, 'width: 100px;');
$table->data[0][1] = html_print_select($backgrounds_list, 'background', $visualConsole['background'], '', 'None', '', true, false, true, '', false, 'width: 120px;');
$table->data[0][2] = html_print_input_text('width', $visualConsole['width'], '', 3, 5, true) .
'x' .
html_print_input_text('height', $visualConsole['height'], '', 3, 5, true);
@ -143,30 +159,39 @@ foreach ($layoutDatas as $layoutData) {
//Image
if (($layoutData['type'] == STATIC_GRAPH) || ($layoutData['type'] == ICON)) {
$table->data[$i + 1][1] = html_print_select ($images_list, 'image_' . $idLayoutData, $layoutData['image'], '', 'None', '', true);
$table->data[$i + 1][1] = html_print_select ($images_list, 'image_' . $idLayoutData, $layoutData['image'], '', 'None', '', true, false, true, '', false, "width: 120px");
}
else {
$table->data[$i + 1][1] = '';
}
//Width and height
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 3, 5, true) .
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) .
'x' .
html_print_input_text('height_' . $idLayoutData, $layoutData['height'], '', 3, 5, true);
html_print_input_text('height_' . $idLayoutData, $layoutData['height'], '', 2, 5, true);
//Position
$table->data[$i + 1][3] = '(' . html_print_input_text('left_' . $idLayoutData, $layoutData['pos_x'], '', 3, 5, true) .
',' . html_print_input_text('top_' . $idLayoutData, $layoutData['pos_y'], '', 3, 5, true) .
$table->data[$i + 1][3] = '(' . html_print_input_text('left_' . $idLayoutData, $layoutData['pos_x'], '', 2, 5, true) .
',' . html_print_input_text('top_' . $idLayoutData, $layoutData['pos_y'], '', 2, 5, true) .
')';
//Parent
$table->data[$i + 1][4] = html_print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '. $idVisualConsole . ' AND id !=' . $idLayoutData,
'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true);
'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true, false, true, false, 'width: 120px;');
//Delete row button
$table->data[$i + 1][5] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=' .
$activeTab . '&action=delete&id_visual_console=' . $visualConsole["id"] . '&id_element=' . $idLayoutData . '" ' .
'onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;">' . html_print_image('images/cross.png', true) . '</a>';
if (!defined('METACONSOLE')) {
$table->data[$i + 1][5] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=' .
$activeTab . '&action=delete&id_visual_console=' . $visualConsole["id"] . '&id_element=' . $idLayoutData . '" ' .
'onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;">' . html_print_image('images/cross.png', true) . '</a>';
}
else {
$pure = get_parameter('pure', 0);
$table->data[$i + 1][5] = '<a href="index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap' .
'&pure=' . $pure . '&tab=list_elements&action2=delete&id_visual_console=' . $visualConsole["id"] . '&id_element=' . $idLayoutData . '" ' .
'onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;">' . html_print_image('images/cross.png', true) . '</a>';
}
//Second row
@ -187,10 +212,31 @@ foreach ($layoutDatas as $layoutData) {
$params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['size'] = 20;
$params['input_name'] = 'agent_' . $idLayoutData;
$params['value'] = agents_get_name($layoutData['id_agent']);
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'module_' . $idLayoutData;
if (defined('METACONSOLE')) {
$params['javascript_ajax_page'] = '../../ajax.php';
$params['disabled_javascript_on_blur_function'] = true;
$params['print_input_server'] = true;
$params['input_server_id'] =
$params['input_server_name'] = 'id_server_name_' . $idLayoutData;
$params['input_server_value'] =
db_get_value('server_name', 'tmetaconsole_setup', 'id', $layoutData['id_metaconsole']);
$params['metaconsole_enabled'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_' . $idLayoutData;
$params['hidden_input_idagent_value'] = $layoutData['id_agent'];
$params['value'] = agents_meta_get_name($layoutData['id_agent'],
"none", $layoutData['id_metaconsole'], true);
}
else {
$params['value'] = agents_get_name($layoutData['id_agent']);
}
$table->data[$i + 2][0] = ui_print_agent_autocomplete_input($params);
}
else {
@ -211,12 +257,20 @@ foreach ($layoutDatas as $layoutData) {
$cell_content_enterprise = enterprise_visual_map_print_list_element('module', $layoutData);
}
if ($cell_content_enterprise === false) {
$modules = agents_get_modules($layoutData['id_agent']);
if (!defined('METACONSOLE')) {
$modules = agents_get_modules($layoutData['id_agent']);
}
else {
if ($layoutData['id_agent'] != 0) {
$modules = agents_meta_get_modules($layoutData['id_metaconsole'],
$layoutData['id_agent']);
}
}
$modules = io_safe_output($modules);
$table->data[$i + 2][1] = html_print_select($modules,
'module_' . $idLayoutData, $layoutData['id_agente_modulo'], '', '---', 0, true);
'module_' . $idLayoutData, $layoutData['id_agente_modulo'], '', '---', 0, true, false, true, '', false, "width: 120px");
}
else {
$table->data[$i + 2][1] = $cell_content_enterprise;
@ -242,7 +296,7 @@ foreach ($layoutDatas as $layoutData) {
//Map linked
$table->data[$i + 2][4] = html_print_select_from_sql ('SELECT id, name FROM tlayout WHERE id != ' . $idVisualConsole,
'map_linked_' . $idLayoutData, $layoutData['id_layout_linked'], '', 'None', '', true);
'map_linked_' . $idLayoutData, $layoutData['id_layout_linked'], '', 'None', '', true, false, true, '', false, "width: 120px");
$table->data[$i + 2][5] = '';
if ($alternativeStyle) {
@ -258,10 +312,21 @@ foreach ($layoutDatas as $layoutData) {
$i = $i + 3;
}
$pure = get_parameter('pure', 0);
echo '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=' . $activeTab . '&id_visual_console=' . $visualConsole["id"] . '">';
if (!defined('METACONSOLE')) {
echo '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=' . $activeTab . '&id_visual_console=' . $visualConsole["id"] . '">';
}
else {
echo "<form method='post' action='index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=0&tab=list_elements&id_visual_console=" . $idVisualConsole . "'>";
}
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden ('action', 'update');
if (!defined('METACONSOLE')) {
html_print_input_hidden ('action', 'update');
}
else {
html_print_input_hidden ('action2', 'update');
}
html_print_input_hidden ('id_visual_console', $visualConsole["id"]);
html_print_submit_button (__('Update'), 'go', false, 'class="sub next"');
echo '</div>';

View File

@ -24,13 +24,23 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once ('include/functions_visual_map.php');
require_once ($config['homedir'] . '/include/functions_visual_map.php');
require_once($config['homedir'] . "/include/functions_agents.php");
enterprise_include_once('include/functions_visual_map.php');
$action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), 'new');
$pure = (int)get_parameter('pure', 0);
$idVisualConsole = get_parameter('id_visual_console', $idVisualConsole);
if (!defined('METACONSOLE')) {
$action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), 'new');
}
else {
$action = get_parameterBetweenListValues('action2', array('new', 'save', 'edit', 'update', 'delete'), 'new');
}
$activeTab = get_parameterBetweenListValues('tab', array('data', 'list_elements', 'wizard', 'editor'), 'data');
$idVisualConsole = get_parameter('id_visual_console', 0);
//Save/Update data in DB
$statusProcessInDB = null;
@ -63,7 +73,7 @@ switch ($activeTab) {
switch ($action) {
case 'update':
$result = false;
if($values['name'] != "" && $values['background'])
if ($values['name'] != "" && $values['background'])
$result = db_process_sql_update('tlayout', $values, array('id' => $idVisualConsole));
if ($result !== false && $values['background']) {
db_pandora_audit( "Visual console builder", "Update visual console #$idVisualConsole");
@ -77,19 +87,24 @@ switch ($activeTab) {
break;
case 'save':
if($values['name'] != "" && $values['background'])
$idVisualConsole = db_process_sql_insert('tlayout', $values);
else
$idVisualConsole = false;
if ($idVisualConsole !== false) {
db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole");
$action = 'edit';
$statusProcessInDB = array('flag' => true, 'message' => '<h3 class="suc">'.__('Successfully created.').'</h3>');
if (!defined('METACONSOLE')) {
if ($values['name'] != "" && $values['background'])
$idVisualConsole = db_process_sql_insert('tlayout', $values);
else
$idVisualConsole = false;
if ($idVisualConsole !== false) {
db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole");
$action = 'edit';
$statusProcessInDB = array('flag' => true, 'message' => '<h3 class="suc">'.__('Successfully created.').'</h3>');
}
else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
$statusProcessInDB = array('flag' => false, 'message' => '<h3 class="error">'.__('Could not be created.').'</h3>');
}
}
else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
$statusProcessInDB = array('flag' => false, 'message' => '<h3 class="error">'.__('Could not be created.').'</h3>');
}
break;
}
@ -114,17 +129,22 @@ switch ($activeTab) {
$width = get_parameter('width');
$height = get_parameter('height');
if($width == 0 && $height == 0) {
$sizeBackground = getimagesize($config['homedir'] . '/images/console/background/' . $background);
if ($width == 0 && $height == 0) {
$sizeBackground = getimagesize(
$config['homedir'] . '/images/console/background/' . $background);
$width = $sizeBackground[0];
$height = $sizeBackground[1];
}
db_process_sql_update('tlayout', array('background' => $background,
'width' => $width, 'height' => $height), array('id' => $idVisualConsole));
db_process_sql_update('tlayout',
array('background' => $background,
'width' => $width,
'height' => $height),
array('id' => $idVisualConsole));
//Update elements in visual map
$idsElements = db_get_all_rows_filter('tlayout_data', array('id_layout' => $idVisualConsole), array('id'));
$idsElements = db_get_all_rows_filter('tlayout_data',
array('id_layout' => $idVisualConsole), array('id'));
if ($idsElements === false){
$idsElements = array();
@ -149,7 +169,16 @@ switch ($activeTab) {
break;
}
$agentName = get_parameter('agent_' . $id, '');
$values['id_agent'] = agents_get_agent_id($agentName);
if (defined('METACONSOLE')) {
$values['id_metaconsole'] = db_get_value('id',
'tmetaconsole_setup', 'server_name',
get_parameter('id_server_name_' . $id, ''));
$values['id_agent'] =
(int)get_parameter('id_agent_' . $id, 0);
}
else {
$values['id_agent'] = agents_get_agent_id($agentName);
}
$values['id_agente_modulo'] = get_parameter('module_' . $id, 0);
$values['parent_item'] = get_parameter('parent_' . $id, 0);
$values['id_layout_linked'] = get_parameter('map_linked_' . $id, 0);
@ -198,6 +227,7 @@ switch ($activeTab) {
$enable_link = get_parameter ("enable_link", 'enable_link');
// This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent
$item_per_agent = get_parameter ("item_per_agent", 0);
$id_server = (int)get_parameter('servers', 0);
$message = '';
@ -207,61 +237,128 @@ switch ($activeTab) {
foreach ($id_agents as $id_agent_key => $id_agent_id)
$id_agents_result[] = $id_agent_id;
$message .= visual_map_process_wizard_add_agents($id_agents_result,
$image, $idVisualConsole, $range, $width, $height,
$period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link);
$message .= visual_map_process_wizard_add_agents(
$id_agents_result,
$image,
$idVisualConsole,
$range,
$width,
$height,
$period,
$process_value,
$percentileitem_width,
$max_value,
$type_percentile,
$value_show,
$label_type,
$type,
$enable_link,
$id_server);
$statusProcessInDB = array('flag' => true, 'message' => $message);
$statusProcessInDB = array('flag' => true,
'message' => $message);
}
else {
// One item per module
if (empty($name_modules)) {
$statusProcessInDB = array('flag' => true, 'message' => ui_print_error_message (__('No modules selected'), '', true));
$statusProcessInDB = array('flag' => true,
'message' => ui_print_error_message (
__('No modules selected'), '', true));
}
else {
//Any module
if ($name_modules[0] == '0') {
$id_modules = array();
foreach ($id_agents as $id_agent) {
$id_modulo = agents_get_modules($id_agent, array('id_agente_modulo'));
if (empty($id_modulo)) $id_modulo = array();
foreach ($id_modulo as $id) {
$id_modules[] = $id['id_agente_modulo'];
if ($id_server != 0) {
foreach ($name_modules as $serial_data) {
$modules_serial = explode(';', $serial_data);
foreach ($modules_serial as $data_serialized) {
$data = explode('|', $data_serialized);
$id_modules[] = $data[0];
}
}
}
else {
foreach ($id_agents as $id_agent) {
$id_modulo = agents_get_modules($id_agent, array('id_agente_modulo'));
if (empty($id_modulo)) $id_modulo = array();
foreach ($id_modulo as $id) {
$id_modules[] = $id['id_agente_modulo'];
}
}
}
$message .= visual_map_process_wizard_add_modules($id_modules,
$image, $idVisualConsole, $range, $width, $height,
$period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link);
$message .= visual_map_process_wizard_add_modules(
$id_modules,
$image,
$idVisualConsole,
$range,
$width,
$height,
$period,
$process_value,
$percentileitem_width,
$max_value,
$type_percentile,
$value_show,
$label_type,
$type,
$enable_link,
$id_server);
}
else {
$id_modules = array();
foreach ($name_modules as $mod) {
foreach ($id_agents as $ag) {
$id_module = agents_get_modules($ag,
array('id_agente_modulo'),
array('nombre' => $mod));
if (empty($id_module))
continue;
else {
$id_module = reset($id_module);
$id_module = $id_module['id_agente_modulo'];
}
if ($id_server != 0) {
foreach ($name_modules as $serial_data) {
$modules_serial = explode(';', $serial_data);
$id_modules[] = $id_module;
foreach ($modules_serial as $data_serialized) {
$data = explode('|', $data_serialized);
$id_modules[] = $data[0];
}
}
}
else {
foreach ($name_modules as $mod) {
foreach ($id_agents as $ag) {
$id_module = agents_get_modules($ag,
array('id_agente_modulo'),
array('nombre' => $mod));
if (empty($id_module))
continue;
else {
$id_module = reset($id_module);
$id_module = $id_module['id_agente_modulo'];
}
$id_modules[] = $id_module;
}
}
}
$message .= visual_map_process_wizard_add_modules($id_modules,
$image, $idVisualConsole, $range, $width, $height,
$period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link);
$message .= visual_map_process_wizard_add_modules(
$id_modules,
$image,
$idVisualConsole,
$range,
$width,
$height,
$period,
$process_value,
$percentileitem_width,
$max_value,
$type_percentile,
$value_show,
$label_type,
$type,
$enable_link,
$id_server);
}
$statusProcessInDB = array('flag' => true, 'message' => $message);
}
@ -272,9 +369,12 @@ switch ($activeTab) {
break;
case 'editor':
switch ($action) {
case 'new':
case 'update':
case 'edit':
$visualConsole = db_get_row_filter('tlayout', array('id' => $idVisualConsole));
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
$visualConsoleName = $visualConsole['name'];
$action = 'edit';
break;
@ -287,21 +387,30 @@ if (isset($config['vc_refr']) and $config['vc_refr'] != 0)
else
$view_refresh = '60';
if (!defined('METACONSOLE')) {
$url_base = 'index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&action=';
$url_view = 'index.php?sec=reporting&sec2=operation/visual_console/render_view&id=' . $idVisualConsole . '&refr=' . $view_refresh;
}
else {
$url_base = 'index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&action2=';
$url_view = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap=' . $idVisualConsole . '&refr=' . $view_refresh;
}
$buttons = array(
'data' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=data&action=' . $action . '&id_visual_console=' . $idVisualConsole . '">' .
'text' => '<a href="' . $url_base . $action . '&tab=data&id_visual_console=' . $idVisualConsole . '">' .
html_print_image ("images/god9.png", true, array ("title" => __('Data'))) .'</a>'),
'list_elements' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=list_elements&action=' . $action . '&id_visual_console=' . $idVisualConsole . '">' .
'text' => '<a href="' . $url_base . $action . '&tab=list_elements&id_visual_console=' . $idVisualConsole . '">' .
html_print_image ("images/god6.png", true, array ("title" => __('List elements'))) .'</a>'),
'wizard' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=wizard&action=' . $action . '&id_visual_console=' . $idVisualConsole . '">' .
'text' => '<a href="' . $url_base . $action . '&tab=wizard&id_visual_console=' . $idVisualConsole . '">' .
html_print_image ("images/wand.png", true, array ("title" => __('Wizard'))) .'</a>'),
'editor' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=editor&action=' . $action . '&id_visual_console=' . $idVisualConsole . '">' .
'text' => '<a href="' . $url_base . $action . '&tab=editor&id_visual_console=' . $idVisualConsole . '">' .
html_print_image ("images/config.png", true, array ("title" => __('Editor'))) .'</a>'),
'view' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=operation/visual_console/render_view&id=' . $idVisualConsole . '&refr=' . $view_refresh . '">' .
'text' => '<a href="' . $url_view . '">' .
html_print_image ("images/eye.png", true, array ("title" => __('View'))) .'</a>'),);
if ($action == 'new' || $idVisualConsole === false) {
@ -313,7 +422,12 @@ if ($action == 'new' || $idVisualConsole === false) {
$buttons[$activeTab]['active'] = true;
ui_print_page_header(__('Visual console') . " &raquo; " . $visualConsoleName, "images/reporting_edit.png", false, "visual_console_editor_" . $activeTab . "_tab", true, $buttons);
if (!defined('METACONSOLE'))
ui_print_page_header(__('Visual console') . " &raquo; " . $visualConsoleName, "images/reporting_edit.png", false, "visual_console_editor_" . $activeTab . "_tab", true, $buttons);
else {
// Print header
//ui_meta_print_header(__('Visual console') . " &raquo; " . $visualConsoleName, "", $buttons);
}
//The source code for PAINT THE PAGE
if ($statusProcessInDB !== null) {
@ -322,16 +436,16 @@ if ($statusProcessInDB !== null) {
switch ($activeTab) {
case 'wizard':
require_once('godmode/reporting/visual_console_builder.wizard.php');
require_once($config['homedir'] . '/godmode/reporting/visual_console_builder.wizard.php');
break;
case 'data':
require_once('godmode/reporting/visual_console_builder.data.php');
require_once($config['homedir'] . '/godmode/reporting/visual_console_builder.data.php');
break;
case 'list_elements':
require_once('godmode/reporting/visual_console_builder.elements.php');
require_once($config['homedir'] . '/godmode/reporting/visual_console_builder.elements.php');
break;
case 'editor':
require_once('godmode/reporting/visual_console_builder.editor.php');
require_once($config['homedir'] . '/godmode/reporting/visual_console_builder.editor.php');
break;
}
?>

View File

@ -24,11 +24,20 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once ('include/functions_visual_map.php');
require_once ($config['homedir'] . '/include/functions_visual_map.php');
require_once($config['homedir'] . "/include/functions_agents.php");
$table->id = 'wizard_table';
$table->width = '98%';
if (!defined('METACONSOLE')) {
$metaconsole_hack = '';
$table->width = '98%';
}
else {
$metaconsole_hack = '../../';
$table->width = '600';
require_once($config['homedir'] . "/enterprise/meta/include/functions_html_meta.php");
}
$table->style = array ();
$table->style[0] = 'font-weight: bold; vertical-align: text-top;';
@ -40,10 +49,18 @@ $table->size[0] = "20%";
$table->size[1] = "20%";
$table->size[2] = "20%";
$table->size[3] = "20%";
$table->align = array();
$table->align[0] = 'left';
$table->align[1] = 'left';
$table->align[2] = 'left';
$table->align[3] = 'left';
$table->data = array ();
$images_list = array ();
$all_images = list_files ('images/console/icons/', "png", 1, 0);
$all_images = list_files (
$config['homedir'] . '/images/console/icons/', "png", 1, 0);
foreach ($all_images as $image_file) {
if (strpos ($image_file, "_bad"))
continue;
@ -61,29 +78,35 @@ $type_list = array(
MODULE_GRAPH => __('Module graph'),
SIMPLE_VALUE => __('Simple value'));
$table->rowstyle["all_0"] = 'display: none;';
$table->data["all_0"][0] = __('Type');
$table->data["all_0"][1] = html_print_select ($type_list, 'type', '', 'hidden_rows()', '', '', true, false, false);
$table->rowstyle["staticgraph"] = 'display: none;';
$table->data["staticgraph"][0] = __('Image');
$table->data["staticgraph"][1] = html_print_select ($images_list, 'image', '', '', '', '', true);
$table->rowstyle["all_1"] = 'display: none;';
$table->data["all_1"][0] = __('Range between elements (px)');
$table->data["all_1"][1] = html_print_input_text ('range', 50, '', 5, 5, true);
$table->colspan["staticgraph_modulegraph"][1] = "2";
$table->rowstyle["staticgraph_modulegraph"] = 'display: none;';
$table->data["staticgraph_modulegraph"][0] = __('Size (px)');
$table->data["staticgraph_modulegraph"][1] = __('Width').': ' .
html_print_input_text ('width', 0, '', 5, 5, true);
$table->data["staticgraph_modulegraph"][1] .= '&nbsp;&nbsp;&nbsp;' . __('Height').': '.html_print_input_text ('height', 0, '', 5, 5, true);
$table->rowstyle["modulegraph_simplevalue"] = 'display: none;';
$table->data["modulegraph_simplevalue"][0] = __('Period');
$table->data["modulegraph_simplevalue"][1] =
html_print_extended_select_for_time ('period', '', '', '', '', false, true);
$table->rowstyle["simplevalue"] = 'display: none;';
$table->data["simplevalue"][0] = __('Process');
$table->data["simplevalue"][1] = html_print_select (
@ -91,68 +114,96 @@ $table->data["simplevalue"][1] = html_print_select (
PROCESS_VALUE_MAX => __('Max value'),
PROCESS_VALUE_AVG => __('Avg value')), 'process_value', PROCESS_VALUE_AVG, '', __('None'), PROCESS_VALUE_NONE, true);
$table->rowstyle["percentileitem_1"] = 'display: none;';
$table->data["percentileitem_1"][0] = __('Width (px)');
$table->data["percentileitem_1"][1] =
html_print_input_text ('percentileitem_width', 0, '', 5, 5, true);
$table->rowstyle["percentileitem_2"] = 'display: none;';
$table->data["percentileitem_2"][0] = __('Max value');
$table->data["percentileitem_2"][1] =
html_print_input_text ('max_value', 0, '', 5, 5, true);
$table->rowstyle["percentileitem_3"] = 'display: none;';
$table->data["percentileitem_3"][0] = __('Type');
$table->data["percentileitem_3"][1] =
html_print_radio_button_extended('type_percentile', 'percentile', ('Percentile'), 'percentile', false, '', 'style="float: left;"', true) .
html_print_radio_button_extended('type_percentile', 'bubble', ('Bubble'), 'percentile', false, '', 'style="float: left;"', true);
$table->rowstyle["percentileitem_4"] = 'display: none;';
$table->data["percentileitem_4"][0] = __('Value to show');
$table->data["percentileitem_4"][1] = html_print_radio_button_extended('value_show', 'percent', ('Percent'), 'value', false, '', 'style="float: left;"', true) .
html_print_radio_button_extended('value_show', 'value', ('Value'), 'value', false, '', 'style="float: left;"', true);
$table->rowstyle["all_2"] = 'display: none;';
$table->data["all_2"][0] = __('Groups');
$table->data["all_2"][1] = html_print_select_groups(
if (defined('METACONSOLE')) {
$table->rowstyle["all_2"] = 'display: none;';
$table->data["all_2"][0] = __('Servers');
$table->data["all_2"][1] = html_meta_print_select_servers(false,
false, 'servers', '', '', '', 0, true);
}
$table->rowstyle["all_3"] = 'display: none;';
$table->data["all_3"][0] = __('Groups');
$table->data["all_3"][1] = html_print_select_groups(
$config['id_user'], "AR", true, 'groups', '', '', '', 0, true);
$table->rowstyle["all_one_item_per_agent"] = 'display: none';
$table->data["all_one_item_per_agent"][0] = __('One item per agent');
$table->data["all_one_item_per_agent"][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('item_per_agent', 1, '', '', false, 'item_per_agent_change(1)', '', true).'&nbsp;&nbsp;';
$table->data["all_one_item_per_agent"][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('item_per_agent', 0, '', 0, false, 'item_per_agent_change(0)', '', true);
$table->data["all_one_item_per_agent"][1] .= html_print_input_hidden ('item_per_agent_test', 0, true);
$table->rowstyle["all_3"] = 'display: none;';
$table->data["all_3"][0] = __('Agents');
$table->data["all_3"][1] = html_print_select (agents_get_group_agents (0, false, "none", false, true),
$table->rowstyle["all_4"] = 'display: none;';
$table->data["all_4"][0] = __('Agents');
$table->data["all_4"][1] = html_print_select (agents_get_group_agents (0, false, "none", false, true),
'id_agents[]', 0, false, '', '', true, true);
$table->data["all_4"][2] = ' <span style="vertical-align: top;">' . __('Modules') . '</span>';
$table->data["all_4"][3] = html_print_select (array (), 'module[]', 0, false, __('None'), -1, true, true);
$table->data["all_3"][2] = ' <span style="vertical-align: top;">' . __('Modules') . '</span>';
$table->data["all_3"][3] = html_print_select (array (), 'module[]', 0, false, __('None'), -1, true, true);
$table->rowstyle["all_5"] = 'display: none;';
$table->data["all_5"][0] = __('Label');
$table->rowstyle["all_6"] = 'display: none;';
$table->data["all_6"][0] = __('Label');
$label_type = array ('agent_module' => __('Agent - Module'),
'module' => __('Module'),
'agent' => __('Agent'),
'none' => __('None'));
$table->data["all_5"][1] = html_print_select ($label_type, 'label_type', 'agent_module', '', '', '', true);
$table->data["all_6"][1] = html_print_select ($label_type, 'label_type', 'agent_module', '', '', '', true);
$table->data["all_6"][0] = __('Enable link agent');
$table->data["all_6"][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('enable_link', 1, '', 1, false, '', '', true).'&nbsp;&nbsp;';
$table->data["all_6"][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('enable_link', 0, '', 1, false, '', '', true);
echo '<form method="post"
action="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=' . $activeTab . '&id_visual_console=' . $visualConsole["id"] . '"
onsubmit="if (! confirm(\''.__('Are you sure to add many elements\nin visual map?').'\')) return false; else return check_fields();">';
$table->data["all_7"][0] = __('Enable link agent');
$table->data["all_7"][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('enable_link', 1, '', 1, false, '', '', true).'&nbsp;&nbsp;';
$table->data["all_7"][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('enable_link', 0, '', 1, false, '', '', true);
if (defined('METACONSOLE')) {
$pure = get_parameter('pure', 0);
echo '<form method="post"
action="index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&tab=wizard&id_visual_console=' . $visualConsole["id"] . '"
onsubmit="if (! confirm(\''.__('Are you sure to add many elements\nin visual map?').'\')) return false; else return check_fields();">';
}
else {
echo '<form method="post"
action="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=' . $activeTab . '&id_visual_console=' . $visualConsole["id"] . '"
onsubmit="if (! confirm(\''.__('Are you sure to add many elements\nin visual map?').'\')) return false; else return check_fields();">';
}
html_print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden ('action', 'update');
if (defined('METACONSOLE')) {
html_print_input_hidden ('action2', 'update');
}
else {
html_print_input_hidden ('action', 'update');
}
html_print_input_hidden ('id_visual_console', $visualConsole["id"]);
html_print_submit_button (__('Add'), 'go', false, 'class="sub wizard wand"');
echo '</div>';
@ -165,6 +216,16 @@ echo '<span id="loading_text" style="display: none;">' . __('Loading...') . '</s
?>
<script type="text/javascript">
var show_only_enabled_modules = true;
<?php
if (defined('METACONSOLE')) {
echo 'var url_ajax = "../../ajax.php";';
}
else {
echo 'var url_ajax = "ajax.php";';
}
?>
$(document).ready (function () {
hidden_rows();
@ -189,13 +250,19 @@ $(document).ready (function () {
var data_params = {"page": "include/ajax/agent",
"get_agents_group": 1,
"id_group": $("#groups").val(),
"mode": "json"};
<?php
if (defined('METACONSOLE')) {
echo '"id_server": $("#servers").val(),' . "\n";
}
?>
"mode": "json"
};
jQuery.ajax ({
data: data_params,
async: false,
type: 'POST',
url: action="ajax.php",
url: url_ajax,
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -228,8 +295,20 @@ $(document).ready (function () {
$("#id_agents").change ( function() {
if ($("#hidden-item_per_agent_test").val() == 0)
agent_changed_by_multiple_agents();
agent_changed_by_multiple_agents(
<?php
if (defined('METACONSOLE')) {
echo "{'data': {'id_server': 'servers', 'metaconsole': 1, 'homedir': '../../'}}";
}
?>
);
});
<?php
if (defined('METACONSOLE')) {
echo "metaconsole_init();";
}
?>
});
function check_fields() {
@ -297,4 +376,27 @@ function item_per_agent_change(itemPerAgent) {
}
}
function metaconsole_init() {
/*
var count_servers = $("#servers option").length;
var count_groups = $("#groups option").length;
if (count_servers > 1) {
servers = $("#servers option");
value = $(servers[1]).val();
$("#servers option[value=" + value + "]").attr('selected', 'true');
}
if (count_groups > 1) {
groups = $("#groups option");
value = $(groups[1]).val();
$("#groups option[value=" + value + "]").attr('selected', 'true');
}
*/
$("#groups").trigger('change');
}
</script>

View File

@ -32,10 +32,38 @@ $get_agents_group = (bool) get_parameter('get_agents_group', false);
if ($get_agents_group) {
$id_group = (int)get_parameter('id_group', -1);
$mode = (string)get_parameter('mode', 'json');
$id_server = (int)get_parameter('id_server', 0);
$return = array();
if ($id_group != -1) {
$return = agents_get_group_agents($id_group);
if (defined('METACONSOLE')) {
if ($id_server == 0) {
$servers = $servers = db_get_all_rows_sql ("SELECT *
FROM tmetaconsole_setup
WHERE disabled = 0");
}
else {
$servers = db_get_all_rows_sql ("SELECT *
FROM tmetaconsole_setup
WHERE id = " . $id_server . "
AND disabled = 0");
}
foreach ($servers as $server) {
if (metaconsole_load_external_db ($server) != NOERR) {
continue;
}
$return = agents_get_group_agents($id_group);
//Restore db connection
metaconsole_restore_db();
}
}
else {
$return = agents_get_group_agents($id_group);
}
}
switch ($mode) {
@ -212,10 +240,10 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1) && defined('METACONSOL
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "'.$string.'%" OR direccion LIKE "'.$string.'%")';
break;
case "oracle":
$filter[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\') OR UPPER(direccion) LIKE UPPER(\'%'.$string.'%\') OR UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
$filter[] = '(UPPER(nombre) LIKE UPPER(\''.$string.'%\') OR UPPER(direccion) LIKE UPPER(\''.$string.'%\'))';
break;
}

View File

@ -62,6 +62,10 @@ $id_agent_module = get_parameter('id_agent_module', 0);
$process_simple_value = get_parameter('process_simple_value', PROCESS_VALUE_NONE);
$type_percentile = get_parameter('type_percentile', 'percentile');
$value_show = get_parameter('value_show', 'percent');
$metaconsole = get_parameter('metaconsole', 0);
$server_name = get_parameter('server_name', null);
$id_agent = get_parameter('id_agent', null);
$id_metaconsole = get_parameter('id_metaconsole', null);
$get_element_status = get_parameter('get_element_status', 0);
$get_image_path_status = get_parameter('get_image_path_status', 0);
@ -78,10 +82,25 @@ switch ($action) {
case 'get_image_sparse':
//Metaconsole db connection
if (!empty($id_metaconsole)) {
$connection = db_get_row_filter ('tmetaconsole_setup',
$id_metaconsole);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$img = grafico_modulo_sparse($id_agent_module,
$period, false, $width, $height, '', null, false, 1, false, 0, '', 0, 0,
true, true);
//Restore db connection
if (!empty($id_metaconsole)) {
metaconsole_restore_db();
}
preg_match("/src=[\'\"](.*)[\'\"]/", $img, $matches);
$url = $matches[1];
@ -108,12 +127,40 @@ switch ($action) {
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
$type = visual_map_get_simple_value_type($process_simple_value);
//Metaconsole db connection
if ($layoutData['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layoutData['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$returnValue = visual_map_get_simple_value($type,
$layoutData['id_agente_modulo'], $period);
//Restore db connection
if ($layoutData['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
break;
case PERCENTILE_BAR:
case PERCENTILE_BUBBLE:
default:
//Metaconsole db connection
if ($layoutData['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layoutData['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$returnValue = db_get_sql ('SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
@ -142,6 +189,11 @@ switch ($action) {
$unit_text = $unit_text_db;
}
}
//Restore db connection
if ($layoutData['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
break;
}
@ -274,7 +326,18 @@ switch ($action) {
if ($top !== null) {
$values['pos_y'] = $top;
}
if ($agent !== null) {
if (defined('METACONSOLE') && $metaconsole) {
if ($server_name !== null) {
$values['id_metaconsole'] = db_get_value('id',
'tmetaconsole_setup', 'server_name', $server_name);
}
if ($id_agent !== null) {
$values['id_agent'] = $id_agent;
}
}
else if ($agent !== null) {
$id_agent = agents_get_agent_id($agent);
$values['id_agent'] = $id_agent;
}
@ -374,7 +437,26 @@ switch ($action) {
case 'icon':
$elementFields = db_get_row_filter('tlayout_data',
array('id' => $id_element));
$elementFields['agent_name'] = io_safe_output(agents_get_name($elementFields['id_agent']));
//Metaconsole db connection
if ($elementFields['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $elementFields['id_metaconsole']));
$elementFields['id_server_name'] =
$connection['server_name'];
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$elementFields['agent_name'] =
io_safe_output(agents_get_name($elementFields['id_agent']))
. " (" . io_safe_output($connection['server_name']) . ")";
//Make the html of select box of modules about id_agent.
if ($elementFields['id_agent'] != 0) {
$modules = agents_get_modules($elementFields['id_agent'], false, array('disabled' => 0, 'id_agente' => $elementFields['id_agent']));
@ -387,6 +469,12 @@ switch ($action) {
else {
$elementFields['modules_html'] = '<option value="0">' . __('Any') . '</option>';
}
//Restore db connection
if ($elementFields['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
switch ($type) {
case 'percentile_item':
case 'percentile_bar':
@ -449,10 +537,18 @@ switch ($action) {
$values['label'] = $label;
$values['pos_x'] = $left;
$values['pos_y'] = $top;
if ($agent != '')
$values['id_agent'] = agents_get_agent_id($agent);
else
$values['id_agent'] = 0;
if (defined('METACONSOLE') && $metaconsole) {
$values['id_metaconsole'] = db_get_value('id',
'tmetaconsole_setup', 'server_name', $server_name);
$values['id_agent'] = $id_agent;
}
else {
if ($agent != '')
$values['id_agent'] = agents_get_agent_id($agent);
else
$values['id_agent'] = 0;
}
$values['id_agente_modulo'] = $id_module;
$values['id_layout_linked'] = $map_linked;
$values['label_color'] = $label_color;

View File

@ -455,7 +455,7 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $u
$temp_file = tempnam($config['attachment_store'], 'netflow_tmp_');
$command .= ' -t '.date($nfdump_date_format, $last_timestamp).'-'.date($nfdump_date_format, $end_date);
exec("$command > $temp_file");
// Parse data file
// We must parse from $start_date to avoid creating new intervals!
netflow_parse_file ($start_date, $end_date, $interval_length, $temp_file, $values, $aggregate, $unit);

View File

@ -1043,11 +1043,15 @@ function ui_require_javascript_file ($name, $path = 'include/javascript/') {
*
* @return bool True if the file was added. False if the file doesn't exist.
*/
function ui_require_javascript_file_enterprise($name) {
function ui_require_javascript_file_enterprise($name, $disabled_metaconsole = false) {
global $config;
$filename = ENTERPRISE_DIR . '/include/javascript/' .$name.'.js';
$metaconsole_hack = '';
if ($disabled_metaconsole) {
$metaconsole_hack = '../../';
}
$filename = $metaconsole_hack . ENTERPRISE_DIR . '/include/javascript/' .$name.'.js';
if (! isset ($config['js']))
$config['js'] = array ();

View File

@ -123,7 +123,19 @@ function visual_map_print_item($layoutData) {
case PERCENTILE_BAR:
case PERCENTILE_BUBBLE:
$module_value = db_get_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $id_module);
//Metaconsole db connection
if ($layoutData['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layoutData['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$module_value = db_get_sql ('SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = ' . $id_module);
$value_text = false;
if ($layoutData['image'] == 'percent') {
$value_text = false;
@ -139,6 +151,11 @@ function visual_map_print_item($layoutData) {
$value_text .= " " . $unit_text;
}
//Restore db connection
if ($layoutData['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
if ( $max_percentile > 0)
$percentile = format_numeric($module_value / $max_percentile * 100, 0);
else
@ -162,8 +179,24 @@ function visual_map_print_item($layoutData) {
break;
case MODULE_GRAPH:
//Metaconsole db connection
if ($layoutData['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
$layoutData['id_metaconsole']);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
$height, '', null, false, 1, false, 0, '', 0, 0, true, true);
//Restore db connection
if ($layoutData['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
echo '<div id="' . $id . '" class="item module_graph" style="z-index: 1; color: ' . $color . '; text-align: center; position: absolute; display: inline-block; ' . $sizeStyle . ' top: ' . $top . 'px; left: ' . $left . 'px;">';
@ -177,7 +210,24 @@ function visual_map_print_item($layoutData) {
case SIMPLE_VALUE_AVG:
echo '<div id="' . $id . '" class="item simple_value" style="z-index: 1; left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
echo $text;
//Metaconsole db connection
if ($layoutData['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layoutData['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$value = visual_map_get_simple_value($type, $id_module, $period);
//Restore db connection
if ($layoutData['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
echo ' <span id="simplevalue_' . $id . '" style="font-weight:bold;">' . $value . '</span>';
echo '</div>';
break;
@ -401,7 +451,9 @@ function visual_map_process_wizard_add ($id_agents, $image, $id_layout, $range,
*/
function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
$range, $width = 0, $height = 0, $period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link = true) {
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link = true,
$id_server = 0) {
if (empty ($id_modules)) {
$return = ui_print_error_message (__('No modules selected'), '', true);
return $return;
@ -419,8 +471,44 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
$pos_y = $pos_y + $range;
}
if ($id_server != 0) {
$connection = db_get_row_filter('tmetaconsole_setup',
array('id' => $id_server));
if (metaconsole_load_external_db($connection) != NOERR) {
$return = ui_print_error_message(
"Error connecting to " . $server_name, '', true);
return $return;
}
}
$id_agent = modules_get_agentmodule_agent ($id_module);
switch ($label_type) {
case 'agent_module':
default:
$agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false);
$module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_small', false, true, false, '…', false);
$label = $agent_label . " - " . $module_label;
break;
case 'module':
$module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_small', false, true, false, '…', false);
$label = $module_label;
break;
case 'agent':
$agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false);
$label = $agent_label;
break;
case 'none':
$label = '';
break;
}
$label = io_safe_input($label);
//Restore db connection
if ($id_server != 0) {
metaconsole_restore_db();
}
$value_height = $height;
$value_image = $image;
@ -458,27 +546,6 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
break;
}
switch ($label_type) {
case 'agent_module':
default:
$agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false);
$module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_small', false, true, false, '…', false);
$label = $agent_label . " - " . $module_label;
break;
case 'module':
$module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_small', false, true, false, '…', false);
$label = $module_label;
break;
case 'agent':
$agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false);
$label = $agent_label;
break;
case 'none':
$label = '';
break;
}
$label = io_safe_input($label);
$values = array ('type' => $value_type,
'id_layout' => $id_layout,
'pos_x' => $pos_x,
@ -491,7 +558,8 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
'period' => $period,
'height' => $value_height,
'label_color' => '#000000',
'enable_link' => $enable_link);
'enable_link' => $enable_link,
'id_metaconsole' => $id_server);
db_process_sql_insert ('tlayout_data', $values);
@ -517,7 +585,10 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
*/
function visual_map_process_wizard_add_agents ($id_agents, $image, $id_layout,
$range, $width = 0, $height = 0, $period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link = 1) {
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link = 1,
$id_server = 0) {
global $config;
if (empty ($id_agents)) {
$return = ui_print_error_message (__('No agents selected'), '', true);
@ -573,9 +644,23 @@ function visual_map_process_wizard_add_agents ($id_agents, $image, $id_layout,
break;
}
if ($id_server != 0) {
$connection = db_get_row_filter('tmetaconsole_setup',
array('id' => $id_server));
if (metaconsole_load_external_db($connection) != NOERR) {
$return = ui_print_error_message(
"Error connecting to " . $server_name, '', true);
return $return;
}
}
switch ($label_type) {
case 'agent':
$agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false);
$agent_label = ui_print_truncate_text(
agents_get_name($id_agent),
'agent_small', false, true, false, '…', false);
$label = $agent_label;
break;
case 'none':
@ -584,6 +669,11 @@ function visual_map_process_wizard_add_agents ($id_agents, $image, $id_layout,
}
$label = io_safe_input($label);
//Restore db connection
if ($id_server != 0) {
metaconsole_restore_db();
}
$values = array ('type' => $value_type,
'id_layout' => $id_layout,
'pos_x' => $pos_x,
@ -596,7 +686,8 @@ function visual_map_process_wizard_add_agents ($id_agents, $image, $id_layout,
'period' => $period,
'height' => $value_height,
'label_color' => '#000000',
'enable_link' => $enable_link);
'enable_link' => $enable_link,
'id_metaconsole' => $id_server);
db_process_sql_insert ('tlayout_data', $values);
@ -713,6 +804,18 @@ function visual_map_get_status_element($layoutData) {
else {
switch ($layoutData["type"]) {
case STATIC_GRAPH:
if ($layoutData['id_metaconsole'] != 0) {
//Metaconsole db connection
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layoutData['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
//Status for a simple module
if ($layoutData['id_agente_modulo'] != 0) {
$status = modules_get_agentmodule_status ($layoutData['id_agente_modulo']);
@ -728,6 +831,11 @@ function visual_map_get_status_element($layoutData) {
$status = VISUAL_MAP_STATUS_UNKNOW;
$id_agent = 0;
}
if ($layoutData['id_metaconsole'] != 0) {
//Restore db connection
metaconsole_restore_db();
}
break;
default:
@ -755,6 +863,11 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
//TODO: USE THE SAME CODE THAT THE VISUAL MAP EDITOR
global $config;
$metaconsole_hack = '/';
if (defined('METACONSOLE')) {
$metaconsole_hack = '../../';
}
$layout = db_get_row ('tlayout', 'id', $id_layout);
$resizedMap = false;
@ -776,70 +889,88 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
else {
$mapWidth = $layout["width"];
$mapHeight = $layout["height"];
$backgroundImage = '/images/console/background/'.io_safe_input ($layout["background"]);
$backgroundImage = $metaconsole_hack . 'images/console/background/'.io_safe_input ($layout["background"]);
}
if (defined('METACONSOLE')) {
echo "<div style='width: 750px; overflow:auto;'>";
}
echo '<div id="layout_map"
style="margin:0px auto;text-align:center;z-index: 0; position:relative; width:'.$mapWidth.'px; height:'.$mapHeight.'px;">';
style="margin:0px auto;
text-align:center;
z-index: 0;
position:relative;
width:'.$mapWidth.'px;
height:'.$mapHeight.'px;">';
echo "<img src='" . ui_get_full_url($backgroundImage) . "' width='100%' height='100%' />";
$layout_datas = db_get_all_rows_field_filter ('tlayout_data', 'id_layout', $id_layout);
if (empty($layout_datas))
$layout_datas = array();
$lines = array ();
foreach ($layout_datas as $layout_data) {
$enable_link = db_get_value('enable_link', 'tlayout_data', 'id', $layout_data['id']);
switch ($layout_data['type']) {
case STATIC_GRAPH:
case PERCENTILE_BAR:
case MODULE_GRAPH:
case SIMPLE_VALUE:
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
case PERCENTILE_BUBBLE:
// Pending delete and disable modules must be ignored
$delete_pending_module = db_get_value ("delete_pending",
"tagente_modulo", "id_agente_modulo",
$layout_data["id_agente_modulo"]);
$disabled_module = db_get_value ("disabled", "tagente_modulo",
"id_agente_modulo", $layout_data["id_agente_modulo"]);
if ($delete_pending_module == 1 || $disabled_module == 1)
continue;
break;
case SERVICE:
break;
default:
break;
//Check the items are from disabled or pending delete modules
if ($layout_data['id_agente_modulo'] != 0 &&
(($layout_data['type'] != LABEL)
|| ($layout_data['type'] != ICON)
|| ($layout_data['type'] != SERVICE))) {
$delete_pending_module = db_get_value ("delete_pending",
"tagente_modulo", "id_agente_modulo",
$layout_data["id_agente_modulo"]);
$disabled_module = db_get_value ("disabled", "tagente_modulo",
"id_agente_modulo", $layout_data["id_agente_modulo"]);
if ($delete_pending_module == 1 || $disabled_module == 1)
continue;
}
$id_agent = 0;
$layout_data['label'] = io_safe_output($layout_data['label']);
// *************************************************************
// Get parent status (Could be an agent, module, map,
// others doesnt have parent info)
// **************************************************************
// *************************************************************
if ($layout_data["parent_item"] != 0) {
$id_agent_module_parent = db_get_value ("id_agente_modulo", "tlayout_data", "id", $layout_data["parent_item"]);
$layout_data_parent = db_get_row_filter('tlayout_data',
array('id' => $layout_data["parent_item"]));
$status_parent = visual_map_get_status_element($layout_data_parent);
}
else {
$id_agent_module_parent = 0;
$status_parent = 3;
$line['id'] = $layout_data['id'];
$line['node_begin'] = 'layout-data-'.$layout_data["parent_item"];
$line['node_end'] = 'layout-data-'.$layout_data["id"];
switch ($status_parent) {
default:
case VISUAL_MAP_STATUS_UNKNOW:
$line["color"] = "#ccc"; // Gray
break;
case VISUAL_MAP_STATUS_WARNING:
$line["color"] = "#20f6f6"; // Yellow
break;
case VISUAL_MAP_STATUS_NORMAL:
$line["color"] = "#00ff00"; // Green
break;
case VISUAL_MAP_STATUS_CRITICAL_ALERT:
case VISUAL_MAP_STATUS_CRITICAL_BAD:
$line["color"] = "#ff0000"; // Red
break;
}
array_push ($lines, $line);
}
// ****************************************************************
// *************************************************************
// Get STATUS of current object
// ****************************************************************
// *************************************************************
$status = visual_map_get_status_element($layout_data);
@ -883,50 +1014,51 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($resizedMap)
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.((integer)($proportion * $layout_data['pos_x'])).'px; margin-top:'.((integer)($proportion * $layout_data['pos_y'])).'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
else
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
if ($layout_data['id_agente_modulo'] != 0) {
$id_agent = db_get_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']);
}
elseif ($layout_data['id_agent'] != 0) {
$id_agent = $layout_data["id_agent"];
}
else {
$id_agent = 0;
}
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
if ($show_links) {
if (!isset($id_agent)) $id_agent = 0;
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
if ($enable_link) {
if (!empty($layout_data['id_agent']) && empty($layout_data['id_layout_linked'])) {
if ($layout_data['enable_link']) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
$id_service = false;
if (!defined('METACONSOLE')) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter(
'custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
}
if ($id_service != 0) {
if (!empty($id_service)) {
//Link to an service page
echo '<a href="'.$config['homeurl'].'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
if (!defined('METACONSOLE')) {
$url = $config['homeurl'] . 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=' . $layout_data['id_agent'];
}
else {
$url = ui_meta_get_url_console_child(
$layout_data['id_metaconsole'],
"estado", "operation/agentes/ver_agente&amp;id_agente=" . $layout_data['id_agent']);
}
// Link to an agent
echo '<a href="'.$config['homeurl'].'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
echo '<a href="' . $url . '">';
}
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
if (!defined('METACONSOLE')) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
$pure = get_parameter('pure', 0);
echo '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_visualmap=' . $layout_data["id_layout_linked"] . '&refr=0">';
}
}
else {
@ -944,7 +1076,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$img_style["height"] = $layout_data["height"];
}
$img = "images/console/icons/".$layout_data["image"];
$img = "images/console/icons/" . $layout_data["image"];
switch ($status) {
case VISUAL_MAP_STATUS_CRITICAL_BAD:
@ -968,12 +1100,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$borderStyle = '';
if (substr($img,0,1) == '4') {
$img_style['border'] ='2px solid #ffa300;';
$img_style['border'] = '2px solid #ffa300;';
$img = substr_replace($img, '', 0,1);
}
if (is_file($img))
$infoImage = getimagesize($img);
if (is_file($config['homedir'] . '/' . $img))
$infoImage = getimagesize($config['homedir'] . '/' . $img);
if (!empty ($layout_data["width"])) {
if ($resizedMap)
@ -993,7 +1125,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
else
$img_style["height"] = (integer)($proportion * $infoImage[1]);
html_print_image ($img, false, $img_style);
html_print_image ($metaconsole_hack . $img, false, $img_style);
// Print label if valid label_color (only testing for starting with #) otherwise print nothing
if ($layout_data['label_color'][0] == '#') {
@ -1004,11 +1136,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo "</a>";
break;
case PERCENTILE_BAR:
break;
case MODULE_GRAPH:
break;
case LABEL:
$z_index = 4;
if ($resizedMap)
@ -1018,15 +1146,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$endTagA = false;
if ($show_links) {
if (!isset($id_agent)) $id_agent = 0;
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
if ($enable_link) {
// Link to an agent
echo '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
$endTagA = true;
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
if ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
$endTagA = true;
@ -1048,21 +1168,18 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$endTagA = false;
if ($show_links) {
if (!isset($id_agent)) $id_agent = 0;
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
if ($enable_link) {
// Link to an agent
echo '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
$endTagA = true;
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
if ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
if (!defined('METACONSOLE')) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
$pure = get_parameter('pure', 0);
echo '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_visualmap=' . $layout_data["id_layout_linked"] . '&refr=0">';
}
$endTagA = true;
}
elseif (preg_match('/^(http:\/\/)((.)+)$/i', $layout_data['label'])){
elseif (preg_match('/^(http:\/\/)((.)+)$/i', $layout_data['label'])) {
// Link to an URL
echo '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="' . $layout_data['label'] .'">';
$endTagA = true;
@ -1081,8 +1198,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$img = "images/console/icons/".$layout_data["image"] . ".png";
if (is_file($img))
$infoImage = getimagesize($img);
if (is_file($config['homedir'] . '/' . $img))
$infoImage = getimagesize($config['homedir'] . '/' . $img);
if (!empty ($layout_data["width"])) {
if ($resizedMap)
@ -1102,7 +1219,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
else
$img_style["height"] = (integer)($proportion * $infoImage[1]);
html_print_image ($img, false, $img_style);
html_print_image ($metaconsole_hack . $img, false, $img_style);
if ($endTagA) echo "</a>";
@ -1112,7 +1229,28 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
case SIMPLE_VALUE_MAX:
case SIMPLE_VALUE_MIN:
case SIMPLE_VALUE_AVG:
$unit_text = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $layout_data['id_agente_modulo']);
//Metaconsole db connection
if ($layout_data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layout_data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$unit_text = db_get_sql ('SELECT unit
FROM tagente_modulo
WHERE id_agente_modulo = ' . $layout_data['id_agente_modulo']);
//Restore db connection
if ($layout_data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
$unit_text = trim(io_safe_output($unit_text));
if ($resizedMap)
@ -1135,7 +1273,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($id_service != 0) {
if ($enable_link) {
if ($layout_data['enable_link']) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
@ -1143,25 +1281,71 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
if (!defined('METACONSOLE')) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
$pure = get_parameter('pure', 0);
echo '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_visualmap=' . $layout_data["id_layout_linked"] . '&refr=0">';
}
$endTagA = true;
}
}
echo '<strong>'.$layout_data['label']. ' ';
echo '<strong>' . $layout_data['label']. ' ';
//TODO: change interface to add a period parameter, now is set to 1 day
switch ($layout_data['type']) {
case SIMPLE_VALUE:
$value = db_get_value ('datos', 'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']);
//Metaconsole db connection
if ($layout_data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layout_data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$value = db_get_value ('datos',
'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']);
//Restore db connection
if ($layout_data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
$value = format_for_graph($value, 2);
if (!empty($unit_text))
$value .= " " . $unit_text;
echo $value;
break;
case SIMPLE_VALUE_MAX:
$value = reporting_get_agentmodule_data_max ($layout_data['id_agente_modulo'], $layout_data['period'], 0);
//Metaconsole db connection
if ($layout_data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layout_data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$value = reporting_get_agentmodule_data_max(
$layout_data['id_agente_modulo'],
$layout_data['period'], 0);
//Restore db connection
if ($layout_data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
if ($value === false) {
$value = __('Unknown');
}
@ -1173,7 +1357,28 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo $value;
break;
case SIMPLE_VALUE_MIN:
$value = reporting_get_agentmodule_data_min ($layout_data['id_agente_modulo'], $layout_data['period'], 0);
//Metaconsole db connection
if ($layout_data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layout_data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$value = reporting_get_agentmodule_data_min(
$layout_data['id_agente_modulo'],
$layout_data['period'], 0);
//Restore db connection
if ($layout_data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
if ($value === false) {
$value = __('Unknown');
}
@ -1185,7 +1390,29 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo $value;
break;
case SIMPLE_VALUE_AVG:
$value = reporting_get_agentmodule_data_average($layout_data['id_agente_modulo'], $layout_data['period'], 0);
//Metaconsole db connection
if ($layout_data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layout_data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$value = reporting_get_agentmodule_data_average(
$layout_data['id_agente_modulo'],
$layout_data['period'], 0);
//Restore db connection
if ($layout_data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
if ($value === false) {
$value = __('Unknown');
}
@ -1209,7 +1436,32 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.((integer)($proportion *$layout_data['pos_x'])).'px; margin-top:'.((integer)($proportion *$layout_data['pos_y'])).'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
else
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
$valor = db_get_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = '.$layout_data['id_agente_modulo']);
//Metaconsole db connection
if ($layout_data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layout_data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
$valor = db_get_sql ('SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = '.$layout_data['id_agente_modulo']);
$unit_text = db_get_sql ('SELECT unit
FROM tagente_modulo
WHERE id_agente_modulo = ' . $layout_data['id_agente_modulo']);
//Restore db connection
if ($layout_data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
$width = $layout_data['width'];
if ( $layout_data['height'] > 0)
$percentile = $valor / $layout_data['height'] * 100;
@ -1224,10 +1476,10 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo "<br>";
if ($show_links) {
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
if (!empty($layout_data['id_agent']) && empty($layout_data['id_layout_linked'])) {
if ($enable_link) {
if ($layout_data['enable_link']) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
@ -1247,15 +1499,32 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
else {
// Link to an agent
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
if (!defined('METACONSOLE')) {
$url = $config['homeurl'] .
'index.php?' .
'sec=estado&amp;' .
'sec2=operation/agentes/ver_agente&amp;id_agente='.$layout_data['id_agent'];
}
else {
$url = ui_meta_get_url_console_child(
$layout_data['id_metaconsole'],
"estado", 'operation/agentes/ver_agente&amp;id_agente='.$layout_data['id_agent']);
}
echo '<a href="' . $url .'">';
$endTagA = true;
}
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
if (!defined('METACONSOLE')) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
$pure = get_parameter('pure', 0);
echo '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_visualmap=' . $layout_data["id_layout_linked"] . '&refr=0">';
}
$endTagA = true;
}
@ -1271,7 +1540,6 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$value_text = false;
}
elseif ($layout_data['image'] == 'value') {
$unit_text = db_get_sql ('SELECT unit FROM tagente_modulo WHERE id_agente_modulo = ' . $layout_data['id_agente_modulo']);
$unit_text = trim(io_safe_output($unit_text));
$value_text = format_for_graph($valor, 2);
@ -1298,10 +1566,14 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
break;
case MODULE_GRAPH:
if ($resizedMap) {
$layout_data['width'] = ((integer)($proportion * $layout_data['width']));
$layout_data['height'] = ((integer)($proportion * $layout_data['height']));
$layout_data['pos_x'] = ((integer)($proportion * $layout_data['pos_x']));
$layout_data['pos_y'] = ((integer)($proportion * $layout_data['pos_y']));
$layout_data['width'] =
((integer)($proportion * $layout_data['width']));
$layout_data['height'] =
((integer)($proportion * $layout_data['height']));
$layout_data['pos_x'] =
((integer)($proportion * $layout_data['pos_x']));
$layout_data['pos_y'] =
((integer)($proportion * $layout_data['pos_y']));
}
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
@ -1314,7 +1586,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($show_links) {
if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) {
if ($enable_link) {
if ($layout_data['enable_link']) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
@ -1332,12 +1604,41 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$id_service . '&offset=0">';
}
else {
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$layout_data["id_agent"].'&amp;tab=data">';
if (!defined('METACONSOLE')) {
$url = $config['homeurl'] .
'index.php?' .
'sec=estado&amp;'.
'sec2=operation/agentes/ver_agente&amp;id_agente='.$layout_data["id_agent"].'&amp;tab=data';
}
else {
$url = ui_meta_get_url_console_child(
$layout_data['id_metaconsole'],
"estado", 'operation/agentes/ver_agente&amp;id_agente='.$layout_data["id_agent"].'&amp;tab=data');
}
echo '<a href="' . $url . '">';
}
}
}
else {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data['id_layout_linked'].'">';
// Link to a map
if (!defined('METACONSOLE')) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
$pure = get_parameter('pure', 0);
echo '<a href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_visualmap=' . $layout_data["id_layout_linked"] . '&refr=0">';
}
}
}
//Metaconsole db connection
if ($layout_data['id_metaconsole'] != 0) {
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layout_data['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
@ -1347,6 +1648,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
false, $layout_data['width'], $layout_data['height'],
'', null, false, 1, false, 0, '', 0, 0, true, true, $home_url, 2);
//Restore db connection
if ($layout_data['id_metaconsole'] != 0) {
metaconsole_restore_db();
}
echo "</a>";
echo "</div>";
break;
@ -1355,33 +1662,6 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
array($layout_data, $status, $colorStatus, 'operation'));
break;
}
// ****************************************************************
// Lines joining objects
// ****************************************************************
// Get parent relationship - Create line data
if ($layout_data["parent_item"] != "" && $layout_data["parent_item"] != 0) {
$line['id'] = $layout_data['id'];
$line['node_begin'] = 'layout-data-'.$layout_data["parent_item"];
$line['node_end'] = 'layout-data-'.$layout_data["id"];
switch ($status_parent) {
default:
case VISUAL_MAP_STATUS_UNKNOW:
$line["color"] = "#ccc"; // Gray
break;
case VISUAL_MAP_STATUS_WARNING:
$line["color"] = "#20f6f6"; // Yellow
break;
case VISUAL_MAP_STATUS_NORMAL:
$line["color"] = "#00ff00"; // Green
break;
case VISUAL_MAP_STATUS_CRITICAL_ALERT:
case VISUAL_MAP_STATUS_CRITICAL_BAD:
$line["color"] = "#ff0000"; // Red
break;
}
array_push ($lines, $line);
}
}
if ($draw_lines) {
@ -1393,12 +1673,17 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo 'var lines = Array ();'."\n";
foreach ($lines as $line) {
echo 'lines.push (eval ('.json_encode ($line).'));'."\n";
echo 'lines.push (eval (' . json_encode ($line) . '));' . "\n";
}
echo '/* ]]> */</script>';
}
// End main div
echo "</div>";
if (defined('METACONSOLE')) {
echo "</div>";
}
}
/**

View File

@ -22,7 +22,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
global $config;
$images_list = array ();
$all_images = list_files ('images/console/icons/', "png", 1, 0);
$all_images = list_files ($config['homedir'] . '/images/console/icons/', "png", 1, 0);
foreach ($all_images as $image_file) {
if (strpos ($image_file, "_bad"))
continue;
@ -37,8 +38,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
//Arrays for select box.
$backgrounds_list = list_files('images/console/background/', "jpg", 1, 0);
$backgrounds_list = array_merge($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
$backgrounds_list = list_files($config['homedir'] . '/images/console/background/', "jpg", 1, 0);
$backgrounds_list = array_merge($backgrounds_list, list_files ($config['homedir'] . '/images/console/background/', "png", 1, 0));
@ -78,30 +79,30 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['label_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'datos'. 'icon');
$form_items['label_row']['html'] = '<td style="">' . __('Label') .'</td>
<td style="">'. html_print_input_text ('label', '', '', 20, 200, true) .'</td>';
$form_items['label_row']['html'] = '<td align="left" style="">' . __('Label') .'</td>
<td align="left" style="">'. html_print_input_text ('label', '', '', 20, 200, true) .'</td>';
$form_items['image_row'] = array();
$form_items['image_row']['items'] = array('static_graph', 'icon', 'datos');
$form_items['image_row']['html'] = '<td>' . __('Image') . '</td>
<td>'. html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) .'</td>';
$form_items['image_row']['html'] = '<td align="left">' . __('Image') . '</td>
<td align="left">'. html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) .'</td>';
$form_items['enable_link_row'] = array();
$form_items['enable_link_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'datos'. 'icon');
$form_items['enable_link_row']['html'] = '<td style="">' . __('Enable link') .'</td>
<td style="">'. html_print_checkbox('enable_link', '', 'enable_link', true) .'</td>';
$form_items['enable_link_row']['html'] = '<td align="left" style="">' . __('Enable link') .'</td>
<td align="left" style="">'. html_print_checkbox('enable_link', '', 'enable_link', true) .'</td>';
$form_items['preview_row'] = array();
$form_items['preview_row']['items'] = array('static_graph', 'datos icon');
$form_items['preview_row']['html'] = '<td colspan="2" style="text-align: right;"><div id="preview" style="text-align: right;"></div></td>';
$form_items['preview_row']['html'] = '<td align="left" colspan="2" style="text-align: right;"><div id="preview" style="text-align: right;"></div></td>';
$form_items['agent_row'] = array();
$form_items['agent_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos');
$form_items['agent_row']['html'] = '<td>' . __('Agent') . '</td>';
$form_items['agent_row']['html'] = '<td align="left">' . __('Agent') . '</td>';
@ -112,8 +113,19 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$params['size'] = 20;
$params['selectbox_id'] = 'module';
$params['javascript_is_function_select'] = true;
$form_items['agent_row']['html'] .= '<td>' .
ui_print_agent_autocomplete_input($params);
if (defined('METACONSOLE')) {
$params['javascript_ajax_page'] = '../../ajax.php';
$params['disabled_javascript_on_blur_function'] = true;
$params['print_input_server'] = true;
$params['input_server_id'] = 'id_server_name';
$params['input_server_value'] = '';
$params['metaconsole_enabled'] = true;
$params['print_hidden_input_idagent'] = true;
}
$form_items['agent_row']['html'] .= '<td align="left">' .
ui_print_agent_autocomplete_input($params) .
'</td>';
@ -121,13 +133,13 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['module_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'datos');
$form_items['module_row']['html'] = '<td>' . __('Module') . '</td>
<td>'. html_print_select (array(), 'module', '', '', __('Any'), 0, true) . '</td>';
$form_items['module_row']['html'] = '<td align="left">' . __('Module') . '</td>
<td align="left">'. html_print_select (array(), 'module', '', '', __('Any'), 0, true) . '</td>';
$form_items['process_value_row'] = array();
$form_items['process_value_row']['items'] = array('simple_value', 'datos');
$form_items['process_value_row']['html'] = '<td><span>' . __('Process') . '</span></td>
<td>'. html_print_select (
$form_items['process_value_row']['html'] = '<td align="left"><span>' . __('Process') . '</span></td>
<td align="left">'. html_print_select (
array (PROCESS_VALUE_MIN => __('Min value'),
PROCESS_VALUE_MAX => __('Max value'),
PROCESS_VALUE_AVG => __('Avg value')),
@ -135,59 +147,59 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['background_row_1'] = array();
$form_items['background_row_1']['items'] = array('background', 'datos');
$form_items['background_row_1']['html'] = '<td>' . __('Background') . '</td>
<td>' . html_print_select($backgrounds_list, 'background_image', $background, '', 'None', '', true) . '</td>';
$form_items['background_row_1']['html'] = '<td align="left">' . __('Background') . '</td>
<td align="left">' . html_print_select($backgrounds_list, 'background_image', $background, '', 'None', '', true) . '</td>';
$form_items['background_row_2'] = array();
$form_items['background_row_2']['items'] = array('background', 'datos');
$form_items['background_row_2']['html'] = '<td>' . __('Original Size') . '</td>
<td>' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"', true) . '</td>';
$form_items['background_row_2']['html'] = '<td align="left">' . __('Original Size') . '</td>
<td align="left">' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"', true) . '</td>';
$form_items['background_row_3'] = array();
$form_items['background_row_3']['items'] = array('background', 'datos');
$form_items['background_row_3']['html'] = '<td>' . __('Aspect ratio') . '</td>
<td>' . html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"', true) . '</td>';
$form_items['background_row_3']['html'] = '<td align="left">' . __('Aspect ratio') . '</td>
<td align="left">' . html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"', true) . '</td>';
$form_items['background_row_4'] = array();
$form_items['background_row_4']['items'] = array('background', 'datos');
$form_items['background_row_4']['html'] = '<td></td>
<td>' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub"', true) . '</td>';
$form_items['background_row_4']['html'] = '<td align="left"></td>
<td align="left">' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub"', true) . '</td>';
$form_items['percentile_bar_row_1'] = array();
$form_items['percentile_bar_row_1']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_bar_row_1']['html'] = '<td>' . __('Width') . '</td>
<td>' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . '</td>';
$form_items['percentile_bar_row_1']['html'] = '<td align="left">' . __('Width') . '</td>
<td align="left">' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . '</td>';
$form_items['percentile_bar_row_2'] = array();
$form_items['percentile_bar_row_2']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_bar_row_2']['html'] = '<td>' . __('Max value') . '</td>
<td>' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . '</td>';
$form_items['percentile_bar_row_2']['html'] = '<td align="left">' . __('Max value') . '</td>
<td align="left">' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . '</td>';
$form_items['percentile_item_row_3'] = array();
$form_items['percentile_item_row_3']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_item_row_3']['html'] = '<td>' . __('Type') . '</td>
<td>' .
$form_items['percentile_item_row_3']['html'] = '<td align="left">' . __('Type') . '</td>
<td align="left">' .
html_print_radio_button_extended('type_percentile', 'percentile', ('Percentile'), 'percentile', false, '', 'style="float: left;"', true) .
html_print_radio_button_extended('type_percentile', 'bubble', ('Bubble'), 'percentile', false, '', 'style="float: left;"', true) .
'</td>';
$form_items['percentile_item_row_4'] = array();
$form_items['percentile_item_row_4']['items'] = array('percentile_bar', 'percentile_item', 'datos');
$form_items['percentile_item_row_4']['html'] = '<td>' . __('Value to show') . '</td>
<td>' .
$form_items['percentile_item_row_4']['html'] = '<td align="left">' . __('Value to show') . '</td>
<td align="left">' .
html_print_radio_button_extended('value_show', 'percent', ('Percent'), 'value', false, '', 'style="float: left;"', true) .
html_print_radio_button_extended('value_show', 'value', ('Value'), 'value', false, '', 'style="float: left;"', true) .
'</td>';
$form_items['period_row'] = array();
$form_items['period_row']['items'] = array('module_graph', 'simple_value', 'datos');
$form_items['period_row']['html'] = '<td>' . __('Period') . '</td>
<td>' . html_print_extended_select_for_time ('period', '', '', '', '', false, true) . '</td>';
$form_items['period_row']['html'] = '<td align="left">' . __('Period') . '</td>
<td align="left">' . html_print_extended_select_for_time ('period', '', '', '', '', false, true) . '</td>';
$form_items['module_graph_size_row'] = array();
$form_items['module_graph_size_row']['items'] = array('module_graph', 'datos');
$form_items['module_graph_size_row']['html'] = '<td>' . __('Size') . '</td>
<td>' .
$form_items['module_graph_size_row']['html'] = '<td align="left">' . __('Size') . '</td>
<td align="left">' .
html_print_input_text('width_module_graph', 300, '', 3, 5, true) .
' X ' .
html_print_input_text('height_module_graph', 180, '', 3, 5, true) .
@ -200,14 +212,14 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['button_update_row'] = array();
$form_items['button_update_row']['items'] = array('datos');
$form_items['button_update_row']['html'] = '<td colspan="2" style="text-align: right;">' .
$form_items['button_update_row']['html'] = '<td align="left" colspan="2" style="text-align: right;">' .
html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true) .
html_print_button(__('Update'), 'update_button', false, 'update_button_palette_callback();', 'class="sub upd"', true) .
'</td>';
$form_items['button_create_row'] = array();
$form_items['button_create_row']['items'] = array('datos');
$form_items['button_create_row']['html'] = '<td colspan="2" style="text-align: right;">' .
$form_items['button_create_row']['html'] = '<td align="left" colspan="2" style="text-align: right;">' .
html_print_button(__('Cancel'), 'cancel_button', false, 'cancel_button_palette_callback();', 'class="sub cancel"', true) .
html_print_button(__('Create'), 'create_button', false, 'create_button_palette_callback();', 'class="sub wand"', true) .
'</td>';
@ -233,8 +245,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos');
$form_items_advance['position_row']['html'] = '
<td>' . __('Position') . '</td>
<td>(' . html_print_input_text('left', '0', '', 3, 5, true) .
<td align="left">' . __('Position') . '</td>
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) .
' , ' .
html_print_input_text('top', '0', '', 3, 5, true) .
')</td>';
@ -242,11 +254,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['size_row'] = array();
$form_items_advance['size_row']['items'] = array('background',
'static_graph', 'icon datos');
$form_items_advance['size_row']['html'] = '<td>' .
$form_items_advance['size_row']['html'] = '<td align="left">' .
__('Size') . '<a href="#" class="tip">&nbsp;<span>' .
__("For use the original image file size, set 0 width and 0 height.") .
'</span></a>' . '</td>
<td>' . html_print_input_text('width', 0, '', 3, 5, true) .
<td align="left">' . html_print_input_text('width', 0, '', 3, 5, true) .
' X ' .
html_print_input_text('height', 0, '', 3, 5, true) .
'</td>';
@ -257,9 +269,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['parent_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos');
$form_items_advance['parent_row']['html'] = '<td>' .
$form_items_advance['parent_row']['html'] = '<td align="left">' .
__('Parent') . '</td>
<td>' .
<td align="left">' .
html_print_select($parents, 'parent', '', '', __('None'), 0, true) .
'</td>';
@ -267,9 +279,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['map_linked_row']['items'] = array(
'static_graph', 'percentile_bar', 'percentile_item',
'module_graph', 'simple_value', 'icon', 'label', 'datos');
$form_items_advance['map_linked_row']['html'] = '<td>'.
$form_items_advance['map_linked_row']['html'] = '<td align="left">'.
__('Map linked') . '</td>' .
'<td>' . html_print_select_from_sql (
'<td align="left">' . html_print_select_from_sql (
'SELECT id, name
FROM tlayout
WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) .
@ -279,9 +291,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['label_color_row']['items'] = array(
'static_graph', 'percentile_bar', 'percentile_item',
'module_graph', 'simple_value', 'label', 'datos');
$form_items_advance['label_color_row']['html'] = '<td>' .
$form_items_advance['label_color_row']['html'] = '<td align="left">' .
__('Label color') . '</td>
<td>' . html_print_input_text_extended ('label_color', '#000000', 'text-'.'label_color', '', 7, 7, false, '', 'class="label_color"', true) .
<td align="left">' . html_print_input_text_extended ('label_color', '#000000', 'text-'.'label_color', '', 7, 7, false, '', 'class="label_color"', true) .
'</td>';
//Insert and modify before the buttons to create or update.
@ -316,7 +328,7 @@ function visual_map_editor_print_toolbox() {
enterprise_hook("enterprise_visual_map_editor_print_toolbox");
visual_map_print_button_editor('save', __('Save'), 'right', true, 'save_min', true);
visual_map_print_button_editor('save_visualmap', __('Save'), 'right', true, 'save_min', true);
$text_autosave = __('Auto Save') . html_print_checkbox('auto_save', 0, true, true, false, "click_button_toolbox('auto_save');");
visual_map_print_item_toolbox('auto_save', $text_autosave, 'right');
visual_map_print_button_editor('show_grid', __('Show grid'), 'right', true, 'grid_min', true);

View File

@ -142,7 +142,7 @@ function isEmptyObject(obj) {
*/
function agent_changed_by_multiple_agents (event, id_agent, selected) {
// Hack to add custom condition
if($("#hidden-custom_condition").val() != undefined) {
if ($("#hidden-custom_condition").val() != undefined) {
custom_condition = $("#hidden-custom_condition").val();
}
else {
@ -166,7 +166,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
}
var selection_mode = $('#modules_selection_mode').val();
if(selection_mode == undefined) {
if (selection_mode == undefined) {
selection_mode = 'common';
}
@ -181,10 +181,22 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
// Check if homedir was received like a JSON
homedir = '';
if (event.data == null)
if (typeof(event) == 'undefined') {
homedir += '.';
else
homedir = event.data.homedir;
}
else {
if (event.data == null)
homedir += '.';
else
homedir = event.data.homedir;
if (event.data.metaconsole != null) {
id_server = $("#" + event.data.id_server).val();
}
else {
id_server = 0;
}
}
jQuery.post (homedir + '/ajax.php',
{"page": "operation/agentes/ver_agente",
@ -193,7 +205,8 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
"all": find_modules,
"custom_condition": custom_condition,
"selection_mode": selection_mode,
"serialized": serialized
"serialized": serialized,
"id_server": id_server
},
function (data) {
$('#module').empty ();

View File

@ -231,7 +231,7 @@ foreach($columns as $col => $attr) {
foreach ($result as $row) {
$data = array ();
foreach($columns as $col => $attr) {
if ($attr[1] != "modules_format_data")
$data[] = $attr[1] ($row[$attr[0]]);

View File

@ -168,6 +168,12 @@ if (is_ajax ()) {
$custom_condition = get_parameter('custom_condition', '');
$selection_mode = get_parameter('selection_mode', 'common');
$serialized = get_parameter('serialized', '');
$id_server = (int)get_parameter('id_server', 0);
$metaconsole_server_name = null;
if ($id_server != 0) {
$metaconsole_server_name = db_get_value('server_name',
'tmetaconsole_setup', 'id', $id_server);
}
$all = (string)get_parameter('all', 'all');
switch ($all) {
@ -190,10 +196,15 @@ if (is_ajax ()) {
$first_elements = array();
foreach ($idAgents as $idA) {
$row = explode ('|', $idA);
$server_name = $row[0];
$id_agent = $row [1];
if (empty($metaconsole_server_name)) {
$row = explode ('|', $idA);
$server_name = $row[0];
$id_agent = $row [1];
}
else {
$id_agent = $idA;
$server_name = $metaconsole_server_name;
}
// New iteration
$counter++;

View File

@ -13,13 +13,18 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
// Login check
require ('include/functions_visual_map.php');
require ($config['homedir'] . '/include/functions_visual_map.php');
check_login ();
$id_layout = (int) get_parameter ('id');
if (!defined('METACONSOLE'))
$id_layout = (int) get_parameter ('id');
else
$id_layout = (int) get_parameter ('id_visualmap');
$refr = (int) get_parameter ('refr', $config['vc_refr']);
$vc_refr = false;
@ -60,29 +65,50 @@ if (check_acl ($config["id_user"], $id_group, "AW")) {
$hash = md5($config["dbpass"]. $id_layout. $config["id_user"]);
$url = ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"]);
if (!defined('METACONSOLE'))
$url = ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"]);
else
$url = ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"], false, false, false);
$options['public_link']['text'] = '<a href="' . $url . '">'.
html_print_image ("images/camera.png", true, array ("title" => __('Show link to public Visual Console'))).'</a>';
$options['public_link']['active'] = false;
$options['setup']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=editor&action=edit&id_visual_console='.$id_layout.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
if (!defined('METACONSOLE'))
$options['setup']['text'] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=editor&action=edit&id_visual_console='.$id_layout.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
else {
$pure = get_parameter('pure', 0);
$options['setup']['text'] = '<a href="index.php?action2=edit&tab=editor&operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_visual_console='.$id_layout.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
}
$options['setup']['active'] = false;
}
if ($config["pure"] == 0) {
$options['pure']['text'] = '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;id='.$id_layout.'&amp;refr='.$config["refr"].'&amp;pure=1">' . html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode')))
. "</a>";
if (!defined('METACONSOLE')) {
if ($config["pure"] == 0) {
$options['pure']['text'] = '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;id='.$id_layout.'&amp;refr='.$config["refr"].'&amp;pure=1">' . html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode')))
. "</a>";
}
else {
$options['pure']['text'] = '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;id='.$id_layout.'&amp;refr='.$config["refr"].'">'
. html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode')))
. "</a>";
}
$options['pure']['active'] = false;
}
if (!defined('METACONSOLE'))
ui_print_page_header (__("Visual console") . " &raquo; " . $layout_name, "images/reporting.png", false, '', false, $options);
else
//ui_meta_print_header(__('Visual console') . " &raquo; " . $layout_name, "", $options);
//Set the hidden value for the javascript
if (defined('METACONSOLE')) {
html_print_input_hidden('metaconsole', 1);
}
else {
$options['pure']['text'] = '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;id='.$id_layout.'&amp;refr='.$config["refr"].'">'
. html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode')))
. "</a>";
html_print_input_hidden('metaconsole', 0);
}
$options['pure']['active'] = false;
ui_print_page_header (__("Visual console") . " &raquo; " . $layout_name, "images/reporting.png", false, '', false, $options);
visual_map_print_visual_map ($id_layout);
@ -122,9 +148,16 @@ if ($config['pure'] && $config["refr"] != 0) {
echo '<div style="height:30px">&nbsp;</div>';
echo '<form method="post" action="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view">';
if (!defined('METACONSOLE'))
echo '<form method="post" action="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view">';
else
echo '<form method="post" action="index.php?sec=screen&sec2=screens/screens&action=visualmap">';
html_print_input_hidden ('pure', $config["pure"]);
html_print_input_hidden ('id', $id_layout);
if (!defined('METACONSOLE'))
html_print_input_hidden ('id', $id_layout);
else
html_print_input_hidden ('id_visualmap', $id_layout);
html_print_table ($table);
echo '</form>';

View File

@ -927,6 +927,9 @@ CREATE SEQUENCE tsesion_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tsesion_inc BEFORE INSERT ON tsesion REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tsesion_s.nextval INTO :NEW.ID_SESION FROM dual; END tsesion_inc;;
-- ---------------------------------------------------------------------
-- Table "ttipo_modulo"
-- ---------------------------------------------------------------------
CREATE TABLE ttipo_modulo (
id_tipo NUMBER(10, 0) NOT NULL PRIMARY KEY,
nombre VARCHAR2(100) default '',
@ -934,11 +937,12 @@ CREATE TABLE ttipo_modulo (
descripcion VARCHAR2(100) default '',
icon VARCHAR2(100) default NULL
);
CREATE SEQUENCE ttipo_modulo_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER ttipo_modulo_inc BEFORE INSERT ON ttipo_modulo REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT ttipo_modulo_s.nextval INTO :NEW.ID_TIPO FROM dual; END ttipo_modulo_inc;;
-- ---------------------------------------------------------------------
-- Table "ttrap"
-- ---------------------------------------------------------------------
CREATE TABLE ttrap (
id_trap NUMBER(19, 0) NOT NULL PRIMARY KEY,
source VARCHAR2(50) default '',
@ -957,9 +961,7 @@ CREATE TABLE ttrap (
description VARCHAR2(255) default '',
severity NUMBER(10, 0) default 2 NOT NULL
);
CREATE SEQUENCE ttrap_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER ttrap_inc BEFORE INSERT ON ttrap REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT ttrap_s.nextval INTO :NEW.ID_TRAP FROM dual; END ttrap_inc;;
-- -----------------------------------------------------
@ -1009,11 +1011,12 @@ CREATE TABLE tusuario_perfil (
assigned_by VARCHAR2(100) default '',
id_policy NUMBER(10, 0) DEFAULT 0 NOT NULL
);
CREATE SEQUENCE tusuario_perfil_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tusuario_perfil_inc BEFORE INSERT ON tusuario_perfil REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tusuario_perfil_s.nextval INTO :NEW.ID_UP FROM dual; END tusuario_perfil_inc;;
-- ---------------------------------------------------------------------
-- Table "tnews"
-- ---------------------------------------------------------------------
CREATE TABLE tnews (
id_news NUMBER(10, 0) NOT NULL PRIMARY KEY,
author VARCHAR2(255) DEFAULT '',
@ -1021,11 +1024,12 @@ CREATE TABLE tnews (
text CLOB NOT NULL,
timestamp TIMESTAMP default NULL
);
CREATE SEQUENCE tnews_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tnews_inc BEFORE INSERT ON tnews REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tnews_s.nextval INTO :NEW.ID_NEWS FROM dual; END tnews_inc;;
-- ---------------------------------------------------------------------
-- Table "tgraph"
-- ---------------------------------------------------------------------
CREATE TABLE tgraph (
id_graph NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_user VARCHAR2(100) default '',
@ -1040,22 +1044,24 @@ CREATE TABLE tgraph (
id_group NUMBER(19, 0) default 0 NOT NULL,
id_graph_template NUMBER(11, 0) default 0 NOT NULL
);
CREATE SEQUENCE tgraph_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgraph_inc BEFORE INSERT ON tgraph REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgraph_s.nextval INTO :NEW.ID_GRAPH FROM dual; END tgraph_inc;;
-- ---------------------------------------------------------------------
-- Table "tgraph_source"
-- ---------------------------------------------------------------------
CREATE TABLE tgraph_source (
id_gs NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_graph NUMBER(19, 0) default 0 NOT NULL,
id_agent_module NUMBER(19, 0) default 0 NOT NULL,
weight BINARY_DOUBLE default 0
);
CREATE SEQUENCE tgraph_source_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tgraph_source_inc BEFORE INSERT ON tgraph_source REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tgraph_source_s.nextval INTO :NEW.ID_GS FROM dual; END tgraph_source_inc;;
-- ---------------------------------------------------------------------
-- Table "treport"
-- ---------------------------------------------------------------------
CREATE TABLE treport (
id_report NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_user VARCHAR2(100) default '',
@ -1072,9 +1078,7 @@ CREATE TABLE treport (
id_group_edit NUMBER(19, 0) default 0 NOT NULL,
metaconsole NUMBER(5, 0) DEFAULT 0
);
CREATE SEQUENCE treport_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER treport_inc BEFORE INSERT ON treport REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT treport_s.nextval INTO :NEW.ID_REPORT FROM dual; END treport_inc;;
-- -----------------------------------------------------
@ -1170,6 +1174,9 @@ CREATE SEQUENCE treport_custom_sql_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER treport_custom_sql_inc BEFORE INSERT ON treport_custom_sql REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT treport_custom_sql_s.nextval INTO :NEW.ID FROM dual; END treport_custom_sql_inc;;
-- ---------------------------------------------------------------------
-- Table "tlayout"
-- ---------------------------------------------------------------------
CREATE TABLE tlayout (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name varchar(50) NOT NULL,
@ -1179,11 +1186,12 @@ CREATE TABLE tlayout (
height NUMBER(10, 0) default 0 NOT NULL,
width NUMBER(10, 0) default 0 NOT NULL
);
CREATE SEQUENCE tlayout_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tlayout_inc BEFORE INSERT ON tlayout REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tlayout_s.nextval INTO :NEW.ID FROM dual; END tlayout_inc;;
-- ---------------------------------------------------------------------
-- Table "tlayout_data"
-- ---------------------------------------------------------------------
CREATE TABLE tlayout_data (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_layout NUMBER(10, 0) default 0 NOT NULL,
@ -1201,26 +1209,28 @@ CREATE TABLE tlayout_data (
parent_item NUMBER(10, 0) default 0 NOT NULL,
label_color varchar(20) DEFAULT '',
no_link_color NUMBER(5, 0) default 0 NOT NULL,
enable_link NUMBER(5, 0) default 1 NOT NULL
enable_link NUMBER(5, 0) default 1 NOT NULL,
id_metaconsole NUMBER(10, 0) default 0 NOT NULL
);
CREATE SEQUENCE tlayout_data_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tlayout_data_inc BEFORE INSERT ON tlayout_data REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tlayout_data_s.nextval INTO :NEW.ID FROM dual; END tlayout_data_inc;;
-- ---------------------------------------------------------------------
-- Table "tplugin"
-- ---------------------------------------------------------------------
CREATE TABLE tplugin (
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(200) NOT NULL,
description CLOB,
max_timeout NUMBER(10, 0) default 0 NOT NULL,
id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(200) NOT NULL,
description CLOB,
max_timeout NUMBER(10, 0) default 0 NOT NULL,
max_retries NUMBER(10, 0) default 0,
execute VARCHAR2(250) NOT NULL,
net_dst_opt VARCHAR2(50) default '',
net_port_opt VARCHAR2(50) default '',
user_opt VARCHAR2(50) default '',
pass_opt VARCHAR2(50) default '',
plugin_type NUMBER(5, 0) default 0 NOT NULL,
macros CLOB default '',
execute VARCHAR2(250) NOT NULL,
net_dst_opt VARCHAR2(50) default '',
net_port_opt VARCHAR2(50) default '',
user_opt VARCHAR2(50) default '',
pass_opt VARCHAR2(50) default '',
plugin_type NUMBER(5, 0) default 0 NOT NULL,
macros CLOB default '',
parameters CLOB default ''
);

View File

@ -1024,9 +1024,9 @@ CREATE TABLE "tlayout" (
"width" INTEGER NOT NULL default 0
);
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
-- Table "tlayout_data"
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
CREATE TABLE "tlayout_data" (
"id" SERIAL NOT NULL PRIMARY KEY,
"id_layout" INTEGER NOT NULL default 0,
@ -1044,30 +1044,40 @@ CREATE TABLE "tlayout_data" (
"parent_item" INTEGER NOT NULL default 0,
"label_color" varchar(20) DEFAULT '',
"no_link_color" SMALLINT NOT NULL default 0,
"enable_link" SMALLINT NOT NULL default 1
"enable_link" SMALLINT NOT NULL default 1,
"id_metaconsole" INTEGER NOT NULL default 0
);
-- ---------------------------------------------------------------------
-- Table "tplugin"
-- ---------------------------------------------------------------------
CREATE TABLE "tplugin" (
"id" SERIAL NOT NULL PRIMARY KEY,
"name" varchar(200) NOT NULL,
"description" TEXT,
"max_timeout" INTEGER NOT NULL default 0,
"max_retries" INTEGER NOT NULL default 0,
"execute" varchar(250) NOT NULL,
"net_dst_opt" varchar(50) default '',
"net_port_opt" varchar(50) default '',
"user_opt" varchar(50) default '',
"pass_opt" varchar(50) default '',
"plugin_type" SMALLINT NOT NULL default 0,
"macros" TEXT default '',
"parameters" TEXT default ''
"id" SERIAL NOT NULL PRIMARY KEY,
"name" varchar(200) NOT NULL,
"description" TEXT,
"max_timeout" INTEGER NOT NULL default 0,
"max_retries" INTEGER NOT NULL default 0,
"execute" varchar(250) NOT NULL,
"net_dst_opt" varchar(50) default '',
"net_port_opt" varchar(50) default '',
"user_opt" varchar(50) default '',
"pass_opt" varchar(50) default '',
"plugin_type" SMALLINT NOT NULL default 0,
"macros" TEXT default '',
"parameters" TEXT default ''
);
-- ---------------------------------------------------------------------
-- Table "tmodule"
-- ---------------------------------------------------------------------
CREATE TABLE "tmodule" (
"id_module" SERIAL NOT NULL PRIMARY KEY,
"name" varchar(100) NOT NULL default ''
);
-- ---------------------------------------------------------------------
-- Table "tserver_export"
-- ---------------------------------------------------------------------
CREATE TYPE type_tserver_export_connect_mode AS ENUM ('tentacle', 'ssh', 'local');
CREATE TABLE "tserver_export" (
"id" SERIAL NOT NULL PRIMARY KEY,
@ -1086,6 +1096,9 @@ CREATE TABLE "tserver_export" (
"timezone_offset" SMALLINT NOT NULL default 0
);
-- ---------------------------------------------------------------------
-- Table "tserver_export_data"
-- ---------------------------------------------------------------------
-- id_export_server is real pandora fms export server process that manages this server
-- id is the "destination" server to export
CREATE TABLE "tserver_export_data" (
@ -1098,9 +1111,9 @@ CREATE TABLE "tserver_export_data" (
"timestamp" TIMESTAMP without time zone default '1970-01-01 00:00:00'
);
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
-- Table "tplanned_downtime"
-- -----------------------------------------------------
-- ---------------------------------------------------------------------
CREATE TABLE "tplanned_downtime" (
"id" BIGSERIAL NOT NULL PRIMARY KEY,
"name" VARCHAR( 100 ) NOT NULL,

View File

@ -1155,6 +1155,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` (
`label_color` varchar(20) DEFAULT "",
`no_link_color` tinyint(1) UNSIGNED NOT NULL default 0,
`enable_link` tinyint(1) UNSIGNED NOT NULL default 1,
`id_metaconsole` int(10) NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;