Merge branch 'develop' into ent-12249-vista-de-seguridad-por-agentes

This commit is contained in:
Daniel Cebrian 2023-11-08 16:16:40 +01:00
commit 9fe85f3425
56 changed files with 544 additions and 252 deletions

View File

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

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

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define version 7.0NG.774
%define release 231108
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -4,8 +4,8 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.773.3
%define release 230919
%define version 7.0NG.774
%define release 231108
%define debug_package %{nil}
Summary: Pandora FMS Linux agent, binary version

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux
%define version 7.0NG.774
%define release 231107
%define release 231108
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.774
%define release 231107
%define release 231108
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.774"
PI_BUILD="231107"
PI_BUILD="231108"
OS_NAME=`uname -s`
FORCE=0

View File

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

View File

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

View File

@ -1387,7 +1387,7 @@ $table_advanced->data['made_enabled'][0] = html_print_checkbox_switch(
'made_enabled',
1,
(bool) $made_enabled,
false,
true,
false,
'',
false,

View File

@ -571,6 +571,7 @@ if (!$maps && is_metaconsole() === false) {
}
if ($maps || is_metaconsole() === true) {
$buttons = '';
if ($vconsoles_write || $vconsoles_manage) {
if (is_metaconsole() === false) {
$actionUrl = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder';
@ -578,20 +579,22 @@ if ($maps || is_metaconsole() === true) {
$actionUrl = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&action2=new&operation=new_visualmap&tab=data&pure='.$pure;
}
echo '<form action="'.$actionUrl.'" method="post">';
html_print_input_hidden('edit_layout', 1);
$buttons .= '<form action="'.$actionUrl.'" method="post">';
$buttons .= html_print_input_hidden('edit_layout', 1, true);
html_print_action_buttons(
html_print_submit_button(
$buttons .= html_print_submit_button(
__('Create'),
'',
false,
[ 'icon' => 'next'],
true
),
[ 'right_content' => $tablePagination ]
);
echo '</form>';
$buttons .= '</form>';
}
html_print_action_buttons(
$buttons,
[ 'right_content' => $tablePagination ]
);
}

View File

@ -2129,6 +2129,15 @@ $table_other->data[$row][] = html_print_label_input_block(
__('Data multiplier to use in graphs/data'),
html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false)
);
$table_other->data[$row][] = html_print_label_input_block(
__('Hide general stats for non admin users in tactical view'),
html_print_checkbox_switch(
'disable_general_statistics',
1,
$config['disable_general_statistics'],
true
)
);
$row++;
/*

View File

@ -33,8 +33,6 @@ check_login();
require_once $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\Dashboard\Manager;
require_once $config['homedir'].'/include/functions_profile.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_groups.php';
@ -1376,72 +1374,6 @@ if (is_metaconsole() === true) {
);
}
$values = [
-1 => __('Use global conf'),
1 => __('Yes'),
0 => __('No'),
];
$home_screen = '<div class="label_select"><p class="edit_user_labels">'.__('Home screen').ui_print_help_tip(
__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'),
true
).'</p>';
$dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$id_usr
);
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];
} else {
foreach ($dashboards as $key => $dashboard) {
$dashboards_aux[$dashboard['id']] = $dashboard['name'];
}
}
$home_screen .= '<div id="show_db" style="display: none; width: 100%;">';
$home_screen .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
$home_screen .= '</div>';
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
$home_screen .= '<div id="show_vc" style="display: none; width: 100%;">';
$home_screen .= html_print_select(
$layouts_aux,
'visual_console',
$user_info['data_section'],
'',
'',
'',
true
);
$home_screen .= '</div>';
$home_screen .= html_print_input_text(
'data_section',
$user_info['data_section'],
'',
60,
255,
true,
false
);
$home_screen = '';
$size_pagination = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Block size for pagination').'</p>';
$size_pagination .= html_print_input_text(
'block_size',
@ -2078,17 +2010,20 @@ if (is_metaconsole() === false) {
}
function show_data_section() {
var $section = $("#section").val();
var $allElements = $('div[id^="custom_home_screen_"]');
var $elementSelected = $('div[id="custom_home_screen_' + $section + '"]');
var section = $("#section").val();
if(section === 'other'){
section = 'external_link';
}
var allElements = $('div[id^="custom_home_screen_"]');
var elementSelected = $('div[id="custom_home_screen_' + section + '"]');
// Hide all elements.
$allElements.each(function() {
allElements.each(function() {
$(this).addClass('invisible');
$(this).children().addClass('invisible');
})
// Show only the selected.
$elementSelected.removeClass('invisible');
$elementSelected.children().removeClass('invisible');
elementSelected.removeClass('invisible');
elementSelected.children().removeClass('invisible');
}
function switch_ehorus_conf() {

View File

@ -26,6 +26,8 @@
* ============================================================================
*/
use PandoraFMS\Dashboard\Manager;
// Load global vars.
global $config;
@ -45,16 +47,75 @@ $homeScreenValues = [
HOME_SCREEN_DASHBOARD => __('Dashboard'),
];
$dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$id_usr
);
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];
} else {
foreach ($dashboards as $key => $dashboard) {
$dashboards_aux[$dashboard['id']] = $dashboard['name'];
}
}
// Custom Home Screen controls.
$customHomeScreenAddition = [];
// Home screen. Dashboard.
$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
// Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
$dashboards_aux,
'dashboard',
$user_info['data_section'],
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
);
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select(
$layouts_aux,
'visual_console',
$user_info['data_section'],
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
);
// Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text(
'data_section',
$user_info['data_section'],
'',
60,
255,
true
);
$customHomeScreenDataField = '';
foreach ($customHomeScreenAddition as $key => $customField) {
$customHomeScreenDataField .= html_print_div(
@ -576,7 +637,7 @@ $userManagementTable->data['fields_autorefreshTime'][0] .= ui_print_input_placeh
true
);
// eHorus conf
// EHorus conf.
if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) {
$userManagementTable->data['captions_ehorus_user_level_enabled'][1] = __('Pandora RC user access enabled');
$userManagementTable->data['fields_ehorus_user_level_enabled'][1] = html_print_checkbox_switch(
@ -791,7 +852,7 @@ $userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
5,
65,
$user_info['comments'],
($view_mode ? 'readonly="readonly"' : ''),
($view_mode) ? 'readonly="readonly"' : '',
true,
''
);
@ -945,15 +1006,7 @@ $(document).ready(function () {
$('#advanced-line1_looknfeel-1 > a').css('display', 'block');
})
var ehorus_user_level_enabled =
<?php
if (isset($user_info['ehorus_user_level_enabled']) === true) {
echo $user_info['ehorus_user_level_enabled'];
} else {
echo 0;
}
?>
;
var ehorus_user_level_enabled = '<?php echo (isset($user_info['ehorus_user_level_enabled']) === true) ? $user_info['ehorus_user_level_enabled'] : 0; ?>';
var chk_ehorus_user_level_enabled = ehorus_user_level_enabled;
if (ehorus_user_level_enabled == 0) {

View File

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

View File

@ -22,7 +22,7 @@ require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby=-1, $acl=false, $total=false, $id_agent=0)
function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby=-1, $acl=false, $total=false, $id_agent=0, $only_enabled=false)
{
$sql = '';
$alerts = [];
@ -121,6 +121,10 @@ function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby
// Only enabled agent.
$sql .= ' AND t3.disabled = 0';
if ($only_enabled === true) {
$sql .= ' AND t0.disabled = 0';
}
$row_alerts = db_get_all_rows_sql($sql);
if ($total) {

View File

@ -1572,6 +1572,10 @@ function config_update_config()
$error_update[] = __('Use data multiplier');
}
if (config_update_value('disable_general_statistics', get_parameter('disable_general_statistics', 0), true) === false) {
$error_update[] = __('Hide general stats for non admin users in tactical view');
}
if (config_update_value('decimal_separator', (string) get_parameter('decimal_separator', '.'), true) === false) {
$error_update[] = __('Decimal separator');
} else {
@ -3711,6 +3715,10 @@ function config_process_config()
config_update_value('use_data_multiplier', '1');
}
if (!isset($config['disable_general_statistics'])) {
config_update_value('disable_general_statistics', 0);
}
if (!isset($config['command_snapshot'])) {
config_update_value('command_snapshot', 1);
}

View File

@ -27,6 +27,8 @@
* ============================================================================
*/
use Models\VisualConsole\Items\Percentile;
require_once $config['homedir'].'/include/graphs/fgraph.php';
require_once $config['homedir'].'/include/functions_reporting.php';
require_once $config['homedir'].'/include/functions_agents.php';
@ -2686,7 +2688,9 @@ function graph_agent_status(
$return=false,
$show_not_init=false,
$data_agents=false,
$donut_narrow_graph=false
$donut_narrow_graph=false,
$onClick='',
$data_in_percentage=false,
) {
global $config;
@ -2766,6 +2770,25 @@ function graph_agent_status(
'labels' => array_keys($data),
];
if (empty($onClick) === false) {
$options['onClick'] = $onClick;
}
if ($data_in_percentage === true) {
$percentages = [];
$total = array_sum($data);
foreach ($data as $key => $value) {
$percentage = (($value / $total) * 100);
if ($percentage < 1 && $percentage > 0) {
$percentage = 1;
}
$percentages[$key] = format_numeric($percentage, 0);
}
$data = $percentages;
}
if ($donut_narrow_graph == true) {
$out = ring_graph(
$data,
@ -4625,9 +4648,15 @@ function graph_nodata_image($options)
return base64_encode($dataImg);
}
$widthImage = '200px';
$style = '';
if (isset($options['nodata_image']['width']) === true) {
$widthImage = $options['nodata_image']['width'];
$style .= 'width: '.$options['nodata_image']['width'].'; ';
} else {
$style .= 'width: 200px; ';
}
if (isset($options['nodata_image']['height']) === true) {
$style .= 'height: '.$options['nodata_image']['height'].'; ';
}
return html_print_image(
@ -4635,7 +4664,7 @@ function graph_nodata_image($options)
true,
[
'title' => __('No data'),
'style' => 'width: '.$widthImage.';',
'style' => $style,
]
);
}

View File

@ -669,6 +669,12 @@ function get_build_setup_charts($type, $options, $data)
$chart->setId($id);
if (isset($options['onClick']) === true
&& empty($options['onClick']) === false
) {
$chart->options()->setOnClick($options['onClick']);
}
// Height is null maximum possible.
if (isset($options['height']) === true
&& empty($options['height']) === false

View File

@ -73,8 +73,40 @@ $(document).ready(function() {
$("#heatmap-title").html($(title).html());
}
});
rescaling();
$(window).on("resize", function() {
rescaling();
});
});
function showLabel(element, event, label) {
$(".label_heatmap").remove();
const tooltip = $(document.createElement("div"));
tooltip.html(label);
tooltip.attr("class", "label_heatmap");
$("#heatmap-group").append(tooltip);
var x = event.clientX;
var y = event.clientY;
tooltip.attr(
"style",
"position: fixed; top:" + (y + 15) + "px; left:" + (x + 20) + "px;"
);
}
function hideLabel() {
$(".label_heatmap").remove();
}
function rescaling() {
if (window.innerWidth < 1300) {
$(".trigger-100").attr("style", "width: 100%;");
$(".trigger-100").addClass("br-b");
} else {
$(".trigger-100").removeAttr("style");
$(".trigger-100").removeClass("br-b");
}
}
function autoRefresh(interval, id, method, php_class) {
setInterval(() => {
$.ajax({
@ -92,3 +124,108 @@ function autoRefresh(interval, id, method, php_class) {
});
}, interval);
}
function redirectStatus(e, element) {
if (element.length > 0) {
switch (e.chart.legend.legendItems[element[0].index].text) {
case "Critical":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=1&sort_field=&sort=none&pure=`
);
break;
case "Warning":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=2&sort_field=&sort=none&pure=`
);
break;
case "Unknown":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=3&sort_field=&sort=none&pure=`
);
break;
case "Not init":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=5&sort_field=&sort=none&pure=`
);
break;
default:
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/status_monitor&refr=0&ag_group=0&ag_freestring=&module_option=1&ag_modulename=&moduletype=&datatype=&status=-1&sort_field=&sort=none&pure=`
);
break;
}
}
}
function redirectHeatmap(view, id, id_agente = 0) {
switch (view) {
case "group":
window.location.assign(
`index.php?sec=view&sec2=godmode/groups/tactical&id_group=${id}`
);
break;
case "agent":
window.location.assign(
`index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=${id}`
);
break;
case "module":
if (id_agente > 0) {
window.location.assign(
`index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=${id_agente}&tab=module&id_agent_module=${id}&edit_module=1`
);
}
break;
default:
break;
}
}
function redirectAgentStatus(e, element) {
if (element.length > 0) {
switch (e.chart.legend.legendItems[element[0].index].text) {
case "No monitors":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente`
);
break;
case "CRITICAL":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente&status=1`
);
break;
case "WARNING":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente&status=2`
);
break;
case "UKNOWN":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente&status=3`
);
break;
case "NORMAL":
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente&status=0`
);
break;
default:
window.location.assign(
`index.php?sec=view&sec2=operation/agentes/estado_agente`
);
break;
}
}
}

