diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 5ed25e4e2a..9f56a63897 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -47,6 +47,10 @@ ui_print_page_header( true, $buttons); +//recursion group filter +$recursion = get_parameter('recursion', $_POST['recursion']); + + //Initialize data $id_group = (int) get_parameter ('id_group'); $name = (string) get_parameter ('name'); @@ -628,7 +632,7 @@ echo ''; if ($id_downtime > 0) { - echo ""; + echo ""; // Show available agents to include into downtime echo '

' . __('Available agents') . ':

'; @@ -643,8 +647,31 @@ if ($id_downtime > 0) { } $filter_cond = ''; - if ($filter_group > 0) - $filter_cond = " AND id_grupo = $filter_group "; + if ($filter_group > 0){ + if($recursion){ + $rg = groups_get_id_recursive($filter_group, true); + $filter_cond .= " AND id_grupo IN ("; + + $i = 0; + $len = count($rg); + + foreach ($rg as $key) { + + if ($i == $len - 1) { + $filter_cond .= $key.")"; + }else{ + $i++; + $filter_cond .= $key.","; + } + } + + } + else{ + $filter_cond = " AND id_grupo = $filter_group "; + } + + } + $sql = sprintf("SELECT tagente.id_agente, tagente.nombre FROM tagente WHERE tagente.id_agente NOT IN ( @@ -671,17 +698,19 @@ if ($id_downtime > 0) { $disabled_add_button = true; } + echo "
"; + html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;width:180px;max-width:180px;margin-right:15px;'); - html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'width:180px'); - + html_print_checkbox ("recursion", !$_POST['recursion'], $_POST['recursion'], false, false, ''); + echo __('Recursion') . ' '; echo "

"; html_print_submit_button (__('Filter by group'), '', false, 'class="sub next"',false); echo "
"; echo "
"; - echo html_print_select ($agents, "id_agents[]", '', '', '', 0, false, true, true, '', false, 'width: 180px;'); + echo html_print_select ($agents, "id_agents[]", -1, '', _("Any"), -2, false, true, true, '', false, 'width: 180px;'); echo '

' . __('Available modules:') . ui_print_help_tip (__('Only for type Quiet for downtimes.'), true) . '

'; diff --git a/pandora_console/images/custom_logo/pandora_logo_head_3.png b/pandora_console/images/custom_logo/pandora_logo_head_3.png index 275871dca6..5bce825279 100644 Binary files a/pandora_console/images/custom_logo/pandora_logo_head_3.png and b/pandora_console/images/custom_logo/pandora_logo_head_3.png differ diff --git a/pandora_console/images/custom_logo/pandora_logo_head_4.png b/pandora_console/images/custom_logo/pandora_logo_head_4.png index 5bce825279..275871dca6 100644 Binary files a/pandora_console/images/custom_logo/pandora_logo_head_4.png and b/pandora_console/images/custom_logo/pandora_logo_head_4.png differ diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index cc8e13ae28..826ba08fed 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -113,6 +113,7 @@ function configure_modules_form () { js_html_entity_decode (data["name"])); $("#textarea_description").attr ("value", js_html_entity_decode (data["description"])); + $("#textarea_description").html(js_html_entity_decode (data["description"])); $("#textarea_configuration_data").val(configuration_data); $("#component_loading").hide (); $("#id_module_type").val(data["type"]); @@ -246,7 +247,7 @@ function configure_modules_form () { flag_load_plugin_component = true; $("#text-name").attr ("value", js_html_entity_decode (data["name"])); - $("#textarea_description").attr ("value", js_html_entity_decode (data["description"])); + $("#textarea_description").html (js_html_entity_decode (data["description"])); $("#id_module_type").val(data["type"]); $("#text-max").attr ("value", data["max"]); $("#text-min").attr ("value", data["min"]); @@ -262,6 +263,10 @@ function configure_modules_form () { .attr ("value", js_html_entity_decode (data["tcp_send"])); $("#textarea_tcp_rcv") .attr ("value", js_html_entity_decode (data["tcp_rcv"])); + $("#textarea_tcp_send") + .html (js_html_entity_decode (data["tcp_send"])); + $("#textarea_tcp_rcv") + .html (js_html_entity_decode (data["tcp_rcv"])); $("#text-snmp_community") .attr ("value", js_html_entity_decode (data["snmp_community"])); $("#text-snmp_oid") diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 6df6262f49..3b52414ea7 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1248,12 +1248,13 @@ div.title_line { max-height: 26px; } #menu_tab_left li a, #menu_tab_left li span { -/* text-transform: uppercase; */ + /*text-transform: uppercase; */ padding: 0px 0px 0px 0px; color: #fff; - font-size: 8.5pt; - font-weight: normal; + font-size: 9pt; line-height: 20px; + letter-spacing:1px; + font-family: verdana; } #menu_tab_left .mn li a { display: block; diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 0864db5fd8..8b79245ce5 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -46,6 +46,8 @@ else { } $ag_freestring = get_parameter ('ag_freestring'); +$moduletype = (string) get_parameter ('moduletype'); +$datatype = (string) get_parameter ('datatype'); $ag_modulename = (string) get_parameter ('ag_modulename'); $refr = (int) get_parameter('refr', 0); $offset = (int) get_parameter ('offset', 0); @@ -88,10 +90,10 @@ $user_groups = implode (',', array_keys (users_get_groups ())); //////////////////////////////////// // Begin Build SQL sentences -$sql_from = ' FROM tagente, tagente_modulo, tagente_estado '; +$sql_from = ' FROM ttipo_modulo,tagente, tagente_modulo, tagente_estado,tmodule '; $sql_conditions_base = ' WHERE tagente.id_agente = tagente_modulo.id_agente - AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo'; + AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo AND tmodule.id_module = tagente_modulo.id_modulo'; $sql_conditions = ' AND tagente_modulo.disabled = 0 AND tagente.disabled = 0'; @@ -138,6 +140,16 @@ if ($ag_modulename != '') { $ag_modulename); } + +if ($datatype != '') { + $sql_conditions .= sprintf (' AND ttipo_modulo.id_tipo =' .$datatype); +} + +if ($moduletype != '') { + $sql_conditions .= sprintf (' AND tagente_modulo.id_modulo =' .$moduletype); +} + + // Freestring selector if ($ag_freestring != '') { $sql_conditions .= sprintf (' AND (tagente.nombre LIKE \'%%%s%%\' @@ -204,6 +216,7 @@ if ($tag_filter !== 0) { } + // Apply the module ACL with tags $sql_conditions_tags = ''; @@ -328,6 +341,129 @@ else { $tag_filter, '', __('All'), '', true, false, true, '', false, 'width: 150px;'); } + + + $network_available = db_get_sql ("SELECT count(*) + FROM tserver + WHERE server_type = 1"); //POSTGRESQL AND ORACLE COMPATIBLE + $wmi_available = db_get_sql ("SELECT count(*) + FROM tserver + WHERE server_type = 6"); //POSTGRESQL AND ORACLE COMPATIBLE + $plugin_available = db_get_sql ("SELECT count(*) + FROM tserver + WHERE server_type = 4"); //POSTGRESQL AND ORACLE COMPATIBLE + $prediction_available = db_get_sql ("SELECT count(*) + FROM tserver + WHERE server_type = 5"); //POSTGRESQL AND ORACLE COMPATIBLE + + // Development mode to use all servers + if ($develop_bypass) { + $network_available = 1; + $wmi_available = 1; + $plugin_available = 1; + $prediction_available = 1; + } + + $typemodules = array (); + $typemodules[1] = __('Data server module'); + if ($network_available) + $typemodules[2] = __('Network server module'); + if ($plugin_available) + $typemodules[4] = __('Plugin server module'); + if ($wmi_available) + $typemodules[6] = __('WMI server module'); + if ($prediction_available) + $typemodules[5] = __('Prediction server module'); + if (enterprise_installed()) { + $typemodules[7] = __('Web server module'); + } + + + $table->data[2][0] = ''.__('Server type').''; + + $table->data[2][1] = html_print_select ($typemodules, 'moduletype',$moduletype, '', __('All'),'', true, false, true, '', false, 'width: 150px;'); + + + $table->data[2][2] = 'data[2][2] .= 'style="display:none"'; +} + + $table->data[2][2] .= '>'.__('Data type').''; + + + $table->data[2][3] .='
'; + + + switch ($moduletype) + { + case 1: + $sql = sprintf ('SELECT id_tipo, descripcion + FROM ttipo_modulo + WHERE categoria IN (6,7,8,0,1,2,-1) order by descripcion '); + break; + case 2: + $sql = sprintf ('SELECT id_tipo, descripcion + FROM ttipo_modulo + WHERE categoria between 3 and 5 '); + break; + case 4: + $sql = sprintf ('SELECT id_tipo, descripcion + FROM ttipo_modulo + WHERE categoria between 0 and 2 '); + break; + case 6: + $sql = sprintf ('SELECT id_tipo, descripcion + FROM ttipo_modulo + WHERE categoria between 0 and 2 '); + break; + case 7: + $sql = sprintf ('SELECT id_tipo, descripcion + FROM ttipo_modulo + WHERE categoria = 9'); + break; + case 5: + $sql = sprintf ('SELECT id_tipo, descripcion + FROM ttipo_modulo + WHERE categoria = 0'); + break; + case '': + $sql = sprintf ('SELECT id_tipo, descripcion + FROM ttipo_modulo'); + break; + + } + $a = db_get_all_rows_sql($sql); + $table->data[2][3] .= ''; + + + + + $table->data[2][3] .= '
'; + + $table_custom_fields = new stdClass(); $table_custom_fields->class = 'filters'; $table_custom_fields->width = '100%'; @@ -364,13 +500,14 @@ foreach ($custom_fields as $custom_field) { $table_custom_fields->data[] = $row; } + $filters = ''; if (is_metaconsole()) { - $table->colspan[2][0] = 7; - $table->cellstyle[2][0] = 'padding: 10px;'; - $table->data[2][0] = ui_toggle( + $table->colspan[3][0] = 7; + $table->cellstyle[3][0] = 'padding: 10px;'; + $table->data[3][0] = ui_toggle( html_print_table($table_custom_fields, true), __('Advanced Options'), '', true, true); @@ -379,9 +516,9 @@ if (is_metaconsole()) { ui_toggle($filters, __('Show Options')); } else { - $table->colspan[2][0] = 7; - $table->cellstyle[2][0] = 'padding-left: 10px;'; - $table->data[2][0] = ui_toggle(html_print_table($table_custom_fields, + $table->colspan[3][0] = 7; + $table->cellstyle[3][0] = 'padding-left: 10px;'; + $table->data[3][0] = ui_toggle(html_print_table($table_custom_fields, true), __('Agent custom fields'), '', true, true); $filters .= html_print_table($table, true); @@ -441,6 +578,22 @@ switch ($sortField) { break; } break; + case 'moduletype': + switch ($sort) { + case 'up': + $selectTypeUp = $selected; + $order = array( + 'field' => 'tagente_modulo.id_modulo', + 'order' => 'ASC'); + break; + case 'down': + $selectTypeDown = $selected; + $order = array( + 'field' => 'tagente_modulo.id_modulo', + 'order' => 'DESC'); + break; + } + break; case 'module_name': switch ($sort) { case 'up': @@ -553,6 +706,7 @@ switch ($config['dbtype']) { WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo)) AS tags, tagente_modulo.id_agente_modulo, + tagente_modulo.id_modulo, tagente.intervalo AS agent_interval, tagente.nombre AS agent_name, tagente_modulo.nombre AS module_name, @@ -599,6 +753,7 @@ switch ($config['dbtype']) { WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo)) AS tags, tagente_modulo.id_agente_modulo, + tagente_modulo.id_modulo, tagente.intervalo AS agent_interval, tagente.nombre AS agent_name, tagente_modulo.nombre AS module_name, @@ -641,6 +796,7 @@ switch ($config['dbtype']) { WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo)) AS tags, tagente_modulo.id_agente_modulo, + tagente_modulo.id_modulo, tagente.intervalo AS agent_interval, tagente.nombre AS agent_name, tagente_modulo.nombre AS module_name, @@ -772,34 +928,41 @@ if (!empty($result)) { $table->head[1] = __('Agent'); if (!is_metaconsole()) { - $table->head[1] .=' ' . html_print_image('images/sort_up.png', true, array('style' => $selectAgentNameUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectAgentNameDown, 'alt' => 'down')) . ''; + $table->head[1] .=' ' . html_print_image('images/sort_up.png', true, array('style' => $selectAgentNameUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectAgentNameDown, 'alt' => 'down')) . ''; } - $table->head[2] = __('Type'); + $table->head[2] = __('Data Type'); if (!is_metaconsole()) { - $table->head[2] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectTypeUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectTypeDown, 'alt' => 'down')) . ''; + $table->head[2] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectTypeUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectTypeDown, 'alt' => 'down')) . ''; } $table->align[2] = 'left'; $table->head[3] = __('Module name'); if (!is_metaconsole()) { - $table->head[3] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . ''; + $table->head[3] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . ''; } + + $table->head[4] = __('Server type'); + if (!is_metaconsole()) { + $table->head[4] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . ''; + } + $table->head[5] = __('Interval'); if (!is_metaconsole()) { - $table->head[5] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectIntervalUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectIntervalDown, 'alt' => 'down')) . ''; + $table->head[5] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectIntervalUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectIntervalDown, 'alt' => 'down')) . ''; $table->align[5] = 'left'; } $table->head[6] = __('Status'); if (!is_metaconsole()) { - $table->head[6] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . ''; + $table->head[6] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . ''; } $table->align[6] = 'left'; @@ -813,14 +976,14 @@ if (!empty($result)) { $table->head[9] = __('Data'); $table->align[9] = 'left'; if ( is_metaconsole() ) { - $table->head[9] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . ''; + $table->head[9] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectStatusUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectStatusDown, 'alt' => 'down')) . ''; } $table->head[10] = __('Timestamp'); if (!is_metaconsole()) { - $table->head[10] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectTimestampUp, 'alt' => 'up')) . '' . - '' . html_print_image('images/sort_down.png', true, array('style' => $selectTimestampDown, 'alt' => 'down')) . ''; + $table->head[10] .= ' ' . html_print_image('images/sort_up.png', true, array('style' => $selectTimestampUp, 'alt' => 'up')) . '' . + '' . html_print_image('images/sort_down.png', true, array('style' => $selectTimestampDown, 'alt' => 'down')) . ''; $table->align[10] = 'left'; } @@ -914,6 +1077,7 @@ if (!empty($result)) { $data[1] .= ''; } + $data[2] = html_print_image('images/' . modules_show_icon_type ($row['module_type']), true); if (check_acl ($config['id_user'], $row['id_group'], 'AW')) { $show_edit_icon = true; @@ -959,7 +1123,8 @@ if (!empty($result)) { 'title' => $row['tags'], 'style' => 'width: 20px; margin-left: 3px;')); } - + $data[4] = servers_show_type ($row['id_modulo']); + $data[5] = ($row['module_interval'] == 0) ? human_time_description_raw($row['agent_interval']) : @@ -1211,7 +1376,27 @@ ui_require_javascript_file('pandora_modules'); $('#tag_filter').css('display', 'none'); $('#tag_td').css('display', 'none'); } - }); + +}); + + +$('#moduletype').click(function(){ + jQuery.get ("ajax.php", + { + "page": "general/subselect_data_module", + "module":$('#moduletype').val()}, + function (data, status){ + $("#datatypetittle").show (); + $("#datatypebox").hide () + .empty () + .append (data) + .show (); + }, + "html" + ); + + return false; + }); $('#ag_group').change (function () { strict_user = $('#text-strict_user_hidden').val(); diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 5305b5f238..cb3c0531ff 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -42,7 +42,7 @@ if (is_ajax ()) { $get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip"); $get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip"); $get_agent_id = (bool) get_parameter ("get_agent_id"); - + $id_group = (int) get_parameter('id_group'); if ($get_agents_group_json) { $id_group = (int) get_parameter('id_group'); $recursion = (int) get_parameter ('recursion', 0); @@ -382,7 +382,19 @@ if (is_ajax ()) { asort($result); } else { - $sql = 'SELECT DISTINCT(nombre) + + if(implode(',', $idAgents) < 0){ + + + $sql = 'SELECT DISTINCT(nombre) FROM tagente_modulo +WHERE nombre IN ( +SELECT nombre +FROM tagente_modulo +GROUP BY nombre +HAVING count(nombre) = (SELECT count(nombre) FROM tagente_modulo))'; + } + else{ + $sql = 'SELECT DISTINCT(nombre) FROM tagente_modulo t1 WHERE ' . $filter . ' AND t1.delete_pending = 0 @@ -398,7 +410,7 @@ if (is_ajax ()) { }elseif ($selection_mode == 'unknown'){ $sql .= 'AND t1.id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = 3 OR estado = 4)'; } - + } $sql .= ' ORDER BY nombre'; $nameModules = db_get_all_rows_sql($sql);