2012-07-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_agents.php operation/agentes/estado_agente.php: Modified changed agents_get_agents function to accomplish agent status general conditions (like in functions_groups.php). Also status constants where changed to standard. * operation/menu.php: Don't hide any menu entry when metaconsole is activated (new metaconsole has a different entry point). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6763 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9411b1bd79
commit
e844ca60e0
|
@ -1,3 +1,14 @@
|
|||
2012-07-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_agents.php
|
||||
operation/agentes/estado_agente.php: Modified changed
|
||||
agents_get_agents function to accomplish agent status general
|
||||
conditions (like in functions_groups.php). Also status constants
|
||||
where changed to standard.
|
||||
|
||||
* operation/menu.php: Don't hide any menu entry when metaconsole is
|
||||
activated (new metaconsole has a different entry point).
|
||||
|
||||
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/constants.php: added more constants into the constants
|
||||
|
|
|
@ -302,10 +302,11 @@ function agents_get_alerts_compound ($id_agent = false, $filter = '', $options =
|
|||
* @param array Fields to get.
|
||||
* @param string Access needed in the agents groups.
|
||||
* @param array $order The order of agents, by default is upward for field nombre.
|
||||
* @param bool $return Whether to return array with agents or false, or sql string statement
|
||||
*
|
||||
* @return mixed An array with all alerts defined for an agent or false in case no allowed groups are specified.
|
||||
*/
|
||||
function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $order = array('field' => 'nombre', 'order' => 'ASC')) {
|
||||
function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $order = array('field' => 'nombre', 'order' => 'ASC'), $return = false) {
|
||||
global $config;
|
||||
|
||||
if (! is_array ($filter)) {
|
||||
|
@ -336,29 +337,29 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0 AND estado = 0
|
||||
AND (utimestamp != 0 OR tagente_modulo.id_tipo_modulo IN (21,22,23))
|
||||
AND (utimestamp != 0)' /*OR tagente_modulo.id_tipo_modulo IN (21,22,23))
|
||||
AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';
|
||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))'*/;
|
||||
|
||||
$warning_modules = 'SELECT tagente.id_agente FROM tagente_estado, tagente, tagente_modulo
|
||||
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0 AND estado = 2
|
||||
AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';
|
||||
AND tagente_modulo.disabled = 0 AND estado = 2 AND tagente_estado.utimestamp != 0';
|
||||
/* AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';*/
|
||||
|
||||
$critical_modules = 'SELECT tagente.id_agente FROM tagente_estado, tagente, tagente_modulo
|
||||
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0 AND estado = 1
|
||||
AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';
|
||||
AND tagente_modulo.disabled = 0 AND estado = 1 AND tagente_estado.utimestamp != 0';
|
||||
/* AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))'; */
|
||||
|
||||
$unknown_modules = 'SELECT tagente.id_agente FROM tagente_estado, tagente, tagente_modulo
|
||||
WHERE tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)
|
||||
AND utimestamp < ( UNIX_TIMESTAMP() - (current_interval * 2)) AND utimestamp != 0';
|
||||
AND tagente_modulo.disabled = 0 AND estado = 3 AND utimestamp != 0' /*AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)
|
||||
AND utimestamp < ( UNIX_TIMESTAMP() - (current_interval * 2)) AND utimestamp != 0'*/;
|
||||
|
||||
$notinit_modules = 'SELECT tagente_estado.id_agente FROM tagente_estado, tagente, tagente_modulo
|
||||
WHERE tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
||||
|
@ -374,12 +375,12 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
id_agente NOT IN ($critical_modules) && id_agente NOT IN ($unknown_modules)"; //&& id_agente NOT IN ($notinit_modules)";
|
||||
break;
|
||||
// Warning
|
||||
case 1:
|
||||
case 2:
|
||||
$status_sql = "id_agente IN ($warning_modules) &&
|
||||
id_agente NOT IN ($critical_modules)"; //&& id_agente NOT IN ($notinit_modules)";
|
||||
break;
|
||||
// Critical
|
||||
case 2:
|
||||
case 1:
|
||||
$status_sql = "id_agente IN ($critical_modules)";
|
||||
break;
|
||||
// Unknown
|
||||
|
@ -490,6 +491,9 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
}
|
||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||
|
||||
if ($return)
|
||||
return $sql;
|
||||
else
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
break;
|
||||
case "postgresql":
|
||||
|
@ -499,6 +503,9 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
}
|
||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||
|
||||
if ($return)
|
||||
return $sql;
|
||||
else
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
break;
|
||||
case "oracle":
|
||||
|
@ -508,6 +515,9 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
$set['offset'] = $offset;
|
||||
}
|
||||
|
||||
if ($return)
|
||||
return $sql;
|
||||
else
|
||||
$agents = oracle_recode_query ($sql, $set, 'AND', false);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -200,8 +200,8 @@ echo '</td><td style="white-space:nowrap;">';
|
|||
|
||||
$fields = array ();
|
||||
$fields[0] = __('Normal');
|
||||
$fields[1] = __('Warning');
|
||||
$fields[2] = __('Critical');
|
||||
$fields[2] = __('Warning');
|
||||
$fields[1] = __('Critical');
|
||||
$fields[3] = __('Unknown');
|
||||
$fields[4] = __('Not normal');
|
||||
$fields[5] = __('Not init');
|
||||
|
|
|
@ -30,7 +30,6 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
|
||||
enterprise_hook ('metaconsole_menu');
|
||||
|
||||
if ($config['metaconsole'] == 0) {
|
||||
//View agents
|
||||
$menu_operation["estado"]["text"] = __('Monitoring');
|
||||
$menu_operation["estado"]["sec2"] = "operation/agentes/tactical";
|
||||
|
@ -87,9 +86,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
|
||||
$menu_operation["estado"]["sub"] = $sub;
|
||||
//End of view agents
|
||||
}
|
||||
|
||||
if ($config['metaconsole'] == 0) {
|
||||
//Start network view
|
||||
|
||||
$menu_operation["network"]["text"] = __('Network View');
|
||||
|
@ -106,7 +103,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
|
||||
$menu_operation["network"]["sub"] = $sub;
|
||||
//End networkview
|
||||
}
|
||||
|
||||
|
||||
// Reporting
|
||||
$menu_operation["reporting"]["text"] = __('Reporting');
|
||||
|
@ -176,7 +173,6 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($config['metaconsole'] == 0) {
|
||||
$sub["godmode/reporting/map_builder"]["sub2"] = $sub2;
|
||||
|
||||
$sub["godmode/reporting/graphs"]["text"] = __('Custom graphs');
|
||||
|
@ -190,7 +186,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
|
||||
enterprise_hook ('dashboard_menu');
|
||||
enterprise_hook ('reporting_godmenu');
|
||||
}
|
||||
|
||||
|
||||
$menu_operation["reporting"]["sub"] = $sub;
|
||||
//End reporting
|
||||
|
@ -352,13 +348,11 @@ if (check_acl ($config['id_user'], 0, "IR")) {
|
|||
// Rest of options, all with AR privilege (or should events be with incidents?)
|
||||
if (check_acl ($config['id_user'], 0, "AR")) {
|
||||
|
||||
if ($config['metaconsole'] == 0) {
|
||||
//SNMP Console
|
||||
$menu_operation["snmpconsole"]["text"] = __('SNMP console');
|
||||
$menu_operation["snmpconsole"]["refr"] = 0;
|
||||
$menu_operation["snmpconsole"]["sec2"] = "operation/snmpconsole/snmp_view";
|
||||
$menu_operation["snmpconsole"]["id"] = "oper-snmpc";
|
||||
}
|
||||
|
||||
// Extensions menu additions
|
||||
if (is_array ($config['extensions'])) {
|
||||
|
@ -384,7 +378,7 @@ if (check_acl ($config['id_user'], 0, "AR")) {
|
|||
else {
|
||||
if (array_key_exists('fatherId',$extension_menu)) {
|
||||
// Check that extension father ID exists previously on the menu
|
||||
if ((strlen($extension_menu['fatherId']) > 0) and (($config['metaconsole'] == 0) or (array_key_exists($extension_menu['fatherId'], $menu_operation)))) {
|
||||
if ((strlen($extension_menu['fatherId']) > 0)) {
|
||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["text"] = __($extension_menu['name']);
|
||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["refr"] = 0;
|
||||
$menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["icon"] = $extension_menu['icon'];
|
||||
|
|
Loading…
Reference in New Issue