2009-12-22 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_html.php: add debug function "f2str" that return as
	string any call of function, for example "var_dump".
	
	*include/fgraph.php: into function "grafico_modulo_boolean" re-add alarms,
	clean source code and show again the flash graph.
	
	*include/functions_db.php: fix the access to IP client, it used very
	deprecate var, that clean of notice php message of error for this cause.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2229 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-12-22 12:56:46 +00:00
parent 4b70e70e41
commit 7458f10b93
4 changed files with 58 additions and 14 deletions

View File

@ -1,3 +1,14 @@
2009-12-22 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: add debug function "f2str" that return as
string any call of function, for example "var_dump".
*include/fgraph.php: into function "grafico_modulo_boolean" re-add alarms,
clean source code and show again the flash graph.
*include/functions_db.php: fix the access to IP client, it used very
deprecate var, that clean of notice php message of error for this cause.
2009-12-21 Ramon Novoa <rnovoa@artica.es>
* include/api.php: Added an Enterprise API.

View File

@ -1233,8 +1233,7 @@ function grafico_modulo_boolean ($idModuleAgent, $period, $show_event,
$date = 0 ) {
global $config;
global $graphic_type;
/******WIP****************************************/
$nameAgent = get_agentmodule_agent_name ($idModuleAgent);
$idAgent = get_agent_id ($nameAgent);
$nameModule = get_agentmodule_name ($idModuleAgent);
@ -1246,9 +1245,23 @@ function grafico_modulo_boolean ($idModuleAgent, $period, $show_event,
$interval = (int) ($period / $resolution);
//TODO
//EVENTS AND ALERTS
//NEEED TO CODE
if ($show_event == 1)
$real_event = array ();
if ($show_alert == 1) {
$alert_high = false;
$alert_low = false;
// If we want to show alerts limits
$alert_high = get_db_value ('MAX(max_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo, true);
$alert_low = get_db_value ('MIN(min_value)', 'talert_template_modules', 'id_agent_module', (int) $id_agente_modulo, true);
// 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;
}
}
$data = get_db_all_rows_filter ('tagente_datos',
array ('id_agente_modulo' => $idModuleAgent,
@ -1313,9 +1326,24 @@ function grafico_modulo_boolean ($idModuleAgent, $period, $show_event,
$max_value = 1;
if (! $graphic_type)
return fs_module_chart ($data, $width, $height, $avg_only, $resolution / 10, $time_format);
//if flash graph
if (! $graphic_type) {
$graphPoints2 = array();
foreach($graphPoints as $time => $value) {
$graphPoints2[] = array(
'sum' => $value,
'count' => 0,
'timestamp_bottom' => $time,
'timestamp_top' => ($time + $interval),
'min' => 1,
'max' => 1,
'last' => 1,
'events' => 0);
}
return fs_module_chart ($graphPoints2, $width, $height, $avg_only, $resolution / 10, $time_format);
}
$engine = get_graph_engine ($period);
$engine->width = $width;
@ -1337,10 +1365,7 @@ function grafico_modulo_boolean ($idModuleAgent, $period, $show_event,
$engine->single_graph ();
return;
/******WIP****************************************/
}
}
/**
* Draw a graph of Module data of agent

View File

@ -1514,7 +1514,7 @@ function agent_delete_address ($id_agent, $ip_address) {
process_sql ($sql);
}
$agent_name = get_agent_name($id_agent, "");
audit_db ($config['id_user'], $REMOTE_ADDR, "Agent management",
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management",
"Deleted IP $ip_address from agent '$agent_name'");
// Need to change main address?
@ -2935,7 +2935,7 @@ function delete_agent ($id_agents, $disableACL = false) {
//And at long last, the agent
temp_sql_delete ("tagente", "id_agente", $id_agent);
audit_db ($config['id_user'], $REMOTE_ADDR, "Agent management",
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "Agent management",
"Deleted agent '$agent_name'");

View File

@ -40,6 +40,14 @@ function debugPrint ($var, $file = '') {
}
}
function f2str($function, $params) {
ob_start();
call_user_func_array($function, $params);
return ob_get_clean();
}
/**
* Prints an array of fields in a popup menu of a form.