Merge branch 'develop' of https://brutus.artica.es:8081/artica/pandorafms into ent-5961-quitar-dependencia-obligatoria-perl-yaml-tiny-del-agente

This commit is contained in:
rafael 2020-08-11 12:29:29 +02:00
commit 1989a08c58
46 changed files with 412 additions and 137 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.748-200804
Version: 7.0NG.748-200811
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.748-200804"
pandora_version="7.0NG.748-200811"
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

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.748';
use constant AGENT_BUILD => '200804';
use constant AGENT_BUILD => '200811';
# 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.748
%define release 200804
%define release 200811
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.748"
PI_BUILD="200804"
PI_BUILD="200811"
OS_NAME=`uname -s`
FORCE=0

View File

@ -56,6 +56,8 @@ my $Reg_exp = '';
# Flag to show or not summary module
my $summary_flag = 0;
my $nodatalist_flag = 0;
# Number of coincidences found
my $coincidences = 0;
@ -120,7 +122,15 @@ sub error_msg ($) {
# Print a help message.
###############################################################################
sub print_help () {
print "Usage: $0 <log_file> <module_name> <pattern> <up_lines_extra> <bot_lines_extra> [--summary]\n";
print "Usage: $0 <log_file> <module_name> <pattern> <up_lines_extra> <bot_lines_extra> [--summary] [--nodatalist]\n\n";
print "Options:\n";
print "\t<log_file>\t\tPath to the log file to be monitored\n";
print "\t<module_name>\t\tName of the module that will be created\n";
print "\t<pattern>\t\tRegex string to be matched in log file\n";
print "\t<up_lines_extra>\tShows NUM lines before matching lines to provide context\n";
print "\t<bot_lines_extra>\tShows NUM lines after matching lines to provide context\n";
print "\t--summary\t\tCreates a module with the total number of matches\n";
print "\t--nodatalist\t\tInserts all coincidences in a single data output instead of a data per line\n";
}
###############################################################################
@ -317,6 +327,7 @@ sub print_log ($) {
if ($#kdata < 0) {
print_summary() if ($summary_flag == 1);
return;
}
# Log module
@ -341,6 +352,18 @@ sub print_log ($) {
$output = "<module>\n";
$output .= "<name><![CDATA[" . $Module_name . "]]></name>\n";
$output .= "<type><![CDATA[async_string]]></type>\n";
if ($nodatalist_flag == 1){
$output .= "<data><![CDATA[";
foreach my $line (@kdata) {
foreach my $content (@{$data->{$line}}) {
my $processed_line = $content;
$processed_line =~ "\n";
$output .= $processed_line;
}
}
$output .= "]]></data>\n";
}
else {
$output .= "<datalist>\n";
foreach my $line (@kdata) {
$output .= "<data><value><![CDATA[";
@ -352,10 +375,12 @@ sub print_log ($) {
$output .= "]]></value></data>\n";
}
$output .= "</datalist>\n";
}
$output .= "</module>\n";
print stdout $output;
}
}
###############################################################################
@ -376,12 +401,18 @@ $Reg_exp = trim($ARGV[2]);
my $up_lines = trim($ARGV[3]);
my $bot_lines = trim($ARGV[4]);
my $sum_flag = trim($ARGV[5]);
my $nodatalist = trim($ARGV[6]);
if ( ( defined($up_lines) && ($up_lines eq "--summary"))
|| ( defined($bot_lines) && ($bot_lines eq "--summary"))
|| ( defined($sum_flag) && ($sum_flag eq "--summary")) ) {
if ( grep { /--summary/ } @ARGV )
{
$summary_flag = 1;
}
if ( grep { /--nodatalist/ } @ARGV )
{
$nodatalist_flag = 1;
}
# Create index file storage directory
if ( ! -d $Idx_dir) {
mkdir($Idx_dir) || error_msg("Error creating directory $Idx_dir: "

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{200804}
{200811}
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.748(Build 200804)")
#define PANDORA_VERSION ("7.0NG.748(Build 200811)")
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.748(Build 200804))"
VALUE "ProductVersion", "(7.0NG.748(Build 200811))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -5,4 +5,3 @@ Options -Indexes
Order Allow,Deny
Deny from All
</Files>

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.748-200804
Version: 7.0NG.748-200811
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.748-200804"
pandora_version="7.0NG.748-200811"
package_pear=0
package_pandora=1

View File

@ -7,5 +7,3 @@
Deny from all
Allow from localhost
</FilesMatch>
php_flag engine off

View File

@ -165,7 +165,12 @@ if (check_login()) {
break;
case 'monitorcheckmodal':
echo __('This system has too many modules per agent. OpenSource version could manage thousands of modules, but is not recommended to have more than 40 modules per agent. This configuration has B/A modules per agent. Checkout the Enterprise Version for a professional supported system.');
// Get agent/module average.
$agentCount = db_get_value_sql('SELECT count(*) FROM tagente');
$modulesCount = db_get_value_sql('SELECT count(*) FROM tagente_modulo');
$average = ($modulesCount / $agentCount);
echo __('This system has too many modules per agent. OpenSource version could manage thousands of modules, but is not recommended to have more than 100 modules per agent. This configuration has %d modules per agent. Checkout the Enterprise Version for a professional supported system.', $average);
break;
case 'remotemodulesmodal':

View File

@ -24,7 +24,16 @@ require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_servers.php';
$search_string = io_safe_output(urldecode(trim(get_parameter('search_string', ''))));
$search_string = io_safe_output(
urldecode(
trim(
get_parameter(
'search_string',
''
)
)
)
);
global $policy_page;
@ -32,17 +41,27 @@ if (!isset($policy_page)) {
$policy_page = false;
}
// Search string filter form
echo '<form id="create_module_type" method="post" action="'.$url.'">';
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
echo __('Search').' '.html_print_input_text(
'search_string',
$search_string,
'',
15,
255,
true
);
html_print_input_hidden('search', 1);
// Search string filter form.
if (($policy_page) || (isset($agent))) {
echo '<form id="" method="post" action="">';
} else {
echo '<form id="create_module_type" method="post" action="'.$url.'">';
}
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
echo __('Search').' '.html_print_input_text('search_string', $search_string, '', 15, 255, true);
html_print_input_hidden('search', 1);
echo '</td>';
echo "<td class='datos' style='width:10%'>";
html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"');
@ -50,38 +69,38 @@ echo '</td>';
echo "<td class='datos' style='width:10%'></td>";
echo '</form>';
// Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo
// kind of modules. If not, do not show server type in combo.
$network_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = 1'
);
// POSTGRESQL AND ORACLE COMPATIBLE
// POSTGRESQL AND ORACLE COMPATIBLE.
$wmi_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = 6'
);
// POSTGRESQL AND ORACLE COMPATIBLE
// POSTGRESQL AND ORACLE COMPATIBLE.
$plugin_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = 4'
);
// POSTGRESQL AND ORACLE COMPATIBLE
// POSTGRESQL AND ORACLE COMPATIBLE.
$prediction_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = 5'
);
// POSTGRESQL AND ORACLE COMPATIBLE
// Development mode to use all servers
// POSTGRESQL AND ORACLE COMPATIBLE.
// Development mode to use all servers.
if ($develop_bypass || is_metaconsole()) {
$network_available = 1;
$wmi_available = 1;
$plugin_available = 1;
// FIXME when prediction predictions server modules can be configured
// on metaconsole
// FIXME when prediction predictions server modules can be configured.
// on metaconsole.
$prediction_available = is_metaconsole() ? 0 : 1;
}
@ -140,7 +159,7 @@ if (($policy_page) || (isset($agent))) {
}
if ($show_creation) {
// Create module/type combo
// Create module/type combo.
echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) {
echo '<td class="datos" style="font-weight: bold; width:20%;">';
@ -151,13 +170,33 @@ if (($policy_page) || (isset($agent))) {
$checked = false;
}
html_print_checkbox('status_hierachy_mode', '', $checked, false, false, 'onChange=change_mod_filter();');
html_print_checkbox(
'status_hierachy_mode',
'',
$checked,
false,
false,
'onChange=change_mod_filter();'
);
echo '</td>';
}
echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __('<p>Type</p>');
html_print_select($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;');
html_print_select(
$modules,
'moduletype',
'',
'',
'',
'',
false,
false,
false,
'',
false,
'max-width:300px;'
);
html_print_input_hidden('edit_module', 1);
echo '</td>';
echo '<td class="datos" style="width:10%;">';
@ -212,7 +251,13 @@ if ($multiple_delete) {
}
enterprise_include_once('include/functions_config_agents.php');
enterprise_hook('config_agents_delete_module_in_conf', [modules_get_agentmodule_agent($id_agent_module_del), modules_get_agentmodule_name($id_agent_module_del)]);
enterprise_hook(
'config_agents_delete_module_in_conf',
[
modules_get_agentmodule_agent($id_agent_module_del),
modules_get_agentmodule_name($id_agent_module_del),
]
);
$error = 0;
@ -220,7 +265,12 @@ if ($multiple_delete) {
// error. NOTICE that we don't delete all data here, just marking for deletion
// and delete some simple data.
$status = '';
$agent_id_of_module = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module_del);
$agent_id_of_module = db_get_value(
'id_agente',
'tagente_modulo',
'id_agente_modulo',
(int) $id_agent_module_del
);
if (db_process_sql(
"UPDATE tagente_modulo
@ -235,7 +285,7 @@ if ($multiple_delete) {
) {
$error++;
} else {
// Set flag to update module status count
// Set flag to update module status count.
if ($agent_id_of_module !== false) {
db_process_sql(
'UPDATE tagente
@ -286,32 +336,48 @@ if ($multiple_delete) {
break;
}
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
// If result is empty then module doesn't have this type of submodules
$ops_json = enterprise_hook('modules_get_synthetic_operations', [$id_agent_module_del]);
// Trick to detect if we are deleting a synthetic module (avg or arithmetic).
// If result is empty then module doesn't have this type of submodules.
$ops_json = enterprise_hook(
'modules_get_synthetic_operations',
[$id_agent_module_del]
);
$result_ops_synthetic = json_decode($ops_json);
if (!empty($result_ops_synthetic)) {
$result = enterprise_hook('modules_delete_synthetic_operations', [$id_agent_module_del]);
$result = enterprise_hook(
'modules_delete_synthetic_operations',
[$id_agent_module_del]
);
if ($result === false) {
$error++;
}
} //end if
else {
$result_components = enterprise_hook('modules_get_synthetic_components', [$id_agent_module_del]);
} else {
$result_components = enterprise_hook(
'modules_get_synthetic_components',
[$id_agent_module_del]
);
$count_components = 1;
if (!empty($result_components)) {
// Get number of components pending to delete to know when it's needed to update orders
// Get number of components pending to delete to know when it's needed to update orders.
$num_components = count($result_components);
$last_target_module = 0;
foreach ($result_components as $id_target_module) {
// Detects change of component or last component to update orders
if (($count_components == $num_components) or ($last_target_module != $id_target_module)) {
// Detects change of component or last component to update orders.
if (($count_components == $num_components) || ($last_target_module != $id_target_module)
) {
$update_orders = true;
} else {
$update_orders = false;
}
$result = enterprise_hook('modules_delete_synthetic_operations', [$id_target_module, $id_agent_module_del, $update_orders]);
$result = enterprise_hook(
'modules_delete_synthetic_operations',
[
$id_target_module,
$id_agent_module_del,
$update_orders,
]
);
if ($result === false) {
$error++;
}
@ -323,7 +389,7 @@ if ($multiple_delete) {
}
// Check for errors
// Check for errors.
if ($error != 0) {
} else {
$count_correct_delete_modules++;
@ -509,7 +575,7 @@ switch ($sortField) {
}
// Build the order sql
// Build the order sql.
if (!empty($order)) {
$order_sql = ' ORDER BY ';
}
@ -525,7 +591,7 @@ foreach ($order as $ord) {
$order_sql .= $ord['field'].' '.$ord['order'];
}
// Get limit and offset parameters
// Get limit and offset parameters.
$limit = (int) $config['block_size'];
$offset = (int) get_parameter('offset');
@ -559,9 +625,15 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
$search_string_entities = io_safe_input($search_string);
$basic_where = sprintf("(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities);
$basic_where = sprintf(
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
$search_string,
$search_string_entities,
$search_string,
$search_string_entities
);
// Tags acl
// Tags acl.
$agent_tags = tags_get_user_applied_agent_tags($id_agente);
if ($agent_tags !== true) {
$where_tags = ' AND ttag_module.id_tag IN ('.implode(',', $agent_tags).')';
@ -619,7 +691,7 @@ if ($modules === false) {
return;
}
// Prepare pagination
// Prepare pagination.
$url = '?'.'sec=gagente&'.'tab=module&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$id_agente.'&'.'sort_field='.$sortField.'&'.'&sort='.$sort.'&'.'search_string='.urlencode($search_string);
if ($paginate_module) {
@ -635,17 +707,48 @@ $table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->head = [];
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
$table->head[0] = __('Name').ui_get_sorting_arrows($url_name.'up', $url_name.'down', $selectNameUp, $selectNameDown);
$table->head['checkbox'] = html_print_checkbox(
'all_delete',
0,
false,
true,
false
);
$table->head[0] = __('Name').ui_get_sorting_arrows(
$url_name.'up',
$url_name.'down',
$selectNameUp,
$selectNameDown
);
// The access to the policy is granted only with AW permission
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
// The access to the policy is granted only with AW permission.
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl(
$config['id_user'],
$agent['id_grupo'],
'AW'
)
) {
$table->head[1] = "<span title='".__('Policy')."'>".__('P.').'</span>';
}
$table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows($url_server.'up', $url_server.'down', $selectServerUp, $selectServerDown);
$table->head[3] = __('Type').ui_get_sorting_arrows($url_type.'up', $url_type.'down', $selectTypeUp, $selectTypeDown);
$table->head[4] = __('Interval').ui_get_sorting_arrows($url_interval.'up', $url_interval.'down', $selectIntervalUp, $selectIntervalDown);
$table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows(
$url_server.'up',
$url_server.'down',
$selectServerUp,
$selectServerDown
);
$table->head[3] = __('Type').ui_get_sorting_arrows(
$url_type.'up',
$url_type.'down',
$selectTypeUp,
$selectTypeDown
);
$table->head[4] = __('Interval').ui_get_sorting_arrows(
$url_interval.'up',
$url_interval.'down',
$selectIntervalUp,
$selectIntervalDown
);
$table->head[5] = __('Description');
$table->head[6] = __('Status');
$table->head[7] = __('Warn');
@ -690,7 +793,16 @@ if ($checked) {
}
foreach ($modules as $module) {
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && ! check_acl_one_of_groups($config['id_user'], $all_groups, 'AD')) {
if (! check_acl_one_of_groups(
$config['id_user'],
$all_groups,
'AW'
) && ! check_acl_one_of_groups(
$config['id_user'],
$all_groups,
'AD'
)
) {
continue;
}
@ -712,7 +824,9 @@ foreach ($modules as $module) {
if (!$checked) {
if ($module['id_module_group'] != $last_modulegroup) {
$last_modulegroup = $module['id_module_group'];
$data[0] = '<strong>'.modules_get_modulegroup_name($last_modulegroup).'</strong>';
$data[0] = '<strong>'.modules_get_modulegroup_name(
$last_modulegroup
).'</strong>';
$i = array_push($table->data, $data);
$table->rowstyle[($i - 1)] = 'text-align: center';
$table->rowclass[($i - 1)] = 'datos3';
@ -727,14 +841,23 @@ foreach ($modules as $module) {
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$data['checkbox'] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
$data['checkbox'] = html_print_checkbox(
'id_delete[]',
$module['id_agente_modulo'],
false,
true
);
}
$data[0] = '';
if (isset($module['deep']) && ($module['deep'] != 0)) {
$data[0] .= str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $module['deep']);
$data[0] .= html_print_image('images/icono_escuadra.png', true, ['style' => 'padding-bottom: inherit;']).'&nbsp;&nbsp;';
$data[0] .= html_print_image(
'images/icono_escuadra.png',
true,
['style' => 'padding-bottom: inherit;']
).'&nbsp;&nbsp;';
}
if ($module['quiet']) {
@ -754,17 +877,38 @@ foreach ($modules as $module) {
}
if ($module['disabled']) {
$data[0] .= '<em class="disabled_module">'.ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[&hellip;]', 'font-size: 7.2pt').'</em>';
$data[0] .= '<em class="disabled_module">'.ui_print_truncate_text(
$module['nombre'],
'module_medium',
false,
true,
true,
'[&hellip;]',
'font-size: 7.2pt'
).'</em>';
} else {
$data[0] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[&hellip;]', 'font-size: 7.2pt');
$data[0] .= ui_print_truncate_text(
$module['nombre'],
'module_medium',
false,
true,
true,
'[&hellip;]',
'font-size: 7.2pt'
);
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$data[0] .= '</a>';
}
// The access to the policy is granted only with AW permission
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
// The access to the policy is granted only with AW permission.
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl(
$config['id_user'],
$agent['id_grupo'],
'AW'
)
) {
$policyInfo = policies_info_module_policy($module['id_agente_modulo']);
if ($policyInfo === false) {
$data[1] = '';
@ -798,17 +942,27 @@ foreach ($modules as $module) {
}
}
// Module type (by server type )
// Module type (by server type ).
$data[2] = '';
if ($module['id_modulo'] > 0) {
$data[2] = servers_show_type($module['id_modulo']);
}
$module_status = db_get_row('tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
$module_status = db_get_row(
'tagente_estado',
'id_agente_modulo',
$module['id_agente_modulo']
);
modules_get_status($module['id_agente_modulo'], $module_status['estado'], $module_status['datos'], $status, $title);
modules_get_status(
$module['id_agente_modulo'],
$module_status['estado'],
$module_status['datos'],
$status,
$title
);
// This module is initialized ? (has real data)
// This module is initialized ? (has real data).
if ($status == STATUS_MODULE_NO_DATA) {
$data[2] .= html_print_image(
'images/error.png',
@ -817,13 +971,13 @@ foreach ($modules as $module) {
);
}
// Module type (by data type)
// Module type (by data type).
$data[3] = '';
if ($type) {
$data[3] = ui_print_moduletype_icon($type, true);
}
// Module interval
// Module interval.
if ($module['module_interval']) {
$data[4] = human_time_description_raw($module['module_interval']);
} else {
@ -831,12 +985,23 @@ foreach ($modules as $module) {
}
if ($module['id_modulo'] == MODULE_DATA && $module['id_policy_module'] != 0) {
$data[4] .= ui_print_help_tip(__('The policy modules of data type will only update their intervals when policy is applied.'), true);
$data[4] .= ui_print_help_tip(
__('The policy modules of data type will only update their intervals when policy is applied.'),
true
);
}
$data[5] = ui_print_truncate_text($module['descripcion'], 'description', false);
$data[5] = ui_print_truncate_text(
$module['descripcion'],
'description',
false
);
$data[6] = ui_print_status_image($status, htmlspecialchars($title), true);
$data[6] = ui_print_status_image(
$status,
htmlspecialchars($title),
true
);
// MAX / MIN values.
if ($module['id_tipo_modulo'] != 25) {
@ -884,7 +1049,7 @@ foreach ($modules as $module) {
);
$data[8] .= '</a> ';
// Make a data normalization
// Make a data normalization.
if (isset($numericModules[$type])) {
if ($numericModules[$type] === true) {
$data[8] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
@ -904,7 +1069,7 @@ foreach ($modules as $module) {
$data[8] .= '&nbsp;&nbsp;';
}
// create network component action
// Create network component action.
if ((is_user_admin($config['id_user']))
&& ($module['id_modulo'] == MODULE_NETWORK)
) {
@ -927,7 +1092,7 @@ foreach ($modules as $module) {
}
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
// Delete module
// Delete module.
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
$data[9] .= html_print_image(
@ -959,7 +1124,12 @@ html_print_table($table);
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_input_hidden('multiple_delete', 1);
html_print_submit_button(__('Delete'), 'multiple_delete', false, 'class="sub delete"');
html_print_submit_button(
__('Delete'),
'multiple_delete',
false,
'class="sub delete"'
);
echo '</div>';
echo '</form>';
}

View File

@ -464,6 +464,8 @@ $data[1] = html_print_select(
$disabledBecauseInPolicy
);
$data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>';
$array_os = [
'inherited' => __('Inherited'),
'linux' => __('SSH'),

View File

@ -60,7 +60,7 @@ if ($al_action !== false) {
__('Alerts').' &raquo; '.__('Configure alert action'),
'images/gm_alerts.png',
false,
'',
'alert_config',
true
);
}
@ -73,7 +73,7 @@ if ($al_action !== false) {
__('Alerts').' &raquo; '.__('Configure alert action'),
'images/gm_alerts.png',
false,
'',
'alert_config',
true
);
}
@ -283,12 +283,12 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
// Store the value in a hidden to keep it on first execution
$table->data['field'.$i][1] .= html_print_input_hidden(
'field'.$i.'_value',
!empty($action['field'.$i]) ? $action['field'.$i] : '',
(!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '',
true
);
$table->data['field'.$i][2] .= html_print_input_hidden(
'field'.$i.'_recovery_value',
!empty($action['field'.$i.'_recovery']) ? $action['field'.$i.'_recovery'] : '',
(!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '',
true
);
}

View File

@ -35,12 +35,15 @@ global $config;
check_login();
enterprise_hook('open_meta_frame');
require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_users.php';
if (is_metaconsole()) {
enterprise_include_once('include/functions_metaconsole.php');
enterprise_include_once('meta/include/functions_agents_meta.php');
enterprise_hook('open_meta_frame');
}
if (is_ajax()) {
if (! check_acl($config['id_user'], 0, 'AR')) {
@ -714,7 +717,12 @@ if ($tab == 'tree') {
foreach ($groups as $key => $group) {
$url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
if (is_metaconsole()) {
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'].'&tab=groups';
} else {
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
}
$table->data[$key][0] = $group['id_grupo'];
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
if ($group['icon'] != '') {

View File

@ -164,9 +164,9 @@ echo '</div></td></tr>';
echo "<tr><td class='datos2'><b>".__('Percentil').'</b></td>';
echo "<td class='datos2'>".html_print_checkbox('percentil', 1, $percentil, true).'</td>';
echo "<td class='datos2'><div id='thresholdDiv' name='thresholdDiv'><b>".__('Equalize maximum thresholds').'</b>';
html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false);
echo '</div></td></tr>';
echo "<td class='datos2 thresholdDiv'><b>".__('Equalize maximum thresholds').'</b></td>';
echo "<td class='datos2 thresholdDiv'>".html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, true, false, '', false);
echo '</td></tr>';
echo "<tr><td class='datos2'><b>".__('Add summatory series').'</b></td>';
echo "<td class='datos2'>".html_print_checkbox('summatory_series', 1, $summatory_series, true)."</td>
<td class='datos2'><b>".__('Add average series').'</b></td>';
@ -175,6 +175,7 @@ echo "<tr><td class='datos2'><b>".__('Modules and series').'</b></td>';
echo "<td class='datos2'>".html_print_checkbox('modules_series', 1, $modules_series, true).'</td>';
echo "<td class='datos2'><b>".__('Show full scale graph (TIP)').'</td>';
echo "<td class='datos2'>".html_print_checkbox('fullscale', 1, $fullscale, true).'</td>';
echo '</tr>';
echo '</table>';
@ -190,9 +191,9 @@ echo '</form>';
echo '<script type="text/javascript">
$(document).ready(function() {
if ($("#stacked").val() == '.CUSTOM_GRAPH_BULLET_CHART.') {
$("#thresholdDiv").show();
$(".thresholdDiv").show();
}else{
$("#thresholdDiv").hide();
$(".thresholdDiv").hide();
}
if(!$("#checkbox-summatory_series").is(":checked") && !$("#checkbox-average_series").is(":checked")){
@ -207,16 +208,16 @@ echo '<script type="text/javascript">
$("[name=threshold]").prop("checked", false);
$(".stacked").hide();
$("input[name=\'width\']").hide();
$("#thresholdDiv").hide();
$(".thresholdDiv").hide();
} else if ($(this).val() == '.CUSTOM_GRAPH_BULLET_CHART.') {
$("#thresholdDiv").show();
$(".thresholdDiv").show();
$(".stacked").show();
$("input[name=\'width\']").show();
} else {
$("[name=threshold]").prop("checked", false);
$(".stacked").show();
$("input[name=\'width\']").show();
$("#thresholdDiv").hide();
$(".thresholdDiv").hide();
}
});

View File

@ -170,6 +170,7 @@ if ($schedule_report != '') {
$parameters[4] = get_parameter('report_type', '');
$parameters['first_execution'] = strtotime($date.' '.$time);
$values = [
'id_usuario' => $config['id_user'],
'id_user_task' => $id_user_task,
@ -180,9 +181,11 @@ if ($schedule_report != '') {
$result = db_process_sql_insert('tuser_task_scheduled', $values);
$report_type = $parameters[4];
ui_print_result_message(
$result,
__('Your report has been planned, and the system will email you a PDF with the report as soon as its finished'),
__('Your report has been planned, and the system will email you a '.$report_type.' file with the report as soon as its finished'),
__('An error has ocurred')
);
echo '<br>';

View File

@ -1,5 +1,4 @@
#pandora disable phpexec
<Files *.php>
<FilesMatch "\.(php)$">
Deny from all
</Files>
php_flag engine off
</FilesMatch>

View File

@ -25,7 +25,7 @@ if (is_ajax()) {
$method = (string) get_parameter('method', '');
$action = (string) get_parameter('action', '');
$target_ip = (string) get_parameter('target_ip', '');
$community = (string) get_parameter('community', '');
$community = (string) io_safe_output((get_parameter('community', '')));
$snmp_version = (string) get_parameter('snmp_browser_version', '');
$snmp3_auth_user = io_safe_output(get_parameter('snmp3_browser_auth_user'));
$snmp3_security_level = get_parameter('snmp3_browser_security_level');

View File

@ -3001,6 +3001,8 @@ class AgentWizard extends HTML
$module['name']
);
$newModule['name_oid'] = str_replace('"', '', $tmpSecond[3]);
// Add this new module to the module list.
$moduleBlocks[] = $newModule;
}

View File

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

View File

@ -3209,7 +3209,7 @@ function get_refresh_time_array()
}
function date2strftime_format($date_format)
function date2strftime_format($date_format, $timestamp=null)
{
$replaces_list = [
'D' => '%a',
@ -3232,11 +3232,14 @@ function date2strftime_format($date_format)
'A' => '%p',
'i' => '%M',
's' => '%S',
'u' => '%s',
'O' => '%z',
'T' => '%Z',
'%' => '%%',
'G' => '%k',
'z' => '%j',
'U' => '%s',
'c' => '%FT%T%z',
'r' => '%d %b %Y %H:%M:%S %z',
];
$return = '';
@ -3249,7 +3252,30 @@ function date2strftime_format($date_format)
if (isset($replaces_list[$c])) {
$return .= $replaces_list[$c];
} else {
$return .= $c;
// Check extra formats.
switch ($date_format) {
default: $return .= date($date_format, $timestamp);
break;
case 'n':
if (stristr(PHP_OS, 'win')) {
$return .= '%#m';
} else {
$return .= '%-m';
}
case 'u':
if (preg_match('/^[0-9]*\\.([0-9]+)$/', $timestamp, $reg)) {
$decimal = substr(str_pad($reg[1], 6, '0'), 0, 6);
} else {
$decimal = '000000';
}
$return .= $decimal;
break;
break;
}
}
}

View File

@ -728,7 +728,7 @@ function notifications_print_source_select_box(
"
<div class='global-config-notification-single-selector'>
<div>
<h4>%s</h4>
<h5>%s</h5>
%s
</div>
<div class='global-notifications-icons'>

View File

@ -273,7 +273,7 @@ function snmp_browser_get_tree(
break;
case '2':
$snmp_version = SNMP::VERSION_2c;
$snmp_version = SNMP::VERSION_2C;
break;
case '2c':
@ -286,7 +286,7 @@ function snmp_browser_get_tree(
break;
default:
$snmp_version = SNMP::VERSION_2c;
$snmp_version = SNMP::VERSION_2C;
break;
}
@ -421,6 +421,10 @@ function snmp_browser_get_oid(
return;
}
if ($version == '2') {
$version = '2c';
}
$output = get_snmpwalk(
$target_ip,
$version,

View File

@ -541,8 +541,9 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
pandora_setlocale();
$title = human_time_comparation($unixtime);
$strf_format = date2strftime_format($config['date_format'], $unixtime);
$data = strftime(
date2strftime_format($config['date_format']),
$strf_format,
$unixtime
);
} else if ($prominent == 'compact') {

View File

@ -183,7 +183,9 @@ class SystemGroupStatusWidget extends Widget
$values = parent::decoders($decoder);
if (isset($decoder['status']) === true) {
if (is_array($decoder['status']) === true) {
if (is_array($decoder['status']) === true
&& count($decoder['status']) > 1
) {
$compatibilityStatus = [];
foreach ($decoder['status'] as $key => $value) {
switch ((int) $value) {

View File

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

View File

@ -150,7 +150,7 @@ $sort = get_parameter('sort', 'up');
$modules_not_init = agents_monitor_notinit($id_agente);
if (empty($modules_not_init) === false) {
$help_not_init = ui_print_warning_message(
__('No initialized modules found.')
__('Non-initialized modules found.')
);
} else {
$help_not_init = '';

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.748
%define release 200804
%define release 200811
# 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.748
%define release 200804
%define release 200811
# 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.748
%define release 200804
%define release 200811
%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.748-200804
Version: 7.0NG.748-200811
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.748-200804"
pandora_version="7.0NG.748-200811"
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.748";
my $pandora_build = "200804";
my $pandora_build = "200811";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

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

View File

@ -203,11 +203,30 @@ sub data_consumer ($$) {
my @row = split(/\|/, $output[2]);
# Get the specified column
$module_data = $row[$module->{'tcp_port'}] if (defined ($module->{'tcp_port'}) && defined ($row[$module->{'tcp_port'}]));
if (defined ($module->{'tcp_port'})) {
$wmi_query =~ m/SELECT\s(.+)\sFROM/ig;
my @wmi_columns = split /\s*,\s*/, $1;
my $selected_col = $wmi_columns[$module->{'tcp_port'}];
# Get result col number
my @output_col = split(/\|/, $output[1]);
# Find column number
my $col_number;
for(my $i = 0; $i < @output_col; $i++ ) {
if( $output_col[$i] =~ /$selected_col/ ) {
$col_number = $i;
last;
}
}
$module_data = $row[$col_number] if (defined ($col_number) && defined ($row[$col_number]));
if ($module_data =~ m/^ERROR/) {
pandora_update_module_on_error ($pa_config, $module, $dbh);
return;
}
}
# Regexp
if ($module->{'snmp_community'} ne ''){

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.748 PS200804";
my $version = "7.0NG.748 PS200811";
# 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.748 PS200804";
my $version = "7.0NG.748 PS200811";
# save program name for logging
my $progname = basename($0);
@ -1129,8 +1129,13 @@ sub cli_create_agent() {
exist_check($id_group,'operating system',$group_name);
my $agent_exists = get_agent_id($dbh,$agent_name);
non_exist_check($agent_exists, 'agent name', $agent_name);
pandora_create_agent ($conf, $server_name, $agent_name, $address, $id_group, 0, $os_id, $description, $interval, $dbh,
my $agent_id = pandora_create_agent ($conf, $server_name, $agent_name, $address, $id_group, 0, $os_id, $description, $interval, $dbh,
undef, undef, undef, undef, undef, undef, undef, undef, $agent_alias);
# Create address for this agent in taddress.
if (defined($address)) {
pandora_add_agent_address($conf, $agent_id, $agent_name, $address, $dbh);
}
}
##############################################################################