New feature: Graphic grouping

This commit is contained in:
Daniel Maya 2017-05-23 17:13:47 +02:00
parent 6f6eac640b
commit e243067c4b
12 changed files with 1411 additions and 6 deletions

View File

@ -1310,3 +1310,41 @@ DROP PROCEDURE addcol;
-- Table `tconfig`
-- ---------------------------------------------------------------------
UPDATE `tconfig` SET `value` = 'login_logo_v7.png' where `token`='custom_logo_login';
-- ---------------------------------------------------------------------
-- Table `tcontainer`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tcontainer` (
`id_container` mediumint(4) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`parent` mediumint(4) unsigned NOT NULL default 0,
`disabled` tinyint(3) unsigned NOT NULL default 0,
`id_group` mediumint(8) unsigned NULL default 0,
`description` TEXT NOT NULL,
PRIMARY KEY (`id_container`),
KEY `parent_index` (`parent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tcontainer` SET `name` = 'Default graph container';
-- ---------------------------------------------------------------------
-- Table `tcontainer_item`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tcontainer_item` (
`id_ci` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_container` mediumint(4) unsigned NOT NULL default 0,
`type` varchar(30) default 'simple_graph',
`id_agent` int(10) unsigned NOT NULL default 0,
`id_agent_module` bigint(14) unsigned NULL default NULL,
`time_lapse` int(11) NOT NULL default 0,
`id_graph` INTEGER UNSIGNED default 0,
`only_average` tinyint (1) unsigned default 0 not null,
`id_group` INT (10) unsigned NOT NULL DEFAULT 0,
`id_module_group` INT (10) unsigned NOT NULL DEFAULT 0,
`agent` varchar(100) NOT NULL default '',
`module` varchar(100) NOT NULL default '',
`id_tag` integer(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id_ci`),
FOREIGN KEY (`id_container`) REFERENCES tcontainer(`id_container`)
ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,617 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global variables
global $config;
// Check user credentials
check_login ();
if (! check_acl ($config['id_user'], 0, "RW")) {
db_pandora_audit("ACL Violation",
"Trying to access Inventory Module Management");
require ("general/noaccess.php");
return;
}
require_once ('include/functions_container.php');
require_once ($config['homedir'] . '/include/functions_custom_graphs.php');
$id_container = get_parameter('id',0);
$offset = (int) get_parameter ('offset',0);
if (is_ajax()){
$add_single = (bool) get_parameter('add_single',0);
$add_custom = (bool) get_parameter('add_custom',0);
$add_dynamic = (bool) get_parameter('add_dynamic',0);
$id_container2 = get_parameter('id_container',0);
if($add_single){
$id_agent = get_parameter('id_agent');
$id_agent_module = get_parameter('id_agent_module');
$time_lapse = get_parameter('time_lapse');
$only_avg = (int) get_parameter('only_avg');
$values = array(
'id_container' => $id_container2,
'type' => "simple_graph",
'id_agent' => $id_agent,
'id_agent_module' => $id_agent_module,
'time_lapse' => $time_lapse,
'only_average' => $only_avg);
$id_item = db_process_sql_insert('tcontainer_item', $values);
return;
}
if($add_custom){
$time_lapse = get_parameter('time_lapse');
$id_custom = get_parameter('id_custom');
$values = array(
'id_container' => $id_container2,
'type' => "custom_graph",
'time_lapse' => $time_lapse,
'id_graph' => $id_custom);
$id_item = db_process_sql_insert('tcontainer_item', $values);
return;
}
if($add_dynamic) {
$time_lapse = get_parameter('time_lapse');
$group = get_parameter('group',0);
$module_group= get_parameter('module_group',0);
$agent_alias = get_parameter('agent_alias','');
$module_name = get_parameter('module_name','');
$tag = get_parameter('tag',0);
$values = array(
'id_container' => $id_container2,
'type' => "dynamic_graph",
'time_lapse' => $time_lapse,
'id_group' => $group,
'id_module_group' => $module_group,
'agent' => $agent_alias,
'module' => $module_name,
'id_tag' => $tag);
$id_item = db_process_sql_insert('tcontainer_item', $values);
return;
}
}
$add_container = (bool) get_parameter ('add_container',0);
$edit_container = (bool) get_parameter ('edit_container',0);
$update_container = (bool) get_parameter ('update_container',0);
$delete_item = (bool) get_parameter ('delete_item',0);
if ($edit_container) {
$name = io_safe_input(get_parameter ('name',''));
if (!empty($name)){
$id_parent = get_parameter ('id_parent',0);
$description = io_safe_input(get_parameter ('description',''));
$id_group = get_parameter ('container_id_group',0);
}else{
$tcontainer = db_get_row_sql("SELECT * FROM tcontainer WHERE id_container = " . $id_container);
$name = $tcontainer['name'];
$id_parent = $tcontainer['parent'];
$description = $tcontainer['description'];
$id_group = $tcontainer['id_group'];
}
}
if($add_container){
$values = array(
'name' => $name,
'description' => $description,
'parent' => $id_parent,
'id_group' => $id_group);
$id_container = db_process_sql_insert('tcontainer', $values);
}
if($update_container){
if($id_container === $id_parent){
$success = false;
} else {
$values = array(
'name' => $name,
'description' => $description,
'parent' => $id_parent,
'id_group' => $id_group);
$success = db_process_sql_update('tcontainer', $values,array('id_container' => $id_container));
}
}
if($delete_item){
$id_item = get_parameter('id_item',0);
$success = db_process_sql_delete('tcontainer_item', array('id_ci' => $id_item));
}
$buttons['graph_container'] = array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">' .
html_print_image("images/graph-container.png", true, array ("title" => __('Graph container'))) . '</a>');
// Header
ui_print_page_header (__('Create container'), "", false, "", false, $buttons);
if($add_container){
ui_print_result_message($id_container, __('Container stored successfully'), __('There was a problem storing container'));
}
if($update_container){
ui_print_result_message($success, __("Update the container"), __("Bad update the container"));
}
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
if($edit_container){
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&update_container=1&id=" . $id_container . "'>";
} else {
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&add_container=1'>";
}
echo "<tr>";
echo "<td class='datos' style='width: 12%;'><b>".__('Name')."</b></td>";
if($id_container === '1'){
echo "<td class='datos' style='width: 27%;'><input type='text' name='name' size='30' disabled='1'";
} else {
echo "<td class='datos' style='width: 27%;'><input type='text' name='name' size='30' ";
}
if ($edit_container) {
echo "value='" . io_safe_output($name) . "'";
}
echo "></td>";
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$return_all_groups = true;
else
$return_all_groups = false;
echo "<td style='width: 12%;'><b>".__('Group')."</b></td><td>";
if($id_container === '1'){
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true,false,true,'',true);
} else {
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true,false,true,'',false);
}
echo "</td></tr>";
echo "<tr>";
echo "<td class='datos2'><b>".__('Description')."</b></td>";
if($id_container === '1'){
echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=95 rows=2 disabled>";
} else {
echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=95 rows=2>";
}
if ($edit_container) {
echo io_safe_output($description);
}
echo "</textarea>";
echo "</td></tr>";
$container = folder_get_folders();
$tree = folder_get_folders_tree_recursive($container);
$containers_tree = folder_flatten_tree_folders($tree,0);
$containers_tree = folder_get_select($containers_tree);
unset($containers_tree[$id_container]);
echo "<tr>";
echo "<td class='datos2'><b>".__("Parent container")."</b></td>";
if($id_container === '1'){
echo "<td class='datos2'>" . html_print_select ($containers_tree, "id_parent", $id_parent,
'', __('none'), 0, true,'',false,'w130',true,'width: 195px','');
} else {
echo "<td class='datos2'>" . html_print_select ($containers_tree, "id_parent", $id_parent,
'', __('none'), 0, true,'',false,'w130','','width: 195px','');
}
echo "</td></tr>";
echo "</table>";
if ($edit_container) {
if($id_container !== '1'){
echo "<div style='width:100%'><input style='float:right;' type=submit name='store' disbaled class='sub upd' value='".__('Update')."'></div>";
}
}
else {
echo "<div style='width:100%'><input style='float:right;' type=submit name='store' class='sub next' value='".__('Create')."'></div>";
}
echo "</form>";
echo "</br>";
echo "</br>";
echo "</br>";
if($edit_container){
$period = SECONDS_15DAYS;
$periods = array ();
$periods[-1] = __('custom');
$periods[SECONDS_1HOUR] = __('1 hour');
$periods[SECONDS_2HOUR] = sprintf(__('%s hours'), '2 ');
$periods[SECONDS_6HOURS] = sprintf(__('%s hours'), '6 ');
$periods[SECONDS_12HOURS] = sprintf(__('%s hours'), '12 ');
$periods[SECONDS_1DAY] = __('1 day');
$periods[SECONDS_2DAY] = sprintf(__('%s days'), '2 ');
$periods[SECONDS_5DAY] = sprintf(__('%s days'), '5 ');
$periods[SECONDS_1WEEK] = __('1 week');
$periods[SECONDS_15DAYS] = __('15 days');
$periods[SECONDS_1MONTH] = __('1 month');
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
$single_table .= __('Time lapse');
$single_table .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '),true);
$single_table .= "</td>";
$single_table .= "<td>";
$single_table .= html_print_extended_select_for_time('period_single', $period,
'', '', '0', 10, true,false,true,'',false,$periods);
$single_table .= "</td>";
$single_table .= "</tr>";
$single_table .= "<tr id='row_agent' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
$single_table .= __('Agent');
$single_table .= "</td>";
$single_table .= "<td>";
$params = array();
$params['show_helptip'] = false;
$params['input_name'] = 'agent';
$params['value'] = '';
$params['return'] = true;
$params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module';
$params['add_none_module'] = true;
$params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-id_agent';
$single_table .= ui_print_agent_autocomplete_input($params);
$single_table .= "</td>";
$single_table .= "</tr>";
$single_table .= "<tr id='row_module' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
$single_table .= __('Module');
$single_table .= "</td>";
$single_table .= "<td>";
if ($idAgent) {
$single_table .= html_print_select_from_sql($sql_modules, 'id_agent_module', $idAgentModule, '', '', '0',true);
} else {
$single_table .= "<select style='max-width: 180px' id='id_agent_module' name='id_agent_module' disabled='disabled'>";
$single_table .= "<option value='0'>";
$single_table .= __('Select an Agent first');
$single_table .= "</option>";
$single_table .= "</select>";
}
$single_table .= "</td>";
$single_table .= "</tr>";
$single_table .= "<tr id='row_only_avg' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;'>";
$single_table .= __('Only average');
$single_table .= "</td>";
$single_table .= "<td>";
$single_table .= html_print_checkbox('only_avg', 1, true,true);
$single_table .= "</td>";
$single_table .= "</tr>";
$single_table .= "<tr>";
$single_table .= "<td >";
$single_table .= "</td>";
$single_table .= "<td style='float:right;'>";
$single_table .= "<input style='float:right;' type=submit name='add_single' class='sub add' value='".__('Add item')."'>";
$single_table .= "</td>";
$single_table .= "</tr>";
$single_table .= "</table>";
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo "<tr>";
echo "<td>";
echo ui_toggle($single_table,'Simple module graph', '', true, true);
echo "</td>";
echo "</tr>";
echo "</table>";
$table = new stdClass();
$table->id = 'custom_graph_table';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->class = 'dat';
$table->styleTable = 'font-weight: bold;';
$table->style[0] = 'width: 12%';
$table->data = array();
$data = array();
$data[0] = __('Time lapse');
$data[0] .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '),true);
$data[1] = html_print_extended_select_for_time('period_custom', $period,'', '', '0', 10, true,false,true,'',false,$periods);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = __('Custom graph');
$list_custom_graphs = custom_graphs_get_user ($config['id_user'], false, true, "RR");
$graphs = array();
foreach ($list_custom_graphs as $custom_graph) {
$graphs[$custom_graph['id_graph']] = $custom_graph['name'];
}
$data[1] = html_print_select($graphs, 'id_custom_graph',$idCustomGraph, '', __('None'), 0,true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = "";
$data[1] = "<input style='float:right;' type=submit name='add_custom' class='sub add' value='".__('Add item')."'>";
$table->data[] = $data;
$table->rowclass[] = '';
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo "<tr>";
echo "<td>";
echo ui_toggle(html_print_table($table, true),'Custom graph', '', true, true);
echo "</td>";
echo "</tr>";
echo "</table>";
unset($table);
$table = new stdClass();
$table->id = 'dynamic_rules_table';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->class = 'dat';
$table->styleTable = 'font-weight: bold;';
$table->style[0] = 'width: 12%';
$table->data = array();
$data = array();
$data[0] = __('Time lapse');
$data[0] .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '),true);
$data[1] = html_print_extended_select_for_time('period_dynamic', $period,'', '', '0', 10, true,false,true,'',false,$periods);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = __('Group');
$data[1] = html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = __('Module group');
$data[1] = html_print_select_from_sql(
"SELECT * FROM tmodule_group ORDER BY name",
'combo_modulegroup', $modulegroup, '',__('All'),false,true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = __('Agent');
$data[1] = html_print_input_text ('text_agent', $textAgent, '', 30, 100, true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = __('Module');
$data[1] = html_print_input_text ('text_agent_module', $textModule, '', 30, 100, true);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = __('Tag');
$select_tags = tags_search_tag (false, false, true);
$data[1] = html_print_select ($select_tags, 'tag',
$tag, '', __('Any'), 0, true, false, false);
$table->data[] = $data;
$table->rowclass[] = '';
$data = array();
$data[0] = "";
$data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>";
$table->data[] = $data;
$table->rowclass[] = '';
echo "<table width='100%' cellpadding=4 cellspacing=4 class='databox filters'>";
echo "<tr>";
echo "<td>";
echo ui_toggle(html_print_table($table, true),'Dynamic rules for simple module graph', '', true, true);
echo "</td>";
echo "</tr>";
echo "</table>";
$total_item = db_get_all_rows_sql("SELECT count(*) FROM tcontainer_item WHERE id_container = " . $id_container);
$result_item = db_get_all_rows_sql("SELECT * FROM tcontainer_item WHERE id_container = " . $id_container . " LIMIT 10 OFFSET ". $offset);
if(!$result_item){
echo "<div class='nf'>".__('There are no defined item container')."</div>";
} else {
ui_pagination ($total_item[0]['count(*)'],false,$offset,10);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->id = 'item_table';
$table->align = array ();
$table->head = array ();
$table->head[0] = __('Agent/Module');
$table->head[1] = __('Custom graph');
$table->head[2] = __('Group');
$table->head[3] = __('M.Group');
$table->head[4] = __('Agent');
$table->head[5] = __('Module');
$table->head[6] = __('Tag');
$table->head[7] = __('Delete');
$table->data = array ();
foreach ($result_item as $item) {
$data = array ();
switch ($item['type']) {
case 'simple_graph':
$agent_alias = ui_print_truncate_text(agents_get_alias($item['id_agent'],20,false));
$module_name = ui_print_truncate_text(modules_get_agentmodule_name($item['id_agent_module']),20,false);
$module_name =
$data[0] = $agent_alias . " / " .$module_name;
$data[1] = '';
$data[2] = '';
$data[3] = '';
$data[4] = '';
$data[5] = '';
$data[6] = '';
break;
case 'custom_graph':
$data[0] = '';
$name = db_get_value_filter('name','tgraph',array('id_graph' => $item['id_graph']));
$data[1] = ui_print_truncate_text(io_safe_output($name),35,false);
$data[2] = '';
$data[3] = '';
$data[4] = '';
$data[5] = '';
$data[6] = '';
break;
case 'dynamic_graph':
$data[0] = '';
$data[1] = '';
$data[2] = ui_print_group_icon($item['id_group'],true);
if ($item['id_module_group'] === '0') {
$data[3] = 'All';
} else {
$data[3] = io_safe_output(db_get_value_filter('name','tmodule_group',array('id_mg' => $item['id_module_group'])));
}
$data[4] = io_safe_output($item['agent']);
$data[5] = io_safe_output($item['module']);
if ($item['id_tag'] === '0') {
$data[6] = 'Any';
} else {
$data[6] = io_safe_output(db_get_value_filter('name','ttag',array('id_tag' => $item['id_tag'])));
}
break;
}
$data[7] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&delete_item=1&id_item='
.$item['id_ci'].'&id='.$id_container.'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>';
array_push ($table->data, $data);
}
html_print_table ($table);
}
}
echo html_print_input_hidden('id_agent', 0);
?>
<script type="text/javascript">
$(document).ready (function () {
$("input[name=add_single]").click (function () {
var id_agent_module = $("#id_agent_module").val();
if(id_agent_module !== '0'){
var id_agent = $("#hidden-id_agent").attr('value');
var time_lapse = $("#hidden-period_single").attr('value');
var only_avg = $("#checkbox-only_avg").prop("checked");
var id_container = <?php echo $id_container; ?>;
jQuery.post ("ajax.php",
{"page" : "godmode/reporting/create_container",
"add_single" : 1,
"id_agent" : id_agent,
"id_agent_module" : id_agent_module,
"time_lapse" : time_lapse,
"only_avg" : only_avg,
"id_container" : id_container,
},
function (data, status) {
var url = location.href.replace('&update_container=1', "");
url = url.replace('&delete_item=1', "");
location.href = url.replace('&add_container=1', "&id="+id_container);
}
);
}
});
$("input[name=add_custom]").click (function () {
var id_custom = $("#id_custom_graph").val();
if (id_custom !== '0'){
var time_lapse = $("#hidden-period_custom").attr('value');
var id_container = <?php echo $id_container; ?>;
jQuery.post ("ajax.php",
{"page" : "godmode/reporting/create_container",
"add_custom" : 1,
"time_lapse" : time_lapse,
"id_custom" : id_custom,
"id_container" : id_container,
},
function (data, status) {
var url = location.href.replace('&update_container=1', "");
url = url.replace('&delete_item=1', "");
location.href = url.replace('&add_container=1', "&id="+id_container);
}
);
}
});
$("input[name=add_dynamic]").click (function () {
var agent_alias = $("#text-text_agent").val();
var module_name = $("#text-text_agent_module").val();
var time_lapse = $("#hidden-period_dynamic").attr('value');
var group = $("#container_id_group1").val();
var module_group = $("#combo_modulegroup").val();
var tag = $("#tag").val();
var id_container = <?php echo $id_container; ?>;
jQuery.post ("ajax.php",
{"page" : "godmode/reporting/create_container",
"add_dynamic" : 1,
"time_lapse" : time_lapse,
"group" : group,
"module_group" : module_group,
"agent_alias" : agent_alias,
"module_name" : module_name,
"tag" : tag,
"id_container" : id_container,
},
function (data, status) {
var url = location.href.replace('&update_container=1', "");
url = url.replace('&delete_item=1', "");
location.href = url.replace('&add_container=1', "&id="+id_container);
}
);
});
});
</script>

View File

@ -0,0 +1,135 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global variables
global $config;
// Check user credentials
check_login ();
if (! check_acl ($config['id_user'], 0, "RW")) {
db_pandora_audit("ACL Violation",
"Trying to access Inventory Module Management");
require ("general/noaccess.php");
return;
}
require_once ('include/functions_container.php');
$delete_container = get_parameter('delete_container',0);
if ($delete_container){
$id_container = get_parameter('id',0);
$child = folder_get_all_child_container($id_container);
if($child){
foreach ($child as $key => $value) {
$parent = array(
'parent' => 1);
db_process_sql_update('tcontainer', $parent, array('id_container' => $value['id_container']));
}
}
db_process_sql_delete('tcontainer', array('id_container' => $id_container));
}
$max_graph = $config['max_graph_container'];
$buttons['graph_list'] = array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs">' .
html_print_image("images/list.png", true, array ("title" => __('Graph list'))) .'</a>');
$enterpriseEnable = false;
if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NOT_HOOK) {
$enterpriseEnable = true;
}
if ($enterpriseEnable) {
$buttons = reporting_enterprise_add_template_graph_tabs($buttons);
}
$subsection = reporting_enterprise_add_graph_template_subsection('', $buttons);
reporting_enterprise_select_graph_template_tab();
$buttons['graph_container'] = array('active' => true,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">' .
html_print_image("images/graph-container.png", true, array ("title" => __('Graph container'))) . '</a>');
// Header
ui_print_page_header (__('Graph container'), "", false, "",false,$buttons);
$container = folder_get_folders();
$tree = folder_get_folders_tree_recursive($container);
echo folder_togge_tree_folders($tree);
echo "<div style='float: right;'>";
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/create_container">';
html_print_submit_button (__('Create container'), 'create', false, 'class="sub next" style="margin-right:5px;margin-top: 15px;"');
echo "</form>";
echo "</div>";
?>
<script type="text/javascript">
function get_graphs_container (id_container,hash,time){
$.ajax({
async:false,
type: "POST",
url: "ajax.php",
data: {"page" : "include/ajax/graph.ajax",
"get_graphs_container" : 1,
"id_container" : id_container,
"hash" : hash,
"time" : time,
},
success: function(data) {
$("#div_"+hash).remove();
$("#tgl_div_"+hash).prepend("<div id='div_"+hash+"' style='width: 100%;padding-left: 63px; padding-top: 7px;'>"+data+"</div>");
$('div[class *= bullet]').css('margin-left','0');
$('div[class *= graph]').css('margin-left','0');
$('div[id *= gauge_]').css('width','100%');
$('select[id *= period_container_'+hash+']').change(function() {
var id = $(this).attr("id");
if(!/unit/.test(id)){
var time = $('select[id *= period_container_'+hash+']').val();
get_graphs_container(id_container,hash,time);
}
});
$('input[id *= period_container_'+hash+']').keypress(function(e) {
if(e.which == 13) {
var time = $('input[id *= hidden-period_container_'+hash+']').val();
get_graphs_container(id_container,hash,time);
}
});
}
});
}
$(document).ready (function () {
$('a[id *= tgl]').click(function(e) {
var id = e.currentTarget.id;
hash = id.replace("tgl_ctrl_","");
var down = document.getElementById("image_"+hash).src;
if (down.search("down") !== -1){
var max_graph = "<?php echo $max_graph;?>";
var id_container = $("#hidden-"+hash).val();
get_graphs_container(id_container,hash,'0');
} else {
$("#div_"+hash).remove();
}
});
});
</script>

View File

@ -65,7 +65,10 @@ switch ($activeTab) {
reporting_enterprise_select_graph_template_tab($activeTab);
break;
}
$buttons['graph_container'] = array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">' .
html_print_image("images/graph-container.png", true, array ("title" => __('Graphs containers'))) .'</a>');
$delete_graph = (bool) get_parameter ('delete_graph');
$view_graph = (bool) get_parameter ('view_graph');
$id = (int) get_parameter ('id');

View File

@ -138,6 +138,9 @@ $table_other->data[10][1] = html_print_input_text ('big_operation_step_datos_pur
$table_other->data[11][0] = __('Small Operation Step to purge old data') . ui_print_help_tip(__('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'), true);
$table_other->data[11][1] = html_print_input_text ('small_operation_step_datos_purge', $config["small_operation_step_datos_purge"], '', 5, 5, true);
$table_other->data[12][0] = __('Graph container - Max. Items') . ui_print_help_tip(__('The number of graphs that are viewed in a container. Default is 10 .Increasing this number could lead to performance problems'), true);
$table_other->data[12][1] = html_print_input_text ('max_graph_container', $config["max_graph_container"], '', 5, 5, true);
echo '<form id="form_setup" method="post">';
echo "<fieldset>";
echo "<legend>" . __('Database maintenance options') . "</legend>";

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

View File

@ -18,6 +18,7 @@ require_once('include/functions_graph.php');
$save_custom_graph = (bool) get_parameter('save_custom_graph');
$print_custom_graph = (bool) get_parameter('print_custom_graph');
$print_sparse_graph = (bool) get_parameter('print_sparse_graph');
$get_graphs = (bool)get_parameter('get_graphs_container');
if ($save_custom_graph) {
$return = array();
@ -111,4 +112,232 @@ if ($print_sparse_graph) {
return;
}
if ($get_graphs){
$id_container = get_parameter('id_container',0);
//config token max_graph
$max_graph = $config['max_graph_container'];
$result_items = db_get_all_rows_sql("SELECT * FROM tcontainer_item WHERE id_container = " . $id_container);
if (!empty($result_items)){
$hash = get_parameter('hash',0);
$period = get_parameter('time',0);
$periods = array ();
$periods[1] = __('none');
$periods[SECONDS_1HOUR] = __('1 hour');
$periods[SECONDS_2HOUR] = sprintf(__('%s hours'), '2 ');
$periods[SECONDS_6HOURS] = sprintf(__('%s hours'), '6 ');
$periods[SECONDS_12HOURS] = sprintf(__('%s hours'), '12 ');
$periods[SECONDS_1DAY] = __('1 day');
$periods[SECONDS_2DAY] = sprintf(__('%s days'), '2 ');
$periods[SECONDS_5DAY] = sprintf(__('%s days'), '5 ');
$periods[SECONDS_1WEEK] = __('1 week');
$periods[SECONDS_15DAYS] = __('15 days');
$periods[SECONDS_1MONTH] = __('1 month');
$table = '';
$single_table = "<table width='100%' cellpadding=4 cellspacing=4>";
$single_table .= "<tr id='row_time_lapse' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;width: 12%;'>";
$single_table .= __('Time container lapse');
// $single_table .= ui_print_help_tip(__('This is the range, or period of time over which the report renders the information for this report type. For example, a week means data from a week ago from now. '),true);
$single_table .= "</td>";
$single_table .= "<td>";
$single_table .= html_print_extended_select_for_time('period_container_'.$hash, $period,
'', '', '0', 10, true,'font-size: 9pt;width: 130px;',true,'',false,$periods,'vertical-align: middle;');
$single_table .= "</td>";
$single_table .= "</tr>";
$single_table .= "</table>";
$table .= $single_table;
$contador = $config['max_graph_container'];
foreach ($result_items as $key => $value) {
$table .= "</br>";
if($period > 1){
$value['time_lapse'] = $period;
}
switch ($value['type']) {
case 'simple_graph':
if ($contador > 0) {
$sql_modulo = db_get_all_rows_sql("SELECT nombre, id_agente FROM
tagente_modulo WHERE id_agente_modulo = ". $value['id_agent_module']);
$sql_alias = db_get_all_rows_sql("SELECT alias from tagente
WHERE id_agente = ". $sql_modulo[0]['id_agente']);
$table .= "<div style='width: 800px'><h4>AGENT " .$sql_alias[0]['alias']." MODULE ".$sql_modulo[0]['nombre']."</h4><hr></div>";
$table .= grafico_modulo_sparse(
$value['id_agent_module'],
$value['time_lapse'],
0,
800,
300,
'',
'',
false,
$value['only_average'],
false,
0,
'',
0,
0,
1,
false,
ui_get_full_url(false, false, false, false),
1,
false,
0,
false,
false,
1,
'white',
null,
false,
false,
'area');
$contador --;
}
// $table .= "</br>";
break;
case 'custom_graph':
if ($contador > 0) {
$graph = db_get_all_rows_field_filter('tgraph', 'id_graph',$value['id_graph']);
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',$value['id_graph']);
$modules = array ();
$weights = array ();
$labels = array ();
foreach ($sources as $source) {
array_push ($modules, $source['id_agent_module']);
array_push ($weights, $source['weight']);
if ($source['label'] != ''){
$item['type'] = 'custom_graph';
$item['id_agent'] = agents_get_module_id($source['id_agent_module']);
$item['id_agent_module'] = $source['id_agent_module'];
$labels[$source['id_agent_module']] = reporting_label_macro($item, $source['label']);
}
}
$homeurl = ui_get_full_url(false, false, false, false);
$graph_conf = db_get_row('tgraph', 'id_graph', $value['id_graph']);
if($graph_conf['stacked'] == 4 || $graph_conf['stacked'] == 9){
$height = 50;
} else if ($graph_conf['stacked'] == 5){
$height = 200;
} else {
$height = 300;
}
$table .= "<div style='width: 800px'><h4>CUSTOM GRAPH ".$graph[0]['name']."</h4><hr></div>";
$table .= graphic_combined_module($modules,
$weights,
$value['time_lapse'],
800,
$height,
'',
'',
0,
0,
0,
$graph_conf['stacked'],
0,
false,
$homeurl,
1,
false,
false,
'white',
array(),
array(),
1,
1,
1,
1,
$labels,
false,
false,
null,
false);
$contador --;
}
break;
case 'dynamic_graph':
$alias = " AND alias like '%".io_safe_output($value['agent'])."%'";
if($value['id_group'] === '0'){
$id_group = "";
} else {
$id_group = " AND id_grupo = ".$value['id_group'];
}
if($value['id_module_group'] === '0'){
$id_module_group = "";
} else {
$id_module_group = " AND id_module_group = ".$value['id_module_group'];
}
if($value['id_tag'] === '0'){
$tag = "";
$id_tag = "";
} else {
$tag = " INNER JOIN ttag_module ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo ";
$id_tag = " AND ttag_module.id_tag = ".$value['id_tag'];
}
$module_name = " AND nombre like '%".io_safe_output($value['module'])."%'";
$id_agent_module = db_get_all_rows_sql("SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo
". $tag . "WHERE 1=1" . $id_module_group . $module_name .
" AND id_agente IN (SELECT id_agente FROM tagente WHERE 1=1" .$alias.$id_group.")"
. $id_tag);
foreach ($id_agent_module as $key2 => $value2) {
if ($contador > 0) {
$sql_modulo2 = db_get_all_rows_sql("SELECT nombre, id_agente FROM
tagente_modulo WHERE id_agente_modulo = ". $value2['id_agente_modulo']);
$sql_alias2 = db_get_all_rows_sql("SELECT alias from tagente
WHERE id_agente = ". $sql_modulo2[0]['id_agente']);
$table .= "<div style='width: 800px'><h4>AGENT " .$sql_alias2[0]['alias']." MODULE ".$sql_modulo2[0]['nombre']."</h4><hr></div>";
$table .= grafico_modulo_sparse(
$value2['id_agente_modulo'],
$value['time_lapse'],
0,
800,
300,
'',
'',
false,
$value['only_average'],
false,
0,
'',
0,
0,
1,
false,
ui_get_full_url(false, false, false, false),
1,
false,
0,
false,
false,
1,
'white',
null,
false,
false,
'area');
$contador --;
}
}
break;
}
}
$table .= "</br>";
echo $table;
return;
}
}
?>

View File

@ -428,6 +428,8 @@ function config_update_config () {
if (!config_update_value ('inventory_purge', get_parameter ('inventory_purge')))
$error_update[] = __('Max. days before delete inventory data');
}
if (!config_update_value ('max_graph_container', get_parameter ('max_graph_container')))
$error_update[] = __('Graph container - Max. Items');
/////////////
break;
@ -913,6 +915,10 @@ function config_process_config () {
config_update_value ('inventory_purge', 21);
}
}
if (!isset($config['max_graph_container'])) {
config_update_value ('max_graph_container', 10);
}
if (!isset($config['max_macro_fields'])) {
config_update_value ('max_macro_fields', 10);

View File

@ -0,0 +1,328 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include
* @subpackage folder_Functions
*/
require_once ('include/functions_graph.php');
function folder_get_folders(){
$folders = io_safe_output(db_get_all_rows_in_table ('tcontainer','parent, name'));
$ordered_folders = array();
foreach ($folders as $folder) {
$ordered_folders[$folder['id_container']] = $folder;
}
return $ordered_folders;
}
function folder_get_folders_tree_recursive($folders) {
$return = array();
$tree = $folders;
foreach($folders as $key => $folder) {
if ($folder['id_container'] == 0) {
continue;
}
if(!in_array($folder['parent'], array_keys($folders))) {
$folder['parent'] = 0;
}
$tree[$folder['parent']]['hash_branch'] = 1;
$tree[$folder['parent']]['branch'][$key] = &$tree[$key];
}
if (isset($folders[0])) {
$tree = array($tree[0]);
}
else {
$tree = $tree[0]['branch'];
}
return $tree;
}
function folder_flatten_tree_folders($tree, $deep) {
foreach ($tree as $key => $folder) {
$return[$key] = $folder;
unset($return[$key]['branch']);
$return[$key]['deep'] = $deep;
if (!empty($folder['branch'])) {
$return = $return +
folder_flatten_tree_folders($folder['branch'], $deep + 1);
}
}
return $return;
}
function folder_get_select($folders_tree){
$fields = array();
foreach ($folders_tree as $folder_tree) {
$folderName = ui_print_truncate_text($folder_tree['name'], GENERIC_SIZE_TEXT, false, true, false);
$fields[$folder_tree['id_container']] = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $folder_tree['deep']) . $folderName;
}
return $fields;
}
function folder_togge_tree_folders($tree) {
$return=array();
foreach ($tree as $key => $folder) {
$folderName = ui_print_truncate_text($folder['name'], GENERIC_SIZE_TEXT, false, true, false);
$table = '';
// style='background: #f2f2f2;border: 1px solid #e2e2e2;margin-bottom: 4px'
if (!empty($folder['branch'])) {
$togge = $table. folder_togge_tree_folders($folder['branch']);
if ($folder['parent']=== '0'){
$return[$key] .= "<div id='$folderName'>" . ui_toggle_container($togge,$folderName, '', true, true, $folder['id_group'], $folder['id_container'],$folder['parent']) . "</div>";
} else {
$return[$key] .= "<div id='$folderName' style='margin-left:23px'>" . ui_toggle_container($togge,$folderName, '', true, true, $folder['id_group'], $folder['id_container'],$folder['parent']) . "</div>";
}
} else {
if ($folder['parent'] === '0'){
$return[$key] = "<div id='$folderName'>";
} else {
$return[$key] = "<div id='$folderName' style='margin-left:23px'>";
}
$return[$key] .= ui_toggle_container($table,$folderName, '', true, true, $folder['id_group'], $folder['id_container'],$folder['parent']);
$return[$key] .= "</div>";
}
}
$retorno = implode("", $return);
return $retorno;
}
function folder_table ($graphs){
global $config;
$report_r = check_acl ($config['id_user'], 0, "RR");
$report_w = check_acl ($config['id_user'], 0, "RW");
$report_m = check_acl ($config['id_user'], 0, "RM");
$access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR'));
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->align = array ();
$table->head = array ();
$table->head[0] = __('Graph name');
$table->head[1] = __('Description');
$table->head[2] = __('Number of Graphs');
$table->head[3] = __('Group');
$table->size[0] = '30%';
$table->size[2] = '200px';
$table->size[3] = '200px';
$table->align[2] = 'left';
$table->align[3] = 'left';
if ($report_w || $report_m) {
$table->align[4] = 'left';
$table->head[4] = __('Op.') .
html_print_checkbox('all_delete', 0, false, true, false,
'check_all_checkboxes();');
$table->size[4] = '90px';
}
$table->data = array ();
// $result_graphs = array_slice($graphs, $offset, $config['block_size']);
foreach ($graphs as $graph) {
$data = array ();
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.
$graph['id_graph'].'">' . ui_print_truncate_text($graph['name'], 70) . '</a>';
$data[1] = ui_print_truncate_text($graph["description"], 70);
$data[2] = $graph["graphs_count"];
$data[3] = ui_print_group_icon($graph['id_group'],true);
if (($report_w || $report_m) && users_can_manage_group_all($access)) {
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.
$graph['id_graph'].'">'.html_print_image("images/config.png", true).'</a>';
$data[4] .= '&nbsp;';
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='
.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>' .
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
}
array_push ($table->data, $data);
}
return $table;
}
function folder_get_all_child_container($parent) {
$child_folders = db_get_all_rows_filter('tcontainer',
array('parent' => $parent));
return $child_folders;
}
/**
* Get parent id
*/
function folder_get_parent_id($child) {
$child_folders = db_get_all_rows_filter('tcontainer',
array('id_container' => $child));
return $child_folders[0]['parent'];
}
/**
* Get all si
*/
function folder_get_sibling($sibling) {
$parent_folders = db_get_all_rows_filter('tcontainer',
array('id_container' => $sibling));
$sibling_folders = db_get_all_rows_filter('tcontainer',
array('parent' => $parent_folders[0]['parent']));
return $sibling_folders;
}
function ui_toggle_container($code, $name, $title = '', $hidden_default = true, $return = false, $group , $id_container, $parent = false) {
// Generate unique Id
$uniqid = uniqid('');
// Options
if ($hidden_default) {
$style = 'display:none';
$image_a = html_print_image("images/down.png", true, false, true);
$image_b = html_print_image("images/go.png", true, false, true);
$original = "images/go.png";
}
else {
$style = '';
$image_a = html_print_image("images/down.png", true, false, true);
$image_b = html_print_image("images/go.png", true, false, true);
$original = "images/down.png";
}
// Link to toggle
$table = new stdClass();
$table->id = 'container_table';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->class = 'dat';
if(!$parent){
$table->styleTable = 'font-weight: bold;background: #f2f2f2;border: 1px solid #e2e2e2;margin-bottom: 4px';
} else {
$table->styleTable = 'font-weight: bold;margin-bottom: 4px;border-bottom: 1px solid #dcdcdc;';
}
$table->style[0] = 'width: 30%';
$table->style[1] = 'width: 30%';
if(!$parent){
$table->style[0] = 'width: 30%';
$table->style[1] = 'width: 30%';
if ($id_container === '1'){
$table->style[2] = 'padding-right: 34px';
}
$table->align[1] = 'center';
$table->align[2] = 'center';
} else {
$id = folder_get_parent_id($id_container);
$i = 0;
while($id !== '0'){
$id = folder_get_parent_id($id);
$i++;
}
$padding_group = 28 * $i;
$padding_icon = 10 * $i;
$table->style[0] = 'width: 30%';
$table->style[1] = 'width: 30%;padding-right: '.$padding_group.'px';
$table->style[2] = 'padding-right: '.$padding_icon.'px';
$table->align[1] = 'center';
$table->align[2] = 'center';
}
$table->data = array();
$data = array();
$data[0] = '<a href="javascript:" id="tgl_ctrl_'.$uniqid.'">' . html_print_image ($original, true, array ("title" => $title, "id" => "image_".$uniqid)) . '&nbsp;&nbsp;<b>'.$name.'</b></a>';
$data[1] = ui_print_group_icon($group,true);
$data[2] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&id='.
$id_container .'">'.html_print_image("images/config.png", true).'</a>';
if ($id_container !== '1'){
$data[2] .= '&nbsp;&nbsp;&nbsp;&nbsp' .'<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container&delete_container=1&id='
.$id_container.'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>';
}
$table->data[] = $data;
$table->rowclass[] = '';
$output .= html_print_table($table, true);
// Code into a div
$output .= "<div id='tgl_div_".$uniqid."' style='".$style."'>\n";
$output .= html_print_input_hidden($uniqid, $id_container);
$output .= $code;
$output .= "</div>";
// JQuery Toggle
$output .= '<script type="text/javascript">' . "\n";
$output .= " var hide_tgl_ctrl_" . $uniqid . " = " . (int)$hidden_default . ";\n";
$output .= ' /* <![CDATA[ */' . "\n";
$output .= " $(document).ready (function () {\n";
$output .= " $('#tgl_ctrl_".$uniqid."').click(function() {\n";
$output .= " if (hide_tgl_ctrl_" . $uniqid . ") {\n";
$output .= " hide_tgl_ctrl_" . $uniqid . " = 0;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_a."'});\n";
$output .= " }\n";
$output .= " else {\n";
$output .= " hide_tgl_ctrl_" . $uniqid . " = 1;\n";
$output .= " $('#tgl_div_".$uniqid."').toggle();\n";
$output .= " $('#image_".$uniqid."').attr({src: '".$image_b."'});\n";
$output .= " }\n";
$output .= " });\n";
$output .= " });\n";
$output .= '/* ]]> */';
$output .= '</script>';
if (!$return) {
echo $output;
}
else {
return $output;
}
}
?>

View File

@ -700,12 +700,17 @@ function html_print_extended_select_for_post_process($name, $selected = '',
function html_print_extended_select_for_time ($name, $selected = '',
$script = '', $nothing = '', $nothing_value = '0', $size = false,
$return = false, $select_style = false, $unique_name = true, $class='',
$readonly = false) {
$readonly = false, $custom_fields = false,$style_icon = '') {
global $config;
$fields = get_periods();
if($custom_fields){
$fields = $custom_fields;
} else {
$fields = get_periods();
}
if ( ! $selected ) {
foreach( $fields as $t_key => $t_value){
if ( $t_key != -1 ) {
@ -770,7 +775,7 @@ function html_print_extended_select_for_time ($name, $selected = '',
array('class' => $uniq_name . '_toggler',
'alt' => __('Custom'),
'title' => __('Custom'),
'style' => 'width: 18px;'), false, false, true) .
'style' => 'width: 18px;'.$style_icon), false, false, true) .
'</a>';
echo '</div>';
@ -784,7 +789,7 @@ function html_print_extended_select_for_time ($name, $selected = '',
html_print_image('images/default_list.png', true,
array('class' => $uniq_name . '_toggler',
'alt' => __('List'),
'title' => __('List'), 'style' => 'width: 18px;')) .
'title' => __('List'), 'style' => 'width: 18px;'.$style_icon)) .
'</a>';
echo '</div>';
echo "<script type='text/javascript'>

View File

@ -572,6 +572,42 @@ CREATE TABLE IF NOT EXISTS `tconfig_os` (
PRIMARY KEY (`id_os`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -----------------------------------------------------
-- Table `tcontainer`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tcontainer` (
`id_container` mediumint(4) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`parent` mediumint(4) unsigned NOT NULL default 0,
`disabled` tinyint(3) unsigned NOT NULL default 0,
`id_group` mediumint(8) unsigned NULL default 0,
`description` TEXT NOT NULL,
PRIMARY KEY (`id_container`),
KEY `parent_index` (`parent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tcontainer_item`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tcontainer_item` (
`id_ci` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_container` mediumint(4) unsigned NOT NULL default 0,
`type` varchar(30) default 'simple_graph',
`id_agent` int(10) unsigned NOT NULL default 0,
`id_agent_module` bigint(14) unsigned NULL default NULL,
`time_lapse` int(11) NOT NULL default 0,
`id_graph` INTEGER UNSIGNED default 0,
`only_average` tinyint (1) unsigned default 0 not null,
`id_group` INT (10) unsigned NOT NULL DEFAULT 0,
`id_module_group` INT (10) unsigned NOT NULL DEFAULT 0,
`agent` varchar(100) NOT NULL default '',
`module` varchar(100) NOT NULL default '',
`id_tag` integer(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id_ci`),
FOREIGN KEY (`id_container`) REFERENCES tcontainer(`id_container`)
ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tevento`
-- ---------------------------------------------------------------------

View File

@ -1249,3 +1249,8 @@ INSERT INTO `tpolicy_modules` (`id_policy`, `configuration_data`, `id_tipo_modul
-- Dumping data for table `tprofile_view`
--
INSERT INTO `tprofile_view` (`id_profile`, `sec`, `sec2`, `sec3`) VALUES (5, '*', '*','*');
--
-- Dumping data for table `tcontainer`
--
INSERT INTO `tcontainer` SET `name` = 'Default graph container';