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:
parent
8bf03bfc74
commit
9797812417
|
@ -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>
|
2008-06-26 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* images/console/background/africa.jpg,
|
* images/console/background/africa.jpg,
|
||||||
|
|
|
@ -384,12 +384,12 @@ function gime_idgroup_from_idevent ($id_event) {
|
||||||
/**
|
/**
|
||||||
* Get name of an agent.
|
* Get name of an agent.
|
||||||
*
|
*
|
||||||
* @param id_agente Agent id.
|
* @param id_agent Agent id.
|
||||||
*
|
*
|
||||||
* @return Name of the given agent.
|
* @return Name of the given agent.
|
||||||
*/
|
*/
|
||||||
function dame_nombre_agente ($id_agente) {
|
function dame_nombre_agente ($id_agent) {
|
||||||
return (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agente);
|
return (string) get_db_value ('nombre', 'tagente', 'id_agente', (int) $id_agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -428,9 +428,98 @@ 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_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 agent_detailed_reporting ($id_agent, $period = 0, $date = 0, $return = false) {
|
||||||
|
$output = '';
|
||||||
|
$n_a_string = lang_string ('N/A').'(*)';
|
||||||
|
$monitors = array ();
|
||||||
|
$table_modules->data = array ();
|
||||||
|
$table_modules->head = array ();
|
||||||
|
$table_alerts->data = array ();
|
||||||
|
|
||||||
|
/* Show modules in agent */
|
||||||
|
$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) {
|
||||||
|
if ($module['descripcion'] != $n_a_string && $module['descripcion'] != '')
|
||||||
|
$data[0] = $module['descripcion'];
|
||||||
|
else
|
||||||
|
$data[0] = $module['nombre'];
|
||||||
|
$module_name = giveme_module_type ($module['id_tipo_modulo']);
|
||||||
|
if (is_module_proc ($module_name)) {
|
||||||
|
array_push ($monitors, $module);
|
||||||
|
}
|
||||||
|
array_push ($table_modules->data, $data);
|
||||||
|
}
|
||||||
|
$output .= print_table ($table_modules, true);
|
||||||
|
|
||||||
|
/* Show alerts in agent */
|
||||||
|
$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) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$alert_type = get_db_row ('talerta', 'id_alerta', $alert['id_alerta']);
|
||||||
|
$data = array ();
|
||||||
|
$data[0] = $alert_type['nombre'];
|
||||||
|
$data[1] = $alert['descripcion'];
|
||||||
|
$data[2] = $alert['dis_min'];
|
||||||
|
$data[3] = $alert['dis_max'];
|
||||||
|
$data[4] = $alert['time_threshold'];
|
||||||
|
$data[5] = get_alert_last_fire_timestamp_in_period ($alert['id_agente_modulo'], $period, $date);
|
||||||
|
$data[6] = $fires;
|
||||||
|
|
||||||
|
array_push ($table_alerts->data, $data);
|
||||||
|
}
|
||||||
|
if (sizeof ($table_alerts->data)) {
|
||||||
|
$output .= '<h4>'.lang_string ('alerts').'</h4>';
|
||||||
|
$output .= print_table ($table_alerts, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show monitor status in agent (if any) */
|
||||||
|
if (sizeof ($monitors) == 0) {
|
||||||
|
$output .= '</div>';
|
||||||
|
if (! $return)
|
||||||
|
echo $output;
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
$table_monitors->data = array ();
|
||||||
|
foreach ($monitors as $monitor) {
|
||||||
|
$downs = get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date);
|
||||||
|
if (! $downs) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$data = array ();
|
||||||
|
if ($monitor['descripcion'] != $n_a_string && $monitor['descripcion'] != '')
|
||||||
|
$data[0] = $monitor['descripcion'];
|
||||||
|
else
|
||||||
|
$data[0] = $monitor['nombre'];
|
||||||
|
$data[1] = get_monitor_last_down_timestamp_in_period ($monitor['id_agente_modulo'], $period, $date);
|
||||||
|
array_push ($table_monitors->data, $data);
|
||||||
|
}
|
||||||
|
if (sizeof ($table_monitors->data)) {
|
||||||
|
$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 $id_group Group to get the report
|
||||||
* @param $return Flag to return or echo the report (by default).
|
* @param $return Flag to return or echo the report (by default).
|
||||||
|
@ -439,9 +528,9 @@ function agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return =
|
||||||
$output = '';
|
$output = '';
|
||||||
$agents = get_agents_in_group ($id_group);
|
$agents = get_agents_in_group ($id_group);
|
||||||
|
|
||||||
$table_modules->width = '750px';
|
$table_modules->width = '700px';
|
||||||
$table_alerts->width = '750px';
|
$table_alerts->width = '700px';
|
||||||
$table_monitors->width = '750px';
|
$table_monitors->width = '700px';
|
||||||
$table_monitors->align = array ();
|
$table_monitors->align = array ();
|
||||||
$table_monitors->align[1] = 'right';
|
$table_monitors->align[1] = 'right';
|
||||||
$table_monitors->head = array ();
|
$table_monitors->head = array ();
|
||||||
|
@ -457,77 +546,12 @@ function agents_detailed_reporting ($id_group, $period = 0, $date = 0, $return =
|
||||||
$table_alerts->head[6] = lang_string ('times_fired');
|
$table_alerts->head[6] = lang_string ('times_fired');
|
||||||
|
|
||||||
$agents = get_agents_in_group ($id_group);
|
$agents = get_agents_in_group ($id_group);
|
||||||
$n_a_string = lang_string ('N/A').'(*)';
|
|
||||||
foreach ($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
$monitors = array ();
|
$output .= agent_detailed_reporting ($agent['id_agente'], $period, $date, true);
|
||||||
$table_modules->data = array ();
|
if (!$return) {
|
||||||
$table_modules->head = array ();
|
echo $output;
|
||||||
$table_alerts->data = array ();
|
$output = '';
|
||||||
|
flush ();
|
||||||
$modules = get_modules_in_agent ($agent['id_agente']);
|
|
||||||
|
|
||||||
/* Show modules in agent */
|
|
||||||
$output .= '<h3>'.lang_string ('agent').' - '.$agent['nombre'].'</h3>';
|
|
||||||
$output .= '<h4>'.lang_string ('modules').'</h3>';
|
|
||||||
$data = array ();
|
|
||||||
foreach ($modules as $module) {
|
|
||||||
if ($module['descripcion'] != $n_a_string && $module['descripcion'] != '')
|
|
||||||
$data[0] = $module['descripcion'];
|
|
||||||
else
|
|
||||||
$data[0] = $module['nombre'];
|
|
||||||
$module_name = giveme_module_type ($module['id_tipo_modulo']);
|
|
||||||
if (is_module_proc ($module_name)) {
|
|
||||||
array_push ($monitors, $module);
|
|
||||||
}
|
|
||||||
array_push ($table_modules->data, $data);
|
|
||||||
}
|
|
||||||
$output .= print_table ($table_modules, true);
|
|
||||||
|
|
||||||
/* Show alerts in agent */
|
|
||||||
$alerts = get_alerts_in_agent ($agent['id_agente']);
|
|
||||||
foreach ($alerts as $alert) {
|
|
||||||
$fires = get_alert_fires_in_period ($alert['id_agente_modulo'], $period, $date);
|
|
||||||
if (! $fires) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$alert_type = get_db_row ('talerta', 'id_alerta', $alert['id_alerta']);
|
|
||||||
$data = array ();
|
|
||||||
$data[0] = $alert_type['nombre'];
|
|
||||||
$data[1] = $alert['descripcion'];
|
|
||||||
$data[2] = $alert['dis_min'];
|
|
||||||
$data[3] = $alert['dis_max'];
|
|
||||||
$data[4] = $alert['time_threshold'];
|
|
||||||
$data[5] = get_alert_last_fire_timestamp_in_period ($alert['id_agente_modulo'], $period, $date);
|
|
||||||
$data[6] = $fires;
|
|
||||||
|
|
||||||
array_push ($table_alerts->data, $data);
|
|
||||||
}
|
|
||||||
if (sizeof ($table_alerts->data)) {
|
|
||||||
$output .= '<h4>'.lang_string ('alerts').'</h4>';
|
|
||||||
$output .= print_table ($table_alerts, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Show monitor status in agent (if any) */
|
|
||||||
if (sizeof ($monitors) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$table_monitors->data = array ();
|
|
||||||
foreach ($monitors as $monitor) {
|
|
||||||
$downs = get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date);
|
|
||||||
if (! $downs) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$data = array ();
|
|
||||||
if ($monitor['descripcion'] != $n_a_string && $monitor['descripcion'] != '')
|
|
||||||
$data[0] = $monitor['descripcion'];
|
|
||||||
else
|
|
||||||
$data[0] = $monitor['nombre'];
|
|
||||||
$data[1] = get_monitor_last_down_timestamp_in_period ($monitor['id_agente_modulo'], $period, $date);
|
|
||||||
array_push ($table_monitors->data, $data);
|
|
||||||
}
|
|
||||||
if (sizeof ($table_monitors->data)) {
|
|
||||||
$output .= '<h4>'.lang_string ('monitors').'</h4>';
|
|
||||||
$output .= print_table ($table_monitors, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -717,3 +717,12 @@ div#main_pure {
|
||||||
float: left;
|
float: left;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.agent_reporting {
|
||||||
|
margin: 5px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report_table, .agent_reporting {
|
||||||
|
border: #CCC outset 3px;
|
||||||
|
}
|
||||||
|
|
|
@ -113,19 +113,18 @@ if ($datetime > time ()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data = array ();
|
|
||||||
$table->size = array ();
|
$table->size = array ();
|
||||||
$table->style = array ();
|
$table->style = array ();
|
||||||
$table->width = '750px';
|
$table->width = '750px';
|
||||||
$table->class = 'databox';
|
$table->class = 'databox report_table';
|
||||||
$table->rowclasses = array ();
|
$table->rowclasses = array ();
|
||||||
|
|
||||||
$group_name = dame_grupo ($report['id_group']);
|
$group_name = dame_grupo ($report['id_group']);
|
||||||
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
|
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
|
||||||
$contents = get_db_all_rows_sqlfree ($sql);
|
$contents = get_db_all_rows_sqlfree ($sql);
|
||||||
foreach ($contents as $content) {
|
foreach ($contents as $content) {
|
||||||
unset ($modules);
|
$table->data = array ();
|
||||||
unset ($weights);
|
|
||||||
$module_name = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
|
$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']);
|
$agent_name = dame_nombre_agente_agentemodulo ($content['id_agent_module']);
|
||||||
|
|
||||||
|
@ -155,7 +154,7 @@ foreach ($contents as $content) {
|
||||||
while ($content2 = mysql_fetch_array($res2)) {
|
while ($content2 = mysql_fetch_array($res2)) {
|
||||||
$weight = $content2["weight"];
|
$weight = $content2["weight"];
|
||||||
$content['id_agent_module'] = $content2["id_agent_module"];
|
$content['id_agent_module'] = $content2["id_agent_module"];
|
||||||
if (!isset($modules)){
|
if (!isset ($modules)) {
|
||||||
$modules = $content['id_agent_module'];
|
$modules = $content['id_agent_module'];
|
||||||
$weights = $weight;
|
$weights = $weight;
|
||||||
} else {
|
} else {
|
||||||
|
@ -163,6 +162,8 @@ foreach ($contents as $content) {
|
||||||
$weights = $weights.",".$weight;
|
$weights = $weights.",".$weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unset ($modules);
|
||||||
|
unset ($weights);
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$data[0] = '<h4>'.lang_string ('custom_graph').'</h4>';
|
$data[0] = '<h4>'.lang_string ('custom_graph').'</h4>';
|
||||||
$data[1] = "<h4>".$graph["name"]."</h4>";
|
$data[1] = "<h4>".$graph["name"]."</h4>";
|
||||||
|
@ -381,8 +382,8 @@ foreach ($contents as $content) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
print_table ($table);
|
||||||
|
flush ();
|
||||||
}
|
}
|
||||||
|
|
||||||
print_table ($table);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue