From e943a84b96dc566b3132b1f814f264617048bdf4 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 5 Feb 2015 14:51:08 +0100 Subject: [PATCH 1/3] Fixed the status of agent with some not-init modules. TICKET: #1761 (cherry picked from commit 39efadf1239aede6ca62957d74d0778721fed7ee) --- pandora_console/include/functions_agents.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index e6ce865e7b..c4e022d7d9 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -1525,6 +1525,8 @@ function agents_get_addresses ($id_agent) { * return -1 if the data are wrong */ function agents_get_status_from_counts($agent) { + + // Check if in the data there are all the necessary values if (!isset($agent['normal_count']) && !isset($agent['warning_count']) && @@ -1534,11 +1536,11 @@ function agents_get_status_from_counts($agent) { !isset($agent['total_count'])) { return -1; } - + # Juanma (05/05/2014) Fix: This status is not init! 0 modules or all not init if ($agent['notinit_count'] == $agent['total_count']) { return AGENT_MODULE_STATUS_NOT_INIT; - } + } if ($agent['critical_count'] > 0) { return AGENT_MODULE_STATUS_CRITICAL_BAD; } @@ -1551,6 +1553,9 @@ function agents_get_status_from_counts($agent) { else if ($agent['normal_count'] == $agent['total_count']) { return AGENT_MODULE_STATUS_NORMAL; } + else if ($agent['normal_count'] + $agent['notinit_count'] == $agent['total_count']) { + return AGENT_MODULE_STATUS_NORMAL; + } //~ else if($agent['notinit_count'] == $agent['total_count']) { //~ return AGENT_MODULE_STATUS_NORMAL; //~ } From d7f002697901af96a12d01055391f66caf35e8a5 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 5 Feb 2015 17:17:18 +0100 Subject: [PATCH 2/3] Fixed the error message in the check syntax of plugin registration plugin. --- .../extensions/plugin_registration.php | 256 +++++++++--------- 1 file changed, 133 insertions(+), 123 deletions(-) diff --git a/pandora_console/extensions/plugin_registration.php b/pandora_console/extensions/plugin_registration.php index 960b7541e9..69fe86c8fa 100644 --- a/pandora_console/extensions/plugin_registration.php +++ b/pandora_console/extensions/plugin_registration.php @@ -69,6 +69,7 @@ function pluginreg_extension_main () { echo "

".__("Cannot load INI file")."

