diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 843972e351..0ee00a8f17 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190206 +Version: 7.0NG.731-190214 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 62b6862cf2..9ebfc5d3dc 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190206" +pandora_version="7.0NG.731-190214" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f9e4458923..664a9964e3 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190206'; +use constant AGENT_BUILD => '190214'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 4ef907e9a3..5c097c9a07 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190206 +%define release 190214 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 0c114ad78a..820f5d3ec1 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190206 +%define release 190214 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 866f9c77d8..8adeac4f7a 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190206" +PI_BUILD="190214" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index a6de1a7aa6..3b606d8ec0 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190206} +{190214} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 5f7e16de45..30fff5f13b 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190206)") +#define PANDORA_VERSION ("7.0NG.731(Build 190214)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 851029f0ba..a34c9905ea 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190206))" + VALUE "ProductVersion", "(7.0NG.731(Build 190214))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ec652cc24b..285b64c80f 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190206 +Version: 7.0NG.731-190214 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 3841cf2905..02c1b2ed71 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190206" +pandora_version="7.0NG.731-190214" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 0d2f49fb1a..798f4e140e 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -235,7 +235,6 @@ function mainAgentsModules() echo ''; // Floating menu - End ui_require_jquery_file('countdown'); - ui_require_css_file('countdown'); } if ($config['pure'] != 1) { diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index 4d49a3dd7a..4a9130a3db 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -309,7 +309,7 @@ function mainModuleGroups() ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups or module groups') ]); } - ui_require_css_file('cluetip'); + ui_require_css_file('cluetip', 'include/styles/js/'); ui_require_jquery_file('cluetip'); ?> data[$row][1] = html_print_select($values, 'vc_refr', $config[ $row++; $table_behaviour->data[$row][0] = __('Paginated module view'); -$table_behaviour->data[$row][1] = html_print_checkbox( +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch( 'paginate_module', 1, $config['paginate_module'], @@ -84,7 +84,7 @@ $table_behaviour->data[$row][1] = html_print_checkbox( $row++; $table_behaviour->data[$row][0] = __('Display data of proc modules in other format'); -$table_behaviour->data[$row][1] = html_print_checkbox( +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch( 'render_proc', 1, $config['render_proc'], @@ -102,7 +102,7 @@ $row++; // Daniel maya 02/06/2016 Display menu with click --INI $table_behaviour->data[$row][0] = __('Click to display lateral menus').ui_print_help_tip(__('When enabled, the lateral menus are shown when left clicking them, instead of hovering over them'), true); -$table_behaviour->data[$row][1] = html_print_checkbox( +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch( 'click_display', 1, $config['click_display'], @@ -121,7 +121,7 @@ if (enterprise_installed()) { } $table_behaviour->data[$row][0] = __('Classic menu mode').ui_print_help_tip(__('Text menu options always visible, don\'t hide'), true); -$table_behaviour->data[$row][1] = html_print_checkbox( +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch( 'classic_menu', 1, $config['classic_menu'], @@ -491,7 +491,7 @@ if (enterprise_installed()) { if (enterprise_installed()) { $table_styles->data[$row][0] = __('Disable logo in graphs'); - $table_styles->data[$row][1] = html_print_checkbox( + $table_styles->data[$row][1] = html_print_checkbox_toogle_switch( 'fixed_graph', 1, $config['fixed_graph'], @@ -507,7 +507,7 @@ if (enterprise_installed()) { */ $table_styles->data[$row][0] = __('Disable helps'); -$table_styles->data[$row][1] = html_print_checkbox( +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch( 'disable_help', 1, $config['disable_help'], @@ -516,7 +516,7 @@ $table_styles->data[$row][1] = html_print_checkbox( $row++; $table_styles->data[$row][0] = __('Fixed header'); -$table_styles->data[$row][1] = html_print_checkbox( +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch( 'fixed_header', 1, $config['fixed_header'], @@ -525,7 +525,7 @@ $table_styles->data[$row][1] = html_print_checkbox( $row++; $table_styles->data[$row][0] = __('Fixed menu'); -$table_styles->data[$row][1] = html_print_checkbox( +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch( 'fixed_menu', 1, $config['fixed_menu'], @@ -535,7 +535,7 @@ $row++; // For 5.1 Autohidden menu feature $table_styles->data['autohidden'][0] = __('Autohidden menu'); -$table_styles->data['autohidden'][1] = html_print_checkbox( +$table_styles->data['autohidden'][1] = html_print_checkbox_toogle_switch( 'autohidden_menu', 1, $config['autohidden_menu'], @@ -543,13 +543,14 @@ $table_styles->data['autohidden'][1] = html_print_checkbox( ); $table_styles->data[$row][0] = __('Visual effects and animation'); -$table_styles->data[$row][1] = html_print_checkbox( +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch( 'visual_animation', 1, $config['visual_animation'], true ); + echo '
'; echo ''.__('Style configuration').''; html_print_table($table_styles); @@ -566,7 +567,7 @@ $table_gis->size[0] = '50%'; $table_gis->data = []; $table_gis->data[$row][0] = __('GIS Labels').ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true); -$table_gis->data[$row][1] = html_print_checkbox( +$table_gis->data[$row][1] = html_print_checkbox_toogle_switch( 'gis_label', 1, $config['gis_label'], @@ -679,7 +680,7 @@ $table_font->data[$row][1] = html_print_input_text( $row++; $table_font->data[$row][0] = __('Show unit along with value in reports').ui_print_help_tip(__('This enabling this, max, min and avg values will be shown with units.'), true); -$table_font->data[$row][1] = html_print_checkbox( +$table_font->data[$row][1] = html_print_checkbox_toogle_switch( 'simple_module_value', 1, $config['simple_module_value'], @@ -777,7 +778,7 @@ $table_chars->data[$row][1] = html_print_input_text( $row++; $table_chars->data[$row][0] = __('Use round corners'); -$table_chars->data[$row][1] = html_print_checkbox( +$table_chars->data[$row][1] = html_print_checkbox_toogle_switch( 'round_corner', 1, $config['round_corner'], @@ -946,7 +947,7 @@ $table_other->data[$row][0] = __('Show report info with description').ui_print_h __('Custom report description info. It will be applied to all reports and templates by default.'), true ); -$table_other->data[$row][1] = html_print_checkbox( +$table_other->data[$row][1] = html_print_checkbox_toogle_switch( 'custom_report_info', 1, $config['custom_report_info'], @@ -966,6 +967,7 @@ $table_other->data[$row][1] = html_print_checkbox( $config['custom_report_front'], true ); + $row++; // ---------------------------------------------------------------------- $dirItems = scandir($config['homedir'].'/images/custom_logo'); @@ -1059,7 +1061,7 @@ $table_other->data['custom_report_front-footer'][1] = html_print_textarea( $table_other->data[$row][0] = __('Show QR Code icon in the header'); -$table_other->data[$row][1] = html_print_checkbox( +$table_other->data[$row][1] = html_print_checkbox_toogle_switch( 'show_qr_code_header', 1, $config['show_qr_code_header'], @@ -1097,7 +1099,7 @@ $table_other->data[$row][0] .= ui_print_help_tip( __('Show the group name instead the group icon.'), true ); -$table_other->data[$row][1] = html_print_checkbox( +$table_other->data[$row][1] = html_print_checkbox_toogle_switch( 'show_group_name', 1, $config['show_group_name'], @@ -1234,7 +1236,7 @@ html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"' echo ''; echo ''; -ui_require_css_file('color-picker'); +ui_require_css_file('color-picker', 'include/styles/js/'); ui_require_jquery_file('colorpicker'); @@ -1440,6 +1442,7 @@ $(document).ready (function () { .prop('checked'); display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().attr('id')); }); + $(".databox.filters").css('margin-bottom','-10px'); }); // Change the favicon preview when is changed diff --git a/pandora_console/godmode/update_manager/update_manager.online.php b/pandora_console/godmode/update_manager/update_manager.online.php index ea946f23d6..3e807367bd 100644 --- a/pandora_console/godmode/update_manager/update_manager.online.php +++ b/pandora_console/godmode/update_manager/update_manager.online.php @@ -140,8 +140,8 @@ if ($enterprise == ENTERPRISE_NOT_HOOK) { ?> diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 65fb516c9b..380d9b5a0b 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190206'; +$build_version = 'PC190214'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index d1b5fb7831..6f13388fc0 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1754,7 +1754,8 @@ function get_snmpwalk( $quick_print=0, $base_oid='', $snmp_port='', - $server_to_exec=0 + $server_to_exec=0, + $extra_arguments='' ) { global $config; @@ -1805,15 +1806,15 @@ function get_snmpwalk( case '3': switch ($snmp3_security_level) { case 'authNoPriv': - $command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; + $command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; break; case 'noAuthNoPriv': - $command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; + $command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; break; default: - $command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; + $command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; break; } break; @@ -1822,7 +1823,7 @@ function get_snmpwalk( case '2c': case '1': default: - $command_str = $snmpwalk_bin.' -m ALL -Oa -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; + $command_str = $snmpwalk_bin.' -m ALL '.$extra_arguments.' -Oa -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; break; } diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index c4e0989b97..6bfe709c32 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1700,6 +1700,43 @@ function alerts_get_effective_alert_actions($id_agent_module) } +/** + * Validate alerts for the given module. + * + * @param int agent_module_id ID of the module + */ +function alerts_validate_alert_module($agent_module_id) +{ + db_process_sql( + sprintf( + 'UPDATE talert_template_modules + SET times_fired=0, internal_counter=0 + WHERE id_agent_module = %d', + $agent_module_id + ) + ); +} + + +/** + * Validate alerts for the given agent. + * + * @param int agent_id ID of the agent + */ +function alerts_validate_alert_agent($agent_id) +{ + db_process_sql( + sprintf( + 'UPDATE talert_template_modules tm + INNER JOIN tagente_modulo am ON tm.id_agent_module = am.id_agente_modulo + SET tm.times_fired=0, tm.internal_counter=0 + WHERE am.id_agente = %d', + $agent_id + ) + ); +} + + /** * Validates an alert id or an array of alert id's. * diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index d393a2a1b3..545d84d640 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -472,11 +472,12 @@ function api_get_module_last_value($idAgentModule, $trash1, $other=';', $returnT DB column mapping table used by tree_agents (and get module_properties) */ -// agent related field mappings (output field => column designation for 'tagente') +/* + * Agent related field mappings (output field => column designation for 'tagente'). + * agent_id is not in this list (because it is mandatory). + * agent_id_group is not in this list. + */ $agent_field_column_mapping = [ - /* - agent_id is not in this list (because it is mandatory) */ - // agent_id_group is not in this list 'agent_name' => 'nombre as agent_name', 'agent_direction' => 'direccion as agent_direction', 'agent_comentary' => 'comentarios as agent_comentary', @@ -496,8 +497,8 @@ $agent_field_column_mapping = [ ]; // module related field mappings 1/2 (output field => column for 'tagente_modulo') +// module_id_agent_modulo is not in this list $module_field_column_mampping = [ - // module_id_agent_modulo is not in this list 'module_id_agent' => 'id_agente as module_id_agent', 'module_id_module_type' => 'id_tipo_modulo as module_id_module_type', 'module_description' => 'descripcion as module_description', @@ -541,8 +542,8 @@ $module_field_column_mampping = [ ]; // module related field mappings 2/2 (output field => column for 'tagente_estado') +// module_id_agent_modulo is not in this list $estado_fields_to_columns_mapping = [ - // module_id_agent_modulo is not in this list 'module_id_agent_state' => 'id_agente_estado as module_id_agent_state', 'module_data' => 'datos as module_data', 'module_timestamp' => 'timestamp as module_timestamp', @@ -14609,3 +14610,67 @@ function api_get_users($thrash1, $thrash2, $other, $returnType) } } + + +/** + * Resets module counts and alert counts in the agents + * + * @param $id id of the agent you want to synchronize. Add "All" to synchronize all agents + * @param $trash1 + * @param $trash2 + * @param $trash3 + * + * Example: + * api.php?op=set&op2=reset_agent_counts&apipass=1234&user=admin&pass=pandora&id=All + */ +function api_set_reset_agent_counts($id, $thrash1, $thrash2, $thrash3) +{ + global $config; + + if (!check_acl($config['id_user'], 0, 'AW')) { + returnError('forbidden', 'string'); + return; + } + + if ($id == '' || !$id) { + returnError('error_parameter', __('Error. Agent cannot be left blank.')); + return; + } + + if ($id != 'All') { + $agent = db_get_row_filter('tagente', ['id_agente' => $id]); + if (empty($agent)) { + returnError('error_agent', __('This agent does not exist.')); + return; + } else { + $return = db_process_sql_update( + 'tagente', + [ + 'update_module_count' => 1, + 'update_alert_count' => 1, + ], + ['id_agente' => $id] + ); + } + } else { + $return = db_process_sql_update( + 'tagente', + [ + 'update_module_count' => 1, + 'update_alert_count' => 1, + ] + ); + } + + $data = __('Successfully updated module/alert count in id agent %d.', $id); + if ($id == 'All') { + $data = __('Successfully updated module/alert count in all agents'); + } + + if ($return === false) { + returnError('error_reset_agent_counts', 'Could not be updated module/alert counts in id agent %d.', $id); + } else { + returnData('string', ['type' => 'string', 'data' => $data]); + } + +} diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index f2093dd1c8..9c6819d535 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2306,6 +2306,89 @@ function html_print_checkbox($name, $value, $checked=false, $return=false, $disa } +/** + * Render a checkbox button input toogle switch type. Extended version, use html_print_checkbox_toogle_switch() to simplify. + * + * @param string Input name. + * @param string Input value. + * @param string Set the button to be marked (optional, unmarked by default). + * @param bool Disable the button (optional, button enabled by default). + * @param string Script to execute when onClick event is triggered (optional). + * @param string Optional HTML attributes. It's a free string which will be + * @param bool Whether to return an output string or echo now (optional, echo by default). + * + * @return string HTML code if return parameter is true. + */ + + +function html_print_checkbox_toogle_switch_extended($name, $value, $checked, $disabled, $script, $attributes, $return=false, $id='') +{ + static $idcounter = []; + + // If duplicate names exist, it will start numbering. Otherwise it won't + if (isset($idcounter[$name])) { + $idcounter[$name]++; + } else { + $idcounter[$name] = 0; + } + + $id_aux = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); + + $output = '