2009-02-25 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_reporting.php: Thanks to Esteban's functions found out some bad performers. Fixed it * include/auth/ldap.php: Calling get_system_time() 800 times is too much. Moved it to a variable. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1485 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
cbbe1a0b1f
commit
0fa74b5974
|
@ -1,3 +1,11 @@
|
|||
2009-02-25 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* include/functions_reporting.php: Thanks to Esteban's functions found out
|
||||
some bad performers. Fixed it
|
||||
|
||||
* include/auth/ldap.php: Calling get_system_time() 800 times is too much.
|
||||
Moved it to a variable.
|
||||
|
||||
2009-02-25 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/functions_db.php: Do not show errors on sql_error_handler()
|
||||
|
|
|
@ -411,6 +411,7 @@ function get_users ($order = false) {
|
|||
}
|
||||
|
||||
$ldap_cache["cached_users"] = array ();
|
||||
$time = get_system_time ();
|
||||
|
||||
if (ldap_connect_bind ()) {
|
||||
$sr = @ldap_search ($ldap_cache["ds"], $config["auth"]["ldap_base_dn"], $config["auth"]["ldap_user_filter"], array_values ($config["auth"]["ldap_user_attr"]));
|
||||
|
@ -421,7 +422,7 @@ function get_users ($order = false) {
|
|||
$info = @ldap_get_entries( $ldap_cache["ds"], $sr );
|
||||
for ( $i = 0; $i < $info['count']; $i++ ) {
|
||||
foreach ($config["auth"]["ldap_user_attr"] as $internal_key => $ldap_key) {
|
||||
$ret[$info[$i][$config["auth"]["ldap_user_attr"]["id_user"]][0]]["last_connect"] = get_system_time ();
|
||||
$ret[$info[$i][$config["auth"]["ldap_user_attr"]["id_user"]][0]]["last_connect"] = $time;
|
||||
if (isset ($info[$i][$ldap_key])) {
|
||||
$ret[$info[$i][$config["auth"]["ldap_user_attr"]["id_user"]][0]][$internal_key] = $info[$i][$ldap_key][0];
|
||||
} else {
|
||||
|
|
|
@ -171,9 +171,10 @@ function get_group_stats ($id_group) {
|
|||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($result === false) {
|
||||
//No data for any agents, means everything is 0 anyway.
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
foreach ($result as $row) {
|
||||
$last_update = $cur_time - $row["utimestamp"];
|
||||
|
||||
|
@ -194,17 +195,24 @@ function get_group_stats ($id_group) {
|
|||
else {
|
||||
$data["monitor_ok"]++;
|
||||
}
|
||||
|
||||
$fired = get_db_value ('times_fired', 'talert_template_modules', 'id_agent_module', $row["id_agente_modulo"]);
|
||||
if ($fired !== false) {
|
||||
$data["monitor_alerts"]++;
|
||||
if ($fired > 0) {
|
||||
$data["monitor_alerts_fired"]++;
|
||||
$data["monitor_alerts_fire_count"] += $fired;
|
||||
}
|
||||
}
|
||||
} //End foreach module
|
||||
|
||||
//Moved it out of the loop otherwise for each module there would be a SQL query
|
||||
$sql = sprintf ("SELECT times_fired FROM talert_template_modules WHERE id_agent_module IN (%s)", implode (",", array_keys ($agents)));
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($result === false) {
|
||||
$result = array (); //It's possible there are no alerts so we don't return
|
||||
}
|
||||
|
||||
foreach ($result as $row) {
|
||||
$data["monitor_alerts"]++;
|
||||
if ($row["times_fired"] > 0) {
|
||||
$data["monitor_alerts_fired"]++;
|
||||
$data["monitor_alerts_fire_count"] += $fired;
|
||||
}
|
||||
}
|
||||
|
||||
$data["total_agents"] = count ($agents);
|
||||
$data["total_checks"] = $data["monitor_checks"];
|
||||
$data["total_ok"] = $data["monitor_ok"];
|
||||
|
|
Loading…
Reference in New Issue