View File

@ -79,11 +79,17 @@ class Element
public function __construct(
$ajax_controller='include/ajax/general_tactical_view.ajax'
) {
global $config;
$this->interval = 0;
$this->title = __('Default element');
$this->ajaxController = $ajax_controller;
// Without ACL.
$agent = db_get_row('tagente', 'nombre', 'pandora.internals', '*');
$agent_name = $config['self_monitoring_agent_name'];
if (empty($agent_name) === true) {
$agent_name = 'pandora.internals';
}
$agent = db_get_row('tagente', 'nombre', $agent_name, '*');
if (is_array($agent) === true) {
$this->monitoringAgent = $agent;
}

View File

@ -50,6 +50,22 @@ class GeneralTacticalView
}
/**
* Returns whether general statistics are disabled.
*
* @return boolean
*/
public function disableGeneralStatistics():bool
{
global $config;
if (users_is_admin($config['id_user']) === true) {
return false;
} else {
return (bool) $config['disable_general_statistics'];
}
}
/**
* Instantiate all the elements that will build the dashboard
*
@ -109,6 +125,7 @@ class GeneralTacticalView
{
$data = [];
$data['javascript'] = $this->javascript();
$data['disableGeneralStatistics'] = $this->disableGeneralStatistics();
$data = array_merge($data, $this->elements);
View::render(
'tacticalView/view',

View File

@ -429,12 +429,29 @@ class Agents extends Element
'cutout' => 80,
'nodata_image' => ['width' => '80%'],
'colors' => $colors,
'onClick' => 'redirectAgentStatus',
];
// To avoid that if a value is too small it is not seen.
$percentages = [];
$total = array_sum($data);
foreach ($data as $key => $value) {
$percentage = (($value / $total) * 100);
if ($percentage < 1 && $percentage > 0) {
$percentage = 1;
}
$percentages[$key] = format_numeric($percentage, 0);
}
$data = $percentages;
$pie = ring_graph($data, $options);
$output = html_print_div(
[
'content' => $pie,
'style' => 'margin: 0 auto; max-width: 80%; max-height: 220px;',
'class' => 'clickable',
],
true
);

View File

@ -83,7 +83,7 @@ class Alerts extends Element
*/
public function getActiveAlerts():string
{
$total = alerts_get_alerts(0, '', 'all', -1, 'AR', true);
$total = alerts_get_alerts(0, '', 'all', -1, 'AR', true, 0, true);
return html_print_div(
[
'content' => format_numeric($total, 0),

View File

@ -34,6 +34,7 @@ class Database extends Element
*/
public function __construct()
{
global $config;
parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php';
$this->title = __('Database');

View File

@ -57,23 +57,13 @@ class Events extends Element
{
global $config;
$id_groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
if (in_array(0, $id_groups) === false) {
foreach ($id_groups as $key => $id_group) {
if ((bool) check_acl_restricted_all($config['id_user'], $id_group, 'AR') === false) {
unset($id_groups[$key]);
}
}
}
if (users_can_manage_group_all() === true) {
$id_groups[] = 0;
}
$id_groups = implode(',', $id_groups);
$event_view_h = (int) ($config['event_view_hr'] > 24) ? 24 : $config['event_view_hr'];
$time_events = ($event_view_h * 3600);
$intervalh = (time() - $time_events);
$sql = 'SELECT utimestamp from tevento WHERE utimestamp >= '.$intervalh.' ORDER BY utimestamp DESC;';
$sql = 'SELECT utimestamp
FROM tevento
WHERE utimestamp >= '.$intervalh.' AND id_grupo IN ('.$id_groups.') ORDER BY utimestamp DESC;';
$rows = db_process_sql($sql);
$cut_seconds = ($time_events / 24);
$now = (time() - 300);
@ -377,6 +367,13 @@ class Events extends Element
$data = [];
$colors = [];
foreach ($rows as $key => $row) {
if ($row['criticity'] != EVENT_CRIT_CRITICAL
&& $row['criticity'] != EVENT_CRIT_NORMAL
&& $row['criticity'] != EVENT_CRIT_WARNING
) {
continue;
}
switch ($row['criticity']) {
case EVENT_CRIT_CRITICAL:
$label = __('CRITICAL');
@ -394,9 +391,7 @@ class Events extends Element
break;
default:
$colors[] = COL_UNKNOWN;
$label = __('UNKNOWN');
break;
continue;
}
$labels[] = $this->controlSizeText($label);
@ -410,6 +405,21 @@ class Events extends Element
'nodata_image' => ['width' => '100%'],
'colors' => $colors,
];
// To avoid that if a value is too small it is not seen.
$percentages = [];
$total = array_sum($data);
foreach ($data as $key => $value) {
$percentage = (($value / $total) * 100);
if ($percentage < 1 && $percentage > 0) {
$percentage = 1;
}
$percentages[$key] = format_numeric($percentage, 0);
}
$data = $percentages;
$pie = ring_graph($data, $options);
$output = html_print_div(
[
@ -451,6 +461,7 @@ class Events extends Element
'get_events' => 1,
'compact_date' => 1,
'external_url' => 1,
'compact_name_event' => 1,
],
'order' => [
'field' => 'timestamp',

View File

@ -118,7 +118,6 @@ class Groups extends Element
return graph_nodata_image(['width' => '400']);
}
$groups = $modules;
// Best square.
$high = (float) max($width, $height);
$low = 0.0;
@ -147,13 +146,18 @@ class Groups extends Element
$x = 0;
$y = 0;
$cont = 1;
foreach ($groups as $key => $value) {
foreach ($modules as $key => $value) {
$module_id = $value['id_agente_modulo'];
$db_status = modules_get_agentmodule_status($module_id);
$module_status = db_get_row(
'tagente_estado',
'id_agente_modulo',
$module_id,
);
$module_value = modules_get_last_value($module_id);
$status = '';
$title = '';
modules_get_status($module_id, $db_status, $module_value, $status, $title);
modules_get_status($module_id, $module_status['estado'], $module_value, $status, $title);
switch ($status) {
case STATUS_MODULE_NO_DATA:
// Not init status.
@ -183,10 +187,16 @@ class Groups extends Element
break;
}
$redirect = '';
if (check_acl($config['id_user'], 0, 'AW')) {
$redirect = 'onclick="redirectHeatmap(\'module\', '.$module_id.', '.$value['id_agente'].')"';
}
$heatmap .= sprintf(
'<rect id="%s" x="%s" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" '.$redirect.' style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'rect_'.$cont,
$x,
$value['nombre'],
$y,
$row,
$column,
@ -350,9 +360,10 @@ class Groups extends Element
}
$heatmap .= sprintf(
'<rect id="%s" x="%s" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" onclick="redirectHeatmap(\'agent\', '.$value['id_agente'].')" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'rect_'.$cont,
$x,
$value['alias'],
$y,
$row,
$column,
@ -490,9 +501,10 @@ class Groups extends Element
}
$heatmap .= sprintf(
'<rect id="%s" x="%s" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'<rect id="%s" x="%s" onmousemove="showLabel(this, event, \'%s\')" onmouseleave="hideLabel()" onclick="redirectHeatmap(\'group\', '.$value['_id_'].')" style="stroke-width:1;stroke:#ffffff" y="%s" row="%s" rx="3" ry="3" col="%s" width="%s" height="%s" class="scuare-status %s_%s"></rect>',
'rect_'.$cont,
$x,
$value['_name_'],
$y,
$row,
$column,

View File

@ -75,7 +75,10 @@ class MonitoringElements extends Element
'display' => false,
],
'cutout' => 80,
'nodata_image' => ['width' => '100%'],
'nodata_image' => [
'width' => '100%',
'height' => '90%',
],
];
$pie = ring_graph($data, $options);
$output = html_print_div(
@ -139,7 +142,10 @@ class MonitoringElements extends Element
'display' => false,
],
'cutout' => 80,
'nodata_image' => ['width' => '100%'],
'nodata_image' => [
'width' => '100%',
'height' => '90%',
],
];
$pie = ring_graph($data, $options);
$output = html_print_div(
@ -208,7 +214,10 @@ class MonitoringElements extends Element
'display' => false,
],
'cutout' => 80,
'nodata_image' => ['width' => '100%'],
'nodata_image' => [
'width' => '100%',
'height' => '90%',
],
];
$pie = ring_graph($data, $options);
$output = html_print_div(
@ -230,11 +239,12 @@ class MonitoringElements extends Element
*/
public function getMonitoringStatusGraph():string
{
$pie = graph_agent_status(false, '', '', true, true, false, true);
$pie = graph_agent_status(false, '', '', true, true, false, true, 'redirectStatus', true);
$output = html_print_div(
[
'content' => $pie,
'style' => 'margin: 0 auto; max-width: 80%; max-height: 220px;',
'class' => 'clickable',
],
true
);

View File

@ -37,6 +37,7 @@ class Overview extends Element
global $config;
include_once $config['homedir'].'/include/graphs/fgraph.php';
parent::__construct();
include_once $config['homedir'].'/include/graphs/fgraph.php';
if (is_ajax() === true) {
include_once $config['homedir'].'/include/functions_servers.php';
}
@ -164,6 +165,9 @@ class Overview extends Element
if ($info['limit'] > $info['count']) {
$used = round(($info['count'] / $info['limit']) * 100);
$free = (100 - $used);
} else if ($info['limit'] <= $info['count']) {
$free = 0;
$used = 100;
} else {
$free = 100;
$used = 0;

View File

@ -23,11 +23,12 @@
align-items: stretch;
}
.col-12 {
width: 100%;
width: 99%;
}
.col-6,
.col-xl-6 {
width: 50%;
flex: 1;
display: flex;
flex-wrap: nowrap;
flex-direction: column;
@ -58,6 +59,9 @@
border-radius: 10px;
height: 100%;
max-width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.br-l {
border-left: 1px solid #e5e9ed;
@ -325,6 +329,22 @@ table.dataTable thead th {
background-color: #ec7176;
}
#svg rect {
cursor: pointer;
}
.trigger-100 {
display: flex;
flex-direction: column;
}
.label_heatmap {
position: absolute;
background-color: #757575;
color: white;
padding: 2px 5px;
border-radius: 5px;
}
@media (max-width: 1636px) {
.col-xl-6 {
width: 100%;
@ -344,9 +364,7 @@ table.dataTable thead th {
.col-7 {
width: 56%;
}
.col-5 {
width: 41%;
}
.flex-nowrap {
flex-wrap: nowrap !important;
}

View File

@ -12741,12 +12741,6 @@ div.agents_custom_fields #datatables_wrapper div.bottom {
justify-content: flex-start !important;
}
.dt-buttons {
width: auto;
position: absolute;
margin-left: 90px;
}
.title_tactical {
padding: 10px 0px 10px 0px;
text-align: center;

View File

@ -369,8 +369,6 @@ a.pandora_pagination.current:hover {
font-size: 20px;
height: 38px;
width: 80px;
margin-left: 90px;
display: flex;
justify-content: space-between;
flex-direction: row;

View File

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

View File

@ -342,6 +342,7 @@ if (is_ajax() === true) {
$table_id = get_parameter('table_id', '');
$groupRecursion = (bool) get_parameter('groupRecursion', false);
$compact_date = (int) get_parameter('compact_date', 0);
$compact_name_event = (int) get_parameter('compact_name_event', 0);
// Datatables offset, limit.
$start = (int) get_parameter('start', 0);
@ -471,7 +472,7 @@ if (is_ajax() === true) {
$data = array_reduce(
$events,
function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url) {
function ($carry, $item) use ($table_id, &$redirection_form_id, $filter, $compact_date, $external_url, $compact_name_event) {
global $config;
$tmp = (object) $item;
@ -518,7 +519,7 @@ if (is_ajax() === true) {
$tmp->evento = ui_print_truncate_text(
$tmp->evento,
'description',
(empty($compact_name_event) === true) ? 'description' : GENERIC_SIZE_TEXT,
false,
true,
false,

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.774
%define release 231107
%define release 231108
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil}
%define name pandorafms_console
%define version 7.0NG.774
%define release 231107
%define release 231108
# 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.774
%define release 231107
%define release 231108
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -120,6 +120,7 @@ try {
echo $e->getMessage();
}
$buttons = [];
if (check_acl($config['id_user'], 0, 'AW')) {
$buttons[] = html_print_submit_button(
__('New cluster'),
@ -131,10 +132,11 @@ if (check_acl($config['id_user'], 0, 'AW')) {
],
true
);
echo '<form action="'.ui_get_full_url($model->url.'&op=new').'" method="POST">';
html_print_action_buttons(
}
echo '<form action="'.ui_get_full_url($model->url.'&op=new').'" method="POST">';
html_print_action_buttons(
implode('', $buttons),
['type' => 'form_action']
);
echo '</form>';
}
);
echo '</form>';

View File

@ -41,6 +41,7 @@
</div>
</div>
</div>
<?php if ($disableGeneralStatistics === false) : ?>
<div class="br-t">
<div class="padding10">
<span class="subtitle">
@ -49,24 +50,25 @@
<?php echo $Overview->getLicenseUsageGraph(); ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<div class="row flex-nowrap">
<div class="row flex-nowrap height_100p">
<div class="col-7 pdd_5px">
<div class="container">
<div class="title">
<?php echo $MonitoringElements->title; ?>
</div>
<div class="content br-t">
<div class="row">
<div class="content br-t height_100p">
<div class="row height_50p">
<div class="col-6 br-r br-b">
<div class="subtitle link padding10 padding2">
<?php echo __('Top-10 Tags'); ?> <a href="index.php?sec=gusuarios&sec2=godmode/tag/tag"><?php echo __('Info'); ?></a>
<?php echo __('Status (%)'); ?> <a href="index.php?sec=view&sec2=operation/agentes/estado_agente"><?php echo __('Info'); ?></a>
</div>
<?php echo $MonitoringElements->getTagsGraph(); ?>
<?php echo $MonitoringElements->getMonitoringStatusGraph(); ?>
</div>
<div class="col-6 br-b">
<div class="subtitle link padding10 padding2">
@ -75,12 +77,12 @@
<?php echo $MonitoringElements->getModuleGroupGraph(); ?>
</div>
</div>
<div class="row">
<div class="row height_50p">
<div class="col-6">
<div class="subtitle link padding10 padding2">
<?php echo __('Status'); ?> <a href="index.php?sec=view&sec2=operation/agentes/estado_agente"><?php echo __('Info'); ?></a>
<?php echo __('Top-10 Tags'); ?> <a href="index.php?sec=gusuarios&sec2=godmode/tag/tag"><?php echo __('Info'); ?></a>
</div>
<?php echo $MonitoringElements->getMonitoringStatusGraph(); ?>
<?php echo $MonitoringElements->getTagsGraph(); ?>
</div>
<div class="col-6 br-l">
<div class="subtitle link padding10 padding2">
@ -165,6 +167,7 @@
</div>
</div>
</div>
<?php if ($disableGeneralStatistics === false) : ?>
<div class="col-6">
<div class="container mrgn_5px" id="logStorage">
<div class="title br-b">
@ -184,7 +187,7 @@
<?php echo $LogStorage->getTotalSources(); ?>
</div>
</div>
<div class="row">
<div class="row height_100p">
<div class="col-6 br-r">
<div class="subtitle">
<?php echo __('Stored data'); ?>
@ -221,6 +224,7 @@
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
@ -236,13 +240,13 @@
<div class="subtitle">
<?php echo __('Currently triggered'); ?>
</div>
<?php echo $Alerts->getCurrentlyTriggered(); ?>
<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&status_alert=fired"><?php echo $Alerts->getCurrentlyTriggered(); ?></a>
</div>
<div class="col-6 br-l">
<div class="subtitle">
<?php echo __('Active alerts'); ?>
</div>
<?php echo $Alerts->getActiveAlerts(); ?>
<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&status_alert=all_enabled"><?php echo $Alerts->getActiveAlerts(); ?></a>
</div>
</div>
<?php if ($Alerts->checkAclUserList() === true) : ?>
@ -261,13 +265,13 @@
<div class="title br-b">
<?php echo $Events->title; ?>
</div>
<div class="row">
<div class="col-8 br-r">
<div class="row" id="auto-rescaling">
<div class="col-8 br-r trigger-100">
<div class="subtitle link padding10 padding2">
<?php echo __('Number of events per hour ('.$config['event_view_hr'].' hrs)'); ?></b> <a href="index.php?sec=eventos&sec2=operation/events/events&filter[event_view_hr]=24&filter[tag_with]=WyIwIl0=&filter[tag_without]=WyIwIl0="><?php echo __('Info'); ?></a>
</div>
<div id="events-last-24"><?php echo $Events->loading(); ?></div>
<div class="row br-t h100p">
<div class="row br-t h100p observer">
<div class="col-4 br-r">
<div class="subtitle padding10 padding2">
<?php echo __('Criticality'); ?></b>
@ -276,7 +280,7 @@
</div>
<div class="col-4 br-r">
<div class="subtitle padding10 padding2">
<?php echo __('Status'); ?></b>
<?php echo __('Status (%)'); ?></b>
</div>
<div id="events-status-validate"><?php echo $Events->loading(); ?></div>
</div>
@ -288,7 +292,7 @@
</div>
</div>
</div>
<div class="col-4">
<div class="col-4 trigger-100">
<div class="subtitle link padding10 padding2">
<?php echo __('Active events ('.$config['event_view_hr'].' hrs)'); ?></b> <a href="index.php?sec=eventos&sec2=operation/events/events"><?php echo __('Info'); ?></a>
</div>
@ -333,7 +337,7 @@
</div>
<?php echo $Agents->getOperatingSystemGraph(); ?>
<div class="subtitle padding10 padding2 br-t">
<?php echo __('Status'); ?></b>
<?php echo __('Status (%)'); ?></b>
</div>
<?php echo $Agents->getStatusGraph(); ?>
</div>
@ -341,6 +345,7 @@
</div>
</div>
<div class="col-xl-6">
<?php if ($disableGeneralStatistics === false) : ?>
<div class="container mrgn_5px">
<div class="title br-b">
<?php echo $Configurations->title; ?>
@ -376,6 +381,7 @@
</a>
</div>
</div>
<?php endif; ?>
<?php if ($ScheduledDowntime->checkAcl() === true) : ?>
<div class="container mrgn_5px">
<div class="title br-b">

View File

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

View File

@ -818,6 +818,8 @@ sub main() {
&& $Config{"self_monitoring"} == 1
&& !is_metaconsole(\%Config)
&& time() - $thr_time_ref > $Config{'self_monitoring_interval'}) {
# Update agent name token.
pandora_set_tconfig_token($DBH, 'self_monitoring_agent_name', $Config{'self_monitoring_agent_name'});
$thr_time_ref = time();
pandora_thread_monitoring (\%Config, $DBH, \@Servers);
}

View File

@ -422,6 +422,9 @@ self_monitoring 1
# Self monitoring interval (in seconds).
self_monitoring_interval 300
# Self monitoring agent name.
self_monitoring_agent_name pandora.internals
# Update parent from the agent xml
update_parent 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.774";
my $pandora_build = "231107";
my $pandora_build = "231108";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -419,6 +419,9 @@ sub pandora_load_config {
# Self monitoring interval
$pa_config->{'self_monitoring_interval'} = 300; # 5.1SP1
# Self monitoring agent name.
$pa_config->{'self_monitoring_agent_name'} = 'pandora.internals'; # 7.774
# Process XML data files as a stack
$pa_config->{"dataserver_lifo"} = 0; # 5.0
@ -1044,6 +1047,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^self_monitoring_interval\s+([0-9]*)/i) {
$pa_config->{'self_monitoring_interval'} = clean_blank($1);
}
elsif ($parametro =~ m/^self_monitoring_agent_name\s+(.*)/i) {
$pa_config->{'self_monitoring_agent_name'} = clean_blank($1);
}
elsif ($parametro =~ m/^update_parent\s+([0-1])/i) {
$pa_config->{'update_parent'} = clean_blank($1);
}

View File

@ -6315,7 +6315,7 @@ sub pandora_self_monitoring ($$) {
my $xml_output = "";
$xml_output = "<agent_data os_name='$OS' os_version='$OS_VERSION' version='" . $pa_config->{'version'} . "' description='" . $pa_config->{'rb_product_name'} . " Server version " . $pa_config->{'version'} . "' agent_name='pandora.internals' agent_alias='pandora.internals' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >";
$xml_output = "<agent_data os_name='$OS' os_version='$OS_VERSION' version='" . $pa_config->{'version'} . "' description='" . $pa_config->{'rb_product_name'} . " Server version " . $pa_config->{'version'} . "' agent_name='" . $pa_config->{"self_monitoring_agent_name"} . "' agent_alias='" . $pa_config->{"self_monitoring_agent_name"} . "' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >";
$xml_output .=" <module>";
$xml_output .=" <name>Status</name>";
$xml_output .=" <type>generic_proc</type>";
@ -6514,7 +6514,7 @@ sub pandora_self_monitoring ($$) {
$xml_output .= "</agent_data>";
my $filename = $pa_config->{"incomingdir"}."/pandora.internals.self".$utimestamp.".data";
my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{"self_monitoring_agent_name"}.".self".$utimestamp.".data";
open (XMLFILE, ">", $filename) or die "[FATAL] Could not open internal monitoring XML file for deploying monitorization at '$filename'";
print XMLFILE $xml_output;
close (XMLFILE);
@ -6539,7 +6539,7 @@ sub pandora_thread_monitoring ($$$) {
# All trhead modules are "Status" module sons.
$module_parent = 'Status';
$xml_output = "<agent_data os_name='$OS' os_version='$OS_VERSION' version='" . $pa_config->{'version'} . "' description='" . $pa_config->{'rb_product_name'} . " Server version " . $pa_config->{'version'} . "' agent_name='pandora.internals' agent_alias='pandora.internals' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >";
$xml_output = "<agent_data os_name='$OS' os_version='$OS_VERSION' version='" . $pa_config->{'version'} . "' description='" . $pa_config->{'rb_product_name'} . " Server version " . $pa_config->{'version'} . "' agent_name='" . $pa_config->{'self_monitoring_agent_name'} . "' agent_alias='pandora.internals' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >";
foreach my $server (@{$servers}) {
my $producer_stats = $server->getProducerStats();
while (my ($tid, $stats) = each(%{$producer_stats})) {
@ -6605,7 +6605,7 @@ sub pandora_thread_monitoring ($$$) {
}
$xml_output .= "</agent_data>";
my $filename = $pa_config->{"incomingdir"}."/pandora.internals.threads.".$utimestamp.".data";
my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{'self_monitoring_agent_name'}.".threads.".$utimestamp.".data";
open (XMLFILE, ">", $filename) or die "[FATAL] Could not write to the thread monitoring XML file '$filename'";
print XMLFILE $xml_output;
close (XMLFILE);

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

View File

@ -7,7 +7,7 @@
%define debug_package %{nil}
%define name pandorafms_server
%define version 7.0NG.774
%define release 231107
%define release 231108
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

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

View File

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