diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0212dc60c3..e60199a249 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,60 @@ +2009-01-12 Sancho Lerena + + * pandoradb.sql: Removed fields "timestamp" and "id_agente" (and altered + some indexes) on tagente_datos, tagente_datos_string and + tagente_datos_inc. + + tagente_estado table: removed cambio, added status_changes, last_status. + tagente_modulo: added five new fields (warning,critical mgmt., flipflop + detection, history module and delete_pending bit. + + * agent_manager.php: Group ALL not shown anymore. + + * configurar_agente.php: Support for new options. Delete a module now + mark for deletion the module, not delete data (It's VERY slow!). + + * modificar_agente.php: Delete agent now uses the global function, + minor fixes. + + * module_manager_editor.php: New fields initializacion. + + * module_manager_editor_network.php: At this time, the first module + editor who implements the new fields and improve old ones (tcp data). + + * setup.php: Added support for new token: event_view_hr (Filter of max + old (in hr) for the event viewer. Removed old tokens show_unknown and + show_lastalert. + + * functions.php: format_for_graph() has an important BUG that makes + all units rendered without the "K" !!!!. Fixed. + + * delete_agent.php: Delete remote config (if present). Also mark + for deletion modules instead delete them (and let the data without + being deleted, because it's a HUGE consuming time, and it's left + for the daily db maintance process). + + * estado_agente.php: Updated code for view new status. + + * estado_generalagente.php: Total packets are removed from this view, + this was a huge time consuming SQL operation that don't give important + infomation. Groupname is now visualized. + + * estado_ultimopaquete.php, + * estado_monitores.php, + * estado_grupo.php: Rewritten much code to view new status and other + minor changes. + + * ver_agente.php: Data view now works under the tabs and other minor + changes. + + * events.php: Support for the new events and status. Added filter for + username and for a max. hours old events. Some boxes are now hidden + by default. + + * fgraph.php: Some graphs are now fixed and uses tagente_datos and + tagent_access with utimestamp and without id_agent index. Works faster + + 2009-01-09 Evi Vanoost * general/footer.php, operation/agentes/sla_view.php, diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 13d7cb8e16..b9978945c6 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -95,10 +95,10 @@ $groups = get_user_groups ($config["id_user"]); $agents = get_group_agents (array_keys ($groups)); $table->data[2][0] = ''.__('Parent').''; -$table->data[2][1] = print_select ($agents, 'id_parent', $id_parent, '', get_agent_name ($id_parent, "lower"), $id_parent, true, false, false); //I use get_agent_name because the user might not have rights to the current parent +$table->data[2][1] = print_select ($agents, 'id_parent', $id_parent, '', __('None'), 0, true, false, false); //I use get_agent_name because the user might not have rights to the current parent $table->data[3][0] = ''.__('Group').''; -$table->data[3][1] = print_select ($groups, 'grupo', $grupo, '', '', 0, true, false, false); +$table->data[3][1] = print_select_from_sql ('SELECT id_grupo, nombre FROM tgrupo WHERE id_grupo > 1 ORDER BY nombre', 'grupo', $grupo, '', '', 0, true); $table->data[4][0] = ''.__('Interval').''; $table->data[4][1] = print_input_text ('intervalo', $intervalo, '', 16, 100, true); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 8187fc6e43..1b0cc0508b 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -16,6 +16,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + // Load global vars require_once ("include/config.php"); enterprise_include ('godmode/agentes/configurar_agente.php'); @@ -34,6 +35,7 @@ if (! give_acl($config["id_user"], $group, "AW")) { exit; } + // Get passed variables $tab = get_parameter_get ("tab", "main"); $form_moduletype = get_parameter_post ("form_moduletype"); @@ -148,17 +150,17 @@ if (isset ($_POST["create_agent"])) { // Create a new and shiny agent // Create special module agent_keepalive $sql = "INSERT INTO tagente_modulo - (nombre, id_agente, id_tipo_modulo, descripcion, id_modulo, custom_id) + (nombre, id_agente, id_tipo_modulo, descripcion, id_modulo,min_warning, max_warning ) VALUES - ('agent_keepalive',".$id_agente.",100,'Agent Keepalive monitor',1,'".$custom_id."')"; + ('agent_keepalive',".$id_agente.",100,'Agent Keepalive monitor',1 ,0,1)"; $id_agent_module = process_sql ($sql, "insert_id"); if ($id_agent_module !== false) { // Create agent_keepalive in tagente_estado table $sql = "INSERT INTO tagente_estado - (id_agente_modulo, datos, timestamp, cambio, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) + (id_agente_modulo, datos, timestamp, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUES - (".$id_agent_module.",1,'',0,0,".$id_agente.",0,0,0,0,0)"; + (".$id_agent_module.",'',0,0,".$id_agente.",0,0,0,0,0)"; $result = process_sql ($sql); if ($result === false) { $agent_created_ok = 0; @@ -697,6 +699,7 @@ if ((isset ($_POST["update_module"])) || (isset ($_POST["insert_module"]))) { $form_minvalue = (int) get_parameter_post ("form_minvalue",0); $form_maxvalue = (int) get_parameter ("form_maxvalue",0); $form_interval = (int) get_parameter ("form_interval",300); + $form_id_prediction_module = (int) get_parameter ("form_id_prediction_module",0); $form_id_plugin = (int) get_parameter ("form_id_plugin",0); $form_id_export = (int) get_parameter ("form_id_export",0); $form_disabled = (bool) get_parameter ("form_disabled",0); @@ -711,6 +714,12 @@ if ((isset ($_POST["update_module"])) || (isset ($_POST["insert_module"]))) { $form_plugin_parameter = (string) get_parameter ("form_plugin_parameter",""); $form_id_modulo = (int) get_parameter ("form_id_modulo",0); $form_custom_id = (string) get_parameter ("form_custom_id",""); + $form_history_data = (int) get_parameter('form_history_data',0); + $form_min_warning = (float) get_parameter ('form_min_warning', 0); + $form_max_warning = (float) get_parameter ('form_max_warning', 0); + $form_min_critical = (float) get_parameter ('form_min_critical', 0); + $form_max_critical = (float) get_parameter ('form_max_critical', 0); + $form_ff_event = (int) get_parameter ('form_ff_event', 0); } // MODULE UPDATE @@ -747,10 +756,16 @@ if ((isset ($_POST["update_module"])) && (!isset ($_POST["oid"]))) { // if modif post_process = %f, prediction_module = %d, max_timeout = %d, - custom_id = '%s' + custom_id = '%s', + history_data = %d, + min_warning = %f, + max_warning = %f, + min_critical = %f, + max_critical = %f, + min_ff_event = %d WHERE id_agente_modulo = %d", $form_description, $form_id_module_group, $form_name, $form_maxvalue, $form_minvalue, $form_interval, $form_tcp_port, $form_tcp_send, $form_tcp_rcv, $form_snmp_community, $form_snmp_oid, $form_ip_target, $form_flag, $form_id_modulo, $form_disabled, $form_id_export, $form_plugin_user, $form_plugin_pass, - $form_plugin_parameter, $form_id_plugin, $form_post_process, $form_prediction_module, $form_max_timeout, $form_custom_id, $id_agente_modulo); + $form_plugin_parameter, $form_id_plugin, $form_post_process, $form_prediction_module, $form_max_timeout, $form_custom_id, $form_history_data, $form_min_warning, $form_max_warning, $form_min_critical, $form_max_critical, $form_ff_event, $id_agente_modulo); $result = process_sql ($sql); if ($result === false) { @@ -795,32 +810,20 @@ if (((!isset ($_POST["nc"]) OR ($_POST["nc"] == -1))) && (!isset ($_POST["oid"]) (id_agente, id_tipo_modulo, nombre, descripcion, max, min, snmp_oid, snmp_community, id_module_group, module_interval, ip_target, tcp_port, tcp_rcv, tcp_send, id_export, plugin_user, plugin_pass, plugin_parameter, id_plugin, post_process, prediction_module, - max_timeout, disabled, id_modulo, custom_id) - VALUES (%d,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%d,'%s','%s',%d,'%s','%s','%s',%d,%d,%d,%d,%d,%d,'%s')", + max_timeout, disabled, id_modulo, custom_id, history_data, min_warning, max_warning, min_critical, max_critical, min_ff_event) + VALUES (%d,%d,'%s','%s',%d,%d,'%s','%s',%d,%d,'%s',%d,'%s','%s',%d,'%s','%s','%s',%d,%d,%d,%d,%d,%d,'%s', %d, %f, %f, %f, %f, %d)", $id_agente, $form_id_tipo_modulo, $form_name, $form_description, $form_maxvalue, $form_minvalue, $form_snmp_oid, $form_snmp_community, $form_id_module_group, $form_interval, $form_ip_target, $form_tcp_port, $form_tcp_rcv, $form_tcp_send, $form_id_export, $form_plugin_user, $form_plugin_pass, - $form_plugin_parameter, $form_id_plugin, $form_post_process, $form_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo, $form_custom_id); + $form_plugin_parameter, $form_id_plugin, $form_post_process, $form_id_prediction_module, $form_max_timeout, $form_disabled, $form_id_modulo, $form_custom_id, $form_history_data, $form_min_warning, $form_max_warning, $form_min_critical, $form_max_critical, $form_ff_event); $id_agente_modulo = process_sql ($sql, 'insert_id'); if ($id_agente_modulo === false){ echo '

'.__('There was a problem adding module').'

'; } else { - // Create with different estado if proc type or data type - if (($form_id_tipo_modulo == 2) || // data_proc - ($form_id_tipo_modulo == 6) || // icmp_proc - ($form_id_tipo_modulo == 9) || // tcp_proc - ($form_id_tipo_modulo == 18) || //snmp proc - ($form_id_tipo_modulo == 21) || // async proc - ($form_id_tipo_modulo == 100) // Keepalive - ) { - $sql = sprintf ("INSERT INTO tagente_estado - (id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp) - VALUES (%d, 0,'0000-00-00 00:00:00',0,0,%d,0)",$id_agente_modulo,$id_agente); - } else { - $sql = sprintf ("INSERT INTO tagente_estado - (id_agente_modulo,datos,timestamp,cambio,estado,id_agente, utimestamp) - VALUES (%d, 0,'0000-00-00 00:00:00',0,100,%d,0)",$id_agente_modulo,$id_agente); - } + $sql = sprintf ("INSERT INTO tagente_estado + (id_agente_modulo,datos,timestamp,estado,id_agente, utimestamp, status_changes, last_status) + VALUES (%d, 0,'0000-00-00 00:00:00',0,%d,0,0,0)",$id_agente_modulo,$id_agente); + $result = process_sql ($sql); if ($result !== false) { echo '

'.__('Module added successfully').'

'; @@ -857,21 +860,12 @@ if (isset ($_GET["delete_module"])){ // DELETE agent module ! // First delete from tagente_modulo -> if not successful, increment // error - if (process_sql ("DELETE FROM tagente_modulo WHERE id_agente_modulo = ".$id_borrar_modulo) === false) + if (process_sql ("UPDATE tagente_modulo SET disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_borrar_modulo) === false) $error++; if (process_sql ("DELETE FROM tagente_estado WHERE id_agente_modulo = ".$id_borrar_modulo) === false) $error++; - - if (process_sql ("DELETE FROM tagente_datos WHERE id_agente_modulo = ".$id_borrar_modulo) === false) - $error++; - - if (process_sql ("DELETE FROM tagente_datos_string WHERE id_agente_modulo = ".$id_borrar_modulo) === false) - $error++; - - if (process_sql ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo = ".$id_borrar_modulo) === false) - $error++; - + //Check for errors if ($error != 0) { echo '

'.__('There was a problem deleting the module').'

'; diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 7ae88f3e51..1e3d74ed3d 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -16,8 +16,10 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + // Load global vars require_once ("include/config.php"); + check_login (); @@ -25,11 +27,9 @@ check_login (); $offset = get_parameter ("offset", 0); $group_id = get_parameter ("group_id", 0); $ag_group = get_parameter ("ag_group", -1); - if (($ag_group == -1) && ($group_id != 0)) { $ag_group = $group_id; } - if (isset ($_GET["ag_group_refresh"])){ $ag_group = get_parameter_get ("ag_group_refresh", -1); } @@ -39,86 +39,10 @@ if (isset ($_GET["borrar_agente"])) { // if delete agent $id_agente = get_parameter_get ("borrar_agente"); $agent_name = get_agent_name ($id_agente); $id_grupo = dame_id_grupo ($id_agente); - $modules = array_keys (get_agent_modules ($id_agente)); if (give_acl ($config["id_user"], $id_grupo, "AW")==1) { - //Start transaction - this improves consistency - process_sql ("SET AUTOCOMMIT=0;"); - process_sql ("START TRANSACTION;"); - $del_error = 0; //Delete error count. At the end it will be used to rollback or commit - - // Firts delete from agents table - $sql_delete = "DELETE FROM tagente WHERE id_agente = ".$id_agente; - if (process_sql ($sql_delete) === false) - $del_error++; //in case process_sql returns false, increase error count - - // Delete agent access table - $sql_delete = "DELETE FROM tagent_access WHERE id_agent = ".$id_agente; - if (process_sql ($sql_delete) === false) - $del_error++; - - if (!empty ($modules) { - // Delete tagente_datos data - $sql_delete = "DELETE FROM tagente_datos WHERE id_agente_modulo IN (".implode (",",$modules).")"; - if (process_sql ($sql_delete) === false) - $del_error++; - - // Delete tagente_datos_string data - $sql_delete = "DELETE FROM tagente_datos_string WHERE id_agente_modulo IN (".implode (",",$modules).")"; - if (process_sql ($sql_delete) === false) - $del_error++; - - // Delete from tagente_datos - relies on id_agente_modulo - $sql_delete = "DELETE FROM tagente_datos_inc WHERE id_agente_modulo IN (".implode (",",$modules).")"; - if (process_sql ($sql_delete) === false) - $del_error++; - - // Delete alerts from talerta_agente_modulo - relies on - // id_agente_modulo - $sql_delete = "DELETE FROM talerta_agente_modulo WHERE id_agente_modulo IN (".implode (",",$modules).")"; - if (process_sql ($sql_delete) === false) - $del_error++; - } - // Delete from tagente_modulo - $sql_delete ="DELETE FROM tagente_modulo WHERE id_agente = ".$id_agente; - if (process_sql ($sql_delete) === false) - $del_error++; - - // Delete from tagente_estado - $sql_delete ="DELETE FROM tagente_estado WHERE id_agente = ".$id_agente; - if (process_sql ($sql_delete) === false) - $del_error++; - - // Delete IP's from taddress table using taddress_agent - $sql_delete = "DELETE FROM taddress WHERE - id_a = ANY(SELECT id_a FROM taddress_agent WHERE id_agent = ".$id_agente.")"; - if (process_sql ($sql_delete) === false) - $del_error++; - - // Delete IPs from taddress_agent table - $sql_delete = "DELETE FROM taddress_agent WHERE id_agent = ".$id_agente; - if (process_sql ($sql_delete) === false) - $del_error++; - - if ($del_error > 0) { - process_sql ("ROLLBACK;"); - echo "

".__('There was a problem deleting agent')."

"; - } else { - process_sql ("COMMIT;"); - echo "

".__('Agent deleted successfully')."

"; - } - unset ($sql_delete, $del_error); //Clean up - process_sql ("SET AUTOCOMMIT=1;"); - audit_db($config["id_user"],$REMOTE_ADDR, "Agent \'$agent_name\' deleted", "Agent Management"); - - // Delete remote configuration - $agent_md5 = md5($agent_name, FALSE); - if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) { - // Agent remote configuration editor - $file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf"; - unlink ($file_name); - $file_name = $config["remote_config"] . "/" . $agent_md5 . ".md5"; - unlink ($file_name); - } + $id_agentes[0] = $id_agente; + if (delete_agent ($id_agentes)) + audit_db($config["id_user"],$REMOTE_ADDR, "Agent \'$agent_name\' deleted", "Agent Management"); } else { // NO permissions. audit_db ($config["id_user"],$REMOTE_ADDR, "ACL Violation", "Trying to delete agent \'$agent_name\'"); @@ -230,49 +154,46 @@ if (mysql_num_rows($result)){ $tdcolor = "datos2"; $color = 1; } - if (! give_acl($config["id_user"], $id_grupo, "AW")) - continue; - - // Agent name - echo ""; - echo ""; - if ($row["disabled"] == 1){ - echo ""; - } - echo "".substr(strtoupper($row["nombre"]),0,20).""; - if ($row["disabled"] == 1){ - echo ""; - } - echo ""; + if (give_acl($config["id_user"], $id_grupo, "AW")==1){ + // Agent name + echo ""; + if ($row["disabled"] == 1){ + echo ""; + } + echo "".substr(strtoupper($row["nombre"]),0,20).""; + if ($row["disabled"] == 1){ + echo ""; + } + echo ""; - echo ""; - // Has remote configuration ? - $agent_md5 = md5 ($row["nombre"], false); - if (file_exists ($config["remote_config"]."/".$agent_md5.".md5")) { + echo ""; + // Has remote configuration ? + $agent_md5 = md5($row["nombre"], FALSE); + if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")){ - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + } + echo ""; + + + // Operating System icon + echo ""; + print_os_icon ($row["id_os"], false); + echo ""; + // Group icon and name + echo "".print_group_icon ($id_grupo, true).""; + // Description + echo "".$row["comentarios"].""; + // Action + echo "'; + echo ""; } - echo ""; - - // Operating System icon - echo ""; - print_os_icon ($row["id_os"], false); - echo ""; - // Group icon and name - echo ""; - print_group_icon ($id_grupo); - echo "  ".get_group_name ($id_grupo).""; - // Description - echo "".$row["comentarios"].""; - // Action - echo "'; - echo ""; } echo ""; echo "
"; @@ -281,10 +202,10 @@ if (mysql_num_rows($result)){ echo " 
"; } -// Create agent button -echo "
"; -echo ""; -echo "
"; + // Create agent button + echo "
"; + echo ""; + echo "
"; ?> diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index e57d87e875..fc2159451f 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -68,7 +68,7 @@ echo ""; // ========================== echo "

".__('Assigned modules')."

"; -$sql1='SELECT * FROM tagente_modulo WHERE id_agente = "'.$id_agente.'" +$sql1='SELECT * FROM tagente_modulo WHERE delete_pending = 0 AND id_agente = "'.$id_agente.'" ORDER BY id_module_group, nombre '; $result=mysql_query($sql1); if ($row=mysql_num_rows($result)){ diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 6c7eed47bc..d8eba54c33 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -115,6 +115,12 @@ if (($form_moduletype == "networkserver" || $form_moduletype == "wmiserver") && $form_plugin_pass = ""; $form_plugin_parameter = ""; $form_custom_id = ""; + $form_history_data = 1; + $form_min_warning = 0; + $form_max_warning = 0; + $form_min_critical = 0; + $form_max_critical = 0; + $form_ff_event = 0; } switch ($form_moduletype) { diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index 7573e971cb..6c942050dc 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -70,7 +70,12 @@ if ($update_module_id != NULL){ $form_prediction_module = $row['prediction_module']; $form_max_timeout = $row['max_timeout']; $form_custom_id = $row['custom_id']; - + $form_history_data = $row['history_data']; + $form_min_warning = $row['min_warning']; + $form_max_warning = $row['max_warning']; + $form_min_critical = $row['min_critical']; + $form_max_critical = $row['max_critical']; + $form_ff_event = $row['min_ff_event']; if ($tbl_disabled == 1){ $disabled_status = 'checked="ckecked"'; } else { @@ -241,6 +246,28 @@ echo ''.__('Max. Value').""; echo ''; echo ''; +// Warning value threshold +echo ''; +echo ''.__('Warning status').""; +echo ''.__("Min").' '; +echo ' '.__("Max").' '; + +// Critical value threshold +echo ''.__('Critical status').""; +echo ''.__("Min").' '; +echo ' '.__("Max").' '; +echo ''; + +echo ""; +echo ''.__('Historical data').""; +echo ''; +print_checkbox ("form_history_data", 1, $form_history_data, false); + +echo ''.__('FF Threshold'); +pandora_help ("ff_threshold"); +echo ''; +echo ''; + // Post process / Export server echo ''; echo ''.__('Post process'); @@ -268,14 +295,14 @@ echo ''.__('TCP send'); pandora_help ("tcp_send"); echo ""; -// SNMP module, tcp_send contains the SNMP version if ($form_id_tipo_modulo >= 15 && $form_id_tipo_modulo <= 18) { - echo ''; + echo ''; } else { - echo ''; + echo ''; } +echo ''; echo ''.__('TCP receive').""; -echo ''; +echo ''; echo ''; // Description diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index bd6b0e9258..98653694ba 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -41,8 +41,6 @@ if ($update_settings) { $config["days_purge"] = (int) get_parameter ('days_purge', $config["days_purge"]); $config["graph_res"] = (int) get_parameter ('graph_res', $config["graph_res"]); $config["step_compact"] = (int) get_parameter ('step_compact', $config["step_compact"]); - $config["show_unknown"] = (int) get_parameter ('show_unknown', $config["show_unknown"]); - $config["show_lastalerts"] = (int) get_parameter ('show_lastalerts', $config["show_lastalerts"]); $config["style"] = (string) get_parameter ('style', $config["style"]); $config["remote_config"] = (string) get_parameter ('remote_config', $config["remote_config"]); $config["graph_color1"] = (string) get_parameter ('graph_color1', $config["graph_color1"]); @@ -54,7 +52,7 @@ if ($update_settings) { $config["autoupdate"] = (string) get_parameter ('autoupdate', $config["autoupdate"]); $config["prominent_time"] = (string) get_parameter ('prominent_time', $config["prominent_time"]); $config["timesource"] = (string) get_parameter ('timesource', $config["timesource"]); - + $config["event_view_hr"] = (int) get_parameter ('event_view_hr', $config["event_view_hr"]); $config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4); process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'"); @@ -64,8 +62,6 @@ if ($update_settings) { process_sql ("UPDATE tconfig SET VALUE='".$config["days_compact"]." ' WHERE token = 'days_compact'"); process_sql ("UPDATE tconfig SET VALUE='".$config["graph_res"]."' WHERE token = 'graph_res'"); process_sql ("UPDATE tconfig SET VALUE='".$config["step_compact"]."' WHERE token = 'step_compact'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["show_unknown"]."' WHERE token = 'show_unknown'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["show_lastalerts"]."' WHERE token = 'show_lastalerts'"); process_sql ("UPDATE tconfig SET VALUE='".$config["style"]."' WHERE token = 'style'"); process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color1"]."' WHERE token = 'graph_color1'"); process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color2"]."' WHERE token = 'graph_color2'"); @@ -76,6 +72,7 @@ if ($update_settings) { process_sql ("UPDATE tconfig SET VALUE='".$config["autoupdate"]."' WHERE token = 'autoupdate'"); process_sql ("UPDATE tconfig SET VALUE='".$config["prominent_time"]."' WHERE token = 'prominent_time'"); process_sql ("UPDATE tconfig SET VALUE='".$config["timesource"]."' WHERE token = 'timesource'"); + process_sql ("UPDATE tconfig SET VALUE='".$config["event_view_hr"]."' WHERE token = 'event_view_hr'"); } echo "

