diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 4255aa11fc..cf6452d7f2 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150506 +Version: 6.0dev-150518 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 8d918c2f03..03bb20caf3 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-150506" +pandora_version="6.0dev-150518" 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 5f759b1753..b928bb1075 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 => '150506'; +use constant AGENT_BUILD => '150518'; # 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 c91725dc76..c1039f40b0 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 150506 +%define release 150518 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 99495a4a99..183254be3e 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 150506 +%define release 150518 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/plugins/pandora_mem b/pandora_agents/unix/plugins/pandora_mem index 1d7745a8fd..229b05ca8a 100755 --- a/pandora_agents/unix/plugins/pandora_mem +++ b/pandora_agents/unix/plugins/pandora_mem @@ -21,7 +21,7 @@ my $freemem=`cat /proc/meminfo | grep 'MemFree' | awk '{ print \$2 } '`; my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`; my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`; my $available=$freemem+$cached+$cachedwap; -my $available_percent = floor(($available / $STOTAL)*100); +my $available_percent = floor(($available / $TOTAL)*100); print "\n"; diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index f450d2f522..dcf98711da 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -19,7 +19,7 @@ server_ip $ServerIP$ server_path /var/spool/pandora/data_in -temporal "C:\Program Files\pandora_agent\temp" +temporal "C:\%ProgramFiles%\pandora_agent\temp" #include "C:\Archivos de programa\pandora_agent\pandora_agent_alt.conf" #broker_agent name_agent diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 38b8db27aa..8e2ff3b931 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150506} +{150518} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 6c4febc0ff..0543e30c57 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 150506)") +#define PANDORA_VERSION ("6.0dev(Build 150518)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index af4fa1c78d..d7a7118eff 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 150506))" + VALUE "ProductVersion", "(6.0dev(Build 150518))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index aa78603ff3..d6ef4ab72e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150506 +Version: 6.0dev-150518 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 deeffbb6f6..700fb80781 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-150506" +pandora_version="6.0dev-150518" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/realtime_graphs/ajax.php b/pandora_console/extensions/realtime_graphs/ajax.php index e5121feaf4..0755db403e 100644 --- a/pandora_console/extensions/realtime_graphs/ajax.php +++ b/pandora_console/extensions/realtime_graphs/ajax.php @@ -20,24 +20,43 @@ $graph = $_POST['graph']; $graph_title = $_POST['graph_title']; $refresh = $_POST['refresh']; +$os = strtolower(PHP_OS); + if (substr($os, 0, 3) === 'win') { + $os = 'windows'; +} switch($graph) { case 'cpu_load': - $data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'"); + if ( $os == 'windows') + $data = exec('wmic cpu get loadpercentage|find /I /V "Loadpercentage" | findstr /r "[0-9]" '); + else + $data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'"); break; case 'pending_packets': $data = exec("ls /var/spool/pandora/data_in/*.data | wc -l"); break; case 'disk_io_wait': - $data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'"); + if ( $os == 'windows') + $data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'"); + else + $data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'"); break; case 'mysql_load': - $data = exec("ps aux | grep mysqld | grep -v safe | grep -v grep | awk '{ print $3 }'"); + if ( $os == 'windows') + $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(mysqld)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); + else + $data = exec("ps aux | grep mysqld | grep -v safe | grep -v grep | awk '{ print $3 }'"); break; case 'apache_load': - $data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); + if ( $os == 'windows') + $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(httpd)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); + else + $data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'"); break; case 'server_load': - $data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'"); + if ( $os == 'windows') + $data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(pandora_server)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."'); + else + $data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'"); break; case 'snmp_interface': $snmp_address = $_POST['snmp_address']; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 2b7ad7e7a2..64dbaecd89 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -994,7 +994,7 @@ if ($update_module || $create_module) { // Make changes in the conf file if necessary enterprise_include_once('include/functions_config_agents.php'); - if (!policies_is_module_in_policy($id_agent_module)) { + if (!enterprise_hook('policies_is_module_in_policy', array($id_agent_module))) { enterprise_hook('config_agents_write_module_in_conf', array($id_agente, io_safe_output($old_configuration_data), io_safe_output($configuration_data), $disabled)); diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 4182c52a9e..3e85086573 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -442,18 +442,6 @@ if ($list_modules) { break; } break; - case 'data': - switch ($sort) { - case 'up': - $selectDataUp = $selected; - $order = array('field' => 'tagente_estado.datos', 'order' => 'ASC'); - break; - case 'down': - $selectDataDown = $selected; - $order = array('field' => 'tagente_estado.datos', 'order' => 'DESC'); - break; - } - break; case 'last_contact': switch ($sort) { case 'up': @@ -703,9 +691,7 @@ if ($list_modules) { '' . 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] = __('Warn'); - $table->head[7] = __('Data') . ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . ''; + $table->head[7] = __('Data'); $table->head[8] = __('Graph'); $table->head[9] = __('Last contact') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '' . diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 35db109620..f488bb8817 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 = 'PC150506'; +$build_version = 'PC150518'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index d8d7e5e88f..39cabf1f32 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -119,7 +119,7 @@ function config_update_config () { case 'general': if (!config_update_value ('language', (string) get_parameter ('language'))) $error_update[] = __('Language code for Pandora'); - if (!config_update_value ('remote_config', (string) get_parameter ('remote_config'))) + if (!config_update_value ('remote_config', io_safe_input((string) get_parameter ('remote_config')))) $error_update[] = __('Remote config directory'); if (!config_update_value ('loginhash_pwd', io_input_password((string) get_parameter ('loginhash_pwd')))) $error_update[] = __('Auto login (hash) password'); @@ -130,7 +130,7 @@ function config_update_config () { $error_update[] = __('Automatic check for updates'); if (!config_update_value ('https', (bool) get_parameter ('https'))) $error_update[] = __('Enforce https'); - if (!config_update_value ('attachment_store', (string) get_parameter ('attachment_store'))) + if (!config_update_value ('attachment_store', io_safe_input((string) get_parameter ('attachment_store')))) $error_update[] = __('Attachment store'); if (!config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API'))) $error_update[] = __('IP list with API access'); @@ -413,7 +413,7 @@ function config_update_config () { $error_update[] = __('Show QR code header'); if (!config_update_value ('status_images_set', (string) get_parameter ('status_images_set'))) $error_update[] = __('Status icon set'); - if (!config_update_value ('fontpath', (string) get_parameter ('fontpath'))) + if (!config_update_value ('fontpath', io_safe_input((string) get_parameter ('fontpath')))) $error_update[] = __('Font path'); if (!config_update_value ('font_size', get_parameter('font_size'))) $error_update[] = __('Font size'); @@ -451,7 +451,7 @@ function config_update_config () { $error_update[] = __('Fixed menu'); if (!config_update_value ('paginate_module', get_parameter('paginate_module'))) $error_update[] = __('Paginate module'); - if (!config_update_value ('graphviz_bin_dir', get_parameter('graphviz_bin_dir'))) + if (!config_update_value ('graphviz_bin_dir', io_safe_input(get_parameter('graphviz_bin_dir')))) $error_update[] = __('Custom graphviz directory'); if (!config_update_value ('networkmap_max_width', get_parameter('networkmap_max_width'))) $error_update[] = __('Networkmap max width'); @@ -461,7 +461,7 @@ function config_update_config () { $error_update[] = __('Show the group name instead the group icon.'); if (!config_update_value ('custom_graph_widht', (int) get_parameter('custom_graph_widht', 1))) $error_update[] = __('Default line thickness for the Custom Graph.'); - if (!config_update_value ('render_proc', (int) get_parameter('render_proc', 0))) + if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false))) $error_update[] = __('Render data of module type is proc.'); @@ -625,7 +625,7 @@ function config_update_config () { enterprise_include_once('include/functions_policies.php'); $enterprise = enterprise_include_once ('include/functions_skins.php'); if ($enterprise !== ENTERPRISE_NOT_HOOK) { - $config['relative_path'] = get_parameter('relative_path', $config['relative_path']); + $config['relative_path'] = get_parameter('relative_path', io_safe_input($config['relative_path'])); } } @@ -653,7 +653,7 @@ function config_process_config () { if (isset ($config['homeurl']) && (strlen($config['homeurl']) > 0)) { if ($config['homeurl'][0] != '/') { - $config['homeurl'] = '/'.$config['homeurl']; + $config['homeurl'] = '/'.io_safe_input($config['homeurl']); } } @@ -862,21 +862,21 @@ function config_process_config () { // dir. if (!isset ($config['attachment_store'])) { config_update_value('attachment_store', - $config['homedir'] . '/attachment'); + io_safe_input($config['homedir']) . '/attachment'); } else { //Fixed when the user moves the pandora console to another dir //after the first uses. if (!is_dir($config['attachment_store'])) { config_update_value('attachment_store', - $config['homedir'] . '/attachment'); + io_safe_input($config['homedir']) . '/attachment'); } } if (!isset ($config['fontpath'])) { config_update_value('fontpath', - $config['homedir'] . '/include/fonts/smallfont.ttf'); + io_safe_input($config['homedir']) . '/include/fonts/smallfont.ttf'); } if (!isset ($config['style'])) { @@ -1468,6 +1468,7 @@ function config_check () { $PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit')); $PHPmax_execution_time = ini_get('max_execution_time'); $PHPsafe_mode = ini_get('safe_mode'); + $PHPdisable_functions = ini_get('disable_functions'); if ($PHPsafe_mode === '1') { set_pandora_error_for_header( @@ -1502,6 +1503,12 @@ function config_check () { sprintf(__('Recommended value is: %s'), sprintf(__('%s or greater'), '500M')) . '

' . __('Please, change it on your PHP configuration file (php.ini) or contact with administrator'), sprintf(__("Not recommended '%s' value in PHP configuration"), 'memory_limit')); } + + if (preg_match("/system/", $PHPdisable_functions) or preg_match("/exec/", $PHPdisable_functions)) { + set_pandora_error_for_header( + __("Variable disable_functions containts functions system() or exec(), in PHP configuration file (php.ini)"). '

' . + __('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'), __("Problems with disable functions in PHP.INI")); + } } function config_return_in_bytes($val) { diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index d83d9102d0..1012d529e3 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -800,6 +800,7 @@ function visual_map_print_item($mode = "read", $layoutData, break; case STATIC_GRAPH: case GROUP_ITEM: + echo "
"; if ($layoutData['image'] != null) { @@ -861,6 +862,7 @@ function visual_map_print_item($mode = "read", $layoutData, echo '
'; } echo io_safe_output($text); + echo "
"; break; case PERCENTILE_BAR: diff --git a/pandora_console/install.php b/pandora_console/install.php index 32a9ad8368..fce5a92c52 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@