diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 0c1ccd826d..9ac3b3ae14 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.711-170901 +Version: 7.0NG.711-170904 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 70c113ed44..37277589bd 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.711-170901" +pandora_version="7.0NG.711-170904" 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 96d2b7ee46..ae4282251f 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.711'; -use constant AGENT_BUILD => '170901'; +use constant AGENT_BUILD => '170904'; # 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 f6638e01dd..48906dc339 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.711 -%define release 170901 +%define release 170904 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 058a044228..6b3e9de15e 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.711 -%define release 170901 +%define release 170904 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 803f056509..8869c90980 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.711" -PI_BUILD="170901" +PI_BUILD="170904" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 50184eaec6..0bb85288c4 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170901} +{170904} ViewReadme {Yes} diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc index 23ebaaf7e8..db33c1315a 100644 --- a/pandora_agents/win32/modules/pandora_module_factory.cc +++ b/pandora_agents/win32/modules/pandora_module_factory.cc @@ -1139,11 +1139,14 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module = new Pandora_Module_Freedisk_Percent (module_name, module_freedisk_percent); // Added a description with the memory free - char buffer[100]; - unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent); - if (sprintf(buffer, "Free memory %s %dMB", + try { + char buffer[100]; + unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent); + if (sprintf(buffer, "Free memory %s %dMB", module_freedisk_percent.c_str(), memory) > 0) { - module->setDescription(buffer); + module->setDescription(buffer); + } + } catch (Pandora_Wmi::Pandora_Wmi_Exception e) { } } else if (module_freememory != "") { module = new Pandora_Module_Freememory (module_name); diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index fa955b581f..d3e0c16216 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.711(Build 170901)") +#define PANDORA_VERSION ("7.0NG.711(Build 170904)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 866aba3f5f..db6c9764db 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.711(Build 170901))" + VALUE "ProductVersion", "(7.0NG.711(Build 170904))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 31948958fe..c414c6b562 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.711-170901 +Version: 7.0NG.711-170904 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 321cff3f19..73e4a98d9f 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.711-170901" +pandora_version="7.0NG.711-170904" package_pear=0 package_pandora=1 diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php index 14c026e2d2..1eebe0c075 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php @@ -716,7 +716,7 @@ $servers_to_exec[0] = __('Local console'); if (enterprise_installed()) { enterprise_include_once ('include/functions_satellite.php'); - $rows = get_proxy_servers(); + $rows = get_proxy_servers(true); foreach ($rows as $row) { $servers_to_exec[$row['id_server']] = $row['name']; } diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php index 80c5a3a84f..13dfd94ad2 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php @@ -254,6 +254,30 @@ if ($create_modules) { $values['unit'] = "Bytes"; } + if ($server_to_exec != 0) { + $sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec); + $row = db_get_row_sql ($sql); + + if ($row['server_type'] = 13) { + if (preg_match ("/Status/", $name_array[1])) { + $module_type = 2; + } + elseif (preg_match ("/Present/", $name_array[1])) { + $module_type = 2; + } + elseif (preg_match("/PromiscuousMode/", $name_array[1])) { + $module_type = 2; + } + // Specific counters (ends in s) + elseif (preg_match("/s$/", $name_array[1])) { + $module_type = 4; + } + else { + $module_type = 4; + } + } + } + $values['id_tipo_modulo'] = $module_type; if (!empty($ifPhysAddress) && isset($interfaces_ip[$id])) { @@ -281,6 +305,26 @@ if ($create_modules) { $errors[$result]++; } else { + if ($server_to_exec != 0) { + $sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec); + $row = db_get_row_sql ($sql); + + if ($row['server_type'] = 13) { + $module_type_name = db_get_value_filter("nombre", "ttipo_modulo", array("id_tipo" => $values['id_tipo_modulo'])); + + $new_module_configuration_data = " + module_begin + module_name " . io_safe_input($name) . " + module_description " . $values['descripcion'] . " + module_type " . $module_type_name . " + module_snmp + module_oid " . $values['snmp_oid'] . " + module_community " . $values['snmp_community'] . " + module_end"; + + config_agents_add_module_in_conf($id_agent, $new_module_configuration_data); + } + } $done++; } } @@ -445,6 +489,7 @@ if (!empty($interfaces_list)) { html_print_input_hidden('snmp3_privacy_method', $snmp3_privacy_method); html_print_input_hidden('snmp3_privacy_pass', $snmp3_privacy_pass); html_print_input_hidden('snmp3_security_level', $snmp3_security_level); + html_print_input_hidden('server_to_exec', $server_to_exec); $table->width = '100%'; diff --git a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php index abdcbbecaa..135709c17b 100644 --- a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php @@ -29,7 +29,7 @@ $ip_target = (string) get_parameter ('ip_target', $ipAgent); // Host $plugin_user = (string) get_parameter ('plugin_user', 'Administrator'); // Username $plugin_pass = io_safe_output(get_parameter('plugin_pass', '')); // Password $tcp_send = (string) get_parameter ('tcp_send'); // Namespace -$server_to_exec = get_parameter('server_to_exec', true); +$server_to_exec = get_parameter('server_to_exec', 0); //See if id_agente is set (either POST or GET, otherwise -1 $id_agent = $idAgent; @@ -202,16 +202,16 @@ if ($create_modules) { $services_values['snmp_community'] = 'Running'; // Key string $services_values['tcp_port'] = 1; // Field number (Running/Stopped) $services_values['id_tipo_modulo'] = 2; // Generic boolean - - $services_result = wmi_create_wizard_modules($id_agent, $services, 'services', $services_values); - + + $services_result = wmi_create_wizard_modules($id_agent, $services, 'services', $services_values, 0, 0, $server_to_exec); + // Create Process modules $processes_values = $values; $processes_values['tcp_port'] = 0; // Field number (OID) $processes_values['id_tipo_modulo'] = 2; // Generic boolean - $processes_result = wmi_create_wizard_modules($id_agent, $processes, 'processes', $processes_values); + $processes_result = wmi_create_wizard_modules($id_agent, $processes, 'processes', $processes_values, 0, 0, $server_to_exec); // Create Space on disk modules $disks_values = $values; @@ -220,14 +220,14 @@ if ($create_modules) { $disks_values['id_tipo_modulo'] = 1; // Generic numeric $disks_values['unit'] = 'Bytes'; // Unit - $disks_result = wmi_create_wizard_modules($id_agent, $disks, 'disks', $disks_values); + $disks_result = wmi_create_wizard_modules($id_agent, $disks, 'disks', $disks_values, 0, 0, $server_to_exec); // Create modules from component $components_values = $values; $components_values['id_agente'] = $id_agent; - $components_result = wmi_create_module_from_components($components, $components_values); + $components_result = wmi_create_module_from_components($components, $components_values, 0, 0, $server_to_exec); // Errors/Success messages @@ -339,6 +339,7 @@ if ($wmiexplore && !$fail) { html_print_input_hidden('plugin_user', $plugin_user); // User html_print_input_hidden('plugin_pass', $plugin_pass); // Password html_print_input_hidden('tcp_send', $tcp_send); // Namespace + html_print_input_hidden('server_to_exec', $server_to_exec); $table->width = '98%'; diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index e412acbb9c..2a45ce650e 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -58,7 +58,7 @@ if (isset($_GET["server"])) { if (enterprise_installed()) { $table->data[] = array (__('Type'), $server_type); - if ($row["server_type"] == 13) { + if ($row["server_type"] == 13 || $row["server_type"] == 1) { $table->data[] = array (__('Exec Server'), html_print_checkbox ("exec_proxy", 1, $row["exec_proxy"], true)); if ($row["exec_proxy"]) { $table->data[] = array (__('Check Exec Server'), '' . html_print_image ("images/dot_red.disabled.png", true) . '' . '
'); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 2a7b0e0534..bcfa76f461 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170901'; +$build_version = 'PC170904'; $pandora_version = 'v7.0NG.711'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_wmi.php b/pandora_console/include/functions_wmi.php index 0c7929e715..685c81b17d 100644 --- a/pandora_console/include/functions_wmi.php +++ b/pandora_console/include/functions_wmi.php @@ -50,7 +50,7 @@ function wmi_compose_query($wmi_client, $user, $password, $host, $namespace = '' } -function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id_police=0, $module_id=0) { +function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id_police=0, $module_id=0, $server_to_exec = 0) { $results = array(ERR_GENERIC => array(), NOERR => array()); if (empty($names)) { @@ -84,6 +84,32 @@ function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id $results[ERR_GENERIC][] = $name; } else { + if ($id_police == 0) { + if ($server_to_exec != 0) { + $sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec); + $row = db_get_row_sql ($sql); + + if ($row['server_type'] = 13) { + $new_module_configuration_data = " + module_begin + module_name " . $name . " + module_description + module_type generic_proc + module_snmp + module_oid " . $values['snmp_oid'] . " + module_community " . $values['snmp_community'] . " + ip_target " . $nc['ip_target'] ." + tcp_send " . $nc['tcp_send'] ." + plugin_user " . $nc['plugin_user'] ." + plugin_pass " . $nc['plugin_pass'] ." + tcp_port " . $nc['tcp_port'] . " + module_end"; + + config_agents_add_module_in_conf($id_agent, $new_module_configuration_data); + } + } + } + $results[NOERR][] = $name; } } @@ -91,7 +117,7 @@ function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id return $results; } -function wmi_create_module_from_components($components, $values, $id_police=0, $module_id=0) { +function wmi_create_module_from_components($components, $values, $id_police=0, $module_id=0, $server_to_exec = 0) { $results = array(ERR_GENERIC => array(), NOERR => array(), ERR_EXIST => array()); if (empty($components)) { @@ -155,6 +181,30 @@ function wmi_create_module_from_components($components, $values, $id_police=0, $ $results[ERR_GENERIC][] = $nc["nombre"]; } else { + if ($id_police == 0) { + if ($server_to_exec != 0) { + $sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec); + $row = db_get_row_sql ($sql); + + if ($row['server_type'] = 13) { + $new_module_configuration_data = " + module_begin + module_name " . $nc["nombre"] . " + module_description " . $nc['descripcion'] . " + module_type generic_data + ip_target " . $nc['ip_target'] ." + tcp_send " . $nc['tcp_send'] ." + plugin_user " . $nc['plugin_user'] ." + plugin_pass " . $nc['plugin_pass'] ." + unit Bytes + tcp_port 1 + module_end"; + + config_agents_add_module_in_conf($nc["id_agente"], $new_module_configuration_data); + } + } + } + if(!empty($tags)) { // Creating tags $tag_ids = array(); diff --git a/pandora_console/install.php b/pandora_console/install.php index 8e99de9a26..78fbd1f32e 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@