".__('Pandora Setup')." > "; @@ -118,18 +115,15 @@ $table->data[9][1] = print_input_text ('graph_res', $config["graph_res"], '', 5, $table->data[10][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); $table->data[10][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true); -$table->data[11][0] = __('Show unknown modules in global view'); -$table->data[11][1] = print_checkbox ('show_unknown', 1, $config["show_unknown"], true); - -$table->data[12][0] = __('Show last fired alerts in global view'); -$table->data[12][1] = print_checkbox ('show_lastalerts', 1, $config["show_lastalerts"], true); - $table->data[13][0] = __('Style template'); $table->data[13][1] = print_select ($file_styles, 'style', $config["style"], '', '', '', true); $table->data[14][0] = __('Block size for pagination'); $table->data[14][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true); +$table->data[14][0] = __('Default hours for event view'); +$table->data[14][1] = print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true); + $table->data[15][0] = __('Timestamp or time comparation'); $table->data[15][1] = __('Comparation in rollover').' '; $table->data[15][1] .= print_radio_button ('prominent_time', "timestamp", '', $config["prominent_time"], true); diff --git a/pandora_console/images/b_magenta.png b/pandora_console/images/b_magenta.png new file mode 100644 index 0000000000..dfd3a9e332 Binary files /dev/null and b/pandora_console/images/b_magenta.png differ diff --git a/pandora_console/images/dot_magenta.png b/pandora_console/images/dot_magenta.png new file mode 100644 index 0000000000..6176514f5b Binary files /dev/null and b/pandora_console/images/dot_magenta.png differ diff --git a/pandora_console/images/mod_icmp_data.png b/pandora_console/images/mod_icmp_data.png index 840466a2a4..b38e6ee934 100644 Binary files a/pandora_console/images/mod_icmp_data.png and b/pandora_console/images/mod_icmp_data.png differ diff --git a/pandora_console/images/mod_icmp_proc.png b/pandora_console/images/mod_icmp_proc.png index 8ad70c9f42..9091c999f6 100644 Binary files a/pandora_console/images/mod_icmp_proc.png and b/pandora_console/images/mod_icmp_proc.png differ diff --git a/pandora_console/images/mod_snmp_data.png b/pandora_console/images/mod_snmp_data.png index c1df3ff619..8cdfec2f6b 100644 Binary files a/pandora_console/images/mod_snmp_data.png and b/pandora_console/images/mod_snmp_data.png differ diff --git a/pandora_console/images/mod_snmp_inc.png b/pandora_console/images/mod_snmp_inc.png index 7c51862564..f2ef77c795 100644 Binary files a/pandora_console/images/mod_snmp_inc.png and b/pandora_console/images/mod_snmp_inc.png differ diff --git a/pandora_console/images/mod_snmp_proc.png b/pandora_console/images/mod_snmp_proc.png index 7379f486bf..fe52f28803 100644 Binary files a/pandora_console/images/mod_snmp_proc.png and b/pandora_console/images/mod_snmp_proc.png differ diff --git a/pandora_console/images/mod_snmp_string.png b/pandora_console/images/mod_snmp_string.png index baf0b2c023..cbd08ae1b3 100644 Binary files a/pandora_console/images/mod_snmp_string.png and b/pandora_console/images/mod_snmp_string.png differ diff --git a/pandora_console/images/mod_tcp_data.png b/pandora_console/images/mod_tcp_data.png index 844b0894b7..81443a80a7 100644 Binary files a/pandora_console/images/mod_tcp_data.png and b/pandora_console/images/mod_tcp_data.png differ diff --git a/pandora_console/images/mod_tcp_inc.png b/pandora_console/images/mod_tcp_inc.png index 2e9dd92c37..5cae015fc2 100644 Binary files a/pandora_console/images/mod_tcp_inc.png and b/pandora_console/images/mod_tcp_inc.png differ diff --git a/pandora_console/images/mod_tcp_proc.png b/pandora_console/images/mod_tcp_proc.png index 2e13344310..5536950020 100644 Binary files a/pandora_console/images/mod_tcp_proc.png and b/pandora_console/images/mod_tcp_proc.png differ diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index af844da9ef..6de1dd463f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -119,6 +119,11 @@ if (!isset ($config['date_format'])) { process_sql ("INSERT INTO tconfig (token,value) VALUES ('date_format', '".$config['date_format']."')"); } +if (!isset($config["event_view_hr"])){ + $config["event_view_hr"] = 8; + process_sql ("INSERT INTO tconfig (token,value) VALUES ('event_view_hr', ".$config["event_view_hr"].")"); +} + if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') { $config['homeurl'] = '/'.$config['homeurl']; } diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 0df6fd677a..9b98f0afba 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -431,9 +431,7 @@ function format_for_graph ($number , $decimals = 1, $dec_point = ".", $thousands $number = $number/1000; } - $number = $number . $shorts[$pos]; - - return format_numeric ($number, $decimals); //This will actually do the rounding and the decimals + return format_numeric ($number, $decimals). $shorts[$pos]; //This will actually do the rounding and the decimals } /** diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 9a17d1553c..5456c02f7f 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -819,6 +819,7 @@ function dame_id_grupo ($id_agent) { return get_agent_group ($id_agent); } + /** * Get the number of pandora data packets in the database. * @@ -1153,6 +1154,31 @@ function show_server_type ($id){ } } +/** + * Get a module category name + * + * @param id_category Id category + * + * @return Name of the given category + */ +function give_modulecategory_name ($id_category) { + switch ($id_category) { + case 0: + return __('Software agent data'); + break; + case 1: + return __('Software agent monitor'); + break; + case 2: + return __('Network agent data'); + break; + case 3: + return __('Network agent monitor'); + break; + } + return __('Unknown'); +} + /** * Get a network component group name * @@ -2028,7 +2054,7 @@ function delete_agent ($id_agents) { foreach ($id_agents as $id_agent) { $id_agent = (int) $id_agent; //Cast as integer - + $agent_name = get_agent_name ($id_agent); if ($id_agent < 1) continue; //If an agent is not an integer or invalid, don't process it @@ -2040,20 +2066,17 @@ function delete_agent ($id_agents) { $sql = sprintf ("SELECT id_ag FROM taddress_agent, taddress WHERE taddress_agent.id_a = taddress.id_a AND id_agent = %d", $id_agent); $result = get_db_all_rows_sql ($sql); + if ($result) foreach ($result as $row) { temp_sql_delete ("taddress_agent", "id_ag", $row["id_ag"]); } - //Standard data - temp_sql_delete ("tagente_datos", "id_agente_modulo", $tmodbase); - - //Incremental Data - temp_sql_delete ("tagente_datos_inc", "id_agente_modulo", $tmodbase); - - //String data - temp_sql_delete ("tagente_datos_string", "id_agente_modulo", $tmodbase); - - //Alert + // We cannot delete tagente_datos and tagente_datos_string here + // because it's a huge ammount of time. tagente_module has a special + // field to mark for delete each module of agent deleted and in + // daily maintance process, all data for that modules are deleted + + //Alert temp_sql_delete ("tcompound_alert", "id_aam", "ANY(SELECT id_aam FROM talerta_agente_modulo WHERE id_agent = ".$id_agent.")"); temp_sql_delete ("talerta_agente_modulo", "id_agente_modulo", $tmodbase); temp_sql_delete ("talerta_agente_modulo", "id_agent", $id_agent); @@ -2076,11 +2099,23 @@ function delete_agent ($id_agents) { //tagente_modulo after this temp_sql_delete ("tagente_modulo", "id_agente", $id_agent); + process_sql ('UPDATE tagente_modulo SET delete_pending = 1, disabled = 1 WHERE id_agente = '. $id_agent); + //Access entries temp_sql_delete ("tagent_access", "id_agent", $id_agent); //And at long last, the agent temp_sql_delete ("tagente", "id_agente", $id_agent); + + // Delete remote configuration + $agent_md5 = md5($agent_name, FALSE); + if (file_exists($config["remote_config"] . "/" . $agent_md5 . ".md5")) { + // Agent remote configuration editor + $file_name = $config["remote_config"] . "/" . $agent_md5 . ".conf"; + unlink ($file_name); + $file_name = $config["remote_config"] . "/" . $agent_md5 . ".md5"; + unlink ($file_name); + } } if ($errors > 0) { @@ -2187,6 +2222,7 @@ function get_agent_modules_count ($id_agent = 0) { $id_agent = safe_int ($id_agent, 1); //Make sure we're all int's and filter out bad stuff if (empty ($id_agent)) { + //If the array proved empty or the agent is less than 1 (eg. -1) $filter = ''; } else { $filter = sprintf (" WHERE id_agente IN (%s)", implode (",", (array) $id_agent)); @@ -2228,7 +2264,6 @@ function get_agent_group ($id_agent) { function get_group_name ($id_group) { return (string) get_db_value ('nombre', 'tgrupo', 'id_grupo', (int) $id_group); } - /** * Validates an alert id or an array of alert id's * @@ -2306,4 +2341,4 @@ function get_modulegroups () { function get_modulegroup_name ($modulegroup_id) { return (string) get_db_value ('name', 'tmodule_group', 'id_mg', (int) $modulegroup_id); } -?> \ No newline at end of file +?> diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 9ab0714c2b..58d5a53648 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -152,7 +152,7 @@ function get_group_stats ($id_group) { $data["data_alerts_fired"] = 0; $data["data_alerts_fire_count"] = 0; - + $cur_time = get_system_time (); foreach ($result as $row) { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index a25a1a072a..4c7d3b0fe9 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -353,6 +353,7 @@ td.datos_id { .red, .redb, .redi, .error { color: #f00; } + .sep { margin-left: 30px; border-bottom: 1px solid #708090; @@ -361,6 +362,9 @@ td.datos_id { .green { color: #5a8629; } +.yellow { + color: #F3C500; +} .greenb { color: #00aa00; } diff --git a/pandora_console/include/styles/pandora_red.css b/pandora_console/include/styles/pandora_red.css index d69d21135f..cc3eb675bb 100644 --- a/pandora_console/include/styles/pandora_red.css +++ b/pandora_console/include/styles/pandora_red.css @@ -383,6 +383,9 @@ td.datos_jus, td.datos2_jus { .green { color: #5a8629; } +.yellow { + color: #F3C500; +} .greenb { color: #00aa00; } diff --git a/pandora_console/include/styles/pandora_width.css b/pandora_console/include/styles/pandora_width.css index a56ae19b5c..60ec2a680c 100644 --- a/pandora_console/include/styles/pandora_width.css +++ b/pandora_console/include/styles/pandora_width.css @@ -374,6 +374,9 @@ td.datos_jus, td.datos2_jus { .green { color: #5a8629; } +.yellow { + color: #F3C500; +} .greenb { color: #00aa00; } diff --git a/pandora_console/include/styles/tip.css b/pandora_console/include/styles/tip.css index 3b38fcb604..c6a557777a 100644 --- a/pandora_console/include/styles/tip.css +++ b/pandora_console/include/styles/tip.css @@ -78,7 +78,9 @@ a.info_table:hover span{ a.info:hover span { top: 45px; left: 20px; - width: 100px; + width: 120px; + background-color: #ffffff; + border: 1px solid #aaaaaa; } a.info2:hover span { top: 8px; diff --git a/pandora_console/operation/agentes/datos_agente.php b/pandora_console/operation/agentes/datos_agente.php index f9d961ef6d..be5efcec8c 100644 --- a/pandora_console/operation/agentes/datos_agente.php +++ b/pandora_console/operation/agentes/datos_agente.php @@ -44,10 +44,10 @@ if (isset ($_GET["delete"])) { // Different query for string data type if (preg_match ("/string/", get_moduletype_name (get_agentmodule_type ($module_id)))) { - $sql = sprintf ("SELECT * FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, get_system_time () - $period); + $sql = sprintf ("SELECT * FROM tagente_datos_string WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); $string_type = 1; } else { - $sql = sprintf ("SELECT * FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY timestamp DESC", $module_id, get_system_time () - $period); + $sql = sprintf ("SELECT * FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d ORDER BY utimestamp DESC", $module_id, get_system_time () - $period); $string_type = 0; } diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index a5b2c4605c..11c71f8c1e 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -182,25 +182,22 @@ if ($agents !== false) { $modules = get_db_all_rows_sql ($sql); if ($modules === false) $modules = array (); - $estado_general = 0; $numero_modulos = 0; - $numero_monitor = 0; $est_timestamp = ""; - $monitor_bad = 0; - $monitor_ok = 0; + $monitor_normal = 0; + $monitor_warning = 0; + $monitor_critical = 0; $monitor_down = 0; - $numero_datamodules = 0; - $estado_cambio = 0; $agent_down = 0; $now = get_system_time (); // Calculate module/monitor totals for this agent foreach ($modules as $module) { - $est_modulo = $module["estado"]; + $numero_modulos ++; $ultimo_contacto_modulo = $module["timestamp"]; $module_interval = $module["module_interval"]; $module_type = $module["id_tipo_modulo"]; - + if ($module_interval > $biginterval) $biginterval = $module_interval; if ($module_interval != 0) @@ -219,22 +216,16 @@ if ($agents !== false) { // Defines if Agent is down (interval x 2 > time last contact if ($seconds >= ($intervalo_comp * 2)) { // If (intervalx2) secs. ago we don't get anything, show alert $agent_down = 1; - if ($est_modulo != 100) - $numero_monitor++; if ($async == 0) $monitor_down++; - } elseif ($est_modulo != 100) { // estado=100 are data modules - $estado_general = $estado_general + $est_modulo; - $estado_cambio = $estado_cambio + $module["cambio"]; - $numero_monitor ++; - if ($est_modulo != 0) - $monitor_bad++; - else - $monitor_ok++; - } elseif ($est_modulo == 100) { // Data modules - $numero_datamodules++; + } else{ + if ($module["estado"] == 2) + $monitor_warning ++; + elseif ($module["estado"]== 1) + $monitor_critical ++; + else + $monitor_normal ++; } - $numero_modulos++; } // Color change for each line (1.2 beta2) if ($color == 1){ @@ -271,44 +262,41 @@ if ($agents !== false) { // Show GROUP icon echo ''; + echo ""; + echo print_group_icon ($id_grupo); + //echo ' ('; + //echo get_group_name ($id_grupo); + //echo ")"; + echo ""; - echo ""; - print_group_icon ($id_grupo); - echo " ". - $numero_modulos." / ".$numero_monitor; - if ($monitor_bad != 0) { - echo " / ".$monitor_bad.""; - } - if ($monitor_down != 0){ - echo " / ".$monitor_down.""; - } + echo "".$numero_modulos." : "; + if ($monitor_normal > 0) + echo " ".$monitor_normal.""; + if ($monitor_warning > 0) + echo " ".$monitor_warning.""; + if ($monitor_critical > 0) + echo " ".$monitor_critical.""; + if ($monitor_down > 0) + echo " ".$monitor_down.""; echo ""; echo ""; - if ($numero_monitor != 0){ - if ($estado_general != 0){ - if ($estado_cambio == 0){ - echo ''; - } else { - echo ''; - } - } elseif ($monitor_ok > 0) { - echo ''; - } elseif ($monitor_down > 0) { + if ($numero_modulos > 0){ + if ($agent_down > 0) { echo ''; - } elseif ($numero_datamodules == 0) { - echo ''; } - } else { - if ($agent_down && $numero_datamodules == 0) { - echo ''; - } elseif ($numero_datamodules == 0) { - echo ''; + elseif ($monitor_critical > 0){ + echo ''; + } elseif ($monitor_warning > 0) { + echo ''; } else { - echo ''; - } + echo ''; + } + } else { + echo ''; } + // checks if an alert was fired recently echo ""; if (give_disabled_group ($id_grupo)) { diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index a0c186ae93..10eca6d808 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -46,7 +46,7 @@ echo '
 
