diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 2f579d46f1..79820554a4 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.740-191113 +Version: 7.0NG.740-191114 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 74a6e96001..d78d751b8f 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.740-191113" +pandora_version="7.0NG.740-191114" 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 b1aeb52f03..914896e60d 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.740'; -use constant AGENT_BUILD => '191113'; +use constant AGENT_BUILD => '191114'; # 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 05f8c89559..69f557d28a 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.740 -%define release 191113 +%define release 191114 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 18ac2f32c0..cb0e9b4f19 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.740 -%define release 191113 +%define release 191114 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 bf85762a39..4ab5dd95d2 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.740" -PI_BUILD="191113" +PI_BUILD="191114" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index be5a498d11..8bc224a07d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{191113} +{191114} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b268f7f436..17535bb510 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.740(Build 191113)") +#define PANDORA_VERSION ("7.0NG.740(Build 191114)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index e2707bff53..046c10a7bb 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.740(Build 191113))" + VALUE "ProductVersion", "(7.0NG.740(Build 191114))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 45e4ec20f1..0938879341 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.740-191113 +Version: 7.0NG.740-191114 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 cf617bb4e3..7cad660d31 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.740-191113" +pandora_version="7.0NG.740-191114" package_pear=0 package_pandora=1 diff --git a/pandora_console/extras/mr/33.sql b/pandora_console/extras/mr/33.sql index 50fc5e0bce..85a38a4fa7 100644 --- a/pandora_console/extras/mr/33.sql +++ b/pandora_console/extras/mr/33.sql @@ -34,4 +34,6 @@ CREATE TABLE `tremote_command_target` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO `tconfig`(`token`, `value`) VALUES ('welcome_state', -1); + COMMIT; diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index 1f4b4c94f7..94acbc4ba2 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -70,6 +70,7 @@ class Diagnostics extends Wizard $this->ajaxController = $page; $this->pdf = $pdf; + $this->product_name = io_safe_output(get_product_name()); } @@ -126,7 +127,7 @@ class Diagnostics extends Wizard // Header. ui_print_page_header( - __('Pandora FMS Diagnostic tool'), + __('%s Diagnostic tool', $this->product_name), 'images/gm_massive_operations.png', false, 'diagnostic_tool_tab', @@ -190,7 +191,7 @@ class Diagnostics extends Wizard foreach ($infoMethods as $key => $method) { switch ($method) { case 'getStatusInfo': - $title = __('Info status pandoraFms'); + $title = __('Info status %s', $this->product_name); break; case 'getPHPSetup': @@ -219,16 +220,17 @@ class Diagnostics extends Wizard case 'getTablesFragmentation': $title = __( - 'Tables fragmentation in the Pandora FMS database' + 'Tables fragmentation in the %s database', + $this->product_name ); break; case 'getPandoraFMSLogsDates': - $title = __('Pandora FMS logs dates'); + $title = __('%s logs dates', $this->product_name); break; case 'getLicenceInformation': - $title = __('Pandora FMS Licence Information'); + $title = __('%s Licence Information', $this->product_name); break; case 'getAttachmentFolder': @@ -240,7 +242,7 @@ class Diagnostics extends Wizard break; case 'getServerThreads': - $title = __('Pandora FMS server threads'); + $title = __('%s server threads', $this->product_name); break; case 'getShowEngine': @@ -399,11 +401,11 @@ class Diagnostics extends Wizard 'error' => false, 'data' => [ 'buildVersion' => [ - 'name' => __('Pandora FMS Build'), + 'name' => __('%s Build', $this->product_name), 'value' => $build_version, ], 'version' => [ - 'name' => __('Pandora FMS Version'), + 'name' => __('%s Version', $this->product_name), 'value' => $pandora_version, ], 'mr' => [ @@ -512,7 +514,7 @@ class Diagnostics extends Wizard 'error' => false, 'data' => [ 'countAgents' => [ - 'name' => __('Total agentsy'), + 'name' => __('Total agents'), 'value' => $countAgents, ], 'countModules' => [ @@ -586,7 +588,10 @@ class Diagnostics extends Wizard $pandoraDbLastRun = __('Pandora DB has never been executed'); if ($dateDbMantenaince !== false) { $difference = ($currentTime - $dateDbMantenaince); - $pandoraDbLastRun = human_time_comparation($difference); + $pandoraDbLastRun = human_time_description_raw( + $difference, + true + ); $pandoraDbLastRun .= ' '.__('Ago'); } @@ -602,7 +607,7 @@ class Diagnostics extends Wizard 'value' => $notInitAgents, ], 'pandoraDbLastRun' => [ - 'name' => __('PandoraDB Last run'), + 'name' => __('Pandora DB Last run'), 'value' => $pandoraDbLastRun, ], ], @@ -671,17 +676,54 @@ class Diagnostics extends Wizard $cpuProcessor = 'cat /proc/cpuinfo | grep "processor" | wc -l'; $ramMemTotal = 'cat /proc/meminfo | grep "MemTotal"'; + exec( + "ifconfig | awk '{ print $2}' | grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}'", + $output + ); + + $ips = implode(', ', $output); + $result = [ 'error' => false, 'data' => [ - 'cpuInfo' => [ + 'cpuInfo' => [ 'name' => __('CPU'), 'value' => exec($cpuModelName).' x '.exec($cpuProcessor), ], - 'ramInfo' => [ + 'ramInfo' => [ 'name' => __('RAM'), 'value' => exec($ramMemTotal), ], + 'osInfo' => [ + 'name' => __('Os'), + 'value' => exec('uname -a'), + ], + 'hostnameInfo' => [ + 'name' => __('Hostname'), + 'value' => exec('hostname'), + ], + 'ipInfo' => [ + 'name' => __('Ip'), + 'value' => $ips, + ], + ], + ]; + } else { + $result = [ + 'error' => false, + 'data' => [ + 'osInfo' => [ + 'name' => __('OS'), + 'value' => exec('ver'), + ], + 'hostnameInfo' => [ + 'name' => __('Hostname'), + 'value' => exec('hostname'), + ], + 'ipInfo' => [ + 'name' => __('Ip'), + 'value' => exec('ipconfig | findstr IPv4'), + ], ], ]; } @@ -750,22 +792,6 @@ class Diagnostics extends Wizard $message = __('Min. Recommended Value').' 64M'; break; - /* - case 'join_buffer_size': - $name = __('Join buffer size'); - $value = ($item['Value'] / $bytes); - $status = (($item['Value'] / $bytes) >= 265) ? 1 : 0; - $message = __('Min. Recommended Value 265'); - break; - - case 'key_buffer_size': - $name = __('Key buffer size'); - $value = ($item['Value'] / $bytes); - $status = (($item['Value'] / $bytes) >= 256) ? 1 : 0; - $message = __('Min. Recommended Value').' 256'; - break; - */ - case 'max_allowed_packet': $name = __('Maximun allowed packet'); $value = ($item['Value'] / $bytes); @@ -953,10 +979,10 @@ class Diagnostics extends Wizard $unit = 'M'; - $pathServerLogs = 'var/log/pandora/pandora_server.log'; + $pathServerLogs = '/var/log/pandora/pandora_server.log'; $servers = $this->getLogInfo($pathServerLogs); - $pathErrLogs = 'var/log/pandora/pandora_server.error'; + $pathErrLogs = '/var/log/pandora/pandora_server.error'; $errors = $this->getLogInfo($pathErrLogs); $pathConsoleLogs = $config['homedir'].'/pandora_console.log'; @@ -1018,6 +1044,7 @@ class Diagnostics extends Wizard $customerKey = db_get_value_sql($sql); // Extract Info license. + enterprise_include_once('include/functions_license.php'); $license = enterprise_hook('license_get_info'); // Agent Capacity. @@ -1050,6 +1077,7 @@ class Diagnostics extends Wizard WHERE id_tipo_modulo BETWEEN 6 AND 18' ); + $totalModuleIntervalTime = db_get_value_sql( 'SELECT SUM(module_interval) FROM tagente_modulo @@ -1060,26 +1088,26 @@ class Diagnostics extends Wizard $averageTime = 0; if ($totalModuleIntervalTime !== false) { $averageTime = number_format( - ((int) $totalModuleIntervalTime / (int) $totalNetworkModules), + ((int) $totalNetworkModules / (int) $totalModuleIntervalTime), 3 ); } $moduleNetworkmsg = __( sprintf( - 'The system is not overloaded (average time %d)', - $average_time + 'The system is not overloaded (average time %f)', + $averageTime ) ); $moduleNetworkst = 1; - if ($average_time === 0) { + if ($averageTime === 0) { $moduleNetworkmsg = __('The system has no load'); $moduleNetworkst = 0; - } else if ($averageTime < 180) { + } else if ($averageTime > 180) { $moduleNetworkmsg = __( sprintf( - 'The system is overloaded (average time %d) and a very fine configuration is required', - $average_time + 'The system is overloaded (average time %f) and a very fine configuration is required', + $averageTime ) ); $moduleNetworkst = 0; @@ -1252,37 +1280,47 @@ class Diagnostics extends Wizard { global $config; - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - return []; + $result = []; + $totalServerThreads = 0; + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $totalServerThreads = shell_exec( + 'ps -T aux | grep pandora_server | grep -v grep | wc -l' + ); } - $totalServerThreads = shell_exec( - 'ps -T aux | grep pandora_server | grep -v grep | wc -l' - ); - $percentageThreadsRam = shell_exec( - "ps axo pmem,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'" - ); - $percentageThreadsCpu = shell_exec( - "ps axo pcpu,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'" - ); + include_once $config['homedir'].'/include/functions_servers.php'; + $sql = 'SELECT `name`, server_type, threads FROM tserver'; + $servers = db_get_all_rows_sql($sql); - $result = [ - 'error' => false, - 'data' => [ - 'totalServerThreads' => [ - 'name' => __('Total server threads'), - 'value' => $totalServerThreads, - ], - 'percentageThreadsRam' => [ - 'name' => __('Percentage of threads used by the RAM'), - 'value' => $percentageThreadsRam.' %', - ], - 'percentageThreadsCpu' => [ - 'name' => __('Percentage of threads used by the CPU'), - 'value' => $percentageThreadsCpu.' %', - ], - ], - ]; + if (isset($servers) === true && is_array($servers) === true) { + $sum_threads = 0; + foreach ($servers as $key => $value) { + $result['data']['threads_server_'.$value['server_type']] = [ + 'name' => __('Threads').' '.\servers_get_server_string_name( + $value['server_type'] + ), + 'value' => $value['threads'], + ]; + + $sum_threads += $value['threads']; + } + + $result['data']['total_threads'] = [ + 'name' => __('Total threads'), + 'value' => $sum_threads, + 'status' => ($sum_threads < $totalServerThreads) ? 2 : 1, + ]; + + if ($sum_threads < $totalServerThreads) { + $result['data']['total_threads']['message'] = __( + 'Current pandora_server running threads' + ); + } else { + __( + 'There\'s more pandora_server threads than configured, are you running multiple servers simultaneusly?.' + ); + } + } return json_encode($result); } @@ -1315,8 +1353,8 @@ class Diagnostics extends Wizard $lenght = strlen($innodb[0]['Status']); $data = []; - for ($i = 0; $i < $lenght; $i = ($i + 500)) { - $str = substr($innodb[0]['Status'], $i, ($i + 500)); + for ($i = 0; $i < $lenght; $i = ($i + 300)) { + $str = substr($innodb[0]['Status'], $i, ($i + 300)); $data['showEngine-'.$i] = [ 'name' => '', 'value' => '
'.$str.'
', @@ -1673,7 +1711,7 @@ class Diagnostics extends Wizard 'status' => 0, ]; - if (is_file($path) === true) { + if (file_exists($path) === true) { $fileSize = filesize($path); $sizeServerLog = number_format($fileSize); $sizeServerLog = (0 + str_replace(',', '', $sizeServerLog)); @@ -1730,7 +1768,17 @@ class Diagnostics extends Wizard // of objects, making a post-process of certain fields. if (isset($items[$key]['status']) === true) { $acumValue = $items[$key]['value']; - if ($items[$key]['status'] === 1) { + + if ($items[$key]['status'] === 2) { + $items[$key]['value'] = html_print_image( + 'images/icono-warning.png', + true, + [ + 'title' => __('Warning'), + 'style' => 'width:15px;', + ] + ); + } else if ($items[$key]['status'] === 1) { $items[$key]['value'] = html_print_image( 'images/exito.png', true, @@ -1872,7 +1920,7 @@ class Diagnostics extends Wizard $mail_feedback = 'feedback@artica.es'; $email = $mail_feedback; - $subject = 'PandoraFMS Report '.$config['pandora_uid']; + $subject = $this->product_name.' Report '.$config['pandora_uid']; $text = get_parameter('what-happened', ''); $attachment = get_parameter_switch('include_installation_data', 0); $email_from = get_parameter_switch('email', ''); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index ff5f365d5e..af1a1512b1 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 = 'PC191113'; +$build_version = 'PC191114'; $pandora_version = 'v7.0NG.740'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 094f4b3393..fcff5046ec 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 058a7a201f..de6e69f159 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.740 -%define release 191113 +%define release 191114 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 1cc4ce0412..5147e9db2b 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.740 -%define release 191113 +%define release 191114 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 34b1a6479c..6b4524bafa 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.740" -PI_BUILD="191113" +PI_BUILD="191114" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 7ae1717f78..172635f066 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.740 PS191113"; +my $version = "7.0NG.740 PS191114"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index f45897efe6..bed56ea29c 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.740 PS191113"; +my $version = "7.0NG.740 PS191114"; # save program name for logging my $progname = basename($0);