Merge branch 'develop' into 'ent-4769-modulos-ssh-php-perl'

Conflicts:
   pandora_console/extras/mr/33.sql
This commit is contained in:
fbsanchez 2019-11-19 14:11:38 +01:00
commit 471389a72a
32 changed files with 265 additions and 235 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.740-191113
Version: 7.0NG.740-191119
Architecture: all
Priority: optional
Section: admin

View File

@ -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-191119"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.740';
use constant AGENT_BUILD => '191113';
use constant AGENT_BUILD => '191119';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.740
%define release 191113
%define release 191119
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.740
%define release 191113
%define release 191119
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.740"
PI_BUILD="191113"
PI_BUILD="191119"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{191113}
{191119}
ViewReadme
{Yes}

View File

@ -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 191119)")
string pandora_path;
string pandora_dir;

View File

@ -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 191119))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.740-191113
Version: 7.0NG.740-191119
Architecture: all
Priority: optional
Section: admin

View File

@ -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-191119"
package_pear=0
package_pandora=1

View File

@ -30,6 +30,15 @@
global $config;
check_login();
// ACL Check
if (!check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Module Groups view'
);
include 'general/noaccess.php';
exit;
}
if (is_ajax()) {
$get_info_alert_module_group = (bool) get_parameter('get_info_alert_module_group');
@ -82,6 +91,16 @@ function mainModuleGroups()
$agent_group_search = get_parameter('agent_group_search', '');
$module_group_search = get_parameter('module_group_search', '');
// Check the user's group permissions.
$user_groups = users_get_groups($config['user'], 'AR');
$info = array_filter(
$info,
function ($v, $k) use ($user_groups) {
return $user_groups[$v['id']] != null;
},
ARRAY_FILTER_USE_BOTH
);
$info = array_filter(
$info,
function ($v, $k) use ($agent_group_search) {
@ -265,7 +284,7 @@ function mainModuleGroups()
text-align: center;
';
if (true) {
if ($info && $array_module_group) {
$table = new StdClass();
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
$table->width = '100%';
@ -296,22 +315,22 @@ function mainModuleGroups()
$url = 'index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group='.$key.'&modulegroup='.$k;
if ($array_data[$key][$k]['alerts_module_count'] != 0) {
$color = '#FFA631';
$color = COL_ALERTFIRED;
// Orange when the cell for this model group and agent has at least one alert fired.
} else if ($array_data[$key][$k]['critical_module_count'] != 0) {
$color = '#e63c52';
$color = COL_CRITICAL;
// Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
} else if ($array_data[$key][$k]['warning_module_count'] != 0) {
$color = '#f3b200';
$color = COL_WARNING;
// Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
} else if ($array_data[$key][$k]['unknown_module_count'] != 0) {
$color = '#B2B2B2 ';
$color = COL_UNKNOWN;
// Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
} else if ($array_data[$key][$k]['normal_module_count'] != 0) {
$color = '#82b92e';
$color = COL_NORMAL;
// Green when the cell for this model group and agent has OK state all modules.
} else if ($array_data[$key][$k]['notInit_module_count'] != 0) {
$color = '#5BB6E5';
$color = COL_NOTINIT;
// Blue when the cell for this module group and all modules have not init value.
}
@ -359,7 +378,7 @@ function mainModuleGroups()
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Grey cell when the module group and agent have at least one in unknown status and the others in green status').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Green cell when the module group and agent have all modules in OK status').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_MAINTENANCE.";'></div></td><td>".__('Blue cell when the module group and agent have all modules in not init status.').'</td></tr>';
echo "<tr><td class='legend_square_simple'><div style='background-color: ".COL_NOTINIT.";'></div></td><td>".__('Blue cell when the module group and agent have all modules in not init status.').'</td></tr>';
echo '</table>';
echo '</div>';
} else {

View File

@ -8,8 +8,6 @@ INSERT INTO `ttipo_modulo` VALUES
(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'),
(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png');
-- Extra tnetwork_component
INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('N.&#x20;total&#x20;processes','Number&#x20;of&#x20;running&#x20;processes&#x20;in&#x20;a&#x20;Windows&#x20;system.',11,34,0,0,300,0,'tasklist&#x20;/NH&#x20;|&#x20;findstr&#x20;/c&#x20;/v&#x20;&quot;&quot;','','','',6,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','windows','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Free&#x20;space&#x20;in&#x20;C:','Free&#x20;space&#x20;available&#x20;in&#x20;C:',11,34,0,0,300,0,'powershell&#x20;$obj=&#40;Get-WmiObject&#x20;-class&#x20;&quot;Win32_LogicalDisk&quot;&#x20;-namespace&#x20;&quot;root&#92;CIMV2&quot;&#41;&#x20;;&#x20;$obj.FreeSpace&#x20;*&#x20;100&#x20;/$obj.Size','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','windows','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux&#x20;uptime','System&#x20;uptime',43,36,0,0,300,0,'uptime&#x20;|sed&#x20;s/us&#92;.*$//g&#x20;|&#x20;sed&#x20;s/,&#92;.*$//g','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
@ -18,4 +16,6 @@ INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `ma
INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux&#x20;available&#x20;memory&#x20;percent','Available&#x20;memory&#x20;%',43,34,0,0,300,0,'free&#x20;|&#x20;grep&#x20;Mem&#x20;|&#x20;awk&#x20;&#039;{print&#x20;$NF/$2&#x20;*&#x20;100}&#039;','','','',4,2,0,'','','',0,0,1,0.00,0.00,'',0.00,0.00,'',0,'','linux','',0,0,0.000000000000000,'%','nowizard','','','','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `max_retries`, `history_data`, `min_warning`, `max_warning`, `max_critical`, `str_warning`, `min_ff_event`, `min_critical`, `custom_string_2`, `str_critical`, `custom_integer_1`, `custom_string_1`, `post_process`, `custom_string_3`, `wizard_level`, `custom_integer_2`, `critical_instructions`, `unit`, `unknown_instructions`, `macros`, `warning_inverse`, `warning_instructions`, `tags`, `critical_inverse`, `module_macros`, `id_category`, `min_ff_event_warning`, `disabled_types_event`, `ff_type`, `min_ff_event_normal`, `dynamic_interval`, `min_ff_event_critical`, `dynamic_min`, `each_ff`, `dynamic_two_tailed`, `dynamic_max`, `dynamic_next`) VALUES ('Linux&#x20;available&#x20;disk&#x20;/','Available&#x20;free&#x20;space&#x20;in&#x20;mountpoint&#x20;/',43,34,0,0,300,0,'df&#x20;/&#x20;|&#x20;tail&#x20;-n&#x20;+2&#x20;|&#x20;awk&#x20;&#039;{print&#x20;$&#40;NF-1&#41;}&#039;&#x20;|&#x20;tr&#x20;-d&#x20;&#039;%&#039;','','','',4,2,0,'','','',0,0,1,0.00,0.00,'0.00',0.00,0.00,'',0,'','inherited','',0,0,0.000000000000000,'','nowizard','','nowizard','0','',0,0,0,'','{\"going_unknown\":1}','',0,0,0,0,0,0,0,0,0,0);
INSERT INTO `tconfig`(`token`, `value`) VALUES ('welcome_state', -1);
COMMIT;

View File

@ -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' => '<pre>'.$str.'</pre>',
@ -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', '');

View File

@ -342,11 +342,11 @@ class WelcomeWindow extends Wizard
$btn_create_alert_class = '';
$btn_create_discovery_class = 'pending';
$li_configure_mail_class = 'green';
$li_create_agent_class = 'green';
$li_create_module_class = 'grey';
$li_create_alert_class = 'grey';
$li_create_discovery_class = 'green';
$li_configure_mail_class = 'row_green';
$li_create_agent_class = 'row_green';
$li_create_module_class = 'row_grey';
$li_create_alert_class = 'row_grey';
$li_create_discovery_class = 'row_green';
if (empty($config['welcome_mail_configured']) === false) {
$btn_configure_mail_class = ' completed';
@ -355,18 +355,18 @@ class WelcomeWindow extends Wizard
if (empty($config['welcome_id_agent']) === false) {
$btn_create_agent_class = ' completed';
$btn_create_module_class = ' pending';
$li_create_module_class = 'green';
$li_create_module_class = 'row_green';
}
if (empty($config['welcome_module']) === false) {
$btn_create_module_class = ' completed';
$btn_create_alert_class = ' pending';
$li_create_module_class = 'green';
$li_create_module_class = 'row_green';
}
if (empty($config['welcome_alert']) === false) {
$btn_create_alert_class = ' completed';
$li_create_alert_class = 'green';
$li_create_alert_class = 'row_green';
}
if (empty($config['welcome_task']) === false) {
@ -380,8 +380,8 @@ class WelcomeWindow extends Wizard
$btn_create_module_class = ' completed';
$btn_create_alert_class = ' completed';
$btn_create_discovery_class = ' completed';
$li_create_module_class = 'green';
$li_create_alert_class = 'green';
$li_create_module_class = 'row_green';
$li_create_alert_class = 'row_green';
}
$form = [
@ -547,7 +547,10 @@ class WelcomeWindow extends Wizard
],
],
],
[
];
if (enterprise_installed()) {
$inputs[] = [
'wrapper' => 'div',
'block_id' => 'div_not_working',
'class' => 'hole flex-row w100p',
@ -573,8 +576,8 @@ class WelcomeWindow extends Wizard
],
],
],
];
];
}
$output = $this->printForm(
[

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC191113';
$build_version = 'PC191119';
$pandora_version = 'v7.0NG.740';
// Do not overwrite default timezone set if defined.

View File

@ -4559,116 +4559,98 @@ function events_page_comments($event, $ajax=false)
// Comments.
global $config;
$comments = '';
$comments = $event['user_comment'];
if (isset($event['comments'])) {
$comments = explode('<br>', $event['comments']);
}
$table_comments = new stdClass;
$table_comments->width = '100%';
$table_comments->data = [];
$table_comments->head = [];
$table_comments->class = 'table_modal_alternate';
$comments = str_replace(["\n", '&#x0a;'], '<br>', $comments);
$comments = ($event['user_comment'] ?? '');
if (is_array($comments)) {
foreach ($comments as $comm) {
if (empty($comm)) {
continue;
}
$comments_array[] = json_decode(io_safe_output($comm), true);
}
if (empty($comments)) {
$table_comments->style[0] = 'text-align:center;';
$table_comments->colspan[0][0] = 2;
$data = [];
$data[0] = __('There are no comments');
$table_comments->data[] = $data;
} else {
// If comments are not stored in json, the format is old.
$comments_array = json_decode(io_safe_output($comments), true);
}
foreach ($comments_array as $comm) {
// Show the comments more recent first.
if (is_array($comm)) {
$comm = array_reverse($comm);
}
if (empty($comm)) {
$comments_format = 'old';
} else {
$comments_format = 'new';
}
switch ($comments_format) {
case 'new':
if (is_array($comments)) {
foreach ($comments as $comm) {
if (empty($comm)) {
$table_comments->style[0] = 'text-align:center;';
$table_comments->colspan[0][0] = 2;
$data = [];
$data[0] = __('There are no comments');
$table_comments->data[] = $data;
continue;
}
if (isset($comm) === true
&& is_array($comm) === true
) {
$comments_array[] = json_decode(io_safe_output($comm), true);
}
} else {
$comments = str_replace(["\n", '&#x0a;'], '<br>', $comments);
// If comments are not stored in json, the format is old.
$comments_array[] = json_decode(io_safe_output($comments), true);
}
foreach ($comments_array as $comm) {
// Show the comments more recent first.
if (is_array($comm)) {
$comm = array_reverse($comm);
}
if (empty($comm)) {
$comments_format = 'old';
} else {
$comments_format = 'new';
}
switch ($comments_format) {
case 'new':
foreach ($comm as $c) {
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
$data[1] = '<p style="word-break: break-word;">'.$c['comment'].'</p>';
$table_comments->data[] = $data;
}
}
break;
break;
case 'old':
$comm = explode('<br>', $comments);
case 'old':
$comm = explode('<br>', $comments);
// Split comments and put in table.
$col = 0;
$data = [];
foreach ($comm as $c) {
switch ($col) {
case 0:
$row_text = preg_replace('/\s*--\s*/', '', $c);
$row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
$row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
$row_text = preg_replace('/[\[|\]]/', '', $row_text);
break;
case 1:
$row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
break;
default:
// Ignore.
break;
}
$data[$col] = $row_text;
$col++;
if ($col == 2) {
$col = 0;
$table_comments->data[] = $data;
$data = [];
}
}
if (count($comm) == 1 && $comm[0] == '') {
$table_comments->style[0] = 'text-align:center;';
$table_comments->colspan[0][0] = 2;
// Split comments and put in table.
$col = 0;
$data = [];
$data[0] = __('There are no comments');
$table_comments->data[] = $data;
}
break;
default:
// Ignore.
break;
foreach ($comm as $c) {
switch ($col) {
case 0:
$row_text = preg_replace('/\s*--\s*/', '', $c);
$row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
$row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
$row_text = preg_replace('/[\[|\]]/', '', $row_text);
break;
case 1:
$row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
break;
default:
// Ignore.
break;
}
$data[$col] = $row_text;
$col++;
if ($col == 2) {
$col = 0;
$table_comments->data[] = $data;
$data = [];
}
}
break;
default:
// Ignore.
break;
}
}
}

View File

@ -5744,7 +5744,7 @@ function ui_print_comments($comments)
continue;
}
$comments_array[] = json_decode(io_safe_output($comm), true);
$comments_array[] = io_safe_output(json_decode($comm, true));
}
}

View File

@ -6,15 +6,8 @@
overflow: hidden;
}
#welcome_modal_window {
/*
max-height: 100%;
height: 100%;
border-left: 1em solid #82b92f;
margin-bottom: -59px;
padding-bottom: 100px;
margin-left: -1px;
*/
#welcome_modal_window * {
font-size: 10pt;
}
#welcome_form ul.wizard > li {
@ -86,7 +79,7 @@
border-left: 4px solid #79a930;
}
#welcome_form li:not(.centered_full):not(.white_box).grey {
#welcome_form li:not(.centered_full):not(.white_box).row_grey {
border-left: 4px solid #d6d6d6;
}

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.740';
$build = '191113';
$build = '191119';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.740
%define release 191113
%define release 191119
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.740
%define release 191113
%define release 191119
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.740
%define release 191113
%define release 191119
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.740-191113
Version: 7.0NG.740-191119
Architecture: all
Priority: optional
Section: admin

View File

@ -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-191119"
package_cpan=0
package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.740";
my $pandora_build = "191113";
my $pandora_build = "191119";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.740";
my $pandora_build = "191113";
my $pandora_build = "191119";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.740
%define release 191113
%define release 191119
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.740
%define release 191113
%define release 191119
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.740"
PI_BUILD="191113"
PI_BUILD="191119"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -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 PS191119";
# Pandora server configuration
my %conf;

View File

@ -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 PS191119";
# save program name for logging
my $progname = basename($0);
@ -118,22 +118,13 @@ sub help_screen{
help_screen_line('--get_planned_downtimes_items', '<name> [<id_group> <type_downtime> <type_execution> <type_periodicity>]', 'Get all items of planned downtimes');
help_screen_line('--set_planned_downtimes_deleted', '<name> ', 'Deleted a planned downtime');
help_screen_line('--get_module_id', '<agent_id> <module_name>', 'Get the id of an module');
<<<<<<< HEAD
help_screen_line('--get_agent_group', '<agent_name>', 'Get the group name of an agent');
help_screen_line('--get_agent_group_id', '<agent_name>', 'Get the group ID of an agent');
help_screen_line('--get_agent_modules', '<agent_name>', 'Get the modules of an agent');
help_screen_line('--get_agents_id_name_by_alias', '<agent_alias>', '[<strict>]', 'List id and alias of agents mathing given alias');
help_screen_line('--get_agents', '[<group_name> <os_name> <status> <max_modules> <filter_substring> <policy_name>]', "Get \n\t list of agents with optative filter parameters");
help_screen_line('--delete_conf_file', '<agent_name>', 'Delete a local conf of a given agent');
help_screen_line('--clean_conf_file', '<agent_name>', "Clean a local conf of a given agent deleting all modules, \n\t policies, file collections and comments");
=======
help_screen_line('--get_agent_group', '<agent_name> [<use_alias>]', 'Get the group name of an agent');
help_screen_line('--get_agent_group_id', '<agent_name> [<use_alias>]', 'Get the group ID of an agent');
help_screen_line('--get_agent_modules', '<agent_name> [<use_alias>]', 'Get the modules of an agent');
help_screen_line('--get_agents_id_name_by_alias', '<agent_alias>', '[<strict>]', 'List id and alias of agents mathing given alias');
help_screen_line('--get_agents', '[<group_name> <os_name> <status> <max_modules> <filter_substring> <policy_name> <use_alias>]', "Get \n\t list of agents with optative filter parameters");
help_screen_line('--delete_conf_file', '<agent_name> [<use_alias>]', 'Delete a local conf of a given agent');
help_screen_line('--clean_conf_file', '<agent_name> [<use_alias>]', "Clean a local conf of a given agent deleting all modules, \n\t policies, file collections and comments");
>>>>>>> origin/develop
help_screen_line('--get_bad_conf_files', '', 'Get the files bad configured (without essential tokens)');
help_screen_line('--locate_agent', '<agent_name> [<use_alias>]', 'Search a agent into of nodes of metaconsole. Only Enterprise.');
help_screen_line('--migration_agent_queue', '<id_node> <source_node_name> <target_node_name> [<db_only>]', 'Migrate agent only metaconsole');
@ -4095,9 +4086,6 @@ sub cli_create_event() {
$id_alert_agent_module = 0;
}
if (defined($comment) && $comment ne '') {
$comment = '<b>-- Added comment by '.$user_name. ' ['. localtime(time).'] --</b><br>'.$comment.'<br>';
}
print_log "[INFO] Adding event '$event' for agent '$agent_name' \n\n";
# Base64 encode custom data
@ -4148,9 +4136,6 @@ sub cli_create_event() {
$id_alert_agent_module = 0;
}
if (defined($comment) && $comment ne '') {
$comment = '<b>-- Added comment by '.$user_name. ' ['. localtime(time).'] --</b><br>'.$comment.'<br>';
}
print_log "[INFO] Adding event '$event' for agent '$agent_name' \n\n";
# Base64 encode custom data