'; //Floating div echo '
'; echo ''.__('Agent access rate (24h)').'

'; -echo ''; +echo ''; echo '
 
'; echo ''.__('Events generated -by module-').'

'; echo ''; @@ -85,17 +85,15 @@ echo ''.$agent["comentarios"].''; // Group echo ''.__('Group').''; echo ''; -print_group_icon ($agent["id_grupo"]); -echo ''; +echo print_group_icon ($agent["id_grupo"]); +echo ' ('; +echo get_group_name ($agent["id_grupo"]); +echo ')'; // Agent version echo ''.__('Agent Version'). ''; echo ''.$agent["agent_version"].''; -// Total packets -echo ''. __('Total packets'). ''; -echo ''.get_agent_modules_data_count ($id_agente).''; - // Last contact echo ''.__('Last contact')." / ".__('Remote').''; print_timestamp ($agent["ultimo_contacto"]); @@ -129,4 +127,4 @@ echo ' $group_name) { $total_agents += $agents; $group_info = array ('agent' => $agents, - 'ok' => 0, - 'bad' => 0, + 'normal' => 0, + 'critical' => 0, + 'warning' => 0, 'alerts' => 0, 'down' => 0, 'icon' => dame_grupo_icono ($id_group), @@ -73,13 +75,12 @@ foreach ($groups as $id_group => $group_name) { 'name' => $group_name); // SQL Join to get monitor status for agents belong this group - $sql = sprintf ("SELECT tagente_estado.datos, tagente_estado.current_interval, + $sql = sprintf ("SELECT tagente_estado.estado, tagente_estado.current_interval, tagente_estado.utimestamp FROM tagente, tagente_estado, tagente_modulo WHERE tagente.disabled = 0 AND tagente.id_grupo = %d AND tagente.id_agente = tagente_estado.id_agente - AND tagente_estado.estado != 100 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_estado.utimestamp != 0", @@ -88,18 +89,15 @@ foreach ($groups as $id_group => $group_name) { if ($modules === false) $modules = array (); foreach ($modules as $module) { - //if ($config["show_unknown"] > 0) { - //this needs to be filled out somehow, but this was a serious bug. If that config var is set, it would short circuit both ok++ and bad++ returning empty for everything - //} $seconds = $now - $module['utimestamp']; - // Down = module/agent down (as in it didn't monitor in time) - // Bad = module bad (as in it did monitor but it returned 0) if ($seconds >= ($module['current_interval'] * 2)) { - $group_info["down"]++; - } elseif ($module['datos'] != 0) { - $group_info["ok"]++; + $group_info['down']++; + } elseif ($module['estado'] == 2) { + $group_info['warning']++; + } elseif ($module['estado'] == 1) { + $group_info['critical']++; } else { - $group_info["bad"]++; + $group_info['normal']++; } } @@ -113,7 +111,7 @@ foreach ($groups as $id_group => $group_name) { AND tagente.id_agente = tagente_modulo.id_agente AND talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo", $id_group); - $group_info["alerts"] = get_db_sql ($sql); + $group_info["alerts"] = 0 + get_db_sql ($sql); } array_push ($groups_info, $group_info); } @@ -160,17 +158,21 @@ for ($table = 0; $table < $ancho; $table++) { $group_name = $group_info["name"]; $icono_grupo = $group_info["icon"]; $icono_type = ""; - if ($group_info["bad"] > 0) { - $icono_type .= ''; + if ($group_info['critical'] > 0) { + $icono_type .= ''; } - if ($group_info["ok"] > 0) { - $icono_type .= ''; + if ($group_info["normal"] > 0) { + $icono_type .= ''; + } + + if ($group_info["warning"] > 0) { + $icono_type .= ''; } // Show yellow light if there are recent alerts fired for this group if ($group_info["alerts"] > 0 ) { - $icono_type .= ''; + $icono_type .= ''; } // Show grey light if there are agent down for this group @@ -187,22 +189,24 @@ for ($table = 0; $table < $ancho; $table++) { $celda = ''; // Grey border if agent down - if ($config["show_unknown"] > 0) { - if ($group_info["down"] > 0) - $celda = ''; - } + if ($group_info["down"] > 0) + $celda = ''; - // Yellow border if agents with alerts + // Yellow border if agents WARNING + if ($group_info["warning"] > 0) + $celda = ''; + + // Red border if agents CRITICAL + if ($group_info["critical"] > 0) + $celda = ''; + + // Magenta border if agents with alerts if ($group_info["alerts"] > 0) - $celda = ''; + $celda = ''; - // Red border if agents bad - if ($group_info["bad"] > 0) - $celda = ''; - - // Orange if alerts and down modules - if (($group_info["bad"] > 0) && ($group_info["alerts"] > 0)) - $celda = ''; + // Black if alerts and down modules + if (($group_info["critical"] > 0) && ($group_info["alerts"] > 0)) + $celda = ''; $celda .= '
'; @@ -210,25 +214,24 @@ for ($table = 0; $table < $ancho; $table++) { $celda .= ''; // Add float info table - $celda .= ' - + $celda .= '
'.__('Agents').':
+
'.__('Agents').':
'.$group_info["agent"].'
- - - - - - '; +
'.__('Monitors').':
'.__('Ok').':'.$group_info["ok"].'
'.__('Fail').':'.$group_info["bad"].'
+ + + + + + + '; - if ($config["show_unknown"] > 0) { - $celda .= ' - '; - } + $celda .= ' + '; - if ($config["show_lastalerts"] == 1) - $celda .= ' - '; + $celda .= ' + '; $celda .= "
'.__('Normal').''.format_for_graph ($group_info["normal"] , 1).'
'.__('Warning').''.format_for_graph ($group_info["warning"] , 1).'
'.__('Critical').''.format_for_graph ($group_info["critical"] , 1).'
'.__('Down').':'.$group_info["down"].'
'.__('Down').''.format_for_graph ($group_info["down"] , 1).'
'.__('Alerts').':'.$group_info["alerts"].'
'.__('Alerts').''.$group_info["alerts"].'
"; diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 2cf8420d7a..91c9374b5d 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -31,6 +31,7 @@ if (!isset ($id_agente)) { $sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente = %d AND tagente_modulo.disabled = 0 + AND tagente_modulo.delete_pending = 0 AND tagente_estado.utimestamp != 0 ORDER BY tagente_modulo.nombre", $id_agente); @@ -53,14 +54,6 @@ $table->head[4] = __('Status'); $table->head[5] = __('Interval'); $table->head[6] = __('Last contact'); -//Since PHP's Zend optimizer references $var2 in case you do $var = $var2, objects get referenced too so we can't do $table = $table_data -$table_data->head = $table->head; //Duplicate table for data modules -$table_data->class = $table->class; -$table_data->data = array (); -$table_data->cellspacing = $table->cellspacing; -$table_data->cellpadding = $table->cellpadding; -$table_data->width = $table->width; - foreach ($modules as $module) { $data = array (); if (($module["id_modulo"] != 1) && ($module["id_tipo_modulo"] != 100)) { @@ -74,15 +67,17 @@ foreach ($modules as $module) { } $data[1] = ''; + if (give_acl ($config['id_user'], $id_grupo, "AW")) + $data[1] .= ''; $data[2] = substr ($module["nombre"], 0, 25); $data[3] = substr ($module["descripcion"], 0, 35); - if ($module["estado"] == 1 && $module["cambio"] == 1) { - $data[4] = ''; + if ($module["estado"] == 2) { + $data[4] = ''; } elseif ($module["estado"] == 1) { - $data[4] = ''; + $data[4] = ''; } else { - $data[4] = ''; + $data[4] = ''; } if ($module["module_interval"] > 0) { @@ -99,14 +94,7 @@ foreach ($modules as $module) { } $data[6] .= print_timestamp ($module["utimestamp"], true); $data[6] .= ''; - - if ($module["estado"] != 100) { - array_push ($table->data, $data); - //Monitor modules go on $table - } else { - array_push ($table_data->data, $data); - //Data modules go on $table_data - } + array_push ($table->data, $data); } if (empty ($table->data)) { @@ -116,12 +104,6 @@ if (empty ($table->data)) { print_table ($table); } -if (empty ($table_data->data)) { - echo '
'.__('This agent doesn\'t have any active data modules').'
'; -} else { - echo "

