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>
* include/functions_db.php: Fixed an undefined variable error.

View File

@ -86,7 +86,7 @@ foreach ($servers as $server) {
$load_percent = 0;
if ($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[4] = human_time_description_raw ($serverinfo["lag"]) . " / ". $serverinfo["module_lag"];
$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 `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 (2,'Network module');

View File

@ -96,7 +96,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
$date = get_system_time ();
$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);
// 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) {
$alert_high = false;
$alert_low = false;
// 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);
if ($result === false)
$result = array ();
foreach ($result as $row) {
if ($row["dis_max"] > $alert_high)
$alert_high = $row["dis_max"];
if ($row["dis_min"] < $alert_low)
$alert_low = $row["dis_min"];
$alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (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 (($alert_low === false || $alert_low === NULL) &&
($alert_high === false || $alert_high === NULL)) {
$show_alert = 0;
}
}
@ -337,22 +337,17 @@ function grafico_modulo_sparse ($id_agente_modulo, $period, $show_event,
$max_value = max ($max_value, $data[$i]['max']);
$min_value = min ($min_value, $data[$i]['min']);
if ($show_alert) {
if ($show_alert == 1) {
$alert_high = false;
$alert_low = false;
// If we want to show alerts limits
$alert_high = (int) get_db_value ('MAX(max_value)',
'talert_template_modules',
'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);
$alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (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 (($alert_low == 0) && ($alert_high == 0)) {
if (($alert_low === false || $alert_low === NULL) &&
($alert_high === false || $alert_high === NULL)) {
$show_alert = 0;
}
}
@ -904,7 +899,7 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
$date = get_system_time ();
$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);
$id_agente = dame_agente_id ($nombre_agente);
$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;
// 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_low = get_db_value ('MIN(dis_min)', '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(min_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo);
// if no valid alert defined to render limits, disable it
if (($alert_low === false || $alert_low === NULL) &&
@ -959,14 +954,14 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
// Init other general variables
$max_value = 0;
$sql = sprintf ('SELECT datos,utimestamp
FROM tagente_datos
WHERE id_agente = %d
AND id_agente_modulo = %d
AND utimestamp > %d
ORDER BY utimestamp DESC',
$id_agente, $id_agente_modulo, $datelimit);
$all_data = get_db_all_rows_sql ($sql);
$all_data = get_db_all_rows_filter ('tagente_datos',
array ('id_agente' => $id_agente,
'id_agente_modulo' => $id_agente_modulo,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('datos', 'utimestamp'));
if ($all_data === false) {
$all_data = array ();
}
@ -976,7 +971,6 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
$utimestamp = $module_data["utimestamp"];
for ($i = 0; $i <= $resolution; $i++) {
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]['count']++;
@ -1032,6 +1026,7 @@ function grafico_modulo_boolean ($id_agente_modulo, $period, $show_event,
$engine->width = $width;
$engine->height = $height;
$engine->data = &$grafica;
$engine->max_value = $max_value;
$engine->legend = array ($nombre_modulo);
$engine->title = ' '.strtoupper ($nombre_agente)." - ".__('Module').' '.$title;
$engine->subtitle = ' '.__('Period').': '.$title_period;