diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 667e96bbbf..0b2df2fd81 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,29 @@ +2009-03-02 Evi Vanoost + + * include/functions_reporting.php: Rewrote get_agentmodule_sla with + faster calculations (count in SQL). + + * include/functions_ui.php: Added print_moduletype_icon that prints the + whole (correct) icon including rollover text + + * include/functions_db.php: Updated some documenation and removed + deprecated functions that are now in the auth parts. Renamed + return_status_agent_module to get_agentmodule_status + + * operation/agentes/sla_view.php: Made it use the 2.0 SQL and HTML + functions + + * godmode/agentes/configurar_agente.php: Fixed tab links + + * operation/events/events.php, include/functions_visual_map.php, + operation/agentes/networkmap.php, operation/agentes/status_monitor.php, + operation/agentes/estado_grupo.php, operation/agentes/ver_agente.php, + operation/reporting/custom_reporting.php, + operation/reporting/reporting_viewer.php, + operation/reporting/reporting_xml.php, godmode/setup/links.php, + godmode/setup/setup.php, godmode/reporting/map_builder.php, + godmode/reporting/reporting_builder.php: Fixed renamed functions + 2009-03-02 Esteban Sanchez * include/functions_menu.php: Added to repository. Functions for menu. diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index d17aa546a6..68469ccf36 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -211,12 +211,12 @@ print_image ("images/lightbulb.png", false, $img_arr); echo '  '.__('Modules').''; echo '
  • '; -echo ''; +echo ''; print_image ("images/bell.png", false, $img_arr); echo '  '.__('Alerts').'
  • '; echo '
  • '; -echo ''; +echo ''; print_image ("images/network.png", false, $img_arr); echo '  '.__('Net. Templates').'
  • '; diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index b0f0376057..5cdf307333 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -83,7 +83,7 @@ if ($id_group) $table->data[2][1] = print_select_from_sql ($sql, 'id_parent', $id_parent, '', 'None', 0, true); $table->data[2][1] .= ' '; if ($id_parent) { - echo ''; + echo ''; } echo''; diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index e74f5b13aa..ddb4fcf1a6 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -278,7 +278,7 @@ if (! $edit_layout && ! $id_layout) { $data = array (); $data[0] = ''.$map['name'].''; - $data[1] = ' '; + $data[1] = ' '; $data[1] .= get_group_name ($map['id_group']); $data[2] = ' '; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 4d88b981c5..a0abec8824 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -351,7 +351,7 @@ if ($edit_sla_report_content) { } $table->data[1][1] .= ' '; if ($report_id_group) { - $table->data[1][1] .= ''; + $table->data[1][1] .= ''; } $table->data[1][1] .= ''; $table->data[2][0] = __('Private'); diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php index 47fb95a2ef..7ce8656cbf 100644 --- a/pandora_console/godmode/setup/links.php +++ b/pandora_console/godmode/setup/links.php @@ -21,7 +21,7 @@ require_once ("include/config.php"); check_login (); -if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'])) { +if (! give_acl ($config['id_user'], 0, "PM") || ! is_user_admin ($config['id_user'])) { audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Link Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 82850653a5..669e06ee0e 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -21,7 +21,7 @@ require_once ("include/config.php"); check_login (); -if (! give_acl ($config['id_user'], 0, "PM") || ! dame_admin ($config['id_user'])) { +if (! give_acl ($config['id_user'], 0, "PM") || ! is_user_admin ($config['id_user'])) { audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Setup Management"); require ("general/noaccess.php"); exit; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index e2881fdeaa..c59aa3520e 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1021,14 +1021,7 @@ function get_os_name ($id_os) { } /** - * DEPRECATED: Use get_user_email - */ -function dame_email ($id_user) { - return get_user_email ($id_user); -} - -/** - * DEPRECATED: Use is_user_admin + * @deprecated Use is_user_admin */ function dame_admin ($id_user) { return is_user_admin ($id_user); @@ -1061,17 +1054,6 @@ function check_alert_fired ($id_agent) { return false; } -/** - * Check is a user exists in the system - * - * @param string User id. - * - * @return bool True if the user exists. - */ -function existe ($id_user) { - return is_user ($id_user); -} - /** * Get the interval value of an agent module. * @@ -1517,11 +1499,12 @@ function get_db_row_sql ($sql) { * Get the first row of a database query into a table. * * The SQL statement executed would be something like: - * "SELECT * FROM $table WHERE $field_search = $condition" + * "SELECT (*||$fields) FROM $table WHERE $field_search = $condition" * * @param string Table to get the row - * @param string Field to filter elementes + * @param string Field to filter elements * @param string Condition the field must have. + * @param mixed Fields to select (array or string or false/empty for *) * * @return mixed The first row of a database query or false. */ @@ -2037,7 +2020,7 @@ function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = fal * * @return bool True if there were alerts fired. */ -function return_status_agent_module ($id_agentmodule = 0) { +function get_agentmodule_status ($id_agentmodule = 0) { $status = get_db_value ('estado', 'tagente_estado', 'id_agente_modulo', $id_agentmodule); $times_fired = get_db_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 4ceb525460..7978e634f3 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -17,8 +17,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -global $config; - require_once ($config["homedir"]."/include/functions_agents.php"); /** @@ -33,84 +31,40 @@ require_once ($config["homedir"]."/include/functions_agents.php"); * * @return int SLA percentage of the requested module. */ -function get_agent_module_sla ($id_agent_module, $period, $min_value, $max_value = false, $date = 0) { - if (empty ($date)) - $date = get_system_time (); - - if (empty ($period)) - return false; //We can't calculate a 0 period (division by zero) +function get_agentmodule_sla ($id_agentmodule, $period = 0, $min_value = 1, $max_value = false, $date = 0) { + if (empty ($date)) { + $date = get_system_time (); + } + if (empty ($period)) { + global $config; + $period = $config["sla_period"]; + } + $datelimit = $date - $period; // start date - /* Get all the data in the interval */ - $sql = sprintf ('SELECT datos, utimestamp FROM tagente_datos - WHERE id_agente_modulo = %d - AND utimestamp > %d AND utimestamp <= %d - ORDER BY utimestamp ASC', - $id_agent_module, $datelimit, $date); - $datas = get_db_all_rows_sql ($sql); - if ($datas === false) { - - /* Try to get data from tagente_estado. It may found nothing because of - data compression */ - $sql = sprintf ('SELECT datos, utimestamp FROM tagente_estado - WHERE id_agente_modulo = %d - AND utimestamp > %d AND utimestamp <= %d - ORDER BY utimestamp ASC', - $id_agent_module, $datelimit, $date); - $data = get_db_sql ($sql); - - if ($data === false) { - //No data to calculate on so we return 0. - return 0; - } - $datas = array (); - array_push ($datas, $data); + /* Get the total data entries in the interval */ + $sql = sprintf ('SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d AND utimestamp <= %d', $id_agentmodule, $datelimit, $date); + $total = get_db_sql ($sql); + + if (empty ($total)) { + //No data to calculate on so we return 100 (fail to good) + return 100; + } + + $sql = sprintf ('SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d AND utimestamp <= %d AND datos < %d', $id_agentmodule, $datelimit, $date, $min_value); + if ($max_value > $min_value) { + $sql .= sprintf (' AND datos > %d', $max_value); + } + $bad = get_db_sql ($sql); + if (empty ($bad)) { + $bad = 0; } - $last_data = ""; - $total_badtime = 0; - $interval_begin = 0; - $interval_last = $date; - $previous_data_timestamp = 0; + //Calculate percentage + $result = 100 - ($bad / $total) * 100; - /* Get also the previous data before the selected interval. */ - $previous_data = get_previous_data ($id_agent_module, $datelimit); - - if ($previous_data) { - /* Add data to the beginning */ - array_unshift ($datas, $previous_data); - $previous_data_timestamp = $previous_data['utimestamp']; - } - - foreach ($datas as $data) { - if ($data["datos"] < $min_value || ($max_value !== false && $data["datos"] > $max_value)) { - if ($interval_begin == 0) { - $interval_begin = $data["utimestamp"]; - } - } elseif ($interval_begin != 0) { - // Here ends interval with data outside valid values, - // Need to add this time to counter - $interval_last = $data["utimestamp"]; - $temp_time = $interval_last - $interval_begin; - $total_badtime += $temp_time; - $interval_begin = 0; - $interval_last = 0; - } - } - - /* Check the last interval, if any */ - if ($interval_begin != 0) { - /* The last time was the time of the previous data in the - interval. That means that in all the interval, the data was - not between the expected values, so the SLA is zero. */ - if ($interval_begin = $previous_data_timestamp) - return 0; - $total_badtime += $interval_last - $interval_begin; - } - - $result = 100 - ($total_badtime / $period) * 100; - return max ($result, 0); + return $result; } /** diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index b71fad7858..00445a347b 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -892,4 +892,22 @@ function debug ($var) { print_r ($var); echo ''; } + +/** + * Prints icon of a module type + * + * @param int Module Type ID + * @param bool Whether to return or print + * + * @return string An HTML string with the icon. Printed if return is false + */ +function print_moduletype_icon ($id_moduletype, $return = false) { + $type = get_db_row ("ttipo_modulo", "id_tipo", (int) $id_moduletype, array ("nombre", "icon")); + if ($type === false) { + $type = array (); + $type["nombre"] = __('Unknown Type'); + $type["icon"] = 'b_down.png'; + } + return print_image ("images/".$type["icon"], $return, array ("border" => 0, "title" => $type["nombre"])); +} ?> diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 49b5879aa7..b201e29bdd 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -46,11 +46,11 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = $id_agent = get_db_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']); $id_agent_module_parent = get_db_value ("id_agente_modulo", "tlayout_data", "id", $layout_data["parent_item"]); // Item value - $status = return_status_agent_module ($layout_data['id_agente_modulo']); + $status = get_agentmodule_status ($layout_data['id_agente_modulo']); if ($layout_data['no_link_color'] == 1) $status_parent = 3; else - $status_parent = return_status_agent_module ($id_agent_module_parent); + $status_parent = get_agentmodule_status ($id_agent_module_parent); // Status for a whole agent } elseif ($layout_data['id_agent'] != 0) { @@ -285,13 +285,13 @@ function get_layout_status ($id_layout = 0) { // Module } elseif ($data["id_agente_modulo"] != 0) { - $temp_status = return_status_agent_module ($data["id_agente_modulo"]); + $temp_status = get_agentmodule_status ($data["id_agente_modulo"]); if ($temp_status > $temp_total) $temp_total = $temp_status; // Agent } else { - $temp_status = return_status_agent ($data["id_agent"]); + $temp_status = get_agentmodule_status ($data["id_agent"]); if ($temp_status > $temp_total) $temp_total = $temp_status; } diff --git a/pandora_console/operation/agentes/estado_grupo.php b/pandora_console/operation/agentes/estado_grupo.php index bf791463f0..8131d93e0b 100644 --- a/pandora_console/operation/agentes/estado_grupo.php +++ b/pandora_console/operation/agentes/estado_grupo.php @@ -70,7 +70,7 @@ foreach ($groups as $id_group => $group_name) { 'warning' => 0, 'alerts' => 0, 'down' => 0, - 'icon' => dame_grupo_icono ($id_group), + 'icon' => get_group_icon ($id_group), 'id_group' => $id_group, 'name' => $group_name); diff --git a/pandora_console/operation/agentes/networkmap.php b/pandora_console/operation/agentes/networkmap.php index 1761cbc3b3..9181bf6648 100644 --- a/pandora_console/operation/agentes/networkmap.php +++ b/pandora_console/operation/agentes/networkmap.php @@ -164,7 +164,7 @@ function create_pandora_node ($name, $font_size = 10) { // Opens a group definition function open_group ($id) { - $img = 'images/'.dame_grupo_icono ($id).'.png'; + $img = 'images/'.get_group_icon ($id).'.png'; $name = get_group_name ($id); $group = 'subgraph cluster_' . $id . diff --git a/pandora_console/operation/agentes/sla_view.php b/pandora_console/operation/agentes/sla_view.php index 8e9b02e4a2..521019a35e 100644 --- a/pandora_console/operation/agentes/sla_view.php +++ b/pandora_console/operation/agentes/sla_view.php @@ -12,13 +12,14 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU General Public Liccense // 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"); +require_once ("include/functions_reporting.php"); check_login(); @@ -29,166 +30,101 @@ if (! give_acl ($config['id_user'], 0, "AR") && ! give_acl ($config['id_user'], exit; } -require ("include/functions_reporting.php"); - echo "

    ".__('SLA view')."

    "; -$id_agent = get_parameter ("id_agente", "0"); -$intervalo = get_agent_interval ($id_agent); +$id_agent = get_parameter ("id_agente", 0); +$interval = get_agent_interval ($id_agent); +$modules = get_agent_modules ($id_agent, '*', array ('disabled' => 0, 'history_data' => 1, 'delete_pending' => 0)); +$offset = get_parameter ("offset", 0); // Get all module from agent -$sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agent.' AND tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 ORDER BY tagente_modulo.nombre'; -$result_t=mysql_query($sql_t); -if (mysql_num_rows ($result_t)) { - echo "

    ".__('Automatic SLA for monitors')."

    "; - echo ""; - echo ""; - echo " - - - - - "; - $color=0; - while ($module_data=mysql_fetch_array($result_t)){ - # For evey module in the status table - $est_modulo = substr($module_data["nombre"],0,25); - $est_tipo = get_moduletype_name ($module_data["id_tipo_modulo"]); - $est_description = $module_data["descripcion"]; - $est_timestamp = $module_data["timestamp"]; - $est_estado = $module_data["estado"]; - $est_datos = $module_data["datos"]; - $est_cambio = $module_data["cambio"]; - $est_interval = $module_data["module_interval"]; - if ($intervalo != $est_interval && $est_interval > 0) { - $temp_interval = $est_interval; - } else { - $temp_interval = $intervalo; - } - if ($est_estado <>100){ # si no es un modulo de tipo datos - # Determinamos si se ha caido el agente (tiempo de intervalo * 2 superado) - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - $seconds = get_system_time () - $module_data["utimestamp"]; - if ($seconds >= ($temp_interval*2)) // If every interval x 2 secs. we get nothing, there's and alert - $agent_down = 1; - else - $agent_down = 0; - - echo ""; - echo "";; - } +$table->head = array (); +$table->head[0] = __('Type'); +$table->head[1] = __('Module name'); +$table->head[2] = __('S.L.A.'); +$table->head[3] = __('Status'); +$table->head[4] = __('Interval'); - echo ""; - else - echo "--"; - echo ""; - } +$table->data = array (); +$loc = 0; + +foreach ($modules as $module_id => $module) { + if ($loc < $offset) { + $loc++; + continue; //Skip offset + } elseif ($loc >= $offset + $config["block_size"]) { + continue; } - echo '
    X".__('Type')."".__('Module name')."".__('S.L.A.')."".__('Status')."".__('Interval')."".__('Last contact')."
    "; +echo "

    ".__('Automatic SLA for monitors')."

    "; +pagination (count ($modules), "index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=".$id_agent, $offset); - if (($module_data["id_modulo"] != 1) AND ($module_data["id_tipo_modulo"] < 100)) { - if ($module_data["flag"] == 0){ - echo ""; - } else { - echo ""; - } - } - echo "
    "; - echo ""; - echo "".$est_modulo.""; +$table->width = '95%'; +$table->cellpadding = 4; +$table->cellspacing = 4; +$table->class = "databox"; - $temp = get_agent_module_sla ($module_data["id_agente_modulo"], $config["sla_period"], 1); - if ($temp === false) - echo __('N/A'); - else { - echo format_numeric ($temp)." %"; - if ($est_estado == 1){ - if ($est_cambio == 1) - echo ""; - else - echo ""; - } else - echo ""; +$table->align = array (); +$table->align[0] = "center"; +$table->align[1] = "center"; +$table->align[2] = "center"; +$table->align[3] = "center"; +$table->align[4] = "center"; - echo ""; - if ($temp_interval != $intervalo) - echo $temp_interval.""; - if ($agent_down == 1) { // If agent down, it's shown red and bold - echo ""; - } - else { - echo ""; - } - if ($module_data["timestamp"] == '0000-00-00 00:00:00') { - echo __('Never'); - } else { - echo human_time_comparation($module_data["timestamp"]); - } - echo "
    '; -} + $data = array (); + $data[0] = print_moduletype_icon ($module["id_tipo_modulo"], true); + $data[1] = print_string_substr ($module["nombre"], 25, true); + $data[2] = format_numeric (get_agentmodule_sla ($module_id, $config["sla_period"], 1)).'%'; - -// Get all SLA report components -$sql = "SELECT tagente_modulo.id_agente_modulo, sla_max, sla_min, sla_limit, tagente_modulo.id_tipo_modulo, tagente_modulo.nombre, tagente_modulo.descripcion FROM treport_content_sla_combined, tagente_modulo WHERE tagente_modulo.id_agente = $id_agent AND tagente_modulo.id_agente_modulo = treport_content_sla_combined.id_agent_module AND tagente_modulo.id_tipo_modulo IN (1,4,7,8,11,15,16,22,24)"; -$result_t = mysql_query ($sql); -if (mysql_num_rows ($result_t)) { - $color=0; - echo "

    ".__('User-defined SLA items')." - "; - echo human_time_description_raw($config["sla_period"]). "

    "; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - while ($module_data = mysql_fetch_array($result_t)){ - if ($color == 1){ - $tdcolor = "datos"; - $color = 0; - } - else { - $tdcolor = "datos2"; - $color = 1; - } - - # For evey module in the status table - $id_agent_module = $module_data[0]; - $sla_max = $module_data[1]; - $sla_min = $module_data[2]; - $sla_limit = $module_data[3]; - $id_tipo_modulo = $module_data[4]; - $name = $module_data[5]; - $description = $module_data[6]; - $est_tipo = get_moduletype_name ($id_tipo_modulo); - - echo ""; - echo ""; - echo ""; - echo "
    " . __('Type') . "" . __('Module name') . "" . __('S.L.A.') . "" . __('Status') . "
    "; - echo ""; - echo "" . $name; - echo " ($sla_min / $sla_max / $sla_limit) "; - - $temp = get_agent_module_sla ($id_agent_module, $config["sla_period"], $sla_min, $sla_max); - if ($temp === false){ - echo __('N/A'); - echo ""; - } else { - echo format_numeric($temp)." %"; - if ($temp > $sla_limit) - echo ""; - else - echo ""; - } + //TODO: Make this work for all new status + $status = get_agentmodule_status ($module_id); + if ($status == 1){ + $data[3] = print_image ("images/pixel_red.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Down'))); + } else { + $data[3] = print_image ("images/pixel_green.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Up'))); } - echo '
    '; + + if ($module["module_interval"] > 0) { + $data[4] = $module["module_interval"]; + } else { + $data[4] = $interval; + } + array_push ($table->data, $data); + $loc++; } +print_table ($table); +unset ($table); + +// Get all SLA report components +$sql = "SELECT id_agent_module, sla_max, sla_min, sla_limit FROM treport_content_sla_combined WHERE id_agent_module IN (".implode (",",array_keys ($modules)).")"; +$result = get_db_all_rows_sql ($sql); +if ($result !== false) { + echo "

    ".__('User-defined SLA items')." - ".human_time_description_raw ($config["sla_period"])."

    "; + $table->width = '95%'; + $table->cellpadding = 4; + $table->cellspacing = 4; + $table->class = "databox"; + $table->head = array (); + $table->head[0] = __('Type'); + $table->head[1] = __('Module name'); + $table->head[2] = __('S.L.A.'); + $table->head[3] = __('Status'); + $table->data = array (); + + foreach ($result as $sla_data) { + $data = array (); + $data[0] = print_moduletype_icon ($modules[$sla_data["id_agent_module"]]["id_tipo_modulo"], true); + $data[1] = print_string_substr ($modules[$sla_data["id_agent_module"]]["nombre"], 25, true); + $data[1] .= "(".$sla_data["sla_min"]." / ".$sla_data["sla_max"]." / ".$sla_data["sla_limit"].")"; + $data[2] = format_numeric (get_agentmodule_sla ($sla_data["id_agent_module"], $config["sla_period"], 1)).'%'; + $status = get_agentmodule_status ($sla_data["id_agent_module"]); + if ($status == 1){ + $data[3] = print_image ("images/pixel_red.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Down'))); + } else { + $data[3] = print_image ("images/pixel_green.png", true, array ("width" => 40, "height" => 18, "title" => __('Module Up'))); + } + array_push ($table->data, $data); + } + print_table ($table); + unset ($table); +} ?> diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index c3e9509509..d8116a87f2 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -213,7 +213,7 @@ $table->align[6] = "right"; foreach ($result as $row) { $data = array (); - //This should be processed locally. Don't rely on other URL's to do our dirty work. Maybe a process_agentmodule_flag function + //TODO: This should be processed locally. Don't rely on other URL's to do our dirty work. Maybe a process_agentmodule_flag function $data[0] = ''; if ($row["flag"] == 0) { $data[0] .= ''; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index d16176795e..6dae2ca18c 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -54,7 +54,7 @@ if (is_ajax ()) { echo '

    '.$agent['nombre'].'

    '; echo ''.__('Main IP').': '.$agent['direccion'].'
    '; echo ''.__('Group').': '; - echo ' '; + echo ' '; echo get_group_name ($agent['id_grupo']).'
    '; echo ''.__('Last contact').': '.human_time_comparation($agent['ultimo_contacto']).'
    '; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 13c54d7639..fe34f07652 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -105,7 +105,7 @@ $group_rep = (int) get_parameter ("group_rep", 1); if ($ev_group > 1 && in_array ($ev_group, array_keys ($groups))) { //If a group is selected and it's in the groups allowed $sql_post = " AND id_grupo = $ev_group"; -} elseif (dame_admin ($config["id_user"])) { +} elseif (is_user_admin ($config["id_user"])) { //Do nothing if you're admin, you get full access $sql_post = ""; $groups[0] = __('System Events'); @@ -207,7 +207,7 @@ if ($result === false) $agents = array (); $agents[-1] = __('All'); -if (dame_admin ($config["id_user"])) { +if (is_user_admin ($config["id_user"])) { $agents[0] = __('System'); } diff --git a/pandora_console/operation/reporting/custom_reporting.php b/pandora_console/operation/reporting/custom_reporting.php index ba1e088102..3991119cd8 100644 --- a/pandora_console/operation/reporting/custom_reporting.php +++ b/pandora_console/operation/reporting/custom_reporting.php @@ -53,7 +53,7 @@ $table->align[3] = 'center'; $table->data = array (); foreach ($reports as $report) { - if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! dame_admin ($config['id_user']))) { + if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user_admin ($config['id_user']))) { continue; } diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index d20afa94ec..ec3220a322 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -41,7 +41,7 @@ if (! give_acl ($config['id_user'], $report['id_group'], "AR")) { require ("include/functions_reporting.php"); /* Check if the user can see the graph */ -if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! dame_admin ($config['id_user']))) { +if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user_admin ($config['id_user']))) { include ("general/noaccess.php"); return; } @@ -231,7 +231,7 @@ foreach ($contents as $content) { $data[0] .= $sla['sla_min']."
    "; $data[0] .= ''.__('SLA Limit')." : "; $data[0] .= $sla['sla_limit']; - $sla_value = get_agent_module_sla ($sla['id_agent_module'], $content['period'], + $sla_value = get_agentmodule_sla ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $datetime); if ($sla_value === false) { $data[1] = ''; @@ -325,7 +325,7 @@ foreach ($contents as $content) { } $data = array (); - $monitor_value = format_numeric (get_agent_module_sla ($content['id_agent_module'], $content['period'], 1, false, $datetime)); + $monitor_value = format_numeric (get_agentmodule_sla ($content['id_agent_module'], $content['period'], 1, false, $datetime)); $data[0] = '

    '; $data[0] .= $monitor_value.' %

    '; $monitor_value = format_numeric (100 - $monitor_value, 2) ; diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 56b1c15c6d..68181febd5 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -112,7 +112,7 @@ if (! give_acl ($config['id_user'], $report['id_group'], "AR")) { } /* Check if the user can see the graph */ -if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! dame_admin ($config['id_user']))) { +if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user_admin ($config['id_user']))) { return; } @@ -203,7 +203,7 @@ foreach ($contents as $content) { $sla_data["max"] = $sla['sla_max']; $sla_data["min"] = $sla['sla_min']; - $sla_value = get_agent_module_sla ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $datetime); + $sla_value = get_agentmodule_sla ($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $datetime); if ($sla_value === false) { $sla_data["error"] = __('Unknown'); } else { @@ -234,7 +234,7 @@ foreach ($contents as $content) { case 6: case 'monitor_report': $data["title"] = __('Monitor report'); - $monitor_value = format_numeric (get_agent_module_sla ($content['id_agent_module'], $content['period'], 1, false, $datetime)); + $monitor_value = format_numeric (get_agentmodule_sla ($content['id_agent_module'], $content['period'], 1, false, $datetime)); $data["objdata"]["good"] = $monitor_value; $data["objdata"]["bad"] = format_numeric (100 - $monitor_value, 2); break;