".__('Full list of Data Modules')."

"; - print_table ($table_data); -} unset ($table); unset ($table_data); -?> \ No newline at end of file +?> diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index 75fe4e3cc2..4a8645cf11 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -110,6 +110,10 @@ if (mysql_num_rows ($result3)) { echo salida_limpia(substr($row3["nombre"],0,15)); echo ""; echo ""; + if (give_acl ($config['id_user'], $id_grupo, "AW")) + echo ''; + + echo ""; if ($row3["module_interval"] != 0){ echo $row3["module_interval"]; @@ -130,7 +134,7 @@ if (mysql_num_rows ($result3)) { } echo ""; } - if ($row3["id_tipo_modulo"] == 100) { + if (($row3["id_tipo_modulo"] == 100) OR ($row3['history_data'] == 0)) { echo ""; echo substr(salida_limpia($row3["datos"]),0,12); } else { @@ -180,12 +184,17 @@ if (mysql_num_rows ($result3)) { echo ''; } - // RAW Table data - echo ""; - echo "  "; - echo "  "; - echo ""; - + + if ($row3['history_data'] == 1){ + // RAW Table data + echo ""; + echo "  "; + echo "  "; + echo ""; + } else { + echo ""; + } + echo ""; if ($row3["timestamp"] == "0000-00-00 00:00:00"){ diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index f3068bb6f3..9ab8ffe9e7 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -171,7 +171,7 @@ if ($flag_alert == 1 && give_acl ($config['id_user'], $id_grupo, "AW")) { echo "

"; echo ''.__('Event control filter').' '.''; -if ($config["pure"] == 1) { + echo '