2010-10-16 Sancho Lerena <slerena@artica.es>
* pandoradb_migrate_v3.1_to_v3.2.sql: Variable for SQL custom reports has more size now (custom SQL reports could be huge SQL sentences). * godmode/reporting/reporting_builder.php, godmode/reporting/reporting_builder.item_editor.php: Added suppor for the new SQL graph reports (vbar, hbar and pie). * include/fgraph.php: Support for new SQL graphs, with new function graph_custom_sql_graph(). * include/functions_reporting.php: Support for new SQL graphs. * operation/reporting/reporting_xml.php: Fixed some problems and added support for graphs using session_id. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3413 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
bced419f7e
commit
c7200075b2
|
@ -1,3 +1,20 @@
|
|||
2010-10-16 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* pandoradb_migrate_v3.1_to_v3.2.sql: Variable for SQL custom reports has
|
||||
more size now (custom SQL reports could be huge SQL sentences).
|
||||
|
||||
* godmode/reporting/reporting_builder.php,
|
||||
godmode/reporting/reporting_builder.item_editor.php: Added suppor for the
|
||||
new SQL graph reports (vbar, hbar and pie).
|
||||
|
||||
* include/fgraph.php: Support for new SQL graphs, with new function
|
||||
graph_custom_sql_graph().
|
||||
|
||||
* include/functions_reporting.php: Support for new SQL graphs.
|
||||
|
||||
* operation/reporting/reporting_xml.php: Fixed some problems and added
|
||||
support for graphs using session_id.
|
||||
|
||||
2010-10-15 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* pandoradb.sql: Added support for recon scripts.
|
||||
|
|
|
@ -35,6 +35,7 @@ ALTER TABLE `treport_content` ADD COLUMN `thursday` tinyint(1) default 1;
|
|||
ALTER TABLE `treport_content` ADD COLUMN `friday` tinyint(1) default 1;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `saturday` tinyint(1) default 1;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `sunday` tinyint(1) default 1;
|
||||
ALTER TABLE `treport_content` MODIFY external_source TEXT default NULL;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tnetwork_map`
|
||||
|
|
|
@ -132,6 +132,21 @@ switch ($action) {
|
|||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$header = $item['header_definition'];
|
||||
break;
|
||||
case 'sql_graph_pie':
|
||||
$description = $item['description'];
|
||||
$sql = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
break;
|
||||
case 'sql_graph_vbar':
|
||||
$description = $item['description'];
|
||||
$sql = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
break;
|
||||
case 'sql_graph_hbar':
|
||||
$description = $item['description'];
|
||||
$sql = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
break;
|
||||
case 'url':
|
||||
$description = $item['description'];
|
||||
$url = $item['column_separator'];
|
||||
|
@ -647,6 +662,24 @@ function chooseType() {
|
|||
$("#row_custom").css('display', '');
|
||||
$("#row_custom_example").css('display', '');
|
||||
break;
|
||||
case 'sql_graph_pie':
|
||||
$("#row_description").css('display', '');
|
||||
$("#row_query").css('display', '');
|
||||
$("#row_custom").css('display', '');
|
||||
$("#row_custom_example").css('display', '');
|
||||
break;
|
||||
case 'sql_graph_hbar':
|
||||
$("#row_description").css('display', '');
|
||||
$("#row_query").css('display', '');
|
||||
$("#row_custom").css('display', '');
|
||||
$("#row_custom_example").css('display', '');
|
||||
break;
|
||||
case 'sql_graph_vbar':
|
||||
$("#row_description").css('display', '');
|
||||
$("#row_query").css('display', '');
|
||||
$("#row_custom").css('display', '');
|
||||
$("#row_custom_example").css('display', '');
|
||||
break;
|
||||
case 'url':
|
||||
$("#row_description").css('display', '');
|
||||
$("#row_url").css('display', '');
|
||||
|
|
|
@ -181,7 +181,7 @@ switch ($action) {
|
|||
$values['time_from'] = get_parameter('time_from');
|
||||
$values['time_to'] = get_parameter('time_to');
|
||||
|
||||
if ($values['type'] == 'sql') {
|
||||
if (($values['type'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')OR ($values['type'] == 'sql_graph_vbar') OR ($values['type'] == 'sql_graph_pie')) {
|
||||
$values['treport_custom_sql_id'] = get_parameter('id_custom');
|
||||
if ($values['treport_custom_sql_id'] == 0) {
|
||||
$values['external_source'] = get_parameter('sql');
|
||||
|
@ -220,13 +220,14 @@ switch ($action) {
|
|||
$values['time_from'] = get_parameter('time_from');
|
||||
$values['time_to'] = get_parameter('time_to');
|
||||
|
||||
if ($values['type'] == 'sql') {
|
||||
if (($values['type'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')OR ($values['type'] == 'sql_graph_vbar') OR ($values['type'] == 'sql_graph_pie')) {
|
||||
|
||||
$values['treport_custom_sql_id'] = get_parameter('id_custom');
|
||||
if ($values['treport_custom_sql_id'] == 0) {
|
||||
$values['external_source'] = get_parameter('sql');
|
||||
}
|
||||
}
|
||||
else if ($values['type'] == 'url') {
|
||||
elseif ($values['type'] == 'url') {
|
||||
$values['external_source'] = get_parameter('url');
|
||||
}
|
||||
else if ($values['type'] == 'event_report_group') {
|
||||
|
|
|
@ -2623,6 +2623,51 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=
|
|||
return "$n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a custom SQL-defined graph
|
||||
*
|
||||
* @param integer ID of report content, used to get SQL code to get information for graph
|
||||
* @param integer height graph height
|
||||
* @param integer width graph width
|
||||
* @param integer Graph type 1 vbar, 2 hbar, 3 pie
|
||||
*/
|
||||
function graph_custom_sql_graph ($id, $width, $height, $type = 1) {
|
||||
global $config;
|
||||
|
||||
$report_content = get_db_row ('treport_content', 'id_rc', $id);
|
||||
if ($report_content["external_source"] != ""){
|
||||
$sql = safe_output ($report_content["external_source"]);
|
||||
}
|
||||
else {
|
||||
$sql = get_db_sql (sprintf ("SELECT sql FROM treport_custom_sql WHERE id = %d",$report_content["treport_custom_sql_id"]));
|
||||
}
|
||||
|
||||
$data_result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($data_result === false)
|
||||
$data_result = array ();
|
||||
|
||||
$data = array ();
|
||||
|
||||
foreach ($data_result as $data_item) {
|
||||
$data[$data_item["label"]] = $data_item["value"];
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 1: // vertical bar
|
||||
generic_vertical_bar_graph ($width, $height, $data);
|
||||
break;
|
||||
case 2: // horizontal bar
|
||||
generic_horizontal_bar_graph ($width, $height, $data);
|
||||
break;
|
||||
case 3: // Pie
|
||||
generic_pie_graph ($width, $height, $data);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function myErrorHandler($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
switch ($errno) {
|
||||
|
@ -2688,6 +2733,7 @@ $date = get_parameter ("date");
|
|||
$graphic_type = (string) get_parameter ('tipo');
|
||||
$mode = get_parameter ("mode", 1);
|
||||
$url = get_parameter ("url");
|
||||
$report_id = (int) get_parameter ("report_id", 0);
|
||||
|
||||
if ($graphic_type) {
|
||||
switch ($graphic_type) {
|
||||
|
@ -2801,6 +2847,18 @@ if ($graphic_type) {
|
|||
grafico_modulo_log4x ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
|
||||
break;
|
||||
|
||||
case 'sql_graph_vbar':
|
||||
graph_custom_sql_graph ($report_id, $width, $height, 1);
|
||||
break;
|
||||
|
||||
case 'sql_graph_hbar':
|
||||
graph_custom_sql_graph ($report_id, $width, $height, 2);
|
||||
break;
|
||||
|
||||
case 'sql_graph_pie':
|
||||
graph_custom_sql_graph ($report_id, $width, $height, 3);
|
||||
break;
|
||||
|
||||
case 'graphic_error':
|
||||
default:
|
||||
graphic_error ();
|
||||
|
|
|
@ -630,6 +630,9 @@ function get_report_types () {
|
|||
//$types['agent_detailed'] = __('Agent detailed view');
|
||||
$types['text'] = __('Text');
|
||||
$types['sql'] = __('SQL query');
|
||||
$types['sql_graph_vbar'] = __('SQL vertical bar graph');
|
||||
$types['sql_graph_pie'] = __('SQL pie graph');
|
||||
$types['sql_graph_hbar'] = __('SQL horizonal bar graph');
|
||||
$types['url'] = __('Import text from URL');
|
||||
$types['database_serialized'] = __('Serialize data');
|
||||
$types['TTRT'] = __('TTRT');
|
||||
|
|
|
@ -1996,6 +1996,39 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
$cellContent = print_table($table2, true);
|
||||
array_push($table->data, array($cellContent));
|
||||
break;
|
||||
|
||||
case 'sql_graph_pie':
|
||||
case 'sql_graph_vbar':
|
||||
case 'sql_graph_hbar':
|
||||
$data = array();
|
||||
$data[0] = $sizh. __('User defined graph') . " (".__($content["type"]) .")". $sizhfin;
|
||||
array_push ($table->data, $data);
|
||||
$table->colspan[0][0] = 2;
|
||||
|
||||
// Put description at the end of the module (if exists)
|
||||
if ($content["description"] != ""){
|
||||
$table->colspan[0][0] = 2;
|
||||
$data_desc = array();
|
||||
$data_desc[0] = $content["description"];
|
||||
array_push ($table->data, $data_desc);
|
||||
}
|
||||
|
||||
$table2->class = 'databox';
|
||||
$table2->width = '100%';
|
||||
|
||||
//Create the head
|
||||
$table2->head = array();
|
||||
if ($content['header_definition'] != '') {
|
||||
$table2->head = explode('|', $content['header_definition']);
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<img src="include/fgraph.php?tipo='.$content["type"].'&report_id='.$content["id_rc"].'&width='.$sizgraph_w.'&pure=1" border="0" alt="">';
|
||||
|
||||
array_push($table->data, $data);
|
||||
break;
|
||||
|
||||
case 'event_report_group':
|
||||
$data = array ();
|
||||
$data[0] = $sizh . __('Group detailed event') . $sizhfin;
|
||||
|
@ -2014,6 +2047,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
$data[0] = get_group_detailed_event_reporting($content['id_agent'], $content['period'], $report["datetime"], true);
|
||||
array_push ($table->data, $data);
|
||||
break;
|
||||
|
||||
case 'event_report_module':
|
||||
$data = array ();
|
||||
$data[0] = $sizh. __('Module detailed event') . $sizhfin;
|
||||
|
|
|
@ -147,10 +147,10 @@ echo '<generated><unix>'.$time.'</unix>';
|
|||
echo '<rfc2822>'.date ("r",$time).'</rfc2822></generated>';
|
||||
|
||||
$xml["id"] = $id_report;
|
||||
$xml["name"] = $report['name'];
|
||||
$xml["description"] = $report['description'];
|
||||
$xml["name"] = safe_output_xml ($report['name']);
|
||||
$xml["description"] = safe_output_xml($report['description']);
|
||||
$xml["group"]["id"] = $report['id_group'];
|
||||
$xml["group"]["name"] = $group_name;
|
||||
$xml["group"]["name"] = safe_output_xml ($group_name);
|
||||
|
||||
if ($contents === false) {
|
||||
$contents = array ();
|
||||
|
@ -164,17 +164,19 @@ $counter = 0;
|
|||
foreach ($contents as $content) {
|
||||
echo '<object id="'.$counter.'">';
|
||||
$data = array ();
|
||||
$data["module"] = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
|
||||
$data["agent"] = get_agentmodule_agent_name ($content['id_agent_module']);
|
||||
$data["module"] = safe_output_xml (get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']));
|
||||
$data["agent"] = safe_output_xml (get_agentmodule_agent_name ($content['id_agent_module']));
|
||||
$data["period"] = human_time_description ($content['period']);
|
||||
$data["uperiod"] = $content['period'];
|
||||
$data["type"] = $content["type"];
|
||||
|
||||
$session_id = session_id();
|
||||
|
||||
switch ($content["type"]) {
|
||||
case 1:
|
||||
case 'simple_graph':
|
||||
$data["title"] = __('Simple graph');
|
||||
$data["objdata"]["img"] = 'include/fgraph.php?tipo=sparse&id='.$content['id_agent_module'].'&height=230&width=720&period='.$content['period'].'&date='.$datetime.'&avg_only=1&pure=1';
|
||||
$data["objdata"]["img"] = 'include/fgraph.php?PHPSESSID='.$session_id.'&tipo=sparse&id='.$content['id_agent_module'].'&height=230&width=720&period='.$content['period'].'&date='.$datetime.'&avg_only=1&pure=1';
|
||||
break;
|
||||
case 2:
|
||||
case 'custom_graph':
|
||||
|
@ -195,7 +197,7 @@ foreach ($contents as $content) {
|
|||
array_push ($weights, $content2["weight"]);
|
||||
}
|
||||
|
||||
$data["objdata"]["img"] = 'include/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height=230&width=720&period='.$content['period'].'&date='.$datetime.'&stacked='.$graph["stacked"].'&pure=1';
|
||||
$data["objdata"]["img"] = 'include/fgraph.php?PHPSESSID='.$session_id.'&tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height=230&width=720&period='.$content['period'].'&date='.$datetime.'&stacked='.$graph["stacked"].'&pure=1';
|
||||
break;
|
||||
case 3:
|
||||
case 'SLA':
|
||||
|
|
Loading…
Reference in New Issue