2009-08-01 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_menu.php: fix bug that introduce obligatory autorefresh
	and maybe some extension run bad with autorefresh.
	
	*include/functions_reporting.php: add function
	"get_agent_module_info_with_filter", this function is similar more or less
	at "get_agent_module_info" but the function can set SQL filter for
	tune the result.
	*include/functions_ui.php: add more features at function "print_group_icon"
	can set style and only icon not link.
	*images/so_aix_small.png, images/network_small.png, images/so_bsd_small.png,
	images/so_solaris_small.png, images/so_other_small.png, 
	images/so_cisco_small.png, 
	images/status_sets/default/agent_critical_ball.png,
	images/status_sets/default/module_warning_ball.png,
	images/status_sets/default/module_ok_ball.png,
	images/status_sets/default/alert_fired_ball.png,
	images/status_sets/default/agent_warning_ball.png,
	images/status_sets/default/agent_no_data_ball.png,
	images/status_sets/default/alert_disabled_square.png,
	images/status_sets/default/agent_no_monitors_ball.png,
	images/status_sets/default/agent_down_ball.png,
	images/status_sets/default/agent_ok_ball.png,
	images/status_sets/default/alert_disabled_ball.png,
	images/status_sets/default/module_critical_ball.png,
	images/status_sets/default/alert_not_fired_ball.png,
	images/so_win_small.png, images/so_hpux_small.png, images/so_mac_small.png,
	images/so_linux_small.png: add many icons for many purposes and new
	features near in the time.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1913 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-09-03 18:15:40 +00:00
parent cd64d2b1c4
commit be98bba81b
27 changed files with 131 additions and 5 deletions

View File

@ -1,3 +1,33 @@
2009-08-01 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php: fix bug that introduce obligatory autorefresh
and maybe some extension run bad with autorefresh.
*include/functions_reporting.php: add function
"get_agent_module_info_with_filter", this function is similar more or less
at "get_agent_module_info" but the function can set SQL filter for
tune the result.
*include/functions_ui.php: add more features at function "print_group_icon"
can set style and only icon not link.
*images/so_aix_small.png, images/network_small.png, images/so_bsd_small.png,
images/so_solaris_small.png, images/so_other_small.png,
images/so_cisco_small.png,
images/status_sets/default/agent_critical_ball.png,
images/status_sets/default/module_warning_ball.png,
images/status_sets/default/module_ok_ball.png,
images/status_sets/default/alert_fired_ball.png,
images/status_sets/default/agent_warning_ball.png,
images/status_sets/default/agent_no_data_ball.png,
images/status_sets/default/alert_disabled_square.png,
images/status_sets/default/agent_no_monitors_ball.png,
images/status_sets/default/agent_down_ball.png,
images/status_sets/default/agent_ok_ball.png,
images/status_sets/default/alert_disabled_ball.png,
images/status_sets/default/module_critical_ball.png,
images/status_sets/default/alert_not_fired_ball.png,
images/so_win_small.png, images/so_hpux_small.png, images/so_mac_small.png,
images/so_linux_small.png: add many icons for many purposes and new
features near in the time.
2009-09-03 Sacnho Lerena <slerena@artica.es>

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

View File

@ -145,7 +145,7 @@ function print_menu (&$menu) {
$extensionInMenu = '';
}
$submenu_output .= '<a href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&amp;sec2='.$subsec2.($main["refr"] ? '&amp;refr='.$main["refr"] : '').$link_add.'">'.$sub["text"].'</a>';
$submenu_output .= '<a href="index.php?'.$extensionInMenu.'sec='.$secUrl.'&amp;sec2='.$subsec2.($main["refr"] ? '&amp;refr=0' : '').$link_add.'">'.$sub["text"].'</a>';
$submenu_output .= '</li>';
}
}

View File