"; } else { + $version = preg_replace("/.*[.]/", "", $name_file); $exec_path = $config["plugin_store"] . "/" . $ini_array["plugin_definition"]["filename"]; @@ -114,6 +115,7 @@ function pluginreg_extension_main () { 'parameters' => $ini_array["plugin_definition"]["parameters"], 'plugin_type' => $ini_array["plugin_definition"]["plugin_type"]); + switch ($version) { case 'pspz': // Fixed the static parameters @@ -265,130 +267,138 @@ function pluginreg_extension_main () { $create_id = db_process_sql_insert('tplugin', $values); - for ($ax = 1; $ax <= $ini_array["plugin_definition"]["total_modules_provided"]; $ax++) { - $label = "module" . $ax; - - $plugin_user = ""; - if (isset($ini_array[$label]["plugin_user"])) - $plugin_user = $ini_array[$label]["plugin_user"]; - $plugin_pass = ""; - if (isset($ini_array[$label]["plugin_pass"])) - $plugin_pass = $ini_array[$label]["plugin_pass"]; - $plugin_parameter = ""; - if (isset($ini_array[$label]["plugin_parameter"])) - $plugin_parameter = $ini_array[$label]["plugin_parameter"]; - $unit = ""; - if (isset($ini_array[$label]["unit"])) - $unit = $ini_array[$label]["unit"]; - - $values = array( - 'name' => io_safe_input ($ini_array[$label]["name"]), - 'description' => io_safe_input ($ini_array[$label]["description"]), - 'id_group' => $ini_array[$label]["id_group"], - 'type' => $ini_array[$label]["type"], - 'max' => isset($ini_array[$label]["max"]) ? $ini_array[$label]["max"] : '', - 'min' => isset($ini_array[$label]["min"]) ? $ini_array[$label]["min"] : '', - 'module_interval' => isset($ini_array[$label]["module_interval"]) ? $ini_array[$label]["module_interval"] : '', - 'id_module_group' => $ini_array[$label]["id_module_group"], - 'id_modulo' => $ini_array[$label]["id_modulo"], - 'plugin_user' => io_safe_input ($plugin_user), - 'plugin_pass' => io_safe_input ($plugin_pass), - 'plugin_parameter' => io_safe_input ($plugin_parameter), - 'unit' => io_safe_input ($unit), - 'max_timeout' => isset($ini_array[$label]["max_timeout"]) ? $ini_array[$label]["max_timeout"] : '', - 'history_data' => isset($ini_array[$label]["history_data"]) ? $ini_array[$label]["history_data"] : '', - 'min_warning' => isset($ini_array[$label]["min_warning"]) ? $ini_array[$label]["min_warning"] : '', - 'max_warning' => isset($ini_array[$label]["max_warning"]) ? $ini_array[$label]["max_warning"] : '', - 'str_warning' => isset($ini_array[$label]["str_warning"]) ? $ini_array[$label]["str_warning"] : '', - 'min_critical' => isset($ini_array[$label]["min_critical"]) ? $ini_array[$label]["min_critical"] : '', - 'max_critical' => isset($ini_array[$label]["max_critical"]) ? $ini_array[$label]["max_critical"] : '', - 'str_critical' => isset($ini_array[$label]["str_critical"]) ? $ini_array[$label]["str_critical"] : '', - 'min_ff_event' => isset($ini_array[$label]["min_ff_event"]) ? $ini_array[$label]["min_ff_event"] : '', - 'tcp_port' => isset($ini_array[$label]["tcp_port"]) ? $ini_array[$label]["tcp_port"] : '', - 'id_plugin' => $create_id); - - $macros_component = $macros; - - switch ($version) { - case 'pspz': - // Fixed the static parameters - // for - // the dinamic parameters of pandoras 5 - - foreach ($macros_component as $key => $macro) { - if ($macro['desc'] == 'Target IP from net') { - if (!empty($values['ip_target'])) { - $macros_component[$key]['value'] = - io_safe_input($values['ip_target']); - } - } - if ($macro['desc'] == 'Target IP') { - if (!empty($values['ip_target'])) { - $macros_component[$key]['value'] = - io_safe_input($values['ip_target']); - } - } - else if ($macro['desc'] == 'Port from net') { - if (!empty($values['tcp_port'])) { - $macros_component[$key]['value'] = - io_safe_input($values['tcp_port']); - } - } - else if ($macro['desc'] == 'Port') { - if (!empty($values['tcp_port'])) { - $macros_component[$key]['value'] = - io_safe_input($values['tcp_port']); - } - } - else if ($macro['desc'] == 'Username') { - if (!empty($values['plugin_user'])) { - $macros_component[$key]['value'] = - io_safe_input($values['plugin_user']); - } - } - else if ($macro['desc'] == 'Password') { - if (!empty($values['plugin_pass'])) { - $macros_component[$key]['value'] = - io_safe_input($values['plugin_pass']); - } - } - else if ($macro['desc'] == 'Plug-in Parameters') { - if (!empty($values['plugin_parameter'])) { - $macros_component[$key]['value'] = - io_safe_input($values['plugin_parameter']); - } - } - } - break; - case 'pspz2': - if ($total_macros > 0) { - for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) { - $macro = "macro_" . $it_macros . "_value"; - - // Set the value or use the default - if (isset($ini_array[$label][$macro])) { - $macros_component[(string)$it_macros]['value'] = - io_safe_input($ini_array[$label][$macro]); - } - } - } - break; - } - - if (!empty($macros_component)) { - $values['macros'] = json_encode($macros_component); - } - - db_process_sql_insert('tnetwork_component', $values); - - echo "

" . - __("Module plugin registered") . " : " . $ini_array[$label]["name"] . - "

