Merge remote-tracking branch 'origin/develop' into ent-9174-nuevo-evento-pandora_db-del-sistema

This commit is contained in:
Ramon Novoa 2022-07-04 17:15:33 +02:00
commit c703c1995c
41 changed files with 844 additions and 242 deletions

View File

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

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.763"
PI_BUILD="220630"
PI_BUILD="220704"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -45,7 +45,7 @@ if ($default != 0) {
'token' => 'event_fields',
'value' => $event_fields,
];
// update 'event_fields' in tconfig table to keep the value at update.
// Update 'event_fields' in tconfig table to keep the value at update.
$result = db_process_sql_update(
'tconfig',
$values,
@ -147,7 +147,7 @@ $table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
$table->data[0][1] = '';
$table->data[0][2] = '<b>'.__('Fields selected').'</b>';
$table->data[1][2] = html_print_select(
$table->data[1][2] = '<div class="flex_justify">'.html_print_select(
$result_selected,
'fields_selected[]',
true,
@ -162,6 +162,25 @@ $table->data[1][2] = html_print_select(
'width: 300px'
);
$table->data[1][2] .= '<div id="sort_arrows" class="flex-column">';
$table->data[1][2] .= '<a href="javascript:">'.html_print_image(
'images/darrowup.png',
true,
[
'onclick' => 'sortUpDown(\'up\');',
'title' => __('Move up selected fields'),
]
).'</a>';
$table->data[1][2] .= '<a href="javascript:">'.html_print_image(
'images/darrowdown.png',
true,
[
'onclick' => 'sortUpDown(\'down\');',
'title' => __('Move down selected fields'),
]
).'</a>';
$table->data[1][2] .= '</div></div>';
echo '<form id="custom_events" method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=fields&amp;pure='.$config['pure'].'">';
html_print_table($table);
@ -174,7 +193,7 @@ echo '</div>';
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#right").click (function () {
jQuery.each($("select[name='fields_available[]'] option:selected"), function (key, value) {
field_name = $(value).html();
@ -186,9 +205,9 @@ $(document).ready (function () {
}
});
});
$("#left").click (function () {
var current_fields_size = ($('#fields_selected option').length);
var current_fields_size = ($('#fields_selected option').length);
var selected_fields = [];
var selected_fields_total = '';
@ -214,7 +233,7 @@ $(document).ready (function () {
move_left();
}
});
$("#submit-upd_button").click(function () {
$("#fields_selected").find("option[value='0']").remove();
$('#fields_selected option').map(function() {
@ -223,7 +242,7 @@ $(document).ready (function () {
});
});
function move_left(){
function move_left() {
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>) {
@ -234,4 +253,16 @@ function move_left(){
}
});
}
// Change the order (to up or down).
function sortUpDown(mode) {
$("#fields_selected option:selected").each(function() {
const field = $(this);
if (field.length) {
(mode === 'up') ? field.first().prev().before(field): field.last().next().after(field);
}
});
}
</script>

View File

@ -180,6 +180,9 @@ $uncompressed_module = true;
$macros_definition = '';
$render_definition = '';
$text_agent = '';
$text_agent_module = '';
$only_data = false;
// Users.
@ -678,6 +681,21 @@ switch ($action) {
$period = $item['period'];
$order_uptodown = $item['order_uptodown'];
$show_resume = $item['show_resume'];
$text_agent = '';
if (isset($style['text_agent']) === true
&& empty($style['text_agent']) === false
) {
$text_agent = base64_decode($style['text_agent']);
}
$text_agent_module = '';
if (isset($style['text_agent_module']) === true
&& empty($style['text_agent_module']) === false
) {
$text_agent_module = base64_decode($style['text_agent_module']);
}
break;
case 'availability':
@ -745,6 +763,21 @@ switch ($action) {
$show_resume = $item['show_resume'];
$show_graph = $item['show_graph'];
$order_uptodown = $item['order_uptodown'];
$text_agent = '';
if (isset($style['text_agent']) === true
&& empty($style['text_agent']) === false
) {
$text_agent = base64_decode($style['text_agent']);
}
$text_agent_module = '';
if (isset($style['text_agent_module']) === true
&& empty($style['text_agent_module']) === false
) {
$text_agent_module = base64_decode($style['text_agent_module']);
}
break;
case 'exception':
@ -755,6 +788,21 @@ switch ($action) {
$show_resume = $item['show_resume'];
$show_graph = $item['show_graph'];
$order_uptodown = $item['order_uptodown'];
$text_agent = '';
if (isset($style['text_agent']) === true
&& empty($style['text_agent']) === false
) {
$text_agent = base64_decode($style['text_agent']);
}
$text_agent_module = '';
if (isset($style['text_agent_module']) === true
&& empty($style['text_agent_module']) === false
) {
$text_agent_module = base64_decode($style['text_agent_module']);
}
break;
case 'agent_module':
@ -1093,6 +1141,52 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_agent_regexp" class="datos">
<td class="bolder">
<?php
echo __('Agent').ui_print_help_tip(
__('Case insensitive regular expression for agent name. For example: Network.* will match with the following agent names: network_agent1, NetworK CHECKS'),
true
);
?>
</td>
<td>
<?php
html_print_input_text(
'text_agent',
$text_agent,
'',
30,
100,
false
);
?>
</td>
</tr>
<tr id="row_module_regexp" class="datos">
<td class="bolder">
<?php
echo __('Module').ui_print_help_tip(
__('Case insensitive regular expression or string for module name. For example: if you use this field with "Module exact match" enabled then this field has to be fulfilled with the literally string of the module name, if not you can use a regular expression. Example: .*usage.* will match: cpu_usage, vram usage in matchine 1.'),
true
);
?>
</td>
<td class="mx180px">
<?php
html_print_input_text(
'text_agent_module',
$text_agent_module,
'',
30,
100,
false
);
?>
</td>
</tr>
<?php
if ($meta) {
?>
@ -5990,6 +6084,8 @@ function chooseType() {
$("#row_render_definition").hide();
$("#row_time_compare_overlapped").hide();
$("#row_quantity").hide();
$("#row_agent_regexp").hide();
$("#row_module_regexp").hide();
$("#row_exception_condition_value").hide();
$("#row_exception_condition").hide();
$("#row_dyn_height").hide();
@ -6480,6 +6576,8 @@ function chooseType() {
$("#row_order_uptodown").show();
$("#row_show_resume").show();
$("#row_show_in_same_row").show();
$("#row_agent_regexp").show();
$("#row_module_regexp").show();
var checked = $("input[name='last_value']").prop("checked");
@ -6548,6 +6646,8 @@ function chooseType() {
$("#row_description").show();
$("#row_period").show();
$("#row_max_min_avg").show();
$("#row_agent_regexp").show();
$("#row_module_regexp").show();
$("#row_quantity").show();
$("#general_list").show();
$("#row_order_uptodown").show();
@ -6565,6 +6665,8 @@ function chooseType() {
$("#row_order_uptodown").show();
$("#row_show_resume").show();
$("#row_show_graph").show();
$("#row_agent_regexp").show();
$("#row_module_regexp").show();
var checked = $("input[name='last_value']").prop("checked");

View File

@ -2321,6 +2321,20 @@ switch ($action) {
// $values['external_source'] = json_encode($es);
break;
case 'top_n':
case 'general':
case 'exception':
$text_agent = get_parameter('text_agent', '');
$text_agent_module = get_parameter('text_agent_module', '');
if (empty($text_agent) === false) {
$style['text_agent'] = base64_encode($text_agent);
}
if (empty($text_agent_module) === false) {
$style['text_agent_module'] = base64_encode($text_agent_module);
}
break;
default:
// Default.
break;
@ -3073,6 +3087,20 @@ switch ($action) {
$es['agent_not_assigned_to_ip'] = get_parameter('agent_not_assigned_to_ip');
break;
case 'top_n':
case 'general':
case 'exception':
$text_agent = get_parameter('text_agent', '');
$text_agent_module = get_parameter('text_agent_module', '');
if (empty($text_agent) === false) {
$style['text_agent'] = base64_encode($text_agent);
}
if (empty($text_agent_module) === false) {
$style['text_agent_module'] = base64_encode($text_agent_module);
}
break;
default:
// Default.
break;

View File

@ -1298,6 +1298,15 @@ $table_other->data[$row][1] = html_print_checkbox_switch(
);
$row++;
$table_other->data[$row][0] = __('Show empty groups in group view');
$table_other->data[$row][1] = html_print_checkbox_switch(
'show_empty_groups',
1,
$config['show_empty_groups'],
true
);
$row++;
$table_other->data[$row][0] = __('Date format string');
$table_other->data[$row][1] = '<em>'.__('Example').'</em> '.date($config['date_format']);
$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true);

View File

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

View File

@ -1245,6 +1245,10 @@ function config_update_config()
$error_update[] = __('Show the group name instead the group icon.');
}
if (config_update_value('show_empty_groups', get_parameter('show_empty_groups'), true) === false) {
$error_update[] = __('Show empty groups in group view.');
}
if (config_update_value('custom_graph_width', (int) get_parameter('custom_graph_width', 1), true) === false) {
$error_update[] = __('Default line thickness for the Custom Graph.');
}
@ -3115,6 +3119,10 @@ function config_process_config()
config_update_value('show_group_name', 0);
}
if (!isset($config['show_empty_groups'])) {
config_update_value('show_empty_groups', 1);
}
if (!isset($config['custom_graph_width'])) {
config_update_value('custom_graph_width', 1);
}

View File

@ -401,15 +401,8 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
case '1':
// Group by events.
$event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']);
$filter['group_rep'] = 0;
$filter['status'] = $event['estado'];
$filter['event_type'] = $event['event_type'];
$filter['id_agent'] = $event['id_agente'];
$filter['id_agentmodule'] = $event['id_agentmodule'];
$sql = events_get_all(
['te.id_evento'],
['te.*'],
$filter,
// Offset.
null,
@ -425,7 +418,18 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
true
);
$target_ids = db_get_all_rows_sql($sql);
$target_ids = db_get_all_rows_sql(
sprintf(
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
ON tu.estado = tf.estado
AND tu.evento = tf.evento
AND tu.id_agente = tf.id_agente
AND tu.id_agentmodule = tf.id_agentmodule
AND tf.max_id_evento = %d',
$sql,
$id_evento
)
);
// Try to avoid deadlock while updating full set.
if ($target_ids !== false && count($target_ids) > 0) {
@ -490,15 +494,8 @@ function events_update_status($id_evento, $status, $filter=null)
case '1':
// Group by events.
$event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']);
$filter['group_rep'] = 0;
$filter['status'] = $event['estado'];
$filter['event_type'] = $event['event_type'];
$filter['id_agent'] = $event['id_agente'];
$filter['id_agentmodule'] = $event['id_agentmodule'];
$sql = events_get_all(
['te.id_evento'],
['te.*'],
$filter,
// Offset.
null,
@ -514,7 +511,18 @@ function events_update_status($id_evento, $status, $filter=null)
true
);
$target_ids = db_get_all_rows_sql($sql);
$target_ids = db_get_all_rows_sql(
sprintf(
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
ON tu.estado = tf.estado
AND tu.evento = tf.evento
AND tu.id_agente = tf.id_agente
AND tu.id_agentmodule = tf.id_agentmodule
AND tf.max_id_evento = %d',
$sql,
$id_evento
)
);
// Try to avoid deadlock while updating full set.
if ($target_ids !== false && count($target_ids) > 0) {

View File

@ -4262,3 +4262,50 @@ function modules_get_min_max_data($id_agent_module, $time_init=0)
return $data;
}
/**
* Get modules match regex.
*
* @param string $regex_alias Regex alias.
* @param string $regex_name_module Regex module name.
* @param string $server_name Name server.
*
* @return array
*/
function modules_get_regex(
$regex_alias,
$regex_name_module='',
$server_name=''
) {
$agent_regexp = sprintf('AND tagente.alias REGEXP "%s"', $regex_alias);
$module_regexp = '';
if (empty($regex_name_module) === false) {
$module_regexp = sprintf(
'AND tagente_modulo.nombre REGEXP "%s"',
$regex_name_module
);
}
$sql = sprintf(
'SELECT tagente_modulo.id_agente_modulo as id_agent_module,
"%s" as server_name
FROM tagente_modulo
INNER JOIN tagente
ON tagente.id_agente = tagente_modulo.id_agente
WHERE 1=1
%s
%s',
$server_name,
$agent_regexp,
$module_regexp
);
$result = db_get_all_rows_sql($sql);
if ($result === false) {
$result = [];
}
return $result;
}

View File

@ -67,6 +67,7 @@ define('REPORT_STATUS_DOWNTIME', 4);
define('REPORT_STATUS_IGNORED', 5);
// Clases.
use PandoraFMS\Enterprise\Metaconsole\Node;
use PandoraFMS\Event;
use PandoraFMS\Module;
@ -1544,10 +1545,6 @@ function reporting_event_top_n(
$return['top_n'] = $content['top_n_value'];
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
// Get all the related data.
$sql = sprintf(
'SELECT id_agent_module, server_name
@ -1556,7 +1553,67 @@ function reporting_event_top_n(
$content['id_rc']
);
$tops = db_process_sql($sql);
$tops = db_get_all_rows_sql($sql);
if ($tops === false) {
$tops = [];
}
// REGEXP.
$text_agent = '';
if (isset($content['style']['text_agent']) === true
&& empty($content['style']['text_agent']) === false
) {
$text_agent = base64_decode($content['style']['text_agent']);
}
$text_agent_module = '';
if (isset($content['style']['text_agent_module']) === true
&& empty($content['style']['text_agent_module']) === false
) {
$text_agent_module = base64_decode($content['style']['text_agent_module']);
}
$modules_regex = [];
if (empty($text_agent) === false) {
if (is_metaconsole() === true) {
$nodes = metaconsole_get_connections();
foreach ($nodes as $node) {
try {
$nd = new Node($node['id']);
$nd->connect();
$modules_regex_node = modules_get_regex(
$text_agent,
$text_agent_module,
$node['server_name']
);
} catch (\Exception $e) {
$nd->disconnect();
$modules_regex_node = [];
} finally {
$nd->disconnect();
}
$modules_regex = array_merge($modules_regex, $modules_regex_node);
}
} else {
$modules_regex = modules_get_regex(
$text_agent,
$text_agent_module
);
}
}
if (empty($modules_regex) === false) {
$tops = array_merge($tops, $modules_regex);
$tops = array_reduce(
$tops,
function ($carry, $item) {
$carry[$item['id_agent_module'].'|'.$item['server_name']] = $item;
return $carry;
},
[]
);
}
} else {
$tops = $content['subitems'];
}
@ -1579,6 +1636,9 @@ function reporting_event_top_n(
$height = $force_height_chart;
}
// Force width 600px.
$width = 600;
if (empty($tops)) {
$return['failed'] = __('There are no Agent/Modules defined');
} else {
@ -1590,7 +1650,6 @@ function reporting_event_top_n(
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
// ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
@ -1644,18 +1703,51 @@ function reporting_event_top_n(
switch ($order_uptodown) {
// Descending.
case 1:
array_multisort($data_top, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
array_multisort(
$data_top,
SORT_DESC,
$agent_name,
SORT_ASC,
$module_name,
SORT_ASC,
$id_agent_module,
SORT_ASC,
$units,
SORT_ASC
);
break;
// Ascending.
case 2:
array_multisort($data_top, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
array_multisort(
$data_top,
SORT_ASC,
$agent_name,
SORT_ASC,
$module_name,
SORT_ASC,
$id_agent_module,
SORT_ASC,
$units,
SORT_ASC
);
break;
// By agent name or without selection.
case 0:
case 3:
array_multisort($agent_name, SORT_ASC, $data_top, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $units, SORT_ASC);
array_multisort(
$agent_name,
SORT_ASC,
$data_top,
SORT_ASC,
$module_name,
SORT_ASC,
$id_agent_module,
SORT_ASC,
$units,
SORT_ASC
);
break;
default:
@ -1683,66 +1775,18 @@ function reporting_event_top_n(
$i = 0;
$data_pie_graph = [];
$data_hbar = [];
foreach ($data_top as $dt) {
$item_name = '';
$item_name = ui_print_truncate_text($agent_name[$i], $truncate_size, false, true, false, '...').' - '.ui_print_truncate_text($module_name[$i], $truncate_size, false, true, false, '...');
$item_name_key_pie = $item_name;
$exist_key = true;
while ($exist_key) {
if (isset($data_pie_graph[$item_name_key_pie])) {
$item_name_key_pie .= ' ';
} else {
$exist_key = false;
}
}
$item_name_key_hbar = $item_name;
$exist_key = true;
while ($exist_key) {
if (isset($data_hbar[$item_name_key_hbar])) {
$item_name_key_hbar = ' '.$item_name_key_hbar;
} else {
$exist_key = false;
}
}
$data_hbar[$item_name]['g'] = $dt;
$data_pie_graph[$item_name] = $dt;
if ($show_graph == 0 || $show_graph == 1) {
$data = [];
$data['agent'] = $agent_name[$i];
$data['module'] = $module_name[$i];
$data['value'] = $dt;
$divisor = get_data_multiplier($units[$i]);
$data['formated_value'] = format_for_graph($dt, 2, '.', ',', $divisor, $units[$i]);
$data_return[] = $data;
}
$i++;
if ($i >= $top_n_value) {
break;
}
}
} else if ($order_uptodown == 0 || $order_uptodown == 3) {
$i = 0;
$data_pie_graph = [];
$data_hbar = [];
foreach ($agent_name as $an) {
$item_name = '';
foreach ($data_top as $key_dt => $dt) {
$item_name = ui_print_truncate_text(
$agent_name[$i],
$agent_name[$key_dt],
$truncate_size,
false,
true,
false,
'...'
).' - '.ui_print_truncate_text(
$module_name[$i],
);
$item_name .= ' - ';
$item_name .= ui_print_truncate_text(
$module_name[$key_dt],
$truncate_size,
false,
true,
@ -1770,17 +1814,94 @@ function reporting_event_top_n(
}
}
$data_pie_graph[$item_name] = $data_top[$i];
$data_hbar[$item_name]['g'] = $data_top[$i];
$data_hbar[$item_name]['g'] = $dt;
$data_pie_graph[$item_name] = $dt;
$divisor = get_data_multiplier($units[$i]);
if ($show_graph == 0 || $show_graph == 1) {
$data = [];
$data['agent'] = $agent_name[$key_dt];
$data['module'] = $module_name[$key_dt];
$data['value'] = $dt;
$divisor = get_data_multiplier($units[$key_dt]);
$data['formated_value'] = format_for_graph(
$dt,
2,
'.',
',',
$divisor,
$units[$key_dt]
);
$data_return[] = $data;
}
$i++;
if ($i >= $top_n_value) {
break;
}
}
} else if ($order_uptodown == 0 || $order_uptodown == 3) {
$i = 0;
$data_pie_graph = [];
$data_hbar = [];
foreach ($agent_name as $key_an => $an) {
$item_name = '';
$item_name = ui_print_truncate_text(
$agent_name[$key_an],
$truncate_size,
false,
true,
false,
'...'
).' - '.ui_print_truncate_text(
$module_name[$key_an],
$truncate_size,
false,
true,
false,
'...'
);
$item_name_key_pie = $item_name;
$exist_key = true;
while ($exist_key) {
if (isset($data_pie_graph[$item_name_key_pie])) {
$item_name_key_pie .= ' ';
} else {
$exist_key = false;
}
}
$item_name_key_hbar = $item_name;
$exist_key = true;
while ($exist_key) {
if (isset($data_hbar[$item_name_key_hbar])) {
$item_name_key_hbar = ' '.$item_name_key_hbar;
} else {
$exist_key = false;
}
}
$data_pie_graph[$item_name] = $data_top[$key_an];
$data_hbar[$item_name]['g'] = $data_top[$key_an];
$divisor = get_data_multiplier($units[$key_an]);
if ($show_graph == 0 || $show_graph == 1) {
$data = [];
$data['agent'] = $an;
$data['module'] = $module_name[$i];
$data['value'] = $data_top[$i];
$data['formated_value'] = format_for_graph($data_top[$i], 2, '.', ',', $divisor, $units[$i]);
$data['module'] = $module_name[$key_an];
$data['value'] = $data_top[$key_an];
$data['formated_value'] = format_for_graph(
$data_top[$key_an],
2,
'.',
',',
$divisor,
$units[$key_an]
);
$data_return[] = $data;
}
@ -1826,7 +1947,7 @@ function reporting_event_top_n(
$ttl,
$config['homeurl'],
'white',
'black'
'#DFDFDF'
);
}
@ -3150,11 +3271,72 @@ function reporting_exception(
WHERE id_report_content = %d',
$content['id_rc']
);
if (is_metaconsole()) {
metaconsole_restore_db();
$exceptions = db_get_all_rows_sql($sql);
if ($exceptions === false) {
$exceptions = [];
}
$exceptions = db_process_sql($sql);
// REGEXP.
$text_agent = '';
if (isset($content['style']['text_agent']) === true
&& empty($content['style']['text_agent']) === false
) {
$text_agent = base64_decode($content['style']['text_agent']);
}
$text_agent_module = '';
if (isset($content['style']['text_agent_module']) === true
&& empty($content['style']['text_agent_module']) === false
) {
$text_agent_module = base64_decode($content['style']['text_agent_module']);
}
$modules_regex = [];
if (empty($text_agent) === false) {
if (is_metaconsole() === true) {
$nodes = metaconsole_get_connections();
foreach ($nodes as $node) {
try {
$nd = new Node($node['id']);
$nd->connect();
$modules_regex_node = modules_get_regex(
$text_agent,
$text_agent_module,
$node['server_name']
);
} catch (\Exception $e) {
$nd->disconnect();
$modules_regex_node = [];
} finally {
$nd->disconnect();
}
$modules_regex = array_merge($modules_regex, $modules_regex_node);
}
} else {
$modules_regex = modules_get_regex(
$text_agent,
$text_agent_module
);
}
}
if (empty($modules_regex) === false) {
$exceptions = array_merge($exceptions, $modules_regex);
$exceptions = array_reduce(
$exceptions,
function ($carry, $item) {
if (isset($item['operation']) === false) {
$item['operation'] = 'avg';
}
$carry[$item['id_agent_module'].'|'.$item['server_name']] = $item;
return $carry;
},
[]
);
}
} else {
$exceptions = $content['subitems'];
}
@ -4924,7 +5106,7 @@ function reporting_custom_render($report, $content, $type='dinamic', $pdf=0)
$data_macro['server_id']
);
if (metaconsole_connect($server) != NOERR) {
continue;
continue 2;
}
}
@ -9423,14 +9605,75 @@ function reporting_general($report, $content)
$return['show_in_same_row'] = $content['style']['show_in_same_row'];
if (empty($content['subitems'])) {
if (is_metaconsole()) {
metaconsole_restore_db();
}
$generals = db_get_all_rows_filter(
'treport_content_item',
['id_report_content' => $content['id_rc']]
);
if ($generals === false) {
$generals = [];
}
// REGEXP.
$text_agent = '';
if (isset($content['style']['text_agent']) === true
&& empty($content['style']['text_agent']) === false
) {
$text_agent = base64_decode($content['style']['text_agent']);
}
$text_agent_module = '';
if (isset($content['style']['text_agent_module']) === true
&& empty($content['style']['text_agent_module']) === false
) {
$text_agent_module = base64_decode($content['style']['text_agent_module']);
}
$modules_regex = [];
if (empty($text_agent) === false) {
if (is_metaconsole() === true) {
$nodes = metaconsole_get_connections();
foreach ($nodes as $node) {
try {
$nd = new Node($node['id']);
$nd->connect();
$modules_regex_node = modules_get_regex(
$text_agent,
$text_agent_module,
$node['server_name']
);
} catch (\Exception $e) {
$nd->disconnect();
$modules_regex_node = [];
} finally {
$nd->disconnect();
}
$modules_regex = array_merge($modules_regex, $modules_regex_node);
}
} else {
$modules_regex = modules_get_regex(
$text_agent,
$text_agent_module
);
}
}
if (empty($modules_regex) === false) {
$generals = array_merge($generals, $modules_regex);
$generals = array_reduce(
$generals,
function ($carry, $item) {
if (isset($item['operation']) === false) {
$item['operation'] = 'avg';
}
$carry[$item['id_agent_module'].'|'.$item['server_name']] = $item;
return $carry;
},
[]
);
}
} else {
$generals = $content['subitems'];
}
@ -9440,16 +9683,14 @@ function reporting_general($report, $content)
}
$i = 0;
$index = 0;
$is_string = [];
foreach ($generals as $row) {
// Metaconsole connection
foreach ($generals as $key_row => $row) {
// Metaconsole connection.
$server_name = $row['server_name'];
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
// ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
@ -9458,7 +9699,7 @@ function reporting_general($report, $content)
|| modules_is_not_init($row['id_agent_module'])
) {
if (is_metaconsole()) {
// Restore db connection
// Restore db connection.
metaconsole_restore_db();
}
@ -9469,7 +9710,7 @@ function reporting_general($report, $content)
$ag_name = modules_get_agentmodule_agent_alias($row['id_agent_module']);
$name_agent = modules_get_agentmodule_agent_name($row['id_agent_module']);
$type_mod = modules_get_last_value($row['id_agent_module']);
$is_string[$index] = modules_is_string($row['id_agent_module']);
$is_string[$key_row] = modules_is_string($row['id_agent_module']);
$unit = db_get_value(
'unit',
'tagente_modulo',
@ -9478,7 +9719,7 @@ function reporting_general($report, $content)
);
$id_module_type = db_get_value('id_tipo_modulo', 'tagente_modulo', 'nombre', $mod_name);
if ($content['period'] == 0) {
$data_res[$index] = modules_get_last_value($row['id_agent_module']);
$data_res[$key_row] = modules_get_last_value($row['id_agent_module']);
} else {
$data_sum = reporting_get_agentmodule_data_sum(
$row['id_agent_module'],
@ -9502,34 +9743,34 @@ function reporting_general($report, $content)
);
if ($content['style']['show_in_same_row'] && $content['group_by_agent'] == REPORT_GENERAL_NOT_GROUP_BY_AGENT) {
$data_res[$index] = [
$data_res[$key_row] = [
$data_avg,
$data_max,
$data_min,
$data_sum,
];
} else {
if (is_numeric($type_mod) && !$is_string[$index]) {
if (is_numeric($type_mod) && !$is_string[$key_row]) {
switch ($row['operation']) {
case 'sum':
$data_res[$index] = $data_sum;
$data_res[$key_row] = $data_sum;
break;
case 'max':
$data_res[$index] = $data_max;
$data_res[$key_row] = $data_max;
break;
case 'min':
$data_res[$index] = $data_min;
$data_res[$key_row] = $data_min;
break;
case 'avg':
default:
$data_res[$index] = $data_avg;
$data_res[$key_row] = $data_avg;
break;
}
} else {
$data_res[$index] = $type_mod;
$data_res[$key_row] = $type_mod;
}
}
}
@ -9538,46 +9779,46 @@ function reporting_general($report, $content)
switch ($content['group_by_agent']) {
case REPORT_GENERAL_NOT_GROUP_BY_AGENT:
$id_agent_module[$index] = $row['id_agent_module'];
$agent_name[$index] = $ag_name;
$module_name[$index] = $mod_name;
$units[$index] = $unit;
$id_module_types[$index] = $id_module_type;
$operations[$index] = $row['operation'];
$id_agent_module[$key_row] = $row['id_agent_module'];
$agent_name[$key_row] = $ag_name;
$module_name[$key_row] = $mod_name;
$units[$key_row] = $unit;
$id_module_types[$key_row] = $id_module_type;
$operations[$key_row] = $row['operation'];
break;
case REPORT_GENERAL_GROUP_BY_AGENT:
$id_module_types[$index] = $id_module_type;
if ($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18) {
$data_res[$index] = round($data_res[$index], 0, PHP_ROUND_HALF_DOWN);
$id_module_types[$key_row] = $id_module_type;
if ($id_module_types[$key_row] == 2 || $id_module_types[$key_row] == 6 || $id_module_types[$key_row] == 9 || $id_module_types[$key_row] == 18) {
$data_res[$key_row] = round($data_res[$key_row], 0, PHP_ROUND_HALF_DOWN);
}
if ($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18) {
if ($data_res[$index] == 1) {
$data_res[$index] = 'Up';
} else if ($data_res[$index] == 0) {
$data_res[$index] = 'Down';
if ($id_module_types[$key_row] == 2 || $id_module_types[$key_row] == 6 || $id_module_types[$key_row] == 9 || $id_module_types[$key_row] == 18) {
if ($data_res[$key_row] == 1) {
$data_res[$key_row] = 'Up';
} else if ($data_res[$key_row] == 0) {
$data_res[$key_row] = 'Down';
}
}
if ($data_res[$index] === false) {
if ($data_res[$key_row] === false) {
$return['data'][$name_agent][$mod_name] = null;
} else {
if (!is_numeric($data_res[$index])) {
$return['data'][$name_agent][$mod_name] = $data_res[$index];
if (!is_numeric($data_res[$key_row])) {
$return['data'][$name_agent][$mod_name] = $data_res[$key_row];
} else {
$return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, ' '.$unit);
$return['data'][$name_agent][$mod_name] = format_for_graph($data_res[$key_row], 2, '.', ',', $divisor, ' '.$unit);
}
}
break;
}
if ($content['style']['show_in_same_row']) {
foreach ($data_res[$index] as $val) {
foreach ($data_res[$key_row] as $val) {
// Calculate the avg, min and max
if (is_numeric($val)) {
$change_min = false;
if (is_null($return['min']['value'])) {
if ($return['min']['value'] === null) {
$change_min = true;
} else {
if ($return['min']['value'] > $val) {
@ -9593,7 +9834,7 @@ function reporting_general($report, $content)
}
$change_max = false;
if (is_null($return['max']['value'])) {
if ($return['max']['value'] === null) {
$change_max = true;
} else {
if ($return['max']['value'] < $val) {
@ -9617,51 +9858,50 @@ function reporting_general($report, $content)
}
} else {
// Calculate the avg, min and max
if (is_numeric($data_res[$index]) && !$is_string[$index]) {
if (is_numeric($data_res[$key_row]) && !$is_string[$key_row]) {
$change_min = false;
if (is_null($return['min']['value'])) {
if ($return['min']['value'] === null) {
$change_min = true;
} else {
if ($return['min']['value'] > $data_res[$index]) {
if ($return['min']['value'] > $data_res[$key_row]) {
$change_min = true;
}
}
if ($change_min) {
$return['min']['value'] = $data_res[$index];
$return['min']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, ' '.$unit);
$return['min']['value'] = $data_res[$key_row];
$return['min']['formated_value'] = format_for_graph($data_res[$key_row], 2, '.', ',', $divisor, ' '.$unit);
$return['min']['agent'] = $ag_name;
$return['min']['module'] = $mod_name;
}
$change_max = false;
if (is_null($return['max']['value'])) {
if ($return['max']['value'] === null) {
$change_max = true;
} else {
if ($return['max']['value'] < $data_res[$index]) {
if ($return['max']['value'] < $data_res[$key_row]) {
$change_max = true;
}
}
if ($change_max) {
$return['max']['value'] = $data_res[$index];
$return['max']['formated_value'] = format_for_graph($data_res[$index], 2, '.', ',', $divisor, ' '.$unit);
$return['max']['value'] = $data_res[$key_row];
$return['max']['formated_value'] = format_for_graph($data_res[$key_row], 2, '.', ',', $divisor, ' '.$unit);
$return['max']['agent'] = $ag_name;
$return['max']['module'] = $mod_name;
}
if ($i == 0) {
$return['avg_value'] = $data_res[$index];
$return['avg_value'] = $data_res[$key_row];
} else {
$return['avg_value'] = ((($return['avg_value'] * $i) / ($i + 1)) + ($data_res[$index] / ($i + 1)));
$return['avg_value'] = ((($return['avg_value'] * $i) / ($i + 1)) + ($data_res[$key_row] / ($i + 1)));
}
}
}
$index++;
$i++;
// Restore dbconnection
// Restore dbconnection.
if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
metaconsole_restore_db();
}
@ -9719,20 +9959,19 @@ function reporting_general($report, $content)
break;
}
$i = 0;
foreach ($data_res as $d) {
foreach ($data_res as $d_key => $d) {
$data = [];
$data['agent'] = $agent_name[$i];
$data['module'] = $module_name[$i];
$data['id_agent_module'] = $id_agent_module[$i];
$data['id_agent'] = agents_get_agent_id_by_module_id($id_agent_module[$i]);
$data['id_module_type'] = $id_module_types[$i];
$data['agent'] = $agent_name[$d_key];
$data['module'] = $module_name[$d_key];
$data['id_agent_module'] = $id_agent_module[$d_key];
$data['id_agent'] = agents_get_agent_id_by_module_id($id_agent_module[$d_key]);
$data['id_module_type'] = $id_module_types[$d_key];
$data['operator'] = '';
if ($content['period'] != 0) {
if ($content['style']['show_in_same_row']) {
$data['operator'] = 'all';
} else {
switch ($operations[$i]) {
switch ($operations[$d_key]) {
case 'sum':
$data['operator'] = __('Summatory');
break;
@ -9758,28 +9997,16 @@ function reporting_general($report, $content)
if ($val === false) {
$data['value'][] = null;
} else {
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
break;
$divisor = get_data_multiplier($units[$d_key]);
case 'oracle':
if (preg_match('/[0-9]+,[0-9]E+[+-][0-9]+/', $val)) {
$val = oracle_format_float_to_php($val);
}
break;
}
$divisor = get_data_multiplier($units[$i]);
if (!is_numeric($val) || $is_string[$i]) {
if (!is_numeric($val) || $is_string[$d_key]) {
$data['value'][] = $val;
// to see the chains on the table
$data['formated_value'][] = $val;
} else {
$data['value'][] = $val;
$data['formated_value'][] = format_for_graph($val, 2, '.', ',', $divisor, ' '.$units[$i]);
$data['formated_value'][] = format_for_graph($val, 2, '.', ',', $divisor, ' '.$units[$d_key]);
}
}
}
@ -9787,35 +10014,21 @@ function reporting_general($report, $content)
if ($d === false) {
$data['value'] = null;
} else {
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
break;
$divisor = get_data_multiplier($units[$d_key]);
case 'oracle':
if (preg_match('/[0-9]+,[0-9]E+[+-][0-9]+/', $d)) {
$d = oracle_format_float_to_php($d);
}
break;
}
$divisor = get_data_multiplier($units[$i]);
if (!is_numeric($d) || $is_string[$i]) {
if (!is_numeric($d) || $is_string[$d_key]) {
$data['value'] = $d;
// to see the chains on the table
$data['formated_value'] = $d;
} else {
$data['value'] = $d;
$data['formated_value'] = format_for_graph($d, 2, '.', ',', $divisor, ' '.$units[$i]);
$data['formated_value'] = format_for_graph($d, 2, '.', ',', $divisor, ' '.$units[$d_key]);
}
}
}
$return['data'][] = $data;
$i++;
}
break;
}

View File

@ -961,8 +961,8 @@ function reporting_html_top_n($table, $item, $pdf=0)
if ($pdf !== 0) {
$return_pdf .= $item['charts']['pie'];
} else {
$table->colspan['char_pie']['cell'] = 3;
$table->data['char_pie']['cell'] = $item['charts']['pie'];
$table->colspan['char_pie'][0] = 2;
$table->data['char_pie'][0] = $item['charts']['pie'];
}
}
@ -970,8 +970,8 @@ function reporting_html_top_n($table, $item, $pdf=0)
if ($pdf !== 0) {
$return_pdf .= $item['charts']['bars'];
} else {
$table->colspan['char_bars']['cell'] = 3;
$table->data['char_bars']['cell'] = $item['charts']['bars'];
// $table->colspan['char_bars']['cell'] = 3;
$table->data['char_pie'][1] = $item['charts']['bars'];
}
}
@ -4815,6 +4815,7 @@ function reporting_html_general($table, $item, $pdf=0)
}
$list_modules = array_keys($list_modules);
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = [];
$table1->head = array_merge([__('Agent')], $list_modules);

View File

@ -1440,13 +1440,17 @@ function snmp_browser_create_modules_snmp(
/**
* Prints html for create module from snmp massive dialog
*
* @param string $url_form
* @param string $title
* @param boolean $return
* @return void
* @param string $target Target.
* @param string $snmp_conf Conf.
* @param boolean $return Type return.
*
* @return string Output html.
*/
function snmp_browser_print_create_module_massive($target='agent', $snmp_conf, $return=false)
{
function snmp_browser_print_create_module_massive(
$target='agent',
$snmp_conf='',
$return=false
) {
global $config;
// String for labels.
@ -1458,6 +1462,10 @@ function snmp_browser_print_create_module_massive($target='agent', $snmp_conf, $
case 'policy':
$target_item = 'Policies';
break;
default:
// Not possible.
break;
}
$output = "<form target='_blank' id='create_module_massive' action='#' method='post'>";

View File

@ -3462,7 +3462,8 @@ function ui_print_datatable(array $parameters)
$(document).ready(function(){
$.fn.dataTable.ext.errMode = "none";
$.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'";
dt_'.$table_id.' = $("#'.$table_id.'").DataTable({
var settings_datatable = {
drawCallback: function(settings) {';
if (isset($parameters['drawCallback'])) {
$js .= $parameters['drawCallback'];
@ -3608,7 +3609,9 @@ function ui_print_datatable(array $parameters)
$js .= '
],
order: [[ '.$order.' ]]
});
};
var dt_'.$table_id.' = $("#'.$table_id.'").DataTable(settings_datatable);
$("#'.$form_id.'_search_bt").click(function (){
dt_'.$table_id.'.draw().page(0)

View File

@ -2652,8 +2652,8 @@ function visual_map_process_wizard_add_modules(
$image,
$id_layout,
$range,
$width=0,
$height=0,
$width,
$height,
$period,
$process_value,
$percentileitem_width,
@ -2669,6 +2669,14 @@ function visual_map_process_wizard_add_modules(
$fontf='lato',
$fonts='12pt'
) {
if (empty($width) === true) {
$width = 0;
}
if (empty($height) === true) {
$height = 0;
}
if (empty($id_modules)) {
$return = ui_print_error_message(
__('No modules selected'),
@ -2923,8 +2931,8 @@ function visual_map_process_wizard_add_agents(
$image,
$id_layout,
$range,
$width=0,
$height=0,
$width,
$height,
$period,
$process_value,
$percentileitem_width,
@ -2942,6 +2950,14 @@ function visual_map_process_wizard_add_agents(
) {
global $config;
if (empty($width) === true) {
$width = 0;
}
if (empty($height) === true) {
$height = 0;
}
if (empty($id_agents)) {
$return = ui_print_error_message(
__('No agents selected'),
@ -4171,8 +4187,14 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
*
* @return string The text for the parent.
*/
function visual_map_create_internal_name_item($label=null, $type, $image, $agent=null, $id_module, $idData)
{
function visual_map_create_internal_name_item(
$label=null,
$type='',
$image='',
$agent=null,
$id_module=0,
$idData=''
) {
$text = '';
if (empty($label)) {

View File

@ -7490,6 +7490,11 @@ div.graph div.legend table {
align-items: center;
}
.flex_justify {
display: flex;
justify-content: center;
}
.span_priority {
width: 20px;
height: 10px;

View File

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

View File

@ -167,7 +167,7 @@ if ($total > 0) {
}
if ($total_agentes > 0) {
// Agents
// Agents.
$total_agent_unknown = format_numeric((($agents_unknown * 100) / $total_agentes), 2);
$total_agent_critical = format_numeric((($agents_critical * 100) / $total_agentes), 2);
$total_agent_warning = format_numeric((($agents_warning * 100) / $total_agentes), 2);
@ -209,7 +209,7 @@ if ($count == 1) {
ui_pagination($count);
if (!empty($result_groups)) {
if (empty($result_groups) === false) {
echo '<table cellpadding="0" cellspacing="0" class="databox data mrgn_top_10px" border="0" width="100%">';
echo '<tr>';
echo '<th colspan=2 ></th>';
@ -235,10 +235,17 @@ if (!empty($result_groups)) {
echo '</tr>';
foreach ($result_groups as $data) {
if ((bool) $config['show_empty_groups'] === false
&& $data['_total_agents_'] === 0
&& $data['_monitor_checks_'] === 0
) {
continue;
}
$groups_id = $data['_id_'];
// Calculate entire row color
if ($groups_id != 0) {
// Calculate entire row color.
if ($groups_id !== '0') {
if ($data['_monitors_alerts_fired_'] > 0) {
$color_class = 'group_view_alrm';
$status_image = ui_print_status_image('agent_alertsfired_ball.png', '', true);
@ -265,7 +272,7 @@ if (!empty($result_groups)) {
echo "<tr class='height_35px'>";
// Force
// Force.
echo "<td class='group_view_data center vertical_middle'>";
if (!isset($data['_is_tag_']) && check_acl($config['id_user'], $data['_id_'], 'AW')) {
echo '<a href="index.php?sec=estado&sec2=operation/agentes/group_view&update_netgroup='.$data['_id_'].'">'.html_print_image(

View File

@ -2213,11 +2213,9 @@ try {
$active_filters_div .= '</div>';
$active_filters_div .= '<div id="events_buffers_display"></div>';
$table_id = 'events';
$table_id = 'table_events';
$form_id = 'events_form';
// Print datatable.
ui_print_datatable(
[

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.763
%define release 220630
%define release 220704
# 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.763
%define release 220630
%define release 220704
# 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.763
%define release 220630
%define release 220704
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -0,0 +1,112 @@
################################################################################
# get Event
################################################################################
# Copyright (c) 2020 Artica Soluciones Tecnologicas S.L
# Jose Antonio Almendros
################################################################################
#
# usage: getEvent.exe -command "get_event.exe [event_source] [log_name] [interval] [*nodatalist] [*sendlog]"
#
################################################################################
param (
[switch]$h = $false,
[switch]$nodatalist = $false,
[switch]$sendlog = $false
)
if (($h -eq $true) -or ($($Args.Count) -le 2)){
echo "Plugin to get events from the last N minutes"
echo "Usage:"
echo "getEvent.exe [event_source] [log_name] [interval] *[-nodatalist] *[-sendlog]`n"
echo "event_source:`t`tfield Source of the Event"
echo "log_name:`t`tfield Log Name of the Event"
echo "interval:`t`ttime interval from events will be extracted (in minutes)"
echo "nodatalist [optional]:`tshows all output in same module data"
echo "sendlog [optional]:`tsends logs to log server"
echo "Artica ST @ 2020"
exit
}
$source = $args[0]
$logname = $args[1]
$interval = $args[2]
if (($nodatalist -eq $false) -and ($sendlog -eq $false))
{
$Logs = get-EventLog -Source $source -LogName $logname -After $((get-date).AddMinutes(-$interval)) | ft -HideTableHeaders
$result = foreach ($Log in $Logs)
{
if ($Log)
{
echo "<data><value><![CDATA["
echo $Log
echo "]]></value></data>"
echo "`r`n"
}
}
echo "<module>"
echo "<name>$source Events</name>"
echo "<type>async_string</type>"
echo "<datalist>"
echo $result
echo "</datalist>"
echo "<description>Logs with log name $logname in source $source</description>"
echo "</module>"
}
else
{
if ($sendlog -eq $false)
{
$Logs = get-EventLog -Source $source -LogName $logname -After $((get-date).AddMinutes(-$interval)) | ft -HideTableHeaders | Out-String
$result = foreach ($Log in $Logs)
{
echo $Log
echo "`r`n"
}
echo "<module>"
echo "<name>$source Events</name>"
echo "<type>async_string</type>"
echo "<data><![CDATA["
echo $result
echo "]]></data>"
echo "<description>Logs with log name $logname in source $source</description>"
echo "</module>"
}
}
if ($sendlog -eq $true)
{
$Logs = get-EventLog -Source $source -LogName $logname -After $((get-date).AddMinutes(-$interval)) | ft -HideTableHeaders | Out-String
$result = foreach ($Log in $Logs)
{
if ($Log)
{
echo "<![CDATA["
echo $Log
echo "]]>"
echo "`n"
}
}
echo "<log_module>"
echo "<source>$source Events</source>"
echo "<data>"
echo $result
echo "</data>"
echo "</log_module>"
}

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.763-220630
Version: 7.0NG.763-220704
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.763-220630"
pandora_version="7.0NG.763-220704"
package_cpan=0
package_pandora=1

View File

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

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.763";
my $pandora_build = "220630";
my $pandora_build = "220704";
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.763
%define release 220630
%define release 220704
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.763"
PI_BUILD="220630"
PI_BUILD="220704"
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.763 Build 220630";
my $version = "7.0NG.763 Build 220704";
# 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.763 Build 220630";
my $version = "7.0NG.763 Build 220704";
# save program name for logging
my $progname = basename($0);