@ -838,4 +838,99 @@ function get_agent_module_info ($id_agent) {
return $return;
}
/**
* Get a detailed report of the modules of the agent
*
* @param int $id_agent Agent id to get the report for.
*
* @return array An array
*/
function get_agent_module_info_with_filter ($id_agent,$filter = '') {
global $config;
$return = array ();
$return["modules"] = 0; //Number of modules
$return["monitor_normal"] = 0; //Number of 'good' monitors
$return["monitor_warning"] = 0; //Number of 'warning' monitors
$return["monitor_critical"] = 0; //Number of 'critical' monitors
$return["monitor_down"] = 0; //Number of 'down' monitors
$return["last_contact"] = 0; //Last agent contact
$return["interval"] = get_agent_interval ($id_agent); //How often the agent gets contacted
$return["status_img"] = print_status_image (STATUS_AGENT_NO_DATA, __('Agent without data'), true);
$return["alert_status"] = "notfired";
$return["alert_img"] = print_status_image (STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true);
$return["agent_group"] = get_agent_group ($id_agent);
if (!give_acl ($config["id_user"], $return["agent_group"], "AR")) {
return $return;
}
$sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND
tagente_modulo.disabled = 0 AND tagente_modulo.id_agente = %d", $id_agent);
$sql .= $filter;
$modules = get_db_all_rows_sql ($sql);
if ($modules === false) {
return $return;
}
$now = get_system_time ();
// Calculate modules for this agent
foreach ($modules as $module) {
$return["modules"]++;
if ($module["module_interval"] > $return["interval"]) {
$return["interval"] = $module["module_interval"];
} elseif ($module["module_interval"] == 0) {
$module["module_interval"] = $return["interval"];
}
if ($module["utimestamp"] > $return["last_contact"]) {
$return["last_contact"] = $module["utimestamp"];
}
if ($module["id_tipo_modulo"] < 21 || $module["id_tipo_modulo"] != 100) {
$async = 0;
} else {
$async = 1;
}
if ($async == 0 && ($module["utimestamp"] < ($now - $module["module_interval"] * 2))) {
$return["monitor_down"]++;
} elseif ($module["estado"] == 2) {
$return["monitor_warning"]++;
} elseif ($module["estado"] == 1) {
$return["monitor_critical"]++;
} else {
$return["monitor_normal"]++;
}
}
if ($return["modules"] > 0) {
if ($return["modules"] == $return["monitor_down"])
$return["status_img"] = print_status_image (STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true);
else if ($return["monitor_critical"] > 0)
$return["status_img"] = print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true);
else if ($return["monitor_warning"] > 0)
$return["status_img"] = print_status_image (STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true);
else
$return["status_img"] = print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true);
}
//Alert not fired is by default
if (give_disabled_group ($return["agent_group"])) {
$return["alert_status"] = "disabled";
$return["alert_img"] = print_status_image (STATUS_ALERT_DISABLED, __('Alert disabled'), true);
} elseif (check_alert_fired ($id_agent) == 1) {
$return["alert_status"] = "fired";
$return["alert_img"] = print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true);
}
return $return;
}
?>

View File

@ -199,16 +199,17 @@ function print_username ($username, $return = false) {
*
* @return string HTML code if return parameter is true.
*/
function print_group_icon ($id_group, $return = false, $path = "groups_small") {
function print_group_icon ($id_group, $return = false, $path = "groups_small", $style='', $link = true) {
$icon = (string) get_db_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group);
if (empty ($icon)) {
return "-";
}
$output = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id_group.'">';
$output .= '<img class="bot" src="images/'.$path.'/'.$icon.'.png" alt="'.get_group_name ($id_group).'" title="'.get_group_name ($id_group).'" />';
$output .= '</a>';
$output = '';
if ($link) $output = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60&amp;group_id='.$id_group.'">';
$output .= '<img style="' . $style . '" class="bot" src="images/'.$path.'/'.$icon.'.png" alt="'.get_group_name ($id_group).'" title="'.get_group_name ($id_group).'" />';
if ($link) $output .= '</a>';
if (!$return)
echo $output;