2012-08-20 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.main.php, godmode/reporting/reporting_builder.php, include/functions_reports.php, pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql, operation/reporting/reporting_xml.php, operation/reporting/reporting_viewer.php, extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: now the reports can set the group can edit or private edition. * include/functions_users.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6889 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
7b84e6161a
commit
f6ef1381a2
|
@ -1,3 +1,18 @@
|
|||
2012-08-20 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/reporting/reporting_builder.main.php,
|
||||
godmode/reporting/reporting_builder.php,
|
||||
include/functions_reports.php, pandoradb.sql,
|
||||
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
|
||||
operation/reporting/reporting_xml.php,
|
||||
operation/reporting/reporting_viewer.php,
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: now the reports
|
||||
can set the group can edit or private edition.
|
||||
|
||||
* include/functions_users.php: cleaned source code style.
|
||||
|
||||
2012-08-20 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* pandoradb_data.sql
|
||||
|
|
|
@ -169,6 +169,7 @@ ALTER TABLE treport_content_item ADD FOREIGN KEY (`id_report_content`) REFERENCE
|
|||
-- Table `treport`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE treport ADD COLUMN `id_template` INTEGER UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE treport ADD COLUMN `id_group_edit` mediumint(8) unsigned NULL DEFAULT 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgraph`
|
||||
|
|
|
@ -158,6 +158,7 @@ ALTER TABLE treport_content_item ADD FOREIGN KEY (id_report_content) REFERENCES
|
|||
-- Table `treport`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE treport ADD (id_template NUMBER(10, 0) default 0 NOT NULL);
|
||||
ALTER TABLE treport ADD (id_group_edit NUMBER(19, 0) default 0 NOT NULL);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgraph`
|
||||
|
|
|
@ -150,6 +150,7 @@ INSERT INTO "tconfig" ("token", "value") VALUES ('event_fields', 'evento,id_agen
|
|||
-- Table `treport`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE "treport" ADD COLUMN "id_template" INTEGER NOT NULL default 0;
|
||||
ALTER TABLE "treport" ADD COLUMN "id_group_edit" BIGINT NOT NULL default 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgraph`
|
||||
|
|
|
@ -29,12 +29,14 @@ $groups = users_get_groups ();
|
|||
|
||||
switch ($action) {
|
||||
case 'new':
|
||||
$actionButtonHtml = html_print_submit_button(__('Save'), 'add', false, 'class="sub wand"', true);
|
||||
$actionButtonHtml = html_print_submit_button(__('Save'),
|
||||
'add', false, 'class="sub wand"', true);
|
||||
$hiddenFieldAction = 'save';
|
||||
break;
|
||||
case 'update':
|
||||
case 'edit':
|
||||
$actionButtonHtml = html_print_submit_button(__('Update'), 'edit', false, 'class="sub upd"', true);
|
||||
$actionButtonHtml = html_print_submit_button(__('Update'),
|
||||
'edit', false, 'class="sub upd"', true);
|
||||
$hiddenFieldAction = 'update';
|
||||
break;
|
||||
}
|
||||
|
@ -46,21 +48,45 @@ $table->head = array ();
|
|||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
$table->size = array ();
|
||||
$table->size[0] = '10%';
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '90%';
|
||||
$table->style[0] = 'font-weight: bold; vertical-align: top;';
|
||||
|
||||
$table->data['name'][0] = __('Name');
|
||||
$table->data['name'][1] = html_print_input_text('name', $reportName, __('Name'), 80, 100, true);
|
||||
$table->data['name'][1] = html_print_input_text('name', $reportName,
|
||||
__('Name'), 80, 100, true);
|
||||
|
||||
$table->data['group'][0] = __('Group');
|
||||
$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
|
||||
else
|
||||
$return_all_groups = false;
|
||||
$table->data['group'][1] = html_print_select_groups(false, "AR", $return_all_groups, 'id_group', $idGroupReport, false, '', '', true);
|
||||
|
||||
if ($report_id_user == $config['id_user'] ||
|
||||
is_user_admin ($config["id_user"])) {
|
||||
//S/he is the creator of report (or admin) and s/he can change the access.
|
||||
$type_access = array('group_view' => __('Only the group can view the report'),
|
||||
'group_edit' => __('The next group can edit the report'),
|
||||
'user_edit' => __('Only the user and admin user can edit the report')
|
||||
);
|
||||
$table->data['access'][0] = __('Write Access') .
|
||||
ui_print_help_tip(__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'), true);
|
||||
$table->data['access'][1] = html_print_select ($type_access, 'type_access',
|
||||
$type_access_selected, 'change_type_access(this)', '', 0, true);
|
||||
|
||||
$style = "display: none;";
|
||||
if ($type_access_selected == 'group_edit')
|
||||
$style = "";
|
||||
$table->data['access'][1] .= '<span style="' . $style . '" class="access_subform" id="group_edit">
|
||||
' .
|
||||
html_print_select_groups(false, "AR", false,
|
||||
'id_group_edit', $id_group_edit, false, '', '', true) . '
|
||||
</span>';
|
||||
}
|
||||
|
||||
|
||||
$table->data['description'][0] = __('Description');
|
||||
$table->data['description'][1] = html_print_textarea('description', 5, 15, $description, '', true);
|
||||
|
||||
|
@ -73,3 +99,17 @@ html_print_input_hidden('action', $hiddenFieldAction);
|
|||
html_print_input_hidden('id_report', $idReport);
|
||||
echo '</div></form>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function change_type_access(select_item) {
|
||||
$(".access_subform").hide();
|
||||
switch ($(select_item).val()) {
|
||||
case 'group_view':
|
||||
break;
|
||||
case 'group_edit':
|
||||
$("#group_edit").show();
|
||||
break;
|
||||
case 'user_edit':
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -42,6 +42,32 @@ $idReport = get_parameter('id_report', 0);
|
|||
$offset = get_parameter('offset', 0);
|
||||
$idItem = get_parameter('id_item', 0);
|
||||
|
||||
//Other Checks for the edit the reports
|
||||
if ($idReport != 0) {
|
||||
$report = db_get_row_filter('treport', array('id_report' => $idReport));
|
||||
$type_access_selected = reports_get_type_access($report);
|
||||
$edit = false;
|
||||
switch ($type_access_selected) {
|
||||
case 'group_view':
|
||||
$edit = check_acl($config['id_user'], $report['id_group'], "IW");
|
||||
break;
|
||||
case 'group_edit':
|
||||
$edit = check_acl($config['id_user'], $report['id_group_edit'], "IW");
|
||||
break;
|
||||
case 'user_edit':
|
||||
if ($config['id_user'] == $report['id_user'] ||
|
||||
is_user_admin ($config["id_user"]))
|
||||
$edit = true;
|
||||
break;
|
||||
}
|
||||
if (! $edit) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access report builder");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'sort_items':
|
||||
switch ($activeTab) {
|
||||
|
@ -325,7 +351,6 @@ switch ($action) {
|
|||
}
|
||||
|
||||
foreach ($reports as $report) {
|
||||
|
||||
if (!is_user_admin ($config["id_user"])){
|
||||
if ($report["private"] && $report["id_user"] != $config['id_user'])
|
||||
if (!check_acl ($config["id_user"], $report["id_group"], "AR"))
|
||||
|
@ -352,7 +377,7 @@ switch ($action) {
|
|||
$data[3] = '<a href="ajax.php?page=operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/database_lightning.png", true) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway
|
||||
|
||||
|
||||
//Calculate dinamically the number of the column
|
||||
//Calculate dinamically the number of the column
|
||||
$next = 4;
|
||||
if (enterprise_hook ('load_custom_reporting_2') !== ENTERPRISE_NOT_HOOK) {
|
||||
$next = 6;
|
||||
|
@ -371,17 +396,35 @@ switch ($action) {
|
|||
$data[$next] = ui_print_group_icon($report['id_group'], true);
|
||||
$next++;
|
||||
|
||||
$data[$next] = '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit" style="display:inline">';
|
||||
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true);
|
||||
$data[$next] .= html_print_input_image ('edit', 'images/config.png', 1, '', true, array ('title' => __('Edit')));
|
||||
$data[$next] .= '</form>';
|
||||
$type_access_selected = reports_get_type_access($report);
|
||||
$edit = false;
|
||||
switch ($type_access_selected) {
|
||||
case 'group_view':
|
||||
$edit = check_acl($config['id_user'], $report['id_group'], "IW");
|
||||
break;
|
||||
case 'group_edit':
|
||||
$edit = check_acl($config['id_user'], $report['id_group_edit'], "IW");
|
||||
break;
|
||||
case 'user_edit':
|
||||
if ($config['id_user'] == $report['id_user'] ||
|
||||
is_user_admin ($config["id_user"]))
|
||||
$edit = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$data[$next] .= ' <form method="post" style="display:inline" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
|
||||
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true);
|
||||
$data[$next] .= html_print_input_hidden ('action','delete_report', true);
|
||||
$data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, '',
|
||||
true, array ('title' => __('Delete')));
|
||||
$data[$next] .= '</form>';
|
||||
if ($edit) {
|
||||
$data[$next] = '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit" style="display:inline">';
|
||||
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true);
|
||||
$data[$next] .= html_print_input_image ('edit', 'images/config.png', 1, '', true, array ('title' => __('Edit')));
|
||||
$data[$next] .= '</form>';
|
||||
|
||||
$data[$next] .= ' <form method="post" style="display:inline" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
|
||||
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true);
|
||||
$data[$next] .= html_print_input_hidden ('action','delete_report', true);
|
||||
$data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, '',
|
||||
true, array ('title' => __('Delete')));
|
||||
$data[$next] .= '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
array_push ($table->data, $data);
|
||||
|
@ -410,6 +453,9 @@ switch ($action) {
|
|||
$idGroupReport = 0; //All groups
|
||||
$description = '';
|
||||
$resultOperationDB = null;
|
||||
$report_id_user = 0;
|
||||
$type_access_selected = reports_get_type_access(false);
|
||||
$id_group_edit = 0;
|
||||
break;
|
||||
case 'item_editor':
|
||||
$resultOperationDB = null;
|
||||
|
@ -428,10 +474,45 @@ switch ($action) {
|
|||
$reportName = get_parameter('name');
|
||||
$idGroupReport = get_parameter('id_group');
|
||||
$description = get_parameter('description');
|
||||
$type_access_selected = get_parameter('type_access', 'group_view');
|
||||
$id_group_edit_param = (int)get_parameter('id_group_edit', 0);
|
||||
|
||||
switch ($type_access_selected) {
|
||||
case 'group_view':
|
||||
$id_group_edit = 0;
|
||||
$private = 0;
|
||||
break;
|
||||
case 'group_edit':
|
||||
$id_group_edit = $id_group_edit_param;
|
||||
$private = 0;
|
||||
break;
|
||||
case 'user_edit':
|
||||
$id_group_edit = 0;
|
||||
$private = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($action == 'update') {
|
||||
if ($reportName != "" && $idGroupReport != ""){
|
||||
$resultOperationDB = (bool)db_process_sql_update('treport', array('name' => $reportName, 'id_group' => $idGroupReport, 'description' => $description), array('id_report' => $idReport));
|
||||
if ($reportName != "" && $idGroupReport != "") {
|
||||
$new_values = array('name' => $reportName,
|
||||
'id_group' => $idGroupReport,
|
||||
'description' => $description,
|
||||
'private' => $private,
|
||||
'id_group_edit' => $id_group_edit);
|
||||
|
||||
|
||||
$report = db_get_row_filter('treport',
|
||||
array('id_report' => $idReport));
|
||||
$report_id_user = $report['id_user'];
|
||||
if ($report_id_user != $config['id_user'] &&
|
||||
is_user_admin ($config["id_user"])) {
|
||||
unset($new_values['private']);
|
||||
unset($new_values['id_group_edit']);
|
||||
}
|
||||
|
||||
$resultOperationDB = (bool)db_process_sql_update(
|
||||
'treport', $new_values,
|
||||
array('id_report' => $idReport));
|
||||
if ($resultOperationDB !== false)
|
||||
db_pandora_audit( "Report management", "Update report #$idReport");
|
||||
else
|
||||
|
@ -442,8 +523,14 @@ switch ($action) {
|
|||
}
|
||||
}
|
||||
else if ($action == 'save') {
|
||||
if($reportName != "" && $idGroupReport != "") {
|
||||
$idOrResult = db_process_sql_insert('treport', array('name' => $reportName, 'id_group' => $idGroupReport, 'description' => $description));
|
||||
if ($reportName != "" && $idGroupReport != "") {
|
||||
$idOrResult = db_process_sql_insert('treport',
|
||||
array('name' => $reportName,
|
||||
'id_group' => $idGroupReport,
|
||||
'description' => $description,
|
||||
'private' => $private,
|
||||
'id_group_edit' => $id_group_edit,
|
||||
'id_user' => $config['id_user']));
|
||||
if ($idOrResult !== false)
|
||||
db_pandora_audit( "Report management", "Create report #$idOrResult");
|
||||
else
|
||||
|
@ -459,6 +546,7 @@ switch ($action) {
|
|||
else {
|
||||
$resultOperationDB = true;
|
||||
$idReport = $idOrResult;
|
||||
$report_id_user = $config['id_user'];
|
||||
}
|
||||
}
|
||||
$action = 'edit';
|
||||
|
@ -487,9 +575,9 @@ switch ($action) {
|
|||
$good_format = true;
|
||||
break;
|
||||
case 'prediction_date':
|
||||
$values['period'] = get_parameter('period1');
|
||||
$values['period'] = get_parameter('period1');
|
||||
$values['top_n'] = get_parameter('radiobutton_max_min_avg');
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$interval_max = get_parameter('max_interval');
|
||||
$interval_min = get_parameter('min_interval');
|
||||
// Checks intervals fields
|
||||
|
@ -597,9 +685,8 @@ switch ($action) {
|
|||
// Will update server_name variable
|
||||
$values['server_name'] = trim($server_name);
|
||||
$agent_name = substr($agent_name_server, 0, $separator_pos);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -647,9 +734,9 @@ switch ($action) {
|
|||
$good_format = true;
|
||||
break;
|
||||
case 'prediction_date':
|
||||
$values['period'] = get_parameter('period1');
|
||||
$values['period'] = get_parameter('period1');
|
||||
$values['top_n'] = get_parameter('radiobutton_max_min_avg');
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$interval_max = get_parameter('max_interval');
|
||||
$interval_min = get_parameter('min_interval');
|
||||
// Checks intervals fields
|
||||
|
@ -780,11 +867,11 @@ switch ($action) {
|
|||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||
$values['style'] = io_safe_input(json_encode($style));
|
||||
|
||||
if ($good_format){
|
||||
if ($good_format) {
|
||||
$result = db_process_sql_insert('treport_content', $values);
|
||||
|
||||
if ($result === false) {
|
||||
$resultOperationDB = false;
|
||||
$resultOperationDB = false;
|
||||
}
|
||||
else {
|
||||
$idItem = $result;
|
||||
|
@ -835,11 +922,15 @@ switch ($action) {
|
|||
case 'filter':
|
||||
case 'edit':
|
||||
$resultOperationDB = null;
|
||||
$report = db_get_row_filter('treport', array('id_report' => $idReport));
|
||||
$report = db_get_row_filter('treport',
|
||||
array('id_report' => $idReport));
|
||||
|
||||
$reportName = $report['name'];
|
||||
$idGroupReport = $report['id_group'];
|
||||
$description = $report['description'];
|
||||
$type_access_selected = reports_get_type_access($report);
|
||||
$id_group_edit = $report['id_group_edit'];
|
||||
$report_id_user = $report['id_user'];
|
||||
break;
|
||||
case 'delete':
|
||||
$idItem = get_parameter('id_item');
|
||||
|
|
|
@ -21,6 +21,20 @@
|
|||
|
||||
require_once ($config['homedir'].'/include/functions_users.php');
|
||||
|
||||
function reports_get_type_access($report) {
|
||||
if (empty($report)) {
|
||||
return 'group_view';
|
||||
}
|
||||
if ($report['private']) {
|
||||
return 'user_edit';
|
||||
}
|
||||
else if ($report['id_group_edit'] != 0) {
|
||||
return 'group_edit';
|
||||
}
|
||||
|
||||
return 'group_view';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a custom user report.
|
||||
*
|
||||
|
@ -73,12 +87,15 @@ function reports_get_reports ($filter = false, $fields = false, $returnAllGroup
|
|||
|
||||
if (! is_array ($filter))
|
||||
$filter = array ();
|
||||
/*
|
||||
if (!is_user_admin ($config["id_user"]))
|
||||
$filter[] = sprintf ('private = 0 OR (private = 1 AND id_user = "%s")',
|
||||
$config['id_user']);
|
||||
*/
|
||||
if (is_array ($fields)) {
|
||||
$fields[] = 'id_group';
|
||||
$fields[] = 'id_user';
|
||||
$fields[] = 'id_group_edit';
|
||||
}
|
||||
|
||||
$reports = array ();
|
||||
|
|
|
@ -90,7 +90,7 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro
|
|||
}
|
||||
|
||||
$user_groups = users_get_groups ($id_user, $privilege, $returnAllGroup, $returnAllColumns, $id_groups);
|
||||
|
||||
|
||||
if ($id_groups !== null) {
|
||||
$childrens = groups_get_childrens($id_groups);
|
||||
foreach ($childrens as $child) {
|
||||
|
@ -110,13 +110,13 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro
|
|||
$user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group);
|
||||
}
|
||||
$fields = array();
|
||||
|
||||
|
||||
foreach ($user_groups_tree as $group) {
|
||||
$groupName = ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false);
|
||||
|
||||
$fields[$group['id_grupo']] = str_repeat(" ", $group['deep']) . $groupName;
|
||||
}
|
||||
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ require_once ('include/functions_groups.php');
|
|||
|
||||
enterprise_include("include/functions_reporting.php");
|
||||
|
||||
// Check if the report is a private report.
|
||||
if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user_admin ($config['id_user']))) {
|
||||
if ($report['id_group'] != 0 &&
|
||||
!is_user_admin ($config['id_user'])) {
|
||||
include ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -129,8 +129,9 @@ if (! check_acl ($config['id_user'], $report['id_group'], "AR")) {
|
|||
exit;
|
||||
}
|
||||
|
||||
/* Check if the user can see the graph */
|
||||
if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user_admin($config['id_user']))) {
|
||||
if ($report['id_group'] != 0 &&
|
||||
!is_user_admin ($config['id_user'])) {
|
||||
include ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -960,7 +960,8 @@ CREATE TABLE treport (
|
|||
first_page CLOB default NULL,
|
||||
footer CLOB default NULL,
|
||||
custom_font VARCHAR2(200) default NULL,
|
||||
id_template NUMBER(10, 0) default 0 NOT NULL
|
||||
id_template NUMBER(10, 0) default 0 NOT NULL,
|
||||
id_group_edit NUMBER(19, 0) default 0 NOT NULL
|
||||
);
|
||||
|
||||
CREATE SEQUENCE treport_s INCREMENT BY 1 START WITH 1;
|
||||
|
|
|
@ -762,6 +762,9 @@ CREATE TABLE "tgraph_source" (
|
|||
"weight" DOUBLE PRECISION default 0
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table "treport"
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE "treport" (
|
||||
"id_report" SERIAL NOT NULL PRIMARY KEY,
|
||||
"id_user" varchar(100) NOT NULL default '',
|
||||
|
@ -774,7 +777,8 @@ CREATE TABLE "treport" (
|
|||
"first_page" TEXT default NULL,
|
||||
"footer" TEXT default NULL,
|
||||
"custom_font" varchar(200) default NULL,
|
||||
"id_template" BIGINT NOT NULL default 0
|
||||
"id_template" BIGINT NOT NULL default 0,
|
||||
"id_group_edit" BIGINT NOT NULL default 0
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
|
|
|
@ -149,6 +149,10 @@ CREATE TABLE `tagente_estado` (
|
|||
|
||||
-- Probably last_execution_try index is not useful and loads more than benefits
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tagente_modulo`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
-- id_modulo now uses tmodule
|
||||
-- ---------------------------
|
||||
-- 1 - Data server modules (agent related modules)
|
||||
|
@ -221,105 +225,122 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
|
|||
KEY `nombre` (`nombre` (255)),
|
||||
KEY `module_group` (`id_module_group`) using btree
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- snmp_oid is also used for WMI query
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tagent_access`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tagent_access` (
|
||||
`id_agent` int(10) unsigned NOT NULL default '0',
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
KEY `agent_index` (`id_agent`),
|
||||
KEY `idx_utimestamp` USING BTREE (`utimestamp`)
|
||||
`id_agent` int(10) unsigned NOT NULL default '0',
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
KEY `agent_index` (`id_agent`),
|
||||
KEY `idx_utimestamp` USING BTREE (`utimestamp`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_snmp`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_snmp` (
|
||||
`id_as` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_alert` int(10) unsigned NOT NULL default '0',
|
||||
`al_field1` text NOT NULL,
|
||||
`al_field2` text NOT NULL,
|
||||
`al_field3` text NOT NULL,
|
||||
`description` varchar(255) default '',
|
||||
`alert_type` int(2) unsigned NOT NULL default '0',
|
||||
`agent` varchar(100) default '',
|
||||
`custom_oid` text,
|
||||
`oid` varchar(255) NOT NULL default '',
|
||||
`time_threshold` int(11) NOT NULL default '0',
|
||||
`times_fired` int(2) unsigned NOT NULL default '0',
|
||||
`last_fired` datetime NOT NULL default '1970-01-01 00:00:00',
|
||||
`max_alerts` int(11) NOT NULL default '1',
|
||||
`min_alerts` int(11) NOT NULL default '1',
|
||||
`internal_counter` int(2) unsigned NOT NULL default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
`_snmp_f1_` text,
|
||||
`_snmp_f2_` text,
|
||||
`_snmp_f3_` text,
|
||||
`_snmp_f4_` text,
|
||||
`_snmp_f5_` text,
|
||||
`_snmp_f6_` text,
|
||||
`trap_type` int(11) NOT NULL default '-1',
|
||||
`single_value` varchar(255) default '',
|
||||
PRIMARY KEY (`id_as`)
|
||||
`id_as` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_alert` int(10) unsigned NOT NULL default '0',
|
||||
`al_field1` text NOT NULL,
|
||||
`al_field2` text NOT NULL,
|
||||
`al_field3` text NOT NULL,
|
||||
`description` varchar(255) default '',
|
||||
`alert_type` int(2) unsigned NOT NULL default '0',
|
||||
`agent` varchar(100) default '',
|
||||
`custom_oid` text,
|
||||
`oid` varchar(255) NOT NULL default '',
|
||||
`time_threshold` int(11) NOT NULL default '0',
|
||||
`times_fired` int(2) unsigned NOT NULL default '0',
|
||||
`last_fired` datetime NOT NULL default '1970-01-01 00:00:00',
|
||||
`max_alerts` int(11) NOT NULL default '1',
|
||||
`min_alerts` int(11) NOT NULL default '1',
|
||||
`internal_counter` int(2) unsigned NOT NULL default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
`_snmp_f1_` text,
|
||||
`_snmp_f2_` text,
|
||||
`_snmp_f3_` text,
|
||||
`_snmp_f4_` text,
|
||||
`_snmp_f5_` text,
|
||||
`_snmp_f6_` text,
|
||||
`trap_type` int(11) NOT NULL default '-1',
|
||||
`single_value` varchar(255) default '',
|
||||
PRIMARY KEY (`id_as`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_commands`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_commands` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
`command` text,
|
||||
`description` text,
|
||||
`internal` tinyint(1) default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(100) NOT NULL default '',
|
||||
`command` text,
|
||||
`description` text,
|
||||
`internal` tinyint(1) default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_actions`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_actions` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` text,
|
||||
`id_alert_command` int(10) unsigned NULL default 0,
|
||||
`field1` text NOT NULL,
|
||||
`field2` text,
|
||||
`field3` text,
|
||||
`id_group` mediumint(8) unsigned NULL default 0,
|
||||
`action_threshold` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` text,
|
||||
`id_alert_command` int(10) unsigned NULL default 0,
|
||||
`field1` text NOT NULL,
|
||||
`field2` text,
|
||||
`field3` text,
|
||||
`id_group` mediumint(8) unsigned NULL default 0,
|
||||
`action_threshold` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_templates`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_templates` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` text,
|
||||
`description` mediumtext,
|
||||
`id_alert_action` int(10) unsigned NULL,
|
||||
`field1` text,
|
||||
`field2` text,
|
||||
`field3` text NOT NULL,
|
||||
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always'),
|
||||
`value` varchar(255) default '',
|
||||
`matches_value` tinyint(1) default 0,
|
||||
`max_value` double(18,2) default NULL,
|
||||
`min_value` double(18,2) default NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
`max_alerts` int(4) unsigned NOT NULL default '1',
|
||||
`min_alerts` int(4) unsigned NOT NULL default '0',
|
||||
`time_from` time default '00:00:00',
|
||||
`time_to` time default '00:00:00',
|
||||
`monday` tinyint(1) default 1,
|
||||
`tuesday` tinyint(1) default 1,
|
||||
`wednesday` tinyint(1) default 1,
|
||||
`thursday` tinyint(1) default 1,
|
||||
`friday` tinyint(1) default 1,
|
||||
`saturday` tinyint(1) default 1,
|
||||
`sunday` tinyint(1) default 1,
|
||||
`recovery_notify` tinyint(1) default '0',
|
||||
`field2_recovery` text NOT NULL,
|
||||
`field3_recovery` text NOT NULL,
|
||||
`priority` tinyint(4) default '0',
|
||||
`id_group` mediumint(8) unsigned NULL default 0,
|
||||
`special_day` tinyint(1) default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_template_action` (`id_alert_action`),
|
||||
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` text,
|
||||
`description` mediumtext,
|
||||
`id_alert_action` int(10) unsigned NULL,
|
||||
`field1` text,
|
||||
`field2` text,
|
||||
`field3` text NOT NULL,
|
||||
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always'),
|
||||
`value` varchar(255) default '',
|
||||
`matches_value` tinyint(1) default 0,
|
||||
`max_value` double(18,2) default NULL,
|
||||
`min_value` double(18,2) default NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
`max_alerts` int(4) unsigned NOT NULL default '1',
|
||||
`min_alerts` int(4) unsigned NOT NULL default '0',
|
||||
`time_from` time default '00:00:00',
|
||||
`time_to` time default '00:00:00',
|
||||
`monday` tinyint(1) default 1,
|
||||
`tuesday` tinyint(1) default 1,
|
||||
`wednesday` tinyint(1) default 1,
|
||||
`thursday` tinyint(1) default 1,
|
||||
`friday` tinyint(1) default 1,
|
||||
`saturday` tinyint(1) default 1,
|
||||
`sunday` tinyint(1) default 1,
|
||||
`recovery_notify` tinyint(1) default '0',
|
||||
`field2_recovery` text NOT NULL,
|
||||
`field3_recovery` text NOT NULL,
|
||||
`priority` tinyint(4) default '0',
|
||||
`id_group` mediumint(8) unsigned NULL default 0,
|
||||
`special_day` tinyint(1) default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_template_action` (`id_alert_action`),
|
||||
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_template_modules`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_template_modules` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_agent_module` int(10) unsigned NOT NULL,
|
||||
|
@ -343,51 +364,57 @@ CREATE TABLE IF NOT EXISTS `talert_template_modules` (
|
|||
INDEX force_execution (`force_execution`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_template_module_actions`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_template_module_actions` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_alert_template_module` int(10) unsigned NOT NULL,
|
||||
`id_alert_action` int(10) unsigned NOT NULL,
|
||||
`fires_min` int(3) unsigned default 0,
|
||||
`fires_max` int(3) unsigned default 0,
|
||||
`module_action_threshold` int(10) NOT NULL default '0',
|
||||
`last_execution` bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_alert_template_module`) REFERENCES talert_template_modules(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_alert_template_module` int(10) unsigned NOT NULL,
|
||||
`id_alert_action` int(10) unsigned NOT NULL,
|
||||
`fires_min` int(3) unsigned default 0,
|
||||
`fires_max` int(3) unsigned default 0,
|
||||
`module_action_threshold` int(10) NOT NULL default '0',
|
||||
`last_execution` bigint(20) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_alert_template_module`) REFERENCES talert_template_modules(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_compound`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `talert_compound` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) default '',
|
||||
`description` mediumtext,
|
||||
`id_agent` int(10) unsigned NOT NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
`max_alerts` int(4) unsigned NOT NULL default '1',
|
||||
`min_alerts` int(4) unsigned NOT NULL default '0',
|
||||
`time_from` time default '00:00:00',
|
||||
`time_to` time default '00:00:00',
|
||||
`monday` tinyint(1) default 1,
|
||||
`tuesday` tinyint(1) default 1,
|
||||
`wednesday` tinyint(1) default 1,
|
||||
`thursday` tinyint(1) default 1,
|
||||
`friday` tinyint(1) default 1,
|
||||
`saturday` tinyint(1) default 1,
|
||||
`sunday` tinyint(1) default 1,
|
||||
`recovery_notify` tinyint(1) default '0',
|
||||
`field2_recovery` varchar(255) NOT NULL default '',
|
||||
`field3_recovery` mediumtext NOT NULL,
|
||||
`internal_counter` int(4) default '0',
|
||||
`last_fired` bigint(20) NOT NULL default '0',
|
||||
`last_reference` bigint(20) NOT NULL default '0',
|
||||
`times_fired` int(3) NOT NULL default '0',
|
||||
`disabled` tinyint(1) default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
`special_day` tinyint(1) default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) default '',
|
||||
`description` mediumtext,
|
||||
`id_agent` int(10) unsigned NOT NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
`max_alerts` int(4) unsigned NOT NULL default '1',
|
||||
`min_alerts` int(4) unsigned NOT NULL default '0',
|
||||
`time_from` time default '00:00:00',
|
||||
`time_to` time default '00:00:00',
|
||||
`monday` tinyint(1) default 1,
|
||||
`tuesday` tinyint(1) default 1,
|
||||
`wednesday` tinyint(1) default 1,
|
||||
`thursday` tinyint(1) default 1,
|
||||
`friday` tinyint(1) default 1,
|
||||
`saturday` tinyint(1) default 1,
|
||||
`sunday` tinyint(1) default 1,
|
||||
`recovery_notify` tinyint(1) default '0',
|
||||
`field2_recovery` varchar(255) NOT NULL default '',
|
||||
`field3_recovery` mediumtext NOT NULL,
|
||||
`internal_counter` int(4) default '0',
|
||||
`last_fired` bigint(20) NOT NULL default '0',
|
||||
`last_reference` bigint(20) NOT NULL default '0',
|
||||
`times_fired` int(3) NOT NULL default '0',
|
||||
`disabled` tinyint(1) default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
`special_day` tinyint(1) default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_agent`) REFERENCES tagente(`id_agente`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `talert_compound_elements` (
|
||||
|
@ -858,20 +885,24 @@ CREATE TABLE IF NOT EXISTS `tgraph_source` (
|
|||
PRIMARY KEY(`id_gs`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `treport`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `treport` (
|
||||
`id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_user` varchar(100) NOT NULL default '',
|
||||
`name` varchar(150) NOT NULL default '',
|
||||
`description` TEXT NOT NULL,
|
||||
`private` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`id_group` mediumint(8) unsigned NULL default NULL,
|
||||
`custom_logo` varchar(200) default NULL,
|
||||
`header` MEDIUMTEXT,
|
||||
`first_page` MEDIUMTEXT,
|
||||
`footer` MEDIUMTEXT,
|
||||
`custom_font` varchar(200) default NULL,
|
||||
`id_template` INTEGER UNSIGNED DEFAULT 0,
|
||||
PRIMARY KEY(`id_report`)
|
||||
`id_report` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_user` varchar(100) NOT NULL default '',
|
||||
`name` varchar(150) NOT NULL default '',
|
||||
`description` TEXT NOT NULL,
|
||||
`private` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`id_group` mediumint(8) unsigned NULL default NULL,
|
||||
`custom_logo` varchar(200) default NULL,
|
||||
`header` MEDIUMTEXT,
|
||||
`first_page` MEDIUMTEXT,
|
||||
`footer` MEDIUMTEXT,
|
||||
`custom_font` varchar(200) default NULL,
|
||||
`id_template` INTEGER UNSIGNED DEFAULT 0,
|
||||
`id_group_edit` mediumint(8) unsigned NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id_report`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue