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
8270ef2bb6
commit
a988da47b5
|
@ -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)) {
|
||||
|
@ -335,30 +336,30 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
$normal_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 = 0
|
||||
AND (utimestamp != 0 OR tagente_modulo.id_tipo_modulo IN (21,22,23))
|
||||
AND tagente_modulo.disabled = 0 AND estado = 0
|
||||
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
|
||||
|
@ -489,8 +490,11 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
$limit_sql = " LIMIT $offset, $limit ";
|
||||
}
|
||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($return)
|
||||
return $sql;
|
||||
else
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
break;
|
||||
case "postgresql":
|
||||
$limit_sql = '';
|
||||
|
@ -499,7 +503,10 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
}
|
||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
if ($return)
|
||||
return $sql;
|
||||
else
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
break;
|
||||
case "oracle":
|
||||
$set = array();
|
||||
|
@ -508,7 +515,10 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||
$set['offset'] = $offset;
|
||||
}
|
||||
|
||||
$agents = oracle_recode_query ($sql, $set, 'AND', false);
|
||||
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,83 +30,80 @@ 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";
|
||||
$menu_operation["estado"]["refr"] = 0;
|
||||
$menu_operation["estado"]["id"] = "oper-agents";
|
||||
|
||||
$sub = array ();
|
||||
$sub["operation/agentes/tactical"]["text"] = __('Tactical view');
|
||||
$sub["operation/agentes/tactical"]["refr"] = 0;
|
||||
|
||||
$sub["operation/agentes/group_view"]["text"] = __('Group view');
|
||||
$sub["operation/agentes/group_view"]["refr"] = 0;
|
||||
|
||||
$sub['operation/tree']['text'] = __('Tree view');
|
||||
$sub["operation/tree"]["refr"] = 0;
|
||||
|
||||
$sub["operation/agentes/estado_agente"]["text"] = __('Agent detail');
|
||||
$sub["operation/agentes/estado_agente"]["refr"] = 0;
|
||||
$sub["operation/agentes/estado_agente"]["subsecs"] = array(
|
||||
"operation/agentes/ver_agente");
|
||||
|
||||
$sub["operation/agentes/alerts_status"]["text"] = __('Alert detail');
|
||||
$sub["operation/agentes/alerts_status"]["refr"] = 0;
|
||||
|
||||
$sub["operation/agentes/status_monitor"]["text"] = __('Monitor detail');
|
||||
$sub["operation/agentes/status_monitor"]["refr"] = 0;
|
||||
|
||||
enterprise_hook ('services_menu');
|
||||
|
||||
enterprise_hook ('inventory_menu');
|
||||
|
||||
$sub["operation/servers/recon_view"]["text"] = __('Recon view');
|
||||
$sub["operation/servers/recon_view"]["refr"] = 0;
|
||||
|
||||
|
||||
//SNMP Console
|
||||
$sub["operation/snmpconsole/snmp_view"]["text"] = __('SNMP console');
|
||||
$sub["operation/snmpconsole/snmp_view"]["refr"] = 0;
|
||||
$sub["operation/snmpconsole/snmp_view"]["subsecs"] = array(
|
||||
"enterprise/godmode/snmpconsole",
|
||||
"godmode/snmpconsole/snmp_trap_editor",
|
||||
"godmode/snmpconsole/snmp_alert",
|
||||
"godmode/snmpconsole/snmp_filters",
|
||||
"godmode/snmpconsole/snmp_trap_generator");
|
||||
|
||||
$sub2 = array();
|
||||
|
||||
$sub2["godmode/snmpconsole/snmp_alert"]["text"] = __("SNMP alerts");
|
||||
$sub2['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters');
|
||||
enterprise_hook ('snmpconsole_submenu');
|
||||
$sub2['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator');
|
||||
|
||||
$sub["operation/snmpconsole/snmp_view"]["sub2"] = $sub2;
|
||||
|
||||
$menu_operation["estado"]["sub"] = $sub;
|
||||
//End of view agents
|
||||
}
|
||||
//View agents
|
||||
$menu_operation["estado"]["text"] = __('Monitoring');
|
||||
$menu_operation["estado"]["sec2"] = "operation/agentes/tactical";
|
||||
$menu_operation["estado"]["refr"] = 0;
|
||||
$menu_operation["estado"]["id"] = "oper-agents";
|
||||
|
||||
if ($config['metaconsole'] == 0) {
|
||||
//Start network view
|
||||
$sub = array ();
|
||||
$sub["operation/agentes/tactical"]["text"] = __('Tactical view');
|
||||
$sub["operation/agentes/tactical"]["refr"] = 0;
|
||||
|
||||
$menu_operation["network"]["text"] = __('Network View');
|
||||
$menu_operation["network"]["sec2"] = "operation/agentes/networkmap_list";
|
||||
$menu_operation["network"]["refr"] = 0;
|
||||
$menu_operation["network"]["id"] = "oper-networkconsole";
|
||||
|
||||
$sub = array();
|
||||
|
||||
$sub["operation/agentes/networkmap_list"]["text"] = __('Network map');
|
||||
$sub["operation/agentes/networkmap_list"]["refr"] = 0;
|
||||
|
||||
enterprise_hook ('networkmap_console');
|
||||
|
||||
$menu_operation["network"]["sub"] = $sub;
|
||||
//End networkview
|
||||
}
|
||||
$sub["operation/agentes/group_view"]["text"] = __('Group view');
|
||||
$sub["operation/agentes/group_view"]["refr"] = 0;
|
||||
|
||||
$sub['operation/tree']['text'] = __('Tree view');
|
||||
$sub["operation/tree"]["refr"] = 0;
|
||||
|
||||
$sub["operation/agentes/estado_agente"]["text"] = __('Agent detail');
|
||||
$sub["operation/agentes/estado_agente"]["refr"] = 0;
|
||||
$sub["operation/agentes/estado_agente"]["subsecs"] = array(
|
||||
"operation/agentes/ver_agente");
|
||||
|
||||
$sub["operation/agentes/alerts_status"]["text"] = __('Alert detail');
|
||||
$sub["operation/agentes/alerts_status"]["refr"] = 0;
|
||||
|
||||
$sub["operation/agentes/status_monitor"]["text"] = __('Monitor detail');
|
||||
$sub["operation/agentes/status_monitor"]["refr"] = 0;
|
||||
|
||||
enterprise_hook ('services_menu');
|
||||
|
||||
enterprise_hook ('inventory_menu');
|
||||
|
||||
$sub["operation/servers/recon_view"]["text"] = __('Recon view');
|
||||
$sub["operation/servers/recon_view"]["refr"] = 0;
|
||||
|
||||
|
||||
//SNMP Console
|
||||
$sub["operation/snmpconsole/snmp_view"]["text"] = __('SNMP console');
|
||||
$sub["operation/snmpconsole/snmp_view"]["refr"] = 0;
|
||||
$sub["operation/snmpconsole/snmp_view"]["subsecs"] = array(
|
||||
"enterprise/godmode/snmpconsole",
|
||||
"godmode/snmpconsole/snmp_trap_editor",
|
||||
"godmode/snmpconsole/snmp_alert",
|
||||
"godmode/snmpconsole/snmp_filters",
|
||||
"godmode/snmpconsole/snmp_trap_generator");
|
||||
|
||||
$sub2 = array();
|
||||
|
||||
$sub2["godmode/snmpconsole/snmp_alert"]["text"] = __("SNMP alerts");
|
||||
$sub2['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters');
|
||||
enterprise_hook ('snmpconsole_submenu');
|
||||
$sub2['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator');
|
||||
|
||||
$sub["operation/snmpconsole/snmp_view"]["sub2"] = $sub2;
|
||||
|
||||
$menu_operation["estado"]["sub"] = $sub;
|
||||
//End of view agents
|
||||
|
||||
//Start network view
|
||||
|
||||
$menu_operation["network"]["text"] = __('Network View');
|
||||
$menu_operation["network"]["sec2"] = "operation/agentes/networkmap_list";
|
||||
$menu_operation["network"]["refr"] = 0;
|
||||
$menu_operation["network"]["id"] = "oper-networkconsole";
|
||||
|
||||
$sub = array();
|
||||
|
||||
$sub["operation/agentes/networkmap_list"]["text"] = __('Network map');
|
||||
$sub["operation/agentes/networkmap_list"]["refr"] = 0;
|
||||
|
||||
enterprise_hook ('networkmap_console');
|
||||
|
||||
$menu_operation["network"]["sub"] = $sub;
|
||||
//End networkview
|
||||
|
||||
|
||||
// Reporting
|
||||
$menu_operation["reporting"]["text"] = __('Reporting');
|
||||
|
@ -176,21 +173,20 @@ 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');
|
||||
//Set godomode path
|
||||
$sub["godmode/reporting/graphs"]["subsecs"] = array(
|
||||
"operation/reporting/graph_viewer",
|
||||
"godmode/reporting/graph_builder");
|
||||
|
||||
$sub["operation/agentes/exportdata"]["text"] = __('Export data');
|
||||
$sub["operation/agentes/exportdata"]["subsecs"] = array("operation/agentes/exportdata");
|
||||
$sub["godmode/reporting/map_builder"]["sub2"] = $sub2;
|
||||
|
||||
$sub["godmode/reporting/graphs"]["text"] = __('Custom graphs');
|
||||
//Set godomode path
|
||||
$sub["godmode/reporting/graphs"]["subsecs"] = array(
|
||||
"operation/reporting/graph_viewer",
|
||||
"godmode/reporting/graph_builder");
|
||||
|
||||
enterprise_hook ('dashboard_menu');
|
||||
enterprise_hook ('reporting_godmenu');
|
||||
}
|
||||
$sub["operation/agentes/exportdata"]["text"] = __('Export data');
|
||||
$sub["operation/agentes/exportdata"]["subsecs"] = array("operation/agentes/exportdata");
|
||||
|
||||
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";
|
||||
}
|
||||
//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