Merge remote-tracking branch 'origin/develop' into ent-11114-Gestion-de-versiones-Obsolescencia-planeada

This commit is contained in:
alejandro.campos@artica.es 2023-09-20 15:52:56 +02:00
commit ae74caf7b1
58 changed files with 1181 additions and 437 deletions

View File

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

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

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230915
%define release 230920
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230915
%define release 230920
Summary: Pandora FMS Linux agent, binary version
Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230915
%define release 230920
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="230915"
PI_BUILD="230920"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{230915}
{230920}
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.773.3 Build 230915")
#define PANDORA_VERSION ("7.0NG.773.3 Build 230920")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230915))"
VALUE "ProductVersion", "(7.0NG.773.3(Build 230920))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

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

View File

@ -1,5 +1,6 @@
START TRANSACTION;
ALTER TABLE tevent_filter ADD private_filter_user text NULL;
ALTER TABLE `ttrap` ADD COLUMN `utimestamp` INT UNSIGNED NOT NULL DEFAULT 0;
UPDATE ttrap SET utimestamp=UNIX_TIMESTAMP(timestamp);
@ -56,4 +57,25 @@ INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of
INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of_support`) VALUES (2,'Cisco.*','IOS 3.4.3','2017/05/12');
INSERT INTO `tconfig_os_version` (`id_os_version`, `product`, `version`, `end_of_support`) VALUES (3,'Linux.*','Centos 7.*','2022/01/01');
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.vmware';
-- Insert new Proxmox APP
SET @short_name = 'pandorafms.proxmox';
SET @name = 'Proxmox';
SET @section = 'app';
SET @description = 'Monitor Proxmox VMs, LXC, backups and nodes from a specific host';
SET @version = '1.0';
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
-- Insert into tdiscovery_apps_scripts
INSERT IGNORE INTO `tdiscovery_apps_scripts` (`id_app`, `macro`, `value`) VALUES (@id_app, '_exec1_', 'bin/pandora_proxmox');
-- Insert into tdiscovery_apps_executions
INSERT IGNORE INTO `tdiscovery_apps_executions` (`id`, `id_app`, `execution`) VALUES (1, @id_app, ''_exec1_' -g '__taskGroup__' --host '_host_' --port '_port_' --user '_user_' --password '_password_' --vm '_scanVM_' --lxc '_scanLXC_' --backups '_scanBackups_' --nodes '_scanNodes_' --transfer_mode tentacle --tentacle_address '_tentacleIP_' --tentacle_port '_tentaclePort_' --as_discovery_plugin 1');
ALTER TABLE `treport_content` ADD COLUMN `cat_security_hardening` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `ignore_skipped` INT NOT NULL DEFAULT 0;
ALTER TABLE `treport_content` ADD COLUMN `status_of_check` TINYTEXT;
COMMIT;

View File

@ -439,7 +439,7 @@ if ($id_agente) {
[
'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente,
'content' => html_print_image(
'images/alert@svg.svg',
'images/add-alert.svg',
true,
[
'title' => __('Alerts'),

View File

@ -61,6 +61,9 @@ if ($id) {
$filter = events_get_event_filter($id);
$id_group_filter = $filter['id_group_filter'];
$id_group = $filter['id_group'];
// Get owner user private filter.
$private_filter = ($filter['private_filter_user'] === null || $filter['private_filter_user'] === '') ? 0 : 1;
$private_filter_user = $filter['private_filter_user'];
$id_name = $filter['id_name'];
$event_type = $filter['event_type'];
$severity = explode(',', $filter['severity']);
@ -113,6 +116,7 @@ if ($id) {
$server_id = ($filter['server_id'] ?? '');
} else {
$id_group = '';
$private_filter = 0;
$id_group_filter = '';
$id_name = '';
$event_type = '';
@ -167,8 +171,8 @@ if ($update || $create) {
$id_user_ack = get_parameter('id_user_ack', '');
$owner_user = get_parameter('owner_user', '');
$group_rep = get_parameter('group_rep', '');
$date_from = get_parameter('date_from', '');
$date_to = get_parameter('date_to', '');
$date_from = get_parameter('date_from', '0000-00-00');
$date_to = get_parameter('date_to', '0000-00-00');
$source = get_parameter('source');
$id_extra = get_parameter('id_extra');
$user_comment = get_parameter('user_comment');
@ -192,6 +196,16 @@ if ($update || $create) {
$server_id = implode(',', $servers_array);
}
// Get private filter from user.
$private_filter = get_parameter_switch('private_filter_event', 0);
if ((int) $private_filter === 1 && $create) {
$private_filter_user = $_SESSION['id_usuario'];
} else if ((int) $private_filter === 1 && $update) {
$private_filter_user = ($private_filter_user === $_SESSION['id_usuario']) ? $private_filter_user : $_SESSION['id_usuario'];
} else if ((int) $private_filter === 0) {
$private_filter_user = null;
}
$values = [
'id_name' => $id_name,
'id_group_filter' => $id_group_filter,
@ -222,6 +236,7 @@ if ($update || $create) {
'custom_data' => $custom_data,
'custom_data_filter_type' => $custom_data_filter_type,
'server_id' => $server_id,
'private_filter_user' => $private_filter_user,
];
$severity = explode(',', $severity);
@ -293,6 +308,17 @@ $table->data[0][0] = html_print_label_input_block(
false,
'',
'w100p'
).html_print_label_input_block(
__('Private'),
html_print_checkbox_switch(
'private_filter_event',
$private_filter,
$private_filter,
true,
false,
'checked_slide_events(this);',
true
)
)
);

View File

@ -133,6 +133,18 @@ $filters = db_get_all_rows_sql($sql);
if ($filters === false) {
$filters = [];
} else {
foreach ($filters as $key => $filter) {
$permission = users_is_admin($config['id_user']);
// Validate permission and private filter user.
if ($permission || $filter['private_filter_user'] === $config['id_user']) {
if ($filter['private_filter_user'] !== null) {
$filters[$key]['id_name'] = $filter['id_name'].' (P)';
}
} else if ($filter['private_filter_user'] !== null) {
unset($filters[$key]);
}
}
}
$table = new stdClass();

View File

@ -200,6 +200,16 @@ $text_agent_module = '';
$only_data = false;
if (enterprise_installed() === true) {
$categories_security_hardening = categories_of_cis();
foreach ($categories_security_hardening as $key => $cat) {
$categories_security_hardening[$key] = implode(' ', $cat);
}
} else {
$categories_security_hardening = [];
}
// Users.
$id_users = [];
$users_groups = [];
@ -1029,6 +1039,51 @@ switch ($action) {
$idAgent = $item['id_agent'];
break;
case 'top_n_agents_sh':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'top_n_checks_failed':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'top_n_categories_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$top_n_value = (empty($item['top_n_value']) === true) ? 10 : $item['top_n_value'];
break;
case 'vul_by_cat':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$ignore_skipped = $item['ignore_skipped'];
break;
case 'list_checks':
$group = $item['id_group'];
$recursion = $item['recursion'];
$cat_selected = $item['cat_security_hardening'];
$status_of_check = $item['status_of_check'];
$idAgent = $item['id_agent'];
break;
case 'scoring':
$group = $item['id_group'];
$recursion = $item['recursion'];
$period = $item['period'];
break;
case 'evolution':
$group = $item['id_group'];
$recursion = $item['recursion'];
$period = $item['period'];
break;
default:
// It's not possible.
break;
@ -3855,6 +3910,64 @@ if (is_metaconsole() === true) {
?>
</td>
</tr>
<tr id="row_ignore_skipped" class="datos">
<td class="bolder">
<?php
echo __('Ignore skipped');
?>
</td>
<td>
<?php
html_print_checkbox_switch(
'ignore_skipped',
1,
($ignore_skipped !== null) ? $ignore_skipped : true,
);
?>
</td>
</tr>
<?php if (enterprise_installed() === true) : ?>
<tr id="row_cat_security_hardening" class="datos">
<td class="bolder">
<?php
echo __('Category');
?>
</td>
<td>
<?php
html_print_select(
$categories_security_hardening,
'cat_security_hardening',
$cat_selected,
);
?>
</td>
</tr>
<?php endif; ?>
<tr id="row_status_check" class="datos">
<td class="bolder">
<?php
echo __('Status of check');
?>
</td>
<td>
<?php
html_print_select(
[
'all' => __('All'),
'PASS' => __('Passed'),
'FAIL' => __('Failed'),
'INVALID' => __('Skipped'),
],
'status_of_check',
$status_of_check,
);
?>
</td>
</tr>
<?php
if ($is_enterprise) {
?>
@ -5185,6 +5298,10 @@ echo "<div id='message_no_group' title='".__('Item Editor Information')."' clas
echo "<p class='center bolder'>".__('Please select a group.').'</p>';
echo '</div>';
echo "<div id='message_no_max_item' title='".__('Max items')."' class='invisible'>";
echo "<p class='center bolder'>".__('Please insert max item number.').'</p>';
echo '</div>';
ui_require_javascript_file(
'pandora_inventory',
ENTERPRISE_DIR.'/include/javascript/'
@ -5520,7 +5637,7 @@ $(document).ready (function () {
return false;
}
break;
case 'permissions_report':
case 'permissions_report':
if ($("#checkbox-select_by_group").prop("checked") && $("select#users_groups>option:selected").val() == undefined) {
dialog_message('#message_no_group');
return false;
@ -5530,6 +5647,30 @@ $(document).ready (function () {
return false;
}
break;
case 'list_checks':
if ($("#text-agent").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'top_n_agents_sh':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_checks_failed':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_categories_checks':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
default:
break;
}
@ -5600,13 +5741,14 @@ $(document).ready (function () {
});
$("#submit-edit_item").click(function () {
$("#button-edit_item").click(function () {
var type = $('#type').val();
if($('#text-name').val() == ''){
dialog_message('#message_no_name');
return false;
}
switch (type){
case 'agent_module':
case 'agent_module_status':
@ -5659,6 +5801,30 @@ $(document).ready (function () {
return false;
}
break;
case 'list_checks':
if ($("#text-agent").val() == '') {
dialog_message('#message_no_agent');
return false;
}
break;
case 'top_n_agents_sh':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_checks_failed':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
case 'top_n_categories_checks':
if ($("#text-max_items").val() == '') {
dialog_message('#message_no_max_item');
return false;
}
break;
default:
break;
@ -6739,6 +6905,9 @@ function chooseType() {
$("#row_os_selector").hide();
$("#row_os_version_regexp").hide();
$("#row_os_end_of_life").hide();
$("#row_cat_security_hardening").hide();
$("#row_ignore_skipped").hide();
$("#row_status_check").hide();
// SLA list default state.
$("#sla_list").hide();
@ -7600,7 +7769,44 @@ function chooseType() {
case 'ncm':
$("#row_agent").show();
break;
case 'top_n_agents_sh':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'top_n_checks_failed':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'top_n_categories_checks':
$("#row_group").show();
$("#row_max_items").show();
break;
case 'vul_by_cat':
$("#row_group").show();
$("#row_cat_security_hardening").show();
$("#row_ignore_skipped").show();
break;
case 'list_checks':
$("#row_group").show();
$("#row_agent").show();
$("#row_cat_security_hardening").show();
$("#row_status_check").show();
break;
case 'scoring':
$("#row_group").show();
$('#row_period').show();
break;
case 'evolution':
$("#row_group").show();
$('#row_period').show();
break;
}
switch (type) {

View File

@ -2001,6 +2001,50 @@ switch ($action) {
$good_format = true;
break;
case 'top_n_agents_sh':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_checks_failed':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_categories_checks':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['ignore_skipped'] = get_parameter('ignore_skipped');
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
case 'scoring':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'evolution':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
@ -2030,6 +2074,7 @@ switch ($action) {
|| ($values['type'] == 'event_report_agent')
|| ($values['type'] == 'agent_configuration')
|| ($values['type'] == 'group_configuration')
|| ($values['type'] == 'list_checks')
) {
$values['id_agent_module'] = '';
} else {
@ -2888,6 +2933,50 @@ switch ($action) {
$good_format = true;
break;
case 'top_n_agents_sh':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_checks_failed':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'top_n_categories_checks':
$values['id_group'] = get_parameter('combo_group');
$values['top_n_value'] = get_parameter('max_items');
$good_format = true;
break;
case 'vul_by_cat':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['ignore_skipped'] = get_parameter('ignore_skipped');
$good_format = true;
break;
case 'list_checks':
$values['id_group'] = get_parameter('combo_group');
$values['cat_security_hardening'] = get_parameter('cat_security_hardening');
$values['status_of_check'] = get_parameter('status_of_check');
$good_format = true;
break;
case 'scoring':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'evolution':
$values['id_group'] = get_parameter('combo_group');
$values['period'] = get_parameter('period');
$good_format = true;
break;
default:
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(

View File

@ -607,16 +607,20 @@ if (is_metaconsole() === true) {
}
}
$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control']));
$userManagementTable->rowclass['captions_blocksize_eventfilter'] = 'field_half_width';
$userManagementTable->rowclass['fields_blocksize_eventfilter'] = 'field_half_width';
$userManagementTable->data['captions_blocksize_eventfilter'][0] = __('Block size for pagination');
$userManagementTable->data['fields_blocksize_eventfilter'][0] = html_print_input_text(
'block_size',
$user_info['block_size'],
'',
5,
5,
true
$userManagementTable->data['fields_blocksize_eventfilter'][0] = html_print_input(
[
'type' => 'number',
'size' => 5,
'max' => $performance_variables_control['block_size']->max,
'name' => 'block_size',
'value' => $user_info['block_size'],
'return' => true,
]
);
if (is_metaconsole() === true && empty($user_info['metaconsole_default_event_filter']) !== true) {

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Add alert@svg</title>
<g id="Add-alert" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M10,18 C10,19.1046875 9.10426763,20 8,20 C6.89573237,20 6,19.1046875 6,18 Z M8,2 C8.47753934,2 8.88669653,2.29621004 9.05726495,2.71662986 C8.40926188,3.26642114 8,4.08541645 8,5 L8.00509269,5.17627279 C8.09633912,6.75108004 9.40231912,8 11,8 L12,8 L12,9 C12,10.2760205 12.7966542,11.3659725 13.9197222,11.7996155 C14.313005,13.7223855 15.173052,14.4998338 15.6924763,15.0633413 C15.9067613,15.2955529 16.001761,15.5739183 16,15.8461538 C15.9964039,16.4375 15.5364053,17 14.8535503,17 L1.14644973,17 C0.46359469,17 0.00395325166,16.4375 -1.59872116e-13,15.8461538 C-0.00176101642,15.5739183 0.0932386904,15.2959135 0.307523743,15.0633413 C0.997521614,14.3147837 2.28858906,13.1887019 2.28858906,9.5 C2.28858906,6.69831731 4.23429734,4.45552885 6.85786067,3.90528846 L6.85786067,3.15384615 C6.85786067,2.51670673 7.36928766,2 8,2 Z M15,0 C15.5522847,-1.01453063e-16 16,0.44771525 16,1 L16,3.999 L19,4 C19.5522847,4 20,4.44771525 20,5 C20,5.55228475 19.5522847,6 19,6 L16,6 L16,9 C16,9.55228475 15.5522847,10 15,10 C14.4477153,10 14,9.55228475 14,9 L14,6 L11,6 C10.4477153,6 10,5.55228475 10,5 C10,4.44771525 10.4477153,4 11,4 L14,4 L14,1 C14,0.44771525 14.4477153,1.01453063e-16 15,0 Z" id="Shape" fill="#3F3F3F"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -35,7 +35,6 @@ $disable_alert = (bool) get_parameter('disable_alert');
$enable_alert = (bool) get_parameter('enable_alert');
$get_actions_module = (bool) get_parameter('get_actions_module');
$show_update_action_menu = (bool) get_parameter('show_update_action_menu');
$get_agent_alerts_agent_view = (bool) get_parameter('get_agent_alerts_agent_view');
$resize_event_week = (bool) get_parameter('resize_event_week');
$get_agent_alerts_datatable = (bool) get_parameter('get_agent_alerts_datatable', 0);
$alert_validate = (bool) get_parameter('alert_validate', false);
@ -91,270 +90,6 @@ if ($get_agent_alerts_simple) {
}
if ($get_agent_alerts_agent_view) {
include_once $config['homedir'].'/include/functions_agents.php';
include_once $config['homedir'].'/operation/agentes/alerts_status.functions.php';
include_once $config['homedir'].'/include/functions_users.php';
$agent_a = check_acl($config['id_user'], 0, 'AR');
$agent_w = check_acl($config['id_user'], 0, 'AW');
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
$free_search_alert = get_parameter('free_search_alert', '');
$all_groups = json_decode(io_safe_output(get_parameter('all_groups')));
$idAgent = (int) get_parameter('id_agent');
$filter = get_parameter('filter', 'all_enabled');
$url = 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$idAgent;
$sortField = get_parameter('sort_field');
$sort = get_parameter('sort', 'none');
$selected = true;
$selectModuleUp = false;
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
$selectLastFiredUp = false;
$selectLastFiredDown = false;
switch ($sortField) {
case 'module':
switch ($sort) {
case 'up':
$selectModuleUp = $selected;
$order = [
'field' => 'agent_module_name',
'order' => 'ASC',
];
break;
case 'down':
$selectModuleDown = $selected;
$order = [
'field' => 'agent_module_name',
'order' => 'DESC',
];
break;
}
break;
case 'template':
switch ($sort) {
case 'up':
$selectTemplateUp = $selected;
$order = [
'field' => 'template_name',
'order' => 'ASC',
];
break;
case 'down':
$selectTemplateDown = $selected;
$order = [
'field' => 'template_name',
'order' => 'DESC',
];
break;
}
break;
case 'last_fired':
switch ($sort) {
case 'up':
$selectLastFiredUp = $selected;
$order = [
'field' => 'last_fired',
'order' => 'ASC',
];
break;
case 'down':
$selectLastFiredDown = $selected;
$order = [
'field' => 'last_fired',
'order' => 'DESC',
];
break;
}
break;
default:
$selectDisabledUp = '';
$selectDisabledDown = '';
$selectModuleUp = $selected;
$selectModuleDown = false;
$selectTemplateUp = false;
$selectTemplateDown = false;
$selectLastFiredUp = false;
$selectLastFiredDown = false;
$order = [
'field' => 'agent_module_name',
'order' => 'ASC',
];
break;
}
if ($free_search_alert != '') {
$whereAlertSimple = 'AND ('.'id_alert_template IN (
SELECT id
FROM talert_templates
WHERE name LIKE "%'.$free_search_alert.'%") OR '.'id_alert_template IN (
SELECT id
FROM talert_templates
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE "%'.$free_search_alert.'%")) OR '.'talert_template_modules.id IN (
SELECT id_alert_template_module
FROM talert_template_module_actions
WHERE id_alert_action IN (
SELECT id
FROM talert_actions
WHERE name LIKE "%'.$free_search_alert.'%")) OR '.'id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE nombre LIKE "%'.$free_search_alert.'%") OR '.'id_agent_module IN (
SELECT id_agente_modulo
FROM tagente_modulo
WHERE alias LIKE "%'.$free_search_alert.'%")'.')';
} else {
$whereAlertSimple = '';
}
// Add checks for user ACL.
$groups = users_get_groups($config['id_user'], $access);
$id_groups = array_keys($groups);
if (empty($id_groups)) {
$whereAlertSimple .= ' AND (1 = 0) ';
} else {
$whereAlertSimple .= sprintf(
' AND id_agent_module IN (
SELECT tam.id_agente_modulo
FROM tagente_modulo tam
WHERE tam.id_agente IN (
SELECT
ta.id_agente
FROM
tagente ta
WHERE
ta.id_grupo IN (%s)
)
OR tam.id_agente IN (
SELECT
DISTINCT(tasg.id_agent)
FROM
tagent_secondary_group tasg
WHERE
tasg.id_group IN (%s)
)
) ',
implode(',', $id_groups),
implode(',', $id_groups)
);
}
$alerts = [];
$filter_alert = [];
if ($filter_standby == 'standby_on') {
$filter_alert['disabled'] = $filter;
$filter_alert['standby'] = '1';
} else if ($filter_standby == 'standby_off') {
$filter_alert['disabled'] = $filter;
$filter_alert['standby'] = '0';
} else {
$filter_alert['disabled'] = $filter;
}
$options_simple = ['order' => $order];
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, false, false, $strict_user, $tag_filter);
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, false, true, $strict_user, $tag_filter);
// Urls to sort the table.
$url_up_module = $url.'&sort_field=module&sort=up';
$url_down_module = $url.'&sort_field=module&sort=down';
$url_up_template = $url.'&sort_field=template&sort=up';
$url_down_template = $url.'&sort_field=template&sort=down';
$url_up_lastfired = $url.'&sort_field=last_fired&sort=up';
$url_down_lastfired = $url.'&sort_field=last_fired&sort=down';
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->cellpadding = '0';
$table->cellspacing = '0';
$table->size = [];
$table->head = [];
$table->align = [];
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[7] = '5%';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$table->head[8] = __('Validate');
$table->align[8] = 'left';
$table->size[8] = '5%';
}
$table->head[0] = "<span title='".__('Policy')."'>".__('P.').'</span>';
$table->head[1] = "<span title='".__('Standby')."'>".__('S.').'</span>';
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$table->head[2] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
}
$table->head[3] = __('Module');
$table->head[4] = __('Template');
$table->head[5] = __('Action');
$table->head[6] = __('Last fired');
$table->head[7] = __('Status');
$table->align[7] = 'center';
$table->head[3] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
$table->head[4] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
} else {
$table->size[6] = '5%';
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
$table->head[7] = __('Validate');
$table->align[7] = 'left';
$table->size[7] = '5%';
}
$table->head[0] = "<span title='".__('Standby')."'>".__('S.').'</span>';
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
$table->head[1] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
}
$table->head[2] = __('Module');
$table->head[3] = __('Template');
$table->head[4] = __('Action');
$table->head[5] = __('Last fired');
$table->head[6] = __('Status');
$table->align[6] = 'center';
$table->head[2] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
$table->head[3] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[5] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
}
$table->data = [];
$rowPair = true;
$iterator = 0;
foreach ($alerts['alerts_simple'] as $alert) {
$row = ui_format_alert_row($alert, false, $url, 'font-size: 9pt;');
$table->data[] = $row;
}
if (empty($table->data) === false) {
html_print_table($table);
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts found') ]);
}
}
if ($enable_alert) {
if (! check_acl($config['id_user'], 0, 'LW')) {
db_pandora_audit(

View File

@ -92,6 +92,9 @@ $get_id_source_event = get_parameter('get_id_source_event');
$node_id = (int) get_parameter('node_id', 0);
$settings_modal = get_parameter('settings', 0);
$parameters_modal = get_parameter('parameters', 0);
// User private filter.
$current_filter = get_parameter('current_filter', 0);
$private_filter_event = get_parameter('private_filter_event', 0);
if ($get_comments === true) {
global $config;
@ -337,6 +340,14 @@ if ($save_event_filter) {
$values['custom_data'] = get_parameter('custom_data');
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
// Get private filter from user.
$private_filter = get_parameter_switch('private_filter_user', 0);
if ((int) $private_filter === 1) {
$values['private_filter_user'] = $config['id_user'];
} else {
$values['private_filter_user'] = null;
}
if (is_metaconsole() === true) {
$values['server_id'] = implode(',', get_parameter('server_id'));
}
@ -397,6 +408,17 @@ if ($update_event_filter) {
$values['custom_data'] = get_parameter('custom_data');
$values['custom_data_filter_type'] = get_parameter('custom_data_filter_type');
// Get private filter from user.
$private_filter = get_parameter('private_filter_user', 0);
$user_private_filter = events_get_event_filter($id);
if ((int) $private_filter === 1 && $user_private_filter['private_filter_user'] === null) {
$values['private_filter_user'] = $config['id_user'];
} else if ($private_filter === $user_private_filter['private_filter_user'] && $user_private_filter['private_filter_user'] !== $config['id_user']) {
$values['private_filter_user'] = $user_private_filter['private_filter_user'];
} else {
$values['private_filter_user'] = null;
}
if (is_metaconsole() === true) {
$values['server_id'] = implode(',', get_parameter('server_id'));
}
@ -712,8 +734,8 @@ if ($save_filter_modal) {
$table = new StdClass;
$table->id = 'save_filter_form';
$table->width = '100%';
$table->cellspacing = 4;
$table->cellpadding = 4;
$table->cellspacing = 5;
$table->cellpadding = 5;
$table->class = 'databox';
if (is_metaconsole() === true) {
$table->class = 'databox filters';
@ -732,7 +754,7 @@ if ($save_filter_modal) {
'filter_mode',
'new',
__('New filter'),
true,
((int) $current_filter === 0) ? true : false,
true
);
@ -740,7 +762,7 @@ if ($save_filter_modal) {
'filter_mode',
'update',
__('Update filter'),
false,
((int) $current_filter > 0) ? true : false,
true
);
@ -755,6 +777,7 @@ if ($save_filter_modal) {
$table->rowclass[2] = 'flex';
$table->rowclass[3] = 'flex';
$table->rowclass[4] = 'flex';
$table->rowclass[5] = 'flex';
$data[0] = '<b>'.__('Filter name').'</b>'.$jump;
$data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
if (is_metaconsole()) {
@ -801,9 +824,9 @@ if ($save_filter_modal) {
$data[0] .= html_print_select(
$_filters_update,
'overwrite_filter',
$current_filter,
'',
'',
'',
__('None'),
0,
true,
false,
@ -814,6 +837,31 @@ if ($save_filter_modal) {
$table->data[] = $data;
$table->rowclass[] = '';
$data = [];
$table->rowid[4] = 'update_filter_row2';
$table->data[] = $data;
$table->rowclass[] = '';
// Update user private filter.
$data = [];
$table->rowid[6] = 'private_filter_event_row1';
$data[0] = html_print_label_input_block(
__('Private'),
html_print_checkbox_switch(
'private_filter_event',
$private_filter_event,
$private_filter_event,
true,
false,
'checked_slide_events(this);',
true
)
);
$table->data[] = $data;
$table->rowclass[] = '';
html_print_table($table);
html_print_div(
@ -858,10 +906,19 @@ if ($save_filter_modal) {
?>
<script type="text/javascript">
function show_save_filter() {
$('#save_filter_row1').show();
$('#save_filter_row2').show();
$('#update_filter_row1').hide();
$('#button-update_filter').hide();
if ($('#hidden-id_filter_event').val() == 0) {
$('#save_filter_row1').show();
$('#save_filter_row2').show();
$('#update_filter_row1').hide();
$('#button-update_filter').hide();
} else {
$('#save_filter_row1').hide();
$('#save_filter_row2').hide();
$('#button-save_filter').hide();
$('#update_filter_row1').show();
$('#button-update_filter').show();
}
// Filter save mode selector
$("[name='filter_mode']").click(function() {
if ($(this).val() == 'new') {
@ -936,7 +993,8 @@ function save_new_filter() {
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val(),
"custom_data": $("#text-custom_data").val(),
"custom_data_filter_type": $("#custom_data_filter_type").val()
"custom_data_filter_type": $("#custom_data_filter_type").val(),
"private_filter_user": $("#checkbox-private_filter_event").val()
},
function (data) {
$("#info_box").hide();
@ -1015,7 +1073,8 @@ function save_update_filter() {
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val(),
"custom_data": $("#text-custom_data").val(),
"custom_data_filter_type": $("#custom_data_filter_type").val()
"custom_data_filter_type": $("#custom_data_filter_type").val(),
"private_filter_user": $("#checkbox-private_filter_event").val()
},
function (data) {

View File

@ -252,6 +252,18 @@ $hack_metaconsole = (is_metaconsole() === true) ? '../../' : '';
echo $chart->render(true);
break;
case 'line_graph':
$params['pdf'] = true;
$params['options']['width'] = '100%';
$params['options']['height'] = 200;
$chart = get_build_setup_charts(
'LINE',
$params['options'],
$params['chart_data']
);
echo $chart->render(true);
break;
case 'slicebar':
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);

View File

@ -621,7 +621,8 @@ class ConsoleSupervisor
'small_operation_step_datos_purge' => 'Small Operation Step to purge old data',
'row_limit_csv' => 'Row limit in csv log',
'limit_parameters_massive' => 'Limit for bulk operations',
'block_size' => 'Block size for pagination',
'block_size' => 'User block size for pagination',
'global_block_size' => 'Global block size for pagination',
'short_module_graph_data' => 'Data precision',
'graph_precision' => 'Data precision in graphs',
];
@ -635,8 +636,14 @@ class ConsoleSupervisor
$message = '';
$limit_value = '';
$url = '';
if ($config[$variable] > $values->max) {
$message = 'Check the setting of %s, a value greater than %s is not recommended';
if ($variable === 'block_size') {
$message .= '. (User: '.$config['id_user'].')';
}
$limit_value = $values->max;
}
@ -647,32 +654,39 @@ class ConsoleSupervisor
if ($limit_value !== '' && $message !== '') {
if (is_metaconsole() === true) {
$this->notify(
[
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
'title' => __('Incorrect config value'),
'message' => __(
$message,
$names[$variable],
$limit_value
),
'url' => '__url__index.php?sec=advanced&sec2=advanced/metasetup',
]
);
$url = '__url__index.php?sec=advanced&sec2=advanced/metasetup';
} else {
$this->notify(
[
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
'title' => __('Incorrect config value'),
'message' => __(
$message,
$names[$variable],
$limit_value
),
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup',
]
);
$url = '__url__/index.php?sec=general&sec2=godmode/setup/setup';
}
if ($variable === 'block_size') {
if (is_metaconsole() === true) {
$url = '__url__index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user='.$config['id_user'];
} else {
$url = '__url__/index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user='.$config['id_user'];
}
}
if ($variable === 'global_block_size') {
if (is_metaconsole() === true) {
$url = '__url__index.php?sec=advanced&sec2=advanced/metasetup&pure=0&tab=visual';
} else {
$url = '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup&section=vis';
}
}
$this->notify(
[
'type' => 'NOTIF.VARIABLES.PERFORMANCE.'.$variable,
'title' => __('Incorrect config value'),
'message' => __(
$message,
$names[$variable],
$limit_value
),
'url' => $url,
]
);
}
}

View File

@ -316,6 +316,8 @@ class Diagnostics extends Wizard
* Graph of the Free Disk Spool Dir module.
* Graph of the Free RAM module.
* Graph of the Queued Modules module.
* Graph of the Queued_Alerts.
* Graph of the Alert_Server_Status.
* Graph of the Status module.
* Graph of the System Load AVG module.
* Graph of the Execution Time module.
@ -333,52 +335,66 @@ class Diagnostics extends Wizard
$result = '';
if ($agentIdMasterServer !== 0) {
$agentMonitoring = [
'chartAgentsUnknown' => [
'chartAgentsUnknown' => [
'title' => __(
'Graph of the Agents Unknown module.'
),
'nameModule' => 'Agents_Unknown',
'idAgent' => $agentIdMasterServer,
],
'chartDatabaseMain' => [
'chartDatabaseMain' => [
'title' => __(
'Graph of the Database Maintenance module.'
),
'nameModule' => 'Database&#x20;Maintenance',
'idAgent' => $agentIdMasterServer,
],
'chartFreeDiskSpoolDir' => [
'chartFreeDiskSpoolDir' => [
'title' => __(
'Graph of the Free Disk Spool Dir module.'
),
'nameModule' => 'FreeDisk_SpoolDir',
'idAgent' => $agentIdMasterServer,
],
'chartFreeRAM' => [
'chartFreeRAM' => [
'title' => __('Graph of the Free RAM module.'),
'nameModule' => 'Free_RAM',
'idAgent' => $agentIdMasterServer,
],
'chartQueuedModules' => [
'chartQueuedModules' => [
'title' => __(
'Graph of the Queued Modules module.'
),
'nameModule' => 'Queued_Modules',
'idAgent' => $agentIdMasterServer,
],
'chartStatus' => [
'chartQueuedAlerts' => [
'title' => __(
'Graph of the Queued Alerts total.'
),
'nameModule' => 'Queued_Alerts',
'idAgent' => $agentIdMasterServer,
],
'chartAlertServerStatus' => [
'title' => __(
'Graph of the Alert Server Status.'
),
'nameModule' => 'Alert_Server_Status',
'idAgent' => $agentIdMasterServer,
],
'chartStatus' => [
'title' => __('Graph of the Status module.'),
'nameModule' => 'Status',
'idAgent' => $agentIdMasterServer,
],
'chartSystemLoadAVG' => [
'chartSystemLoadAVG' => [
'title' => __(
'Graph of the System Load AVG module.'
),
'nameModule' => 'System_Load_AVG',
'idAgent' => $agentIdMasterServer,
],
'chartExecutionTime' => [
'chartExecutionTime' => [
'title' => __(
'Graph of the Execution Time module.'
),

View File

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

View File

@ -2774,7 +2774,6 @@ function agents_delete_agent($id_agents, $disableACL=false)
enterprise_include_once('include/functions_agents.php');
enterprise_hook('agent_delete_from_cache', [$id_agent]);
// Delete agent from fav menu.
db_process_sql_delete(
'tfavmenu_user',

View File

@ -2573,6 +2573,10 @@ function config_process_config()
'max' => 200,
'min' => 10,
],
'global_block_size' => [
'max' => 200,
'min' => 10,
],
'short_module_graph_data' => [
'max' => 20,
'min' => 1,

View File

@ -2567,6 +2567,10 @@ function db_get_column_type(string $table, string $column='')
*/
function db_validate_sql(string $sql, $server=false)
{
if ($server == 0) {
$server = false;
}
if ($server !== false && is_metaconsole() === true) {
$setup = metaconsole_get_connection($server);
if (metaconsole_connect($setup) !== NOERR) {

View File

@ -3357,7 +3357,7 @@ function events_get_event_filter_select($manage=true)
}
$sql = '
SELECT id_filter, id_name
SELECT id_filter, id_name, private_filter_user
FROM tevent_filter
WHERE id_group_filter IN (0, '.implode(',', array_keys($user_groups)).')';
@ -3368,7 +3368,20 @@ function events_get_event_filter_select($manage=true)
} else {
$result = [];
foreach ($event_filters as $event_filter) {
$result[$event_filter['id_filter']] = $event_filter['id_name'];
$permission = users_is_admin($config['id_user']);
if ($permission || $event_filter['private_filter_user'] === $config['id_user']) {
if ($event_filter['private_filter_user'] !== null) {
$filter_name = $event_filter['id_name'].' (P)';
} else {
$filter_name = $event_filter['id_name'];
}
$result[$event_filter['id_filter']] = $filter_name;
}
if ($event_filter['private_filter_user'] === null) {
$result[$event_filter['id_filter']] = $event_filter['id_name'];
}
}
}

View File

@ -947,6 +947,57 @@ function reporting_make_reporting_data(
);
break;
case 'top_n_agents_sh':
$report['contents'][] = reporting_top_n_agents_sh(
$report,
$content
);
break;
case 'top_n_checks_failed':
$report['contents'][] = reporting_top_n_checks_failed(
$report,
$content
);
break;
case 'top_n_categories_checks':
$report['contents'][] = reporting_top_n_categories_checks(
$report,
$content
);
break;
case 'vul_by_cat':
$report['contents'][] = reporting_vul_by_categories(
$report,
$content,
$type
);
break;
case 'list_checks':
$report['contents'][] = reporting_list_checks(
$report,
$content
);
break;
case 'scoring':
$report['contents'][] = reporting_scoring(
$report,
$content
);
break;
case 'evolution':
$report['contents'][] = reporting_evolution_hardening(
$report,
$content,
$type
);
break;
default:
// Default.
break;

View File

@ -479,6 +479,34 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
case 'ncm':
reporting_html_ncm_config($table, $item);
break;
case 'top_n_agents_sh':
reporting_html_top_n_agents_sh($table, $item);
break;
case 'top_n_checks_failed':
reporting_html_top_n_checks_failed($table, $item);
break;
case 'top_n_categories_checks':
reporting_html_top_n_categories_checks($table, $item);
break;
case 'vul_by_cat':
reporting_vul_by_cat_graph($table, $item);
break;
case 'list_checks':
reporting_html_list_checks($table, $item);
break;
case 'scoring':
reporting_html_scoring($table, $item);
break;
case 'evolution':
reporting_evolution_graph($table, $item);
break;
}
if ($item['type'] == 'agent_module') {
@ -494,6 +522,280 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust
}
/**
* Function to print the security hardening evolution.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_evolution_graph($table, $item)
{
$table->rowclass[0] = '';
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
/**
* Function to print the agents scoring.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_scoring($table, $item, $pdf=0)
{
global $config;
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->width = '99%';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Date').'</b>';
$table1->head[1] = '<b>'.__('Agent').'</b>';
$table1->head[2] = '<b>'.__('Score').'</b>';
$row = 1;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][1] = date($config['date_format'], $check['date']);
$table1->data[$row][2] = $check['agent'];
$table1->data[$row][3] = $check['scoring'].' %';
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML checks filtered by agent and category.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_list_checks($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 4;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Id').'</b>';
$table1->head[1] = '<b>'.__('Title').'</b>';
$table1->head[2] = '<b>'.__('Category').'</b>';
$table1->head[3] = '<b>'.__('Status').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][0] = $check['id'];
$table1->data[$row][1] = $check['title'];
$table1->data[$row][2] = $check['category'];
$table1->data[$row][3] = $check['status'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top checks failed by category
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_categories_checks($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Id').'</b>';
$table1->head[1] = '<b>'.__('Category').'</b>';
$table1->head[2] = '<b>'.__('Total Failed').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][0] = $check['id'];
$table1->data[$row][1] = $check['category'];
$table1->data[$row][2] = $check['total'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top checks failed.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_checks_failed($table, $item, $pdf=0)
{
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->width = '99%';
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[2] = 'text-align: left';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->headstyle[1] = 'width: 10%; text-align: center;';
$table1->style[2] = 'text-align: center;';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Title').'</b>';
$table1->head[1] = '<b>'.__('Total Failed').'</b>';
$table1->head[2] = '<b>'.__('Description').'</b>';
$row = 2;
foreach ($item['data'] as $key => $check) {
$table1->data[$row][1] = $check['title'];
$table1->data[$row][2] = $check['total'];
$table1->data[$row][3] = $check['description'];
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table1, true);
}
}
/**
* Function to print HTML top categories in graph.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
*
* @return void
*/
function reporting_vul_by_cat_graph($table, $item)
{
$table->rowclass[0] = '';
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
}
/**
* Function to print HTML top n agents from security hardening.
*
* @param object $table Head table or false if it comes from pdf.
* @param array $item Items data.
* @param boolean $pdf If it comes from pdf.
*
* @return string
*/
function reporting_html_top_n_agents_sh($table, $item, $pdf=0)
{
global $config;
$table->width = '99%';
$table->styleTable = 'border: 0px;';
$table->colspan[2][0] = 3;
$table1 = new stdClass();
$table1->headstyle = [];
$table1->width = '99%';
$table1->class = 'info_table';
$table1->titleclass = 'title_table_pdf';
$table1->rowclass[0] = '';
$table1->head[0] = '<b>'.__('Agent').'</b>';
$table1->head[1] = '<b>'.__('Last audit scan').'</b>';
$table1->head[2] = '<b>'.__('Score').'</b>';
$row = 2;
foreach ($item['data'] as $key => $agent) {
$table1->data[$row][0] = $agent['alias'];
$table1->data[$row][1] = date($config['date_format'], $agent['utimestamp']);
$table1->data[$row][2] = $agent['datos'].' %';
$row++;
}
if ($pdf === 1) {
$table1->title = $item['title'];
$table1->titleclass = 'title_table_pdf';
$table1->titlestyle = 'text-align:left;';
}
$table->data[2][0] = html_print_table($table1, true);
if ($pdf === 1) {
return html_print_table($table, true);
}
}
/**
* Function to print to HTML SLA report.
*

View File

@ -968,6 +968,43 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Network configuration changes'),
];
if (enterprise_installed() === true) {
$types['top_n_agents_sh'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N agents with the worst score'),
];
$types['top_n_checks_failed'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N most frequent failed checks'),
];
$types['top_n_categories_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('Top-N checks failed by category'),
];
$types['vul_by_cat'] = [
'optgroup' => __('Security hardening'),
'name' => __('Vulnerabilities by category'),
];
$types['list_checks'] = [
'optgroup' => __('Security hardening'),
'name' => __('List of checks'),
];
$types['scoring'] = [
'optgroup' => __('Security hardening'),
'name' => __('Scoring by date'),
];
$types['evolution'] = [
'optgroup' => __('Security hardening'),
'name' => __('Evolution'),
];
}
return $types;
}

View File

@ -609,12 +609,20 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
$tag = 'span';
}
if (empty($option['style']) === true) {
$style = 'class="'.($option['class'] ?? 'nowrap').'"';
if (empty($option['class']) === false) {
$class = 'class="nowrap '.$option['class'].'"';
} else {
$style = 'style="'.$option['style'].'"';
$class = 'class="nowrap"';
}
if (empty($option['style']) === false) {
$style = 'style="'.$option['style'].'"';
} else {
$style = 'style=""';
}
$style .= ' '.$class;
if (empty($option['prominent']) === false) {
$prominent = $option['prominent'];
} else {
@ -1486,32 +1494,34 @@ function ui_format_alert_row(
$actionText .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true);
// Is possible manage actions if have LW permissions in the agent group of the alert module.
if (check_acl($config['id_user'], $id_group, 'LM')) {
$actionText .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&delete_action=1&id_alert='.$alert['id'].'&id_agent='.$agente['alias'].'&id_action='.$action['original_id'].'" onClick="if (!confirm(\' '.__('Are you sure you want to delete alert action?').'\')) return false;">'.html_print_image(
'images/delete.svg',
true,
[
'alt' => __('Delete action'),
'title' => __('Delete action'),
'class' => 'main_menu_icon invert_filter vertical_baseline',
]
).'</a>';
}
if (is_metaconsole() === true) {
if (check_acl($config['id_user'], $id_group, 'LM')) {
$actionText .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&delete_action=1&id_alert='.$alert['id'].'&id_agent='.$agente['alias'].'&id_action='.$action['original_id'].'" onClick="if (!confirm(\' '.__('Are you sure you want to delete alert action?').'\')) return false;">'.html_print_image(
'images/delete.svg',
true,
[
'alt' => __('Delete action'),
'title' => __('Delete action'),
'class' => 'main_menu_icon invert_filter vertical_baseline',
]
).'</a>';
}
if (check_acl($config['id_user'], $id_group, 'LW')) {
$actionText .= html_print_input_image(
'update_action',
'/images/edit.svg',
1,
'padding:0px;',
true,
[
'title' => __('Update action'),
'class' => 'main_menu_icon invert_filter',
'onclick' => 'show_display_update_action(\''.$action['original_id'].'\',\''.$alert['id'].'\',\''.$alert['id_agent_module'].'\',\''.$action['original_id'].'\',\''.$alert['agent_name'].'\')',
]
);
$actionText .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
if (check_acl($config['id_user'], $id_group, 'LW')) {
$actionText .= html_print_input_image(
'update_action',
'/images/edit.svg',
1,
'padding:0px;',
true,
[
'title' => __('Update action'),
'class' => 'main_menu_icon invert_filter',
'onclick' => 'show_display_update_action(\''.$action['original_id'].'\',\''.$alert['id'].'\',\''.$alert['id_agent_module'].'\',\''.$action['original_id'].'\',\''.$alert['agent_name'].'\')',
]
);
$actionText .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
}
}
$actionText .= '<div id="update_action-div-'.$alert['id'].'" class="invisible">';

View File

@ -515,6 +515,26 @@ function line_graph(
$chart_data,
$options
) {
if (empty($chart_data) === true) {
if (isset($options['ttl']) === true
&& (int) $options['ttl'] === 2
) {
$options['base64'] = true;
}
return graph_nodata_image($options);
}
if (isset($options['ttl']) === true && (int) $options['ttl'] === 2) {
$params = [
'chart_data' => $chart_data,
'options' => $options,
'return_img_base_64' => true,
];
return generator_chart_to_pdf('line_graph', $params);
}
$chart = get_build_setup_charts('LINE', $options, $chart_data);
return $chart->render(true, true);
}

View File

@ -256,7 +256,7 @@ class InventoryWidget extends Widget
'arguments' => [
'name' => 'free_search',
'type' => 'text',
'class' => 'w100p',
'class' => 'w96p',
'input_class' => 'flex-row',
'value' => $values['freeSearch'],
'return' => true,
@ -612,7 +612,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -642,8 +642,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -666,8 +666,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
);
}
@ -682,7 +682,10 @@ class InventoryWidget extends Widget
'',
'',
false,
false
false,
'',
'white-box-content',
'box-flat white_table_graph w96p'
);
}
} else {
@ -729,7 +732,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -759,8 +762,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -782,8 +785,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
);
}
@ -895,7 +898,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -925,8 +928,8 @@ class InventoryWidget extends Widget
true,
true,
'',
'white-box-content w100p',
'box-shadow white_table_graph w100p',
'white-box-content w96p',
'box-shadow white_table_graph w96p',
'images/arrow_down_green.png',
'images/arrow_right_green.png',
false,
@ -947,7 +950,10 @@ class InventoryWidget extends Widget
'',
'',
false,
false
false,
'',
'white-box-content',
'box-flat white_table_graph w96p'
);
}
} else {
@ -986,7 +992,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -1022,7 +1028,7 @@ class InventoryWidget extends Widget
$table = ui_print_datatable(
[
'id' => $id_table,
'class' => 'info_table w100p',
'class' => 'info_table w96p',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $columns,
@ -1049,7 +1055,7 @@ class InventoryWidget extends Widget
$id_agente = $inventory_id_agent;
$agentes = [];
$data = [];
$class = 'info_table w100p';
$class = 'info_table w96p';
$style = 'width: 100%; font-size: 100px !important;';
$ordering = true;
$searching = false;

View File

@ -5089,7 +5089,7 @@ div#dialog_messages table th:last-child {
position: absolute;
cursor: pointer;
top: 5px;
left: 0;
left: 5px;
right: 0;
bottom: 0;
background-color: #ccc;

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'>
<?php
$version = '7.0NG.773.3';
$build = '230915';
$build = '230920';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -349,12 +349,6 @@ if (is_metaconsole() === true) {
}
}
$alert_action = empty(alerts_get_alert_actions_filter()) === false
? alerts_get_alert_actions_filter()
: ['' => __('No actions')];
ob_start();
if ($agent_view_page === true) {

View File

@ -201,6 +201,10 @@ $search_recursive_groups = get_parameter(
'filter[search_recursive_groups]',
($filter['search_recursive_groups'] ?? '')
);
$search_recursive_groups = get_parameter(
'filter[private_filter_event]',
($filter['private_filter_event'] ?? '')
);
$id_group_filter = get_parameter(
'filter[id_group_filter]',
($filter['id_group'] ?? '')
@ -1334,6 +1338,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false
$filter_only_alert = $filter['filter_only_alert'];
$search_secondary_groups = ($filter['search_secondary_groups'] ?? 0);
$private_filter_event = ($filter['private_filter_user'] ?? 0);
$search_recursive_groups = ($filter['search_recursive_groups'] ?? 0);
$id_group_filter = $filter['id_group_filter'];
$date_from = $filter['date_from'];
@ -1886,6 +1891,9 @@ if (enterprise_hook(
* Load filter form.
*/
// User private filter process.
$inputs[] = html_print_input_hidden('id_filter_event', $load_filter_id, true);
// Group.
if ($id_group === null) {
$id_group = 0;
@ -1919,7 +1927,7 @@ $data = html_print_checkbox_switch(
$in_group = '<div class="display-initial">';
$in_group .= $data;
$in_group .= '<label class="vert-align-bottom pdd_r_20px">';
$in_group .= '<label class="vert-align-bottom pdd_r_15px">';
$in_group .= __('Group recursion');
$in_group .= ui_print_help_tip(
__('WARNING: This could cause a performace impact.'),
@ -2070,6 +2078,8 @@ $in = '<div class="filter_input"><label>'.__('Severity').'</label>';
$in .= $data.'</div>';
$inputs[] = $in;
// User private filter.
$inputs[] = html_print_input_hidden('private_filter_event', $private_filter_event, true);
// Trick view in table.
$inputs[] = '<div class="w100p pdd_t_15px"></div>';
@ -3363,7 +3373,8 @@ $(document).ready( function() {
data: {
page: 'include/ajax/events',
save_filter_modal: 1,
current_filter: $('#latest_filter_id').val()
current_filter: $('#hidden-id_filter_event').val(),
private_filter_event: $('#hidden-private_filter_event').val()
},
success: function (data){
$('#save-modal-filter')

View File

@ -97,29 +97,12 @@ $filename = (string) get_parameter('filename');
$date_mode = get_parameter('date_mode', 'none');
$period = null;
switch ($date_mode) {
case 'none':
case 'end_time':
// Get different date to search the report.
$date = (string) get_parameter('date', date('Y-m-j'));
$time = (string) get_parameter('time', date('h:iA'));
break;
case 'init_and_end_time':
// Get different date to search the report.
$date = (string) get_parameter('date', date('Y-m-j'));
$time = (string) get_parameter('time', date('h:iA'));
// Calculations in order to modify init date of the report
$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date('Y-m-j', $date_init_less));
$time_init = get_parameter('time_init', date('h:iA'));
$datetime_init = strtotime($date_init.' '.$time_init);
$period = (strtotime($date.' '.$time) - $datetime_init);
break;
$date_init = get_parameter('date_init', '');
if (empty($date_init) === false) {
$date_end = get_parameter('date_end', time());
$period = ($date_end - $date_init);
$date = date('Y-m-d', $date_end);
$time = date('H:i:s', $date_end);
}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 230915
%define release 230920
# User and Group under which Apache is running
%define httpd_name httpd
@ -23,7 +23,7 @@ Group: Productivity/Networking/Web/Utilities
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /var/www/html
BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch
BuildArch: x86_64
AutoReq: 0
Requires: %{httpd_name} >= 2.0.0
Requires: php >= 8.0
@ -109,3 +109,5 @@ fi
%{prefix}/pandora_console
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console
%attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console
%defattr(0744,%{httpd_user},%{httpd_group},0755)
%{prefix}/pandora_console/attachment/discovery

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.773.3
%define release 230915
%define release 230920
# User and Group under which Apache is running
%define httpd_name httpd
@ -23,7 +23,7 @@ Group: Productivity/Networking/Web/Utilities
Packager: Sancho Lerena <slerena@artica.es>
Prefix: /opt/rh/httpd24/root/var/www/html
BuildRoot: %{_tmppath}/%{name}
BuildArch: noarch
BuildArch: x86_64
AutoReq: 0
Requires: httpd24-httpd
Requires: httpd24-mod_php >= 7.2
@ -93,3 +93,5 @@ fi
%{prefix}/pandora_console
%config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console
%attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console
%defattr(0744,%{httpd_user},%{httpd_group},0755)
%{prefix}/pandora_console/attachment/discovery

View File

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

View File

@ -1312,6 +1312,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`custom_data` VARCHAR(500) DEFAULT '',
`custom_data_filter_type` TINYINT UNSIGNED DEFAULT 0,
`owner_user` TEXT,
`private_filter_user` TEXT,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
@ -1684,6 +1685,9 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`macros_definition` TEXT,
`render_definition` TEXT,
`use_prefix_notation` TINYINT UNSIGNED NOT NULL DEFAULT 1,
`cat_security_hardening` INT NOT NULL DEFAULT 0,
`ignore_skipped` INT NOT NULL DEFAULT 0,
`status_of_check` TINYTEXT,
PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,7 @@ use POSIX qw(strftime);
use PandoraFMS::DB;
use constant DATASERVER => 0;
use constant ALERTSERVER => 21;
use Scalar::Util qw(looks_like_number);
@ -159,6 +160,18 @@ sub pandora_self_monitoring ($$) {
if (!defined($queued_modules)) {
$queued_modules = 0;
}
my $queued_alerts = get_db_value ($dbh, "SELECT count(id) FROM talert_execution_queue");
if (!defined($queued_alerts)) {
$queued_alerts = 0;
}
my $alert_server_status = get_db_value ($dbh, "SELECT status FROM tserver WHERE server_type = ?", ALERTSERVER);
if (!defined($alert_server_status || $alert_server_status eq "") ) {
$alert_server_status = 0;
}
my $dbmaintance;
if ($RDBMS eq 'postgresql') {
@ -193,7 +206,19 @@ sub pandora_self_monitoring ($$) {
$xml_output .=" <type>generic_data</type>\n";
$xml_output .=" <data>$queued_modules</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>\n";
$xml_output .=" <name>Queued_Alerts</name>\n";
$xml_output .=" <type>generic_data</type>\n";
$xml_output .=" <data>$queued_alerts</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>\n";
$xml_output .=" <name>Alert_Server_Status</name>\n";
$xml_output .=" <type>generic_proc</type>\n";
$xml_output .=" <data>$alert_server_status</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>\n";
$xml_output .=" <name>Agents_Unknown</name>\n";
$xml_output .=" <type>generic_data</type>\n";

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.773.3-230915
Version: 7.0NG.773.3-230920
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.773.3-230915"
pandora_version="7.0NG.773.3-230920"
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.773.3";
my $pandora_build = "230915";
my $pandora_build = "230920";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -127,6 +127,7 @@ use JSON qw(decode_json encode_json);
use MIME::Base64;
use Text::ParseWords;
use Math::Trig; # Math functions
use constant ALERTSERVER => 21;
# Debugging
#use Data::Dumper;
@ -6137,6 +6138,18 @@ sub pandora_self_monitoring ($$) {
if (!defined($queued_modules)) {
$queued_modules = 0;
}
my $queued_alerts = get_db_value ($dbh, "SELECT count(id) FROM talert_execution_queue");
if (!defined($queued_alerts)) {
$queued_alerts = 0;
}
my $alert_server_status = get_db_value ($dbh, "SELECT status FROM tserver WHERE server_type = ?", ALERTSERVER);
if (!defined($alert_server_status) || $alert_server_status eq "") {
$alert_server_status = 0;
}
my $pandoradb = 0;
my $pandoradb_tstamp = get_db_value ($dbh, "SELECT `value` FROM tconfig WHERE token = 'db_maintance'");
@ -6163,6 +6176,18 @@ sub pandora_self_monitoring ($$) {
$xml_output .=" <type>generic_data</type>";
$xml_output .=" <data>$queued_modules</data>";
$xml_output .=" </module>";
$xml_output .=" <module>\n";
$xml_output .=" <name>Queued_Alerts</name>\n";
$xml_output .=" <type>generic_data</type>\n";
$xml_output .=" <data>$queued_alerts</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>\n";
$xml_output .=" <name>Alert_Server_Status</name>\n";
$xml_output .=" <type>generic_proc</type>\n";
$xml_output .=" <data>$alert_server_status</data>\n";
$xml_output .=" </module>\n";
$xml_output .=" <module>";
$xml_output .=" <name>Agents_Unknown</name>";

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.773.3";
my $pandora_build = "230915";
my $pandora_build = "230920";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.773.3
%define release 230915
%define release 230920
Summary: Pandora FMS Server
Name: %{name}
@ -18,7 +18,7 @@ Group: System/Monitoring
Packager: Sancho Lerena <slerena@artica.es>
Prefix: %{_datadir}
BuildRoot: %{_tmppath}/%{name}-buildroot
BuildArchitectures: noarch
BuildArchitectures: x86_64
AutoReq: 0
Provides: %{name}-%{version}
Requires(pre): shadow-utils
@ -59,6 +59,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/netflow
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/sflow
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/trans
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/commands
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/
mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf.d/
@ -68,6 +69,23 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pandora/.ssh
mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/
# Copy open discovery plugins to data_in
if [ -d "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery" ]; then
echo ">Installing the open discovery scripts to $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery..."
for disco_folder in $(ls "discovery/"); do
if [ -d "discovery/"$disco_folder ]; then
if [ -d "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder" ]; then
rm -Rf "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
fi
cp -Rf "discovery/"$disco_folder "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
chmod -R 770 "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder"
fi
done
else
echo ">ERROR: Failed to copy open discovery scripts to $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery - Folder not found"
fi
# All binaries go to %{_bindir}
cp -aRf bin/pandora_server $RPM_BUILD_ROOT%{_bindir}/
cp -aRf bin/pandora_exec $RPM_BUILD_ROOT%{_bindir}/

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.773.3
%define release 230915
%define release 230920
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.773.3"
PI_BUILD="230915"
PI_BUILD="230920"
MODE=$1
if [ $# -gt 1 ]; then
@ -341,6 +341,23 @@ install () {
chown apache:$GROUPNAME $DESTDIR$PANDORA_SPOOL/data_in/customer_key 2>/dev/null
# Copy open discovery plugins to data_in
if [ -d "$DESTDIR$PANDORA_SPOOL/data_in/discovery" ]; then
echo ">Installing the open discovery scripts to $DESTDIR$PANDORA_SPOOL/data_in/discovery..."
for disco_folder in $(ls "discovery/"); do
if [ -d "discovery/"$disco_folder ]; then
if [ -d "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder" ]; then
rm -Rf "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
fi
cp -Rf "discovery/"$disco_folder "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
chmod -R 770 "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder"
fi
done
else
echo ">ERROR: Failed to copy open discovery scripts to $DESTDIR$PANDORA_SPOOL/data_in/discovery/discovery - Folder not found"
fi
echo "Creating setup directory in $PANDORA_CFG_DIR"
mkdir -p $DESTDIR$PANDORA_CFG_DIR 2> /dev/null
if [ -f "$DESTDIR$PANDORA_CFG_FILE" ]

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.773.3 Build 230915";
my $version = "7.0NG.773.3 Build 230920";
# 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.773.3 Build 230915";
my $version = "7.0NG.773.3 Build 230920";
# save program name for logging
my $progname = basename($0);

View File

@ -2,7 +2,7 @@
################################################################################
#
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
# Copyright (c) 2007-2023 Pandora FMS.
# Copyright (c) 2007-2023 Pandora FMS.
#
# tentacle_client.pl Tentacle Client. See https://pandorafms.com/docs/ for
# protocol description.
@ -1095,7 +1095,7 @@ Protocol description and more info at: L<< https://pandorafms.com/manual/en/docu
=head1 COPYRIGHT
Copyright (c) 2005-2023 Pandora FMS.
Copyright (c) 2005-2010 Artica Soluciones Tecnologicas S.L
=cut