2009-03-12 Esteban Sanchez <estebans@artica.es>

* reporting/fgraph.php: Fixed interval in combined graphs. Fixed
	alert min and max values. Fixed data retrieval on boolean charts and a
	bug that was not drawing this charts.
	
	* pandoradb_data.sql: First new now has the current date.

	* operation/servers/view_server.php: Fixed progress bar height.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1528 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2009-03-12 13:25:15 +00:00
parent 547ba76b63
commit d3f2415ae0
4 changed files with 44 additions and 39 deletions

View File

@ -1,3 +1,13 @@
2009-03-12 Esteban Sanchez <estebans@artica.es>
* reporting/fgraph.php: Fixed interval in combined graphs. Fixed
alert min and max values. Fixed data retrieval on boolean charts and a
bug that was not drawing this charts.
* pandoradb_data.sql: First new now has the current date.
* operation/servers/view_server.php: Fixed progress bar height.
2009-03-12 Esteban Sanchez <estebans@artica.es> 2009-03-12 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Fixed an undefined variable error. * include/functions_db.php: Fixed an undefined variable error.

View File

@ -86,7 +86,7 @@ foreach ($servers as $server) {
$load_percent = 0; $load_percent = 0;
if ($load_percent > 100) if ($load_percent > 100)
$load_percent = 100; $load_percent = 100;
$data[2] = '<img src="reporting/fgraph.php?tipo=progress&percent='.$load_percent.'&height=18&width=80">'; $data[2] = '<img src="reporting/fgraph.php?tipo=progress&percent='.$load_percent.'&height=20&width=80">';
$data[3] = $serverinfo["modules"] . " ".__('of')." ". $total_modules; $data[3] = $serverinfo["modules"] . " ".__('of')." ". $total_modules;
$data[4] = human_time_description_raw ($serverinfo["lag"]) . " / ". $serverinfo["module_lag"]; $data[4] = human_time_description_raw ($serverinfo["lag"]) . " / ". $serverinfo["module_lag"];
$data[5] = ''; $data[5] = '';

View File

@ -245,7 +245,7 @@ INSERT INTO `tusuario_perfil` VALUES (1,'admin',5,1,'admin');
INSERT INTO `tperfil` VALUES (1,'Operator (Read)',0,1,0,1,0,0,0,0,0,0),(2,'Operator (Write)',1,1,0,1,0,0,0,0,0,0),(3,'Chief Operator',1,1,1,1,0,0,0,0,0,0),(4,'Group coordinator',1,1,1,1,1,1,1,0,0,0),(5,'Pandora Administrator',1,1,1,1,1,1,1,1,1,1); INSERT INTO `tperfil` VALUES (1,'Operator (Read)',0,1,0,1,0,0,0,0,0,0),(2,'Operator (Write)',1,1,0,1,0,0,0,0,0,0),(3,'Chief Operator',1,1,1,1,0,0,0,0,0,0),(4,'Group coordinator',1,1,1,1,1,1,1,0,0,0),(5,'Pandora Administrator',1,1,1,1,1,1,1,1,1,1);
INSERT INTO `tnews` VALUES (1,'admin','Welcome to Pandora FMS 2.0!','This is the new Pandora FMS Console. A lot of new features have been added since last version. Please read the documentation about it, and feel free to test any option.\r\n\r\nThe Pandora FMS Team.','2007-06-22 13:03:20'); INSERT INTO `tnews` VALUES (1,'admin','Welcome to Pandora FMS 2.0!','This is the new Pandora FMS Console. A lot of new features have been added since last version. Please read the documentation about it, and feel free to test any option.\r\n\r\nThe Pandora FMS Team.',NOW());
INSERT INTO tmodule VALUES (1,'Agent module'); INSERT INTO tmodule VALUES (1,'Agent module');
INSERT INTO tmodule VALUES (2,'Network module'); INSERT INTO tmodule VALUES (2,'Network module');

View File

@ -96,7 +96,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$date = get_system_time (); $date = get_system_time ();
$datelimit = $date - $period; // limit date $datelimit = $date - $period; // limit date
$interval = $period / $resolution; // Each interval is $interval seconds length $interval = (int) ($period / $resolution); // Each interval is $interval seconds length
$module_number = count ($module_list); $module_number = count ($module_list);
// interval - This is the number of "rows" we are divided the time to fill data. // interval - This is the number of "rows" we are divided the time to fill data.
@ -151,19 +151,19 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
} }
} }
} }
$alert_high = 0;
$alert_low = 10000000;
if ($show_alert == 1) { if ($show_alert == 1) {
$alert_high = false;
$alert_low = false;
// If we want to show alerts limits // If we want to show alerts limits
$sql = "SELECT * FROM talerta_agente_modulo where id_agente_modulo = ".$id_agente_modulo;
$result = get_db_all_rows_sql ($sql); $alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo);
if ($result === false) $alert_low = get_db_value ('MIN(min_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo);
$result = array ();
foreach ($result as $row) { // if no valid alert defined to render limits, disable it
if ($row["dis_max"] > $alert_high) if (($alert_low === false || $alert_low === NULL) &&
$alert_high = $row["dis_max"]; ($alert_high === false || $alert_high === NULL)) {
if ($row["dis_min"] < $alert_low) $show_alert = 0;
$alert_low = $row["dis_min"];
} }
} }
@ -337,22 +337,17 @@ function grafico_modulo_sparse ($id_agente_modulo, $period, $show_event,
$max_value = max ($max_value, $data[$i]['max']); $max_value = max ($max_value, $data[$i]['max']);
$min_value = min ($min_value, $data[$i]['min']); $min_value = min ($min_value, $data[$i]['min']);
if ($show_alert) { if ($show_alert == 1) {
$alert_high = false; $alert_high = false;
$alert_low = false; $alert_low = false;
// If we want to show alerts limits // If we want to show alerts limits
$alert_high = (int) get_db_value ('MAX(max_value)', $alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo);
'talert_template_modules', $alert_low = get_db_value ('MIN(min_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo);
'id_agent_module',
(int) $id_agente_modulo);
$alert_low = (int) get_db_value ('MIN(max_value)',
'talert_template_modules',
'id_agent_module',
(int) $id_agente_modulo);
// if no valid alert defined to render limits, disable it // if no valid alert defined to render limits, disable it
if (($alert_low == 0) && ($alert_high == 0)) { if (($alert_low === false || $alert_low === NULL) &&
($alert_high === false || $alert_high === NULL)) {
$show_alert = 0; $show_alert = 0;
} }
} }
@ -904,7 +899,7 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
$date = get_system_time (); $date = get_system_time ();
$datelimit = $date - $period; // limit date $datelimit = $date - $period; // limit date
$interval = $period / $resolution; // Each interval is $interval seconds length $interval = (int) ($period / $resolution); // Each interval is $interval seconds length
$nombre_agente = get_agentmodule_agent_name ($id_agente_modulo); $nombre_agente = get_agentmodule_agent_name ($id_agente_modulo);
$id_agente = dame_agente_id ($nombre_agente); $id_agente = dame_agente_id ($nombre_agente);
$nombre_modulo = get_agentmodule_name ($id_agente_modulo); $nombre_modulo = get_agentmodule_name ($id_agente_modulo);
@ -917,8 +912,8 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
$alert_low = false; $alert_low = false;
// If we want to show alerts limits // If we want to show alerts limits
$alert_high = get_db_value ('MAX(dis_max)', 'talerta_agente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); $alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo);
$alert_low = get_db_value ('MIN(dis_min)', 'talerta_agente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); $alert_low = get_db_value ('MIN(min_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo);
// if no valid alert defined to render limits, disable it // if no valid alert defined to render limits, disable it
if (($alert_low === false || $alert_low === NULL) && if (($alert_low === false || $alert_low === NULL) &&
@ -950,7 +945,7 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
foreach ($result as $row) { foreach ($result as $row) {
$utimestamp = $row['utimestamp']; $utimestamp = $row['utimestamp'];
for ($i = 0; $i <= $resolution; $i++) { for ($i = 0; $i <= $resolution; $i++) {
if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']){ if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']) {
$data['events']++; $data['events']++;
} }
} }
@ -958,15 +953,15 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
} }
// Init other general variables // Init other general variables
$max_value = 0; $max_value = 0;
$sql = sprintf ('SELECT datos,utimestamp $all_data = get_db_all_rows_filter ('tagente_datos',
FROM tagente_datos array ('id_agente' => $id_agente,
WHERE id_agente = %d 'id_agente_modulo' => $id_agente_modulo,
AND id_agente_modulo = %d "utimestamp > $datelimit",
AND utimestamp > %d "utimestamp < $date",
ORDER BY utimestamp DESC', 'order' => 'utimestamp ASC'),
$id_agente, $id_agente_modulo, $datelimit); array ('datos', 'utimestamp'));
$all_data = get_db_all_rows_sql ($sql);
if ($all_data === false) { if ($all_data === false) {
$all_data = array (); $all_data = array ();
} }
@ -976,7 +971,6 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
$utimestamp = $module_data["utimestamp"]; $utimestamp = $module_data["utimestamp"];
for ($i = 0; $i <= $resolution; $i++) { for ($i = 0; $i <= $resolution; $i++) {
if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']) { if ($utimestamp <= $data[$i]['timestamp_top'] && $utimestamp >= $data[$i]['timestamp_bottom']) {
/* If the data was down, it has prevalence, so ignore any other loop */
$data[$i]['sum'] += $real_data; $data[$i]['sum'] += $real_data;
$data[$i]['count']++; $data[$i]['count']++;
@ -1032,6 +1026,7 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
$engine->width = $width; $engine->width = $width;
$engine->height = $height; $engine->height = $height;
$engine->data = &$grafica; $engine->data = &$grafica;
$engine->max_value = $max_value;
$engine->legend = array ($nombre_modulo); $engine->legend = array ($nombre_modulo);
$engine->title = ' '.strtoupper ($nombre_agente)." - ".__('Module').' '.$title; $engine->title = ' '.strtoupper ($nombre_agente)." - ".__('Module').' '.$title;
$engine->subtitle = ' '.__('Period').': '.$title_period; $engine->subtitle = ' '.__('Period').': '.$title_period;