"; + if (empty($create_id)) { + ui_print_error_message( + __('Plug-in Remote Registered unsuccessfull')); + ui_print_info_message( + __('Please check the syntax of file "plugin_definition.ini"')); + } + else { + for ($ax = 1; $ax <= $ini_array["plugin_definition"]["total_modules_provided"]; $ax++) { + $label = "module" . $ax; + + $plugin_user = ""; + if (isset($ini_array[$label]["plugin_user"])) + $plugin_user = $ini_array[$label]["plugin_user"]; + $plugin_pass = ""; + if (isset($ini_array[$label]["plugin_pass"])) + $plugin_pass = $ini_array[$label]["plugin_pass"]; + $plugin_parameter = ""; + if (isset($ini_array[$label]["plugin_parameter"])) + $plugin_parameter = $ini_array[$label]["plugin_parameter"]; + $unit = ""; + if (isset($ini_array[$label]["unit"])) + $unit = $ini_array[$label]["unit"]; + + $values = array( + 'name' => io_safe_input ($ini_array[$label]["name"]), + 'description' => io_safe_input ($ini_array[$label]["description"]), + 'id_group' => $ini_array[$label]["id_group"], + 'type' => $ini_array[$label]["type"], + 'max' => isset($ini_array[$label]["max"]) ? $ini_array[$label]["max"] : '', + 'min' => isset($ini_array[$label]["min"]) ? $ini_array[$label]["min"] : '', + 'module_interval' => isset($ini_array[$label]["module_interval"]) ? $ini_array[$label]["module_interval"] : '', + 'id_module_group' => $ini_array[$label]["id_module_group"], + 'id_modulo' => $ini_array[$label]["id_modulo"], + 'plugin_user' => io_safe_input ($plugin_user), + 'plugin_pass' => io_safe_input ($plugin_pass), + 'plugin_parameter' => io_safe_input ($plugin_parameter), + 'unit' => io_safe_input ($unit), + 'max_timeout' => isset($ini_array[$label]["max_timeout"]) ? $ini_array[$label]["max_timeout"] : '', + 'history_data' => isset($ini_array[$label]["history_data"]) ? $ini_array[$label]["history_data"] : '', + 'min_warning' => isset($ini_array[$label]["min_warning"]) ? $ini_array[$label]["min_warning"] : '', + 'max_warning' => isset($ini_array[$label]["max_warning"]) ? $ini_array[$label]["max_warning"] : '', + 'str_warning' => isset($ini_array[$label]["str_warning"]) ? $ini_array[$label]["str_warning"] : '', + 'min_critical' => isset($ini_array[$label]["min_critical"]) ? $ini_array[$label]["min_critical"] : '', + 'max_critical' => isset($ini_array[$label]["max_critical"]) ? $ini_array[$label]["max_critical"] : '', + 'str_critical' => isset($ini_array[$label]["str_critical"]) ? $ini_array[$label]["str_critical"] : '', + 'min_ff_event' => isset($ini_array[$label]["min_ff_event"]) ? $ini_array[$label]["min_ff_event"] : '', + 'tcp_port' => isset($ini_array[$label]["tcp_port"]) ? $ini_array[$label]["tcp_port"] : '', + 'id_plugin' => $create_id); + + $macros_component = $macros; + + switch ($version) { + case 'pspz': + // Fixed the static parameters + // for + // the dinamic parameters of pandoras 5 + + foreach ($macros_component as $key => $macro) { + if ($macro['desc'] == 'Target IP from net') { + if (!empty($values['ip_target'])) { + $macros_component[$key]['value'] = + io_safe_input($values['ip_target']); + } + } + if ($macro['desc'] == 'Target IP') { + if (!empty($values['ip_target'])) { + $macros_component[$key]['value'] = + io_safe_input($values['ip_target']); + } + } + else if ($macro['desc'] == 'Port from net') { + if (!empty($values['tcp_port'])) { + $macros_component[$key]['value'] = + io_safe_input($values['tcp_port']); + } + } + else if ($macro['desc'] == 'Port') { + if (!empty($values['tcp_port'])) { + $macros_component[$key]['value'] = + io_safe_input($values['tcp_port']); + } + } + else if ($macro['desc'] == 'Username') { + if (!empty($values['plugin_user'])) { + $macros_component[$key]['value'] = + io_safe_input($values['plugin_user']); + } + } + else if ($macro['desc'] == 'Password') { + if (!empty($values['plugin_pass'])) { + $macros_component[$key]['value'] = + io_safe_input($values['plugin_pass']); + } + } + else if ($macro['desc'] == 'Plug-in Parameters') { + if (!empty($values['plugin_parameter'])) { + $macros_component[$key]['value'] = + io_safe_input($values['plugin_parameter']); + } + } + } + break; + case 'pspz2': + if ($total_macros > 0) { + for ($it_macros = 1; $it_macros <= $total_macros; $it_macros++) { + $macro = "macro_" . $it_macros . "_value"; + + // Set the value or use the default + if (isset($ini_array[$label][$macro])) { + $macros_component[(string)$it_macros]['value'] = + io_safe_input($ini_array[$label][$macro]); + } + } + } + break; + } + + if (!empty($macros_component)) { + $values['macros'] = json_encode($macros_component); + } + + db_process_sql_insert('tnetwork_component', $values); + + echo "

" . + __("Module plugin registered") . " : " . $ini_array[$label]["name"] . + "

"; + } + + echo "

" . + __("Plugin") . " " . $ini_array["plugin_definition"]["name"] . " " . __("Registered successfully") . + "

"; } - - echo "

" . - __("Plugin") . " " . $ini_array["plugin_definition"]["name"] . " " . __("Registered successfully") . - "

"; unlink ($config["attachment_store"] . "/plugin_definition.ini"); } } From 55569ab805a00db4be0a56b874124fff9935493a Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 6 Feb 2015 00:01:09 +0100 Subject: [PATCH 3/3] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 72a86d0d39..a8697287bc 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150205 +Version: 6.0dev-150206 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 61302ad28a..c79a7da420 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="6.0dev-150205" +pandora_version="6.0dev-150206" 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 3ca537d051..05f3b3b0c7 100644 --- 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 => '6.0dev'; -use constant AGENT_BUILD => '150205'; +use constant AGENT_BUILD => '150206'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 894fc1215b..f0e38e13fd 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 6.0dev -%define release 150205 +%define release 150206 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 5ebeb4ed3e..26863b2dbd 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 6.0dev -%define release 150205 +%define release 150206 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index f3c87bf732..ebb448ba93 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150205} +{150206} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index ee0c445a6f..51fa9ff21a 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 ("6.0dev(Build 150205)") +#define PANDORA_VERSION ("6.0dev(Build 150206)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 872ab100f2..97710c5811 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", "(6.0dev(Build 150205))" + VALUE "ProductVersion", "(6.0dev(Build 150206))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 6821d9151c..3600b1eb73 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150205 +Version: 6.0dev-150206 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 2892313312..1c56834c83 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="6.0dev-150205" +pandora_version="6.0dev-150206" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index ff29099a89..dd97f971f1 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 = 'PC150205'; +$build_version = 'PC150206'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index a2b883b61b..1b7bda19c1 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@