2009-05-28 Esteban Sanchez <estebans@artica.es>

* install.php: Use server address if the db host is not localhost.
	Fixes #2796790.

	* include/functions_agents.php: Fixed an array cast on
	get_agent_alerts_compound().

	* include/functions_events.php: Critical and warning colors where
	swapped on print_events_table().

	* include/functions_reporting.php: Fixed alerts count on
	get_group_stats() and count combined alerts too. Fixes #2791577

	* operation/agentes/tactical.php: Style corrections.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1719 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2009-05-28 11:32:12 +00:00
parent ae226675aa
commit d3019cb494
6 changed files with 45 additions and 23 deletions

View File

@ -1,3 +1,19 @@
2009-05-28 Esteban Sanchez <estebans@artica.es>
* install.php: Use server address if the db host is not localhost.
Fixes #2796790.
* include/functions_agents.php: Fixed an array cast on
get_agent_alerts_compound().
* include/functions_events.php: Critical and warning colors where
swapped on print_events_table().
* include/functions_reporting.php: Fixed alerts count on
get_group_stats() and count combined alerts too. Fixes #2791577
* operation/agentes/tactical.php: Style corrections.
2009-05-27 Evi Vanoost <vanooste@rcbi.rochester.edu>
* godmode/agentes/configurar_agente.php: Should fix bug #2785154. Wasn't

View File

@ -169,10 +169,10 @@ function get_agent_alerts_compound ($id_agent, $filter = '', $options = false) {
$filter .= format_array_to_where_clause_sql ($options);
}
$id_agent = array ($id_agent);
$id_agent = (array) $id_agent;
$sql = sprintf ("SELECT * FROM talert_compound
WHERE id_agent in (%s)%s",
WHERE id_agent IN (%s)%s",
implode (',', $id_agent), $filter);
$alerts = get_db_all_rows_sql ($sql);

View File

@ -279,11 +279,14 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return =
$data = array ();
/* Colored box */
if ($event["estado"] == 0) {
$data[0] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20, "title" => get_priority_name ($event["criticity"])));
if ($event["estado"] == 1) {
$img = 'images/pixel_red.png';
} else {
$data[0] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20, "title" => get_priority_name ($event["criticity"])));
$img = 'images/pixel_green.png';
}
$data[0] = print_image ($img, true, array ("width" => 20,
"height" => 20,
"title" => get_priority_name ($event["criticity"])));
/* Event type */
$data[1] = print_event_type_img ($event["event_type"], true);

View File

@ -118,7 +118,7 @@ function get_group_stats ($id_group = 0) {
if ($id_group == 0) {
$id_group = array_keys (get_user_groups ());
}
$agents = array_keys (get_group_agents ($id_group));
$agents = array_keys (get_group_agents ($id_group));
if (empty ($agents)) {
//No agents in this group, means no data
@ -134,18 +134,19 @@ function get_group_stats ($id_group = 0) {
$data["monitor_warning"] = (int) get_db_sql ("SELECT COUNT(*) FROM tagente_estado WHERE ".$filter."AND utimestamp > 0 AND estado = 2 AND UNIX_TIMESTAMP() - utimestamp < current_interval * 2");
$data["monitor_ok"] = $data["monitor_checks"] - $data["monitor_not_init"] - $data["monitor_unknown"] - $data["monitor_critical"] - $data["monitor_warning"];
$result = get_db_all_rows_filter ('talert_template_modules',
array ('id_agent_module' => array_keys ($agents)),
array ('times_fired'));
if (empty ($result)) {
$result = array ();
}
$alerts = get_agent_alerts ($agents);
foreach ($result as $row) {
$data["monitor_alerts"]++;
if ($row["times_fired"] > 0) {
$data["monitor_alerts_fired"]++;
$data["monitor_alerts_fire_count"] += $row["times_fired"];
if (empty ($alerts))
$alerts = array ();
$data["monitor_alerts"] = 0;
foreach ($alerts as $alert_type) {
$data["monitor_alerts"] += count ($alert_type);
foreach ($alert_type as $alert) {
if ($alert["times_fired"] > 0) {
$data["monitor_alerts_fired"]++;
$data["monitor_alerts_fire_count"] += $alert["times_fired"];
}
}
}

View File

@ -346,7 +346,6 @@ function install_step3() {
</div>";
}
function install_step4() {
$pandora_config = "include/config.php";
@ -410,7 +409,10 @@ function install_step4() {
check_generic ($step4, "Populating database");
$random_password = random_name (8);
$step5 = mysql_query ("GRANT ALL PRIVILEGES ON $dbname.* to pandora@localhost
$host = 'localhost';
if ($dbhost != 'localhost')
$host = $_SERVER['SERVER_ADDR'];
$step5 = mysql_query ("GRANT ALL PRIVILEGES ON $dbname.* to pandora@$host
IDENTIFIED BY '".$random_password."'");
mysql_query ("FLUSH PRIVILEGES");
check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>");

View File

@ -23,11 +23,11 @@ require_once ("include/functions_events.php");
check_login ();
if (give_acl ($config['id_user'], 0, "AR") != 1) {
if (! give_acl ($config['id_user'], 0, "AR")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent view (Grouped)");
require ("general/noaccess.php");
exit;
return;
}
require_once ("include/functions_reporting.php");
@ -185,9 +185,9 @@ foreach ($serverinfo as $server) {
$data[0] = $server["name"];
if ($server["status"] == 0){
$data[1] = print_status_image(STATUS_SERVER_DOWN, '', true);
$data[1] = print_status_image (STATUS_SERVER_DOWN, '', true);
} else {
$data[1] = print_status_image(STATUS_SERVER_OK, '', true);
$data[1] = print_status_image (STATUS_SERVER_OK, '', true);
}
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80",