2008-06-27 Esteban Sanchez <estebans@artica.es>

* include/functions_db.php: Renamed variable from spanish.

        * include/functions_reporting.php: Splitted 
        agents_detailed_reporting() into agent_detailed_reporting() so now
        it's possible to get the report of a single agent. Also the table
        width of this report was reduced a bit to fit well in the console.

        * include/styles/pandora.css: Added style to agent reportings,
        basically a border.

        * operation/reporting/reporting_viewer.php: Separate each report into
        its own table. Flush the result to improve speed. Style correction.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@902 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2008-06-27 08:06:28 +00:00
parent 935e13dfe6
commit 079c147e8b
5 changed files with 134 additions and 85 deletions

View File

@ -1,3 +1,18 @@
2008-06-27 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Renamed variable from spanish.
* include/functions_reporting.php: Splitted
agents_detailed_reporting() into agent_detailed_reporting() so now
it's possible to get the report of a single agent. Also the table
width of this report was reduced a bit to fit well in the console.
* include/styles/pandora.css: Added style to agent reportings,
basically a border.
* operation/reporting/reporting_viewer.php: Separate each report into
its own table. Flush the result to improve speed. Style correction.
2008-06-26 Esteban Sanchez <estebans@artica.es>
* images/console/background/africa.jpg,

View File

@ -384,12 +384,12 @@ function gime_idgroup_from_idevent ($id_event) {
/**
* Get name of an agent.
*
* @param id_agente Agent id.
* @param id_agent Agent id.
*
* @return Name of the given agent.
*/
function dame_nombre_agente ($id_agente) {
return (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agente);
function dame_nombre_agente ($id_agent) {
return (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agent);
}
/**

View File

@ -428,46 +428,25 @@ function general_group_reporting ($id_group, $return = false) {
}
/**
* Get a detailed report of agents in a group.
* Get a detailed report of an agent
*
* It
*
* @param $id_group Group to get the report
* @param $id_agent Agent to get the report.
* @param $period Period of time of the desired report.
* @param $date Beggining date of the report (current date by default).
* @param $return Flag to return or echo the report (by default).
*/
function agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return = false) {
function agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $return = false) {
$output = '';
$agents = get_agents_in_group ($id_group);
$table_modules->width = '750px';
$table_alerts->width = '750px';
$table_monitors->width = '750px';
$table_monitors->align = array ();
$table_monitors->align[1] = 'right';
$table_monitors->head = array ();
$table_monitors->head[0] = lang_string ('monitor');
$table_monitors->head[1] = lang_string ('last_failure');
$table_alerts->head = array ();
$table_alerts->head[0] = lang_string ('type');
$table_alerts->head[1] = lang_string ('description');
$table_alerts->head[2] = lang_string ('min');
$table_alerts->head[3] = lang_string ('max');
$table_alerts->head[4] = lang_string ('threshold');
$table_alerts->head[5] = lang_string ('last_fired');
$table_alerts->head[6] = lang_string ('times_fired');
$agents = get_agents_in_group ($id_group);
$n_a_string = lang_string ('N/A').'(*)';
foreach ($agents as $agent) {
$monitors = array ();
$table_modules->data = array ();
$table_modules->head = array ();
$table_alerts->data = array ();
$modules = get_modules_in_agent ($agent['id_agente']);
/* Show modules in agent */
$output .= '<h3>'.lang_string ('agent').' - '.$agent['nombre'].'</h3>';
$modules = get_modules_in_agent ($id_agent);
$output .= '<div class="agent_reporting">';
$output .= '<h3 style="text-decoration: underline">'.lang_string ('agent').' - '.dame_nombre_agente ($id_agent).'</h3>';
$output .= '<h4>'.lang_string ('modules').'</h3>';
$data = array ();
foreach ($modules as $module) {
@ -484,7 +463,7 @@ function agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return =
$output .= print_table ($table_modules, true);
/* Show alerts in agent */
$alerts = get_alerts_in_agent ($agent['id_agente']);
$alerts = get_alerts_in_agent ($id_agent);
foreach ($alerts as $alert) {
$fires = get_alert_fires_in_period ($alert['id_agente_modulo'], $period, $date);
if (! $fires) {
@ -509,7 +488,10 @@ function agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return =
/* Show monitor status in agent (if any) */
if (sizeof ($monitors) == 0) {
continue;
$output .= '</div>';
if (! $return)
echo $output;
return $output;
}
$table_monitors->data = array ();
foreach ($monitors as $monitor) {
@ -529,6 +511,48 @@ function agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return =
$output .= '<h4>'.lang_string ('monitors').'</h4>';
$output .= print_table ($table_monitors, true);
}
$output .= '</div>';
if (! $return)
echo $output;
return $output;
}
/**
* Get a detailed report of agents in a group.
*
* @param $id_group Group to get the report
* @param $return Flag to return or echo the report (by default).
*/
function agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return = false) {
$output = '';
$agents = get_agents_in_group ($id_group);
$table_modules->width = '700px';
$table_alerts->width = '700px';
$table_monitors->width = '700px';
$table_monitors->align = array ();
$table_monitors->align[1] = 'right';
$table_monitors->head = array ();
$table_monitors->head[0] = lang_string ('monitor');
$table_monitors->head[1] = lang_string ('last_failure');
$table_alerts->head = array ();
$table_alerts->head[0] = lang_string ('type');
$table_alerts->head[1] = lang_string ('description');
$table_alerts->head[2] = lang_string ('min');
$table_alerts->head[3] = lang_string ('max');
$table_alerts->head[4] = lang_string ('threshold');
$table_alerts->head[5] = lang_string ('last_fired');
$table_alerts->head[6] = lang_string ('times_fired');
$agents = get_agents_in_group ($id_group);
foreach ($agents as $agent) {
$output .= agent_detailed_reporting ($agent['id_agente'], $period, $date, true);
if (!$return) {
echo $output;
$output = '';
flush ();
}
}
if (!$return)

View File

@ -717,3 +717,12 @@ div#main_pure {
float: left;
width: 300px;
}
.agent_reporting {
margin: 5px;
padding: 5px;
}
.report_table, .agent_reporting {
border: #CCC outset 3px;
}

View File

@ -113,19 +113,18 @@ if ($datetime > time ()) {
return;
}
$table->data = array ();
$table->size = array ();
$table->style = array ();
$table->width = '750px';
$table->class = 'databox';
$table->class = 'databox report_table';
$table->rowclasses = array ();
$group_name = dame_grupo ($report['id_group']);
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
$contents = get_db_all_rows_sqlfree ($sql);
foreach ($contents as $content) {
unset ($modules);
unset ($weights);
$table->data = array ();
$module_name = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
$agent_name = dame_nombre_agente_agentemodulo ($content['id_agent_module']);
@ -163,6 +162,8 @@ foreach ($contents as $content) {
$weights = $weights.",".$weight;
}
}
unset ($modules);
unset ($weights);
$data = array ();
$data[0] = '<h4>'.lang_string ('custom_graph').'</h4>';
$data[1] = "<h4>".$graph["name"]."</h4>";
@ -381,8 +382,8 @@ foreach ($contents as $content) {
break;
}
print_table ($table);
flush ();
}
print_table ($table);
?>