Merge branch 'ent-9662-second-round' of brutus.artica.es:artica/pandorafms into ent-9662-second-round

This commit is contained in:
Jonathan 2023-03-14 13:26:31 +01:00
commit 9f953809a0
65 changed files with 1932 additions and 1834 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.769-230313 Version: 7.0NG.769-230314
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230313" pandora_version="7.0NG.769-230314"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.769" PI_VERSION="7.0NG.769"
PI_BUILD="230313" PI_BUILD="230314"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{230313} {230314}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.769 Build 230313") #define PANDORA_VERSION ("7.0NG.769 Build 230314")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.769(Build 230313))" VALUE "ProductVersion", "(7.0NG.769(Build 230314))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.769-230313 Version: 7.0NG.769-230314
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230313" pandora_version="7.0NG.769-230314"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -143,22 +143,23 @@ function quickShell()
'form' => [ 'form' => [
'method' => 'POST', 'method' => 'POST',
'action' => '#', 'action' => '#',
], 'id' => 'retry_form',
'inputs' => [
[
'class' => 'w100p',
'arguments' => [
'name' => 'submit',
'label' => __('Retry'),
'type' => 'submit',
'attributes' => ['icon' => 'next'],
'return' => true,
],
],
], ],
] ]
); );
html_print_action_buttons(
html_print_submit_button(
__('Retry'),
'submit',
false,
[
'icon' => 'next',
'form' => 'retry_form',
],
true
)
);
return; return;
} }
@ -168,6 +169,7 @@ function quickShell()
'action' => '#', 'action' => '#',
'class' => 'wizard', 'class' => 'wizard',
'method' => 'post', 'method' => 'post',
'id' => 'connect_form',
], ],
'inputs' => [ 'inputs' => [
[ [
@ -198,19 +200,24 @@ function quickShell()
'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);", 'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);",
], ],
], ],
[
'arguments' => [
'type' => 'submit',
'label' => __('Connect'),
'attributes' => ['icon' => 'cog'],
],
],
], ],
], ],
false, false,
true true
); );
html_print_action_buttons(
html_print_submit_button(
__('Connect'),
'submit',
false,
[
'icon' => 'cog',
'form' => 'connect_form',
],
true
)
);
return; return;
} }

View File

@ -155,4 +155,6 @@ INSERT INTO `twelcome_tip_file` (`twelcome_tip_file`, `filename`, `path`) VALUES
(20, 'zoom_en_graficas.png', 'images/tips/'), (20, 'zoom_en_graficas.png', 'images/tips/'),
(22, 'politica_de_pass.png', 'images/tips/'); (22, 'politica_de_pass.png', 'images/tips/');
ALTER TABLE `tusuario` ADD COLUMN `show_tips_startup` TINYINT UNSIGNED NOT NULL DEFAULT 1;
COMMIT; COMMIT;

View File

@ -1071,9 +1071,15 @@ if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === tr
echo '</form>'; echo '</form>';
} }
$modalCreateModule = '<form name="create_module_form" method="post">'; // Form table for Module creation.
$input_type = html_print_input_hidden('edit_module', 1, true); $createModuleTable = new stdClass();
$input_type .= html_print_select( $createModuleTable->id = 'module_creation_modal';
$createModuleTable->class = 'filter-table-adv';
$createModuleTable->data = [];
$createModuleTable->data[0][] = html_print_label_input_block(
__('Select module type'),
html_print_select(
policies_type_modules_availables($sec2), policies_type_modules_availables($sec2),
'moduletype', 'moduletype',
'', '',
@ -1086,12 +1092,29 @@ $input_type .= html_print_select(
'', '',
false, false,
'max-width:300px;' 'max-width:300px;'
)
); );
$modalCreateModule .= $input_type; $createModuleTable->data[1][] = html_print_label_input_block(
'',
html_print_anchor(
[
'href' => 'https://pandorafms.com/Library/Library/',
'class' => 'color-black-grey invert_filter',
'content' => __('Get more modules on Monitoring Library'),
],
true
)
);
$createModuleFormTable = html_print_input_hidden('edit_module', 1, true);
$createModuleFormTable .= html_print_table($createModuleTable, true);
// Form definition.
$modalCreateModule = '<form name="create_module_form" method="post">';
$modalCreateModule .= $createModuleFormTable;
$modalCreateModule .= html_print_div( $modalCreateModule .= html_print_div(
[ [
'class' => 'action-buttons', 'class' => 'action-buttons-right-forced',
'content' => html_print_submit_button( 'content' => html_print_submit_button(
__('Create'), __('Create'),
'create_module', 'create_module',

View File

@ -672,7 +672,7 @@ foreach ($simple_alerts as $alert) {
'[&hellip;]', '[&hellip;]',
'' ''
); );
$data[2] .= ' <a class="template_details patatas" $data[2] .= ' <a class="template_details"
href="'.ui_get_full_url(false, false, false, false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">'; href="'.ui_get_full_url(false, false, false, false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">';
$data[2] .= html_print_image( $data[2] .= html_print_image(
'images/details.svg', 'images/details.svg',

View File

@ -60,7 +60,7 @@ if ($enterprise_include === true) {
$id = get_parameter('id', get_parameter('id_user', '')); $id = get_parameter('id', get_parameter('id_user', ''));
// Check if we are the same user for edit or we have a proper profile for edit users. // Check if we are the same user for edit or we have a proper profile for edit users.
if ($id !== $config['id_user']) { if ($id !== $config['id_user']) {
if ((is_centralized() === true) || (bool) check_acl($config['id_user'], 0, 'UM') === false) { if ((bool) check_acl($config['id_user'], 0, 'UM') === false) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access User Management' 'Trying to access User Management'
@ -1011,13 +1011,13 @@ if (!$new_user) {
$user_id .= html_print_input_hidden('id_user', $id, true); $user_id .= html_print_input_hidden('id_user', $id, true);
$user_id .= '</div>'; $user_id .= '</div>';
$apiTokenContentElements[] = '<span style="height: 15px;font-size: 14px;">'.__('API Token').'</span>'; $apiTokenContentElements[] = '<span style="line-height: 15px; height: 15px;font-size: 14px;">'.__('API Token').'</span>';
$apiTokenContentElements[] = html_print_button( $apiTokenContentElements[] = html_print_button(
__('Renew'), __('Renew'),
'renew_api_token', 'renew_api_token',
false, false,
sprintf( sprintf(
'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')', 'javascript:renewAPIToken("%s", "%s", "%s")',
__('Warning'), __('Warning'),
__('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'), __('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'),
'user_profile_form', 'user_profile_form',
@ -1033,7 +1033,7 @@ if (!$new_user) {
'show_api_token', 'show_api_token',
false, false,
sprintf( sprintf(
'javascript:showAPIToken(\'%s\', \'%s\')', 'javascript:showAPIToken("%s", "%s")',
__('API Token'), __('API Token'),
base64_encode(__('Your API Token is:').'&nbsp;<br><span class="font_12pt bolder">'.users_get_API_token($id).'</span><br>&nbsp;'.__('Please, avoid share this string with others.')), base64_encode(__('Your API Token is:').'&nbsp;<br><span class="font_12pt bolder">'.users_get_API_token($id).'</span><br>&nbsp;'.__('Please, avoid share this string with others.')),
), ),
@ -1826,13 +1826,17 @@ if (is_metaconsole() === true) {
true true
); );
} }
// User Profile definition table. (Only where user is not creating).
if ($new_user === false && ((bool) check_acl($config['id_user'], 0, 'UM') === true)) {
profile_print_profile_table($id, io_safe_output($json_profile), false, ($is_err === true));
}
} else { } else {
$access_or_pagination = $size_pagination; $access_or_pagination = $size_pagination;
// WIP: Only for node. // WIP: Only for node.
include_once 'user_management.php'; include_once 'user_management.php';
} }
if ((bool) $config['admin_can_add_user'] === true) { if ((bool) $config['admin_can_add_user'] === true) {
html_print_csrf_hidden(); html_print_csrf_hidden();
html_print_input_hidden((($new_user === true) ? 'create_user' : 'update_user'), 1); html_print_input_hidden((($new_user === true) ? 'create_user' : 'update_user'), 1);

View File

@ -731,7 +731,7 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_CLOUD_AZURE_COMPUTE: case DISCOVERY_CLOUD_AZURE_COMPUTE:
// Discovery Applications MySQL. // Discovery Applications MySQL.
$data[6] = html_print_image( $data[6] = html_print_image(
'images/plugin@svg.svg', 'images/plugins@svg.svg',
true, true,
[ [
'title' => __('Discovery Cloud Azure Compute'), 'title' => __('Discovery Cloud Azure Compute'),
@ -744,7 +744,7 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_CLOUD_AWS_EC2: case DISCOVERY_CLOUD_AWS_EC2:
// Discovery Applications MySQL. // Discovery Applications MySQL.
$data[6] = html_print_image( $data[6] = html_print_image(
'images/plugin@svg.svg', 'images/plugins@svg.svg',
true, true,
[ [
'title' => __('Discovery Cloud AWS EC2'), 'title' => __('Discovery Cloud AWS EC2'),
@ -856,7 +856,7 @@ class DiscoveryTaskList extends HTML
} else { } else {
// APP or external script recon task. // APP or external script recon task.
$data[6] = html_print_image( $data[6] = html_print_image(
'images/plugin@svg.svg', 'images/plugins@svg.svg',
true, true,
['class' => 'main_menu_icon invert_filter'] ['class' => 'main_menu_icon invert_filter']
).'&nbsp;&nbsp;'; ).'&nbsp;&nbsp;';

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 27.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;}
.st1{fill:#000000;}
</style>
<g id="Dark-/-20-/-delete-v2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" transform="translate(10.000000, 10.000000) rotate(0.000000) translate(-10.000000, -10.000000) translate(4.000000, 4.000000)" fill="#3F3F3F">
<path d="M6,0 C6.51283584,0 6.93550716,0.38604019 6.99327227,0.883378875 L7,1 L7,5 L11,5 C11.5522847,5 12,5.44771525 12,6 C12,6.51283584 11.6139598,6.93550716 11.1166211,6.99327227 L11,7 L7,7 L7,11 C7,11.5522847 6.55228475,12 6,12 C5.48716416,12 5.06449284,11.6139598 5.00672773,11.1166211 L5,11 L5,7 L1,7 C0.44771525,7 0,6.55228475 0,6 C0,5.48716416 0.38604019,5.06449284 0.883378875,5.00672773 L1,5 L5,5 L5,1 C5,0.44771525 5.44771525,0 6,0 Z" id="Path-7"></path>
</g>
<path d="M10,0 C4.4771525,0 0,4.4771525 0,10 C0,15.5228475 4.4771525,20 10,20 C15.5228475,20 20,15.5228475 20,10 C20,4.4771525 15.5228475,0 10,0 Z M10,2 C14.418278,2 18,5.581722 18,10 C18,14.418278 14.418278,18 10,18 C5.581722,18 2,14.418278 2,10 C2,5.581722 5.581722,2 10,2 Z" id="Oval" fill="#3F3F3F"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -25,6 +25,8 @@ if ((bool) is_metaconsole() === true) {
if ($networkmap) { if ($networkmap) {
$networkmap_id = get_parameter('networkmap_id', 0); $networkmap_id = get_parameter('networkmap_id', 0);
$dashboard = get_parameter('dashboard', 0);
$size = get_parameter('size', []);
$x_offset = get_parameter('x_offset', 0); $x_offset = get_parameter('x_offset', 0);
$y_offset = get_parameter('y_offset', 0); $y_offset = get_parameter('y_offset', 0);
$zoom_dash = get_parameter('zoom_dash', 0.5); $zoom_dash = get_parameter('zoom_dash', 0.5);
@ -62,6 +64,15 @@ if ($networkmap) {
global $id_networkmap; global $id_networkmap;
$id_networkmap = $networkmap['id']; $id_networkmap = $networkmap['id'];
$tab = 'radial_dynamic'; $tab = 'radial_dynamic';
if (empty($size) === false) {
if ($size['width'] > $size['height']) {
$width = $size['height'];
$height = ($size['height'] - 10);
} else {
$width = $size['width'];
$height = ($size['width'] + 50);
}
}
include_once 'operation/agentes/networkmap.dinamic.php'; include_once 'operation/agentes/networkmap.dinamic.php';
} else { } else {

View File

@ -68,6 +68,11 @@ if (check_login()) {
0 0
); );
$get_data_ModulesByStatus = (bool) get_parameter(
'get_data_ModulesByStatus',
0
);
$load_filter_modal = get_parameter('load_filter_modal', 0); $load_filter_modal = get_parameter('load_filter_modal', 0);
$save_filter_modal = get_parameter('save_filter_modal', 0); $save_filter_modal = get_parameter('save_filter_modal', 0);
$get_monitor_filters = get_parameter('get_monitor_filters', 0); $get_monitor_filters = get_parameter('get_monitor_filters', 0);
@ -1568,7 +1573,7 @@ if (check_login()) {
$value['thresholds'] $value['thresholds']
); );
$resultData = '<span style="color:'.$status['color'].'">'; $resultData = '<span class="widget-module-tabs-data" style="color:'.$status['color'].'">';
if ($vdata !== null && $vdata !== '' && $vdata !== false) { if ($vdata !== null && $vdata !== '' && $vdata !== false) {
if (isset($formatData) === true if (isset($formatData) === true
&& (bool) $formatData === true && (bool) $formatData === true
@ -1665,6 +1670,259 @@ if (check_login()) {
return; return;
} }
if ($get_data_ModulesByStatus === true) {
global $config;
$data = [];
$table_id = get_parameter('table_id', '');
$search = get_parameter('search', '');
$status = get_parameter('status', '');
$start = get_parameter('start', 0);
$length = get_parameter('length', $config['block_size']);
// There is a limit of (2^32)^2 (18446744073709551615) rows in a MyISAM table, show for show all use max nrows.
$length = ($length != '-1') ? $length : '18446744073709551615';
$order = get_datatable_order(true);
$nodes = get_parameter('nodes', 0);
$where = '';
$recordsTotal = 0;
if (empty($search) === false) {
$where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND ';
}
$where .= sprintf(
'tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
$status
);
if (is_metaconsole() === false) {
$order_by = '';
switch ($order['field']) {
case 'nombre':
$order_by = 'tagente_modulo.'.$order['field'].' '.$order['direction'];
break;
case 'alias':
$order_by = 'tagente.'.$order['field'].' '.$order['direction'];
break;
case 'last_status_change':
$order_by = 'tagente_estado.'.$order['field'].' '.$order['direction'];
break;
case 'estado':
$order_by = 'tagente_estado.'.$order['field'].' '.$order['direction'];
break;
default:
$order_by = 'tagente_estado.last_status_change desc';
break;
}
$sql = sprintf(
'SELECT
tagente_modulo.nombre,
tagente.alias,
tagente.id_agente,
tagente_estado.last_status_change,
tagente_estado.estado
FROM tagente_modulo
INNER JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
WHERE %s
ORDER BY %s
LIMIT %d, %d',
$where,
$order_by,
$start,
$length
);
$data = db_get_all_rows_sql($sql);
$sql_count = sprintf(
'SELECT COUNT(*) AS "total"
FROM tagente_modulo
INNER JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo'
);
$recordsTotal = db_get_value_sql($sql_count);
// Metaconsole.
} else {
// $servers_ids = array_column(metaconsole_get_servers(), 'id');
$servers_ids = explode(',', $nodes);
foreach ($servers_ids as $server_id) {
try {
$node = new Node((int) $server_id);
$node->connect();
$sql = sprintf(
'SELECT
tagente_modulo.nombre,
tagente.alias,
tagente.id_agente,
tagente_estado.last_status_change,
tagente_estado.estado
FROM tagente_modulo
INNER JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
WHERE %s',
$where
);
$res_sql = db_get_all_rows_sql($sql);
foreach ($res_sql as $row_sql) {
$row_sql['server_name'] = $node->server_name();
$row_sql['server_url'] = $node->server_url();
array_push($data, $row_sql);
}
$node->disconnect();
} catch (\Exception $e) {
// Unexistent modules.
$node->disconnect();
}
}
// Drop temporary table if exist.
db_process_sql('DROP TEMPORARY TABLE IF EXISTS temp_modules_status;');
$table_temporary = 'CREATE TEMPORARY TABLE IF NOT EXISTS temp_modules_status (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
nombre VARCHAR(600),
alias VARCHAR(600),
id_agente INT,
last_status_change INT,
estado INT,
server_name VARCHAR(100),
server_url VARCHAR(200),
PRIMARY KEY (`id`),
KEY `nombre` (`nombre`(600))
)';
db_process_sql($table_temporary);
$result = db_process_sql_insert_multiple('temp_modules_status', $data);
if (empty($result) === false) {
$data = [];
$sql = '';
$where = '';
if (empty($search) === false) {
$where = 'nombre LIKE "%%'.$search.'%%" AND ';
}
$where .= sprintf(
'estado IN (%s)',
$status
);
$order_by = $order['field'].' '.$order['direction'];
$sql = sprintf(
'SELECT
nombre,
alias,
id_agente,
last_status_change,
estado,
server_name,
server_url
FROM temp_modules_status
WHERE %s
ORDER BY %s
LIMIT %d, %d',
$where,
$order_by,
$start,
$length
);
$data = db_get_all_rows_sql($sql);
$sql_count = sprintf(
'SELECT COUNT(*) AS "total"
FROM temp_modules_status'
);
$recordsTotal = db_get_value_sql($sql_count);
}
}
if ($data === false) {
$data = [];
}
foreach ($data as $key => $row) {
$data[$key]['nombre'] = html_ellipsis_characters($row['nombre'], 35, true);
if (is_metaconsole() === false) {
$name_link = '<a href="index.php?sec=estado&sec2=';
} else {
$name_link = '<a href="'.$row['server_url'].'index.php?sec=estado&sec2=';
}
$name_link .= 'operation/agentes/ver_agente&id_agente='.$row['id_agente'];
$name_link .= '"><b>';
$name_link .= '<span class="ellipsis-35ch">'.html_ellipsis_characters($row['alias'], 35, true).'</span>';
$name_link .= '</b></a>';
$data[$key]['alias'] = $name_link;
$data[$key]['last_status_change'] = ui_print_timestamp(
$row['last_status_change'],
true
);
switch ((int) $row['estado']) {
case 0:
$status_img = ui_print_status_image(STATUS_MODULE_OK, __('Normal'), true);
break;
case 1:
case 6:
$status_img = ui_print_status_image(STATUS_MODULE_CRITICAL, __('Critical'), true);
break;
case 2:
$status_img = ui_print_status_image(STATUS_MODULE_WARNING, __('Warning'), true);
break;
case 3:
$status_img = ui_print_status_image(STATUS_MODULE_UNKNOWN, __('Unknown'), true);
break;
case 5:
$status_img = ui_print_status_image(STATUS_MODULE_NO_DATA, __('Not init'), true);
break;
default:
$status_img = '';
break;
}
$data[$key]['estado'] = $status_img;
}
echo json_encode(
[
'data' => $data,
'recordsTotal' => $recordsTotal,
'recordsFiltered' => $recordsTotal,
]
);
}
if ($get_children_modules === true) { if ($get_children_modules === true) {
$parent_modules = get_parameter('parent_modulues', false); $parent_modules = get_parameter('parent_modulues', false);
$children_selected = []; $children_selected = [];

View File

@ -1329,7 +1329,7 @@ class AgentWizard extends HTML
$table->rowstyle[$i] = 'color:#ccc;'; $table->rowstyle[$i] = 'color:#ccc;';
$data[0] .= ' '; $data[0] .= ' ';
$data[0] .= html_print_image( $data[0] .= html_print_image(
'images/error.png', 'images/alert-warning@svg.svg',
true, true,
['title' => $msgError] ['title' => $msgError]
); );
@ -1347,7 +1347,7 @@ class AgentWizard extends HTML
// Img Server. // Img Server.
if ($this->serverType == SERVER_TYPE_ENTERPRISE_SATELLITE) { if ($this->serverType == SERVER_TYPE_ENTERPRISE_SATELLITE) {
$img_server = html_print_image( $img_server = html_print_image(
'images/satellite.png', 'images/satellite@os.svg',
true, true,
[ [
'title' => __('Enterprise Satellite server'), 'title' => __('Enterprise Satellite server'),
@ -1357,7 +1357,7 @@ class AgentWizard extends HTML
} else { } else {
if ($module['execution_type'] == EXECUTION_TYPE_PLUGIN) { if ($module['execution_type'] == EXECUTION_TYPE_PLUGIN) {
$img_server = html_print_image( $img_server = html_print_image(
'images/plugin.png', 'images/plugins@svg.svg',
true, true,
[ [
'title' => __('Plugin server'), 'title' => __('Plugin server'),
@ -1367,7 +1367,7 @@ class AgentWizard extends HTML
} else { } else {
if ($this->protocol === 'wmi') { if ($this->protocol === 'wmi') {
$img_server = html_print_image( $img_server = html_print_image(
'images/wmi.png', 'images/WMI@svg.svg',
true, true,
[ [
'title' => __('WMI server'), 'title' => __('WMI server'),
@ -1376,7 +1376,7 @@ class AgentWizard extends HTML
); );
} else { } else {
$img_server = html_print_image( $img_server = html_print_image(
'images/op_network.png', 'images/network@svg.svg',
true, true,
[ [
'title' => __('Network server'), 'title' => __('Network server'),
@ -4090,7 +4090,7 @@ class AgentWizard extends HTML
$blockTitle .= '<b>'.$block['name']; $blockTitle .= '<b>'.$block['name'];
$blockTitle .= '&nbsp;&nbsp;'; $blockTitle .= '&nbsp;&nbsp;';
$blockTitle .= html_print_image( $blockTitle .= html_print_image(
'images/tip_help.png', 'images/info@svg.svg',
true, true,
[ [
'title' => __('Modules selected'), 'title' => __('Modules selected'),
@ -4110,7 +4110,7 @@ class AgentWizard extends HTML
$blockTitle .= '&nbsp;&nbsp;'; $blockTitle .= '&nbsp;&nbsp;';
$blockTitle .= html_print_image( $blockTitle .= html_print_image(
'images/tip_help.png', 'images/info@svg.svg',
true, true,
[ [
'title' => __('Modules selected'), 'title' => __('Modules selected'),
@ -4205,6 +4205,9 @@ class AgentWizard extends HTML
$table->size[4] = '140px'; $table->size[4] = '140px';
$table->size[5] = '3%'; $table->size[5] = '3%';
$table->align = [];
$table->align[1] = 'center';
// If is needed show current value, we must correct the table. // If is needed show current value, we must correct the table.
if ($showCurrentValue === true) { if ($showCurrentValue === true) {
// Correct headers. // Correct headers.
@ -4273,7 +4276,7 @@ class AgentWizard extends HTML
false, false,
false, false,
'', '',
$md5IdBlock, $md5IdBlock.' w100p',
'', '',
'', '',
false, false,
@ -4293,8 +4296,9 @@ class AgentWizard extends HTML
1, 1,
20, 20,
$module['description'], $module['description'],
'form=\'form-create-modules\' class=\'min-height-50px\'', 'form=\'form-create-modules\'',
true true,
'w100p'
); );
} }
@ -4703,8 +4707,6 @@ class AgentWizard extends HTML
'toggle_class' => '', 'toggle_class' => '',
'container_class' => 'white-box-content', 'container_class' => 'white-box-content',
'main_class' => $class, 'main_class' => $class,
'img_a' => 'images/arrow_down_green.png',
'img_b' => 'images/arrow_right_green.png',
'clean' => false, 'clean' => false,
'reverseImg' => $reverseImg, 'reverseImg' => $reverseImg,
'switch' => $buttonSwitch, 'switch' => $buttonSwitch,

View File

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

View File

@ -6740,6 +6740,32 @@ function html_print_extended_select_for_downtime_cron(
} }
/**
* Ellipse string to x characters.
*
* @param string $string String to ellipsis.
* @param integer $characters Characters size to show.
* @return string String ellipsed.
*/
function html_ellipsis_characters(
string $string,
int $characters,
bool $return=false
) {
$out = $string;
if (strlen($string) > $characters) {
$out = substr($string, 0, $characters).'...';
}
if ($return === true) {
return $out;
} else {
echo $out;
}
}
/** /**
* Return formed subtitle with the new Pandora's style. * Return formed subtitle with the new Pandora's style.
* *

View File

@ -1017,40 +1017,58 @@ function servers_get_info($id_server=-1)
// Remote servers LAG Calculation (server_type != 0). // Remote servers LAG Calculation (server_type != 0).
if ($server['server_type'] != 0) { if ($server['server_type'] != 0) {
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations. // MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
$result = db_get_row_sql( $sql = sprintf(
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, 'SELECT COUNT(tam.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag" AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS "lag"
FROM tagente_estado, tagente_modulo, tagente FROM (
WHERE utimestamp > 0 SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo
AND tagente.disabled = 0 FROM tagente_estado
AND tagente.id_agente = tagente_estado.id_agente WHERE tagente_estado.current_interval > 0
AND tagente_estado.last_execution_try > 0
AND tagente_estado.running_by = %d
) tae
JOIN (
SELECT tagente_modulo.id_agente_modulo
FROM tagente_modulo LEFT JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
WHERE tagente.disabled = 0
AND tagente_modulo.disabled = 0 AND tagente_modulo.disabled = 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo ) tam
AND current_interval > 0 ON tae.id_agente_modulo = tam.id_agente_modulo
AND running_by = '.$server['id_server'].' WHERE (UNIX_TIMESTAMP() - tae.last_execution_try) > (tae.current_interval)
AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10) AND (UNIX_TIMESTAMP() - tae.last_execution_try) < ( tae.current_interval * 10)',
AND (UNIX_TIMESTAMP() - utimestamp) > current_interval' $server['id_server']
); );
} else { } else {
// Local/Dataserver server LAG calculation. // Local/Dataserver server LAG calculation.
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations. // MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
$result = db_get_row_sql( $sql = sprintf(
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, 'SELECT COUNT(tam.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag" AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS "lag"
FROM tagente_estado, tagente_modulo, tagente FROM (
WHERE utimestamp > 0 SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo
AND tagente.disabled = 0 FROM tagente_estado
AND tagente.id_agente = tagente_estado.id_agente WHERE tagente_estado.current_interval > 0
AND tagente_estado.last_execution_try > 0
AND tagente_estado.running_by = %d
) tae
JOIN (
SELECT tagente_modulo.id_agente_modulo
FROM tagente_modulo LEFT JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
WHERE tagente.disabled = 0
AND tagente_modulo.disabled = 0 AND tagente_modulo.disabled = 0
AND tagente_modulo.id_tipo_modulo < 5 AND tagente_modulo.id_tipo_modulo < 5
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo ) tam
AND current_interval > 0 ON tae.id_agente_modulo = tam.id_agente_modulo
AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10) WHERE (UNIX_TIMESTAMP() - tae.last_execution_try) > (tae.current_interval * 1.1)
AND running_by = '.$server['id_server'].' AND (UNIX_TIMESTAMP() - tae.last_execution_try) < ( tae.current_interval * 10)',
AND (UNIX_TIMESTAMP() - utimestamp) > (current_interval * 1.1)' $server['id_server']
); );
} }
$result = db_get_row_sql($sql);
// Lag over current_interval * 2 is not lag, // Lag over current_interval * 2 is not lag,
// it's a timed out module. // it's a timed out module.
if (!empty($result['lag'])) { if (!empty($result['lag'])) {

View File

@ -696,7 +696,7 @@ function get_build_setup_charts($type, $options, $data)
$legend->setAlign($legendAlign); $legend->setAlign($legendAlign);
// Defaults fonts legends. // Defaults fonts legends.
$legend->labels()->getFonts()->setFamily((empty($config['fontpath']) === true) ? 'Lato' : $config['fontpath']); $legend->labels()->getFonts()->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
$legend->labels()->getFonts()->setStyle('normal'); $legend->labels()->getFonts()->setStyle('normal');
$legend->labels()->getFonts()->setWeight(600); $legend->labels()->getFonts()->setWeight(600);
$legend->labels()->getFonts()->setSize(((int) $config['font_size'] + 2)); $legend->labels()->getFonts()->setSize(((int) $config['font_size'] + 2));
@ -835,7 +835,7 @@ function get_build_setup_charts($type, $options, $data)
$dataLabel->setFormatter($dataLabelFormatter); $dataLabel->setFormatter($dataLabelFormatter);
// Defaults fonts datalabel. // Defaults fonts datalabel.
$dataLabel->getFonts()->setFamily((empty($config['fontpath']) === true) ? 'Lato' : $config['fontpath']); $dataLabel->getFonts()->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
$dataLabel->getFonts()->setStyle('normal'); $dataLabel->getFonts()->setStyle('normal');
$dataLabel->getFonts()->setWeight(600); $dataLabel->getFonts()->setWeight(600);
$dataLabel->getFonts()->setSize(((int) $config['font_size'] + 2)); $dataLabel->getFonts()->setSize(((int) $config['font_size'] + 2));
@ -944,14 +944,14 @@ function get_build_setup_charts($type, $options, $data)
// Defaults scalesFont X. // Defaults scalesFont X.
$scalesXFonts = $scales->getX()->ticks()->getFonts(); $scalesXFonts = $scales->getX()->ticks()->getFonts();
$scalesXFonts->setFamily((empty($config['fontpath']) === true) ? 'Lato' : $config['fontpath']); $scalesXFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
$scalesXFonts->setStyle('normal'); $scalesXFonts->setStyle('normal');
$scalesXFonts->setWeight(600); $scalesXFonts->setWeight(600);
$scalesXFonts->setSize(((int) $config['font_size'] + 2)); $scalesXFonts->setSize(((int) $config['font_size'] + 2));
// Defaults scalesFont Y. // Defaults scalesFont Y.
$scalesYFonts = $scales->getY()->ticks()->getFonts(); $scalesYFonts = $scales->getY()->ticks()->getFonts();
$scalesYFonts->setFamily((empty($config['fontpath']) === true) ? 'Lato' : $config['fontpath']); $scalesYFonts->setFamily((empty($config['fontpath']) === true) ? 'lato' : $config['fontpath']);
$scalesYFonts->setStyle('normal'); $scalesYFonts->setStyle('normal');
$scalesYFonts->setWeight(600); $scalesYFonts->setWeight(600);
$scalesYFonts->setSize(((int) $config['font_size'] + 2)); $scalesYFonts->setSize(((int) $config['font_size'] + 2));

File diff suppressed because one or more lines are too long

View File

@ -806,7 +806,9 @@ function dashboardLoadNetworkMap(settings) {
auth_hash: settings.auth_hash, auth_hash: settings.auth_hash,
id_user: settings.id_user, id_user: settings.id_user,
ignore_acl: 1, ignore_acl: 1,
node: settings.node node: settings.node,
dashboard: 1,
size: settings.size
}, },
dataType: "html", dataType: "html",
success: function(data) { success: function(data) {

View File

@ -421,6 +421,8 @@ class Widget
case 'BlockHistogram': case 'BlockHistogram':
case 'DataMatrix': case 'DataMatrix':
case 'EventCardboard': case 'EventCardboard':
case 'ModulesByStatus':
case 'AvgSumMaxMinModule':
$className .= '\\'.$name; $className .= '\\'.$name;
break; break;

View File

@ -0,0 +1,701 @@
<?php
/**
* Widget Avg|Sum|Max|Min Module Data Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget Avg|Sum|Max|Min Module Data
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Enterprise\Metaconsole\Node;
global $config;
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_modules.php';
/**
* Avg|Sum|Max|Min Module Widgets.
*/
class AvgSumMaxMinModule extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Grid Width.
*
* @var integer
*/
protected $gridWidth;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
* @param integer|null $gridWidth Grid width.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0,
?int $gridWidth=0
) {
global $config;
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->width = $width;
// Height.
$this->height = $height;
// Grid Width.
$this->gridWidth = $gridWidth;
// Cell Id.
$this->cellId = $cellId;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Avg|Sum|Max|Min Module Data');
// Name.
if (empty($this->name) === true) {
$this->name = 'AvgSumMaxMinModule';
}
// This forces at least a first configuration.
$this->configurationRequired = false;
if (empty($this->values['moduleId']) === true) {
$this->configurationRequired = true;
} else {
try {
if (is_metaconsole() === true
&& $this->values['metaconsoleId'] > 0
) {
$node = new Node($this->values['metaconsoleId']);
$node->connect();
}
$check_exist = db_get_sql(
sprintf(
'SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente_modulo = %s
AND delete_pending = 0',
$this->values['moduleId']
)
);
} catch (\Exception $e) {
// Unexistent agent.
if (is_metaconsole() === true
&& $this->values['metaconsoleId'] > 0
) {
$node->disconnect();
}
$check_exist = false;
} finally {
if (is_metaconsole() === true
&& $this->values['metaconsoleId'] > 0
) {
$node->disconnect();
}
}
if ($check_exist === false) {
$this->loadError = true;
}
}
$this->overflow_scrollbars = false;
}
/**
* Decoders hack for retrocompability.
*
* @param array $decoder Values.
*
* @return array Returns the values with the correct key.
*/
public function decoders(array $decoder): array
{
$values = [];
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
if (isset($decoder['label_'.$this->cellId]) === true) {
$values['label'] = $decoder['label_'.$this->cellId];
}
if (isset($decoder['label']) === true) {
$values['label'] = $decoder['label'];
}
if (isset($decoder['id_agent_'.$this->cellId]) === true) {
$values['agentId'] = $decoder['id_agent_'.$this->cellId];
}
if (isset($decoder['type_'.$this->cellId]) === true) {
$values['type'] = $decoder['type_'.$this->cellId];
}
if (isset($decoder['type']) === true) {
$values['type'] = $decoder['type'];
}
if (isset($decoder['period_'.$this->cellId]) === true) {
$values['period'] = $decoder['period_'.$this->cellId];
}
if (isset($decoder['period']) === true) {
$values['period'] = $decoder['period'];
}
if (isset($decoder['agentId']) === true) {
$values['agentId'] = $decoder['agentId'];
}
if (isset($decoder['metaconsoleId']) === true) {
$values['metaconsoleId'] = $decoder['metaconsoleId'];
}
if (isset($decoder['id_module_'.$this->cellId]) === true) {
$values['moduleId'] = $decoder['id_module_'.$this->cellId];
}
if (isset($decoder['moduleId']) === true) {
$values['moduleId'] = $decoder['moduleId'];
}
if (isset($decoder['size_value_'.$this->cellId]) === true) {
$values['sizeValue'] = $decoder['size_value_'.$this->cellId];
}
if (isset($decoder['sizeValue']) === true) {
$values['sizeValue'] = $decoder['sizeValue'];
}
if (isset($decoder['size_label_'.$this->cellId]) === true) {
$values['sizeLabel'] = $decoder['size_label_'.$this->cellId];
}
if (isset($decoder['sizeLabel']) === true) {
$values['sizeLabel'] = $decoder['sizeLabel'];
}
if (isset($decoder['text_color_'.$this->cellId]) === true) {
$values['text_color'] = $decoder['text_color_'.$this->cellId];
}
if (isset($decoder['text_color']) === true) {
$values['text_color'] = $decoder['text_color'];
}
if (isset($decoder['unit_'.$this->cellId]) === true) {
$values['unit'] = $decoder['unit_'.$this->cellId];
}
if (isset($decoder['unit']) === true) {
$values['unit'] = $decoder['unit'];
}
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
global $config;
$values = $this->values;
// Default values.
if (isset($values['sizeLabel']) === false) {
$values['sizeLabel'] = 20;
}
if (isset($values['sizeValue']) === false) {
$values['sizeValue'] = 20;
}
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
// Label.
$inputs[] = [
'label' => __('Label'),
'arguments' => [
'name' => 'label',
'type' => 'text',
'value' => $values['label'],
'return' => true,
'size' => 0,
],
];
// Type.
$type_fields = [];
$type_fields[0] = 'AVG';
$type_fields[1] = 'SUM';
$type_fields[2] = 'MAX';
$type_fields[3] = 'MIN';
$type_selected = explode(',', $values['type']);
(isset($values['type']) === false) ? $type_selected = 0 : '';
$inputs[] = [
'label' => __('Type'),
'arguments' => [
'name' => 'type',
'type' => 'select',
'fields' => $type_fields,
'selected' => $type_selected,
'return' => true,
'required' => true,
'select2_enable' => false,
'sort' => false,
],
];
// Period.
$period_fields = [];
$period_fields[0] = __('Last 30 days');
$period_fields[1] = __('This month');
$period_fields[2] = __('Last 7 days');
$period_fields[3] = __('This week');
$period_fields[4] = __('Last 24 hrs');
$period_fields[5] = __('Today');
$period_selected = explode(',', $values['period']);
(isset($values['period']) === false) ? $period_selected = 0 : '';
$inputs[] = [
'label' => __('Time period'),
'arguments' => [
'name' => 'period',
'type' => 'select',
'fields' => $period_fields,
'selected' => $period_selected,
'return' => true,
'required' => true,
'select2_enable' => false,
'sort' => false,
],
];
// Autocomplete agents.
$inputs[] = [
'label' => __('Agent'),
'arguments' => [
'type' => 'autocomplete_agent',
'name' => 'agentAlias',
'id_agent_hidden' => $values['agentId'],
'name_agent_hidden' => 'agentId',
'server_id_hidden' => $values['metaconsoleId'],
'name_server_hidden' => 'metaconsoleId',
'return' => true,
'module_input' => true,
'module_name' => 'moduleId',
'module_none' => false,
'size' => 0,
],
];
// Autocomplete module.
$inputs[] = [
'label' => __('Module'),
'arguments' => [
'type' => 'autocomplete_module',
'name' => 'moduleId',
'selected' => $values['moduleId'],
'return' => true,
'sort' => false,
'agent_id' => $values['agentId'],
'metaconsole_id' => $values['metaconsoleId'],
'style' => 'width: inherit;',
'filter_modules' => (users_access_to_agent($values['agentId']) === false) ? [$values['moduleId']] : [],
'nothing' => __('None'),
'nothing_value' => 0,
],
];
// Text size of value in px.
$inputs[] = [
'label' => __('Text size of value in px'),
'arguments' => [
'name' => 'sizeValue',
'type' => 'number',
'value' => $values['sizeValue'],
'return' => true,
'min' => 0,
],
];
// Text size of label in px.
$inputs[] = [
'label' => __('Text size of label in px'),
'arguments' => [
'name' => 'sizeLabel',
'type' => 'number',
'value' => $values['sizeLabel'],
'return' => true,
'min' => 0,
],
];
// Text color.
if (empty($values['text_color']) === true) {
$values['text_color'] = '#000000';
if ($config['style'] === 'pandora_black'
&& is_metaconsole() === false
) {
$values['text_color'] = '#eeeeee';
}
}
$inputs[] = [
'label' => __('Text color'),
'arguments' => [
'wrapper' => 'div',
'name' => 'text_color',
'type' => 'color',
'value' => $values['text_color'],
'return' => true,
],
];
// Unit.
$inputs[] = [
'label' => __('Unit'),
'arguments' => [
'wrapper' => 'div',
'name' => 'unit',
'type' => 'switch',
'value' => $values['unit'],
'return' => true,
],
];
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['label'] = \get_parameter('label', '');
$values['type'] = \get_parameter('type', 0);
$values['period'] = \get_parameter('period', 0);
$values['agentId'] = \get_parameter('agentId', 0);
$values['metaconsoleId'] = \get_parameter('metaconsoleId', 0);
$values['moduleId'] = \get_parameter('moduleId', 0);
$values['sizeValue'] = \get_parameter('sizeValue', 0);
$values['sizeLabel'] = \get_parameter_switch('sizeLabel');
$values['text_color'] = \get_parameter('text_color', 0);
$values['unit'] = \get_parameter_switch('unit');
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
global $config;
$output = '';
$text_color = 'color:'.$this->values['text_color'].' !important;';
$id_module = $this->values['moduleId'];
$to = 0;
$now = time();
switch ((int) $this->values['period']) {
case 0:
$to = strtotime('-30 days');
break;
case 1:
$to = strtotime(date('Y-m-01 00:00:00'));
break;
case 2:
$to = strtotime('-7 days');
break;
case 3:
$to = strtotime('last Monday');
break;
case 4:
$to = strtotime('-1 days');
break;
case 5:
$to = strtotime(date('Y-m-d 00:00:00'));
break;
default:
$to = 0;
break;
}
$data = 0;
switch ((int) $this->values['type']) {
case 0:
$rows = modules_get_raw_data($id_module, $to, $now);
$count = (int) count($rows);
$sum = 0;
foreach ($rows as $row) {
$sum += (int) $row['datos'];
}
$data = ($sum / $count);
break;
case 1:
$rows = modules_get_raw_data($id_module, $to, $now);
$sum = 0;
foreach ($rows as $row) {
$sum += (int) $row['datos'];
}
$data = $sum;
break;
case 2:
$rows = modules_get_min_max_data($id_module, $to);
$data = $rows[0]['max'];
break;
case 3:
$rows = modules_get_min_max_data($id_module, $to);
$data = $rows[0]['min'];
break;
default:
$data = 0;
break;
}
$label = $this->values['label'];
$sizeLabel = (isset($this->values['sizeLabel']) === true) ? $this->values['sizeLabel'] : 40;
$sizeValue = (isset($this->values['sizeValue']) === true) ? $this->values['sizeValue'] : 40;
$output .= '<div class="container-center">';
// General div.
$output .= '<div class="container-icon">';
// Div value.
$output .= '<div style="flex: 0 1 '.$sizeValue.'px; font-size:'.$sizeValue.'px;'.$text_color.'">';
if (is_numeric($data) === true) {
$dataDatos = remove_right_zeros(
number_format(
$data,
$config['graph_precision'],
$config['decimal_separator'],
$config['thousand_separator']
)
);
} else {
$dataDatos = trim($data);
}
$unit = '';
if (empty($this->values['unit']) === false) {
$unit = modules_get_unit($id_module);
}
$output .= $dataDatos.'&nbsp;'.$unit;
$output .= '</div>';
if (empty($label) === false) {
// Div Label.
$output .= '<div style="flex: 1 1 '.$sizeLabel.'px; font-size:'.$sizeLabel.'px;'.$text_color.'">'.$label.'</div>';
}
$output .= '</div>';
$output .= '</div>';
return $output;
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Avg|Sum|Max|Min Module Data');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'AvgSumMaxMinModule';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
$size = [
'width' => 550,
'height' => 710,
];
return $size;
}
}

View File

@ -520,7 +520,7 @@ class DataMatrix extends Widget
[ [
'id' => $tableId, 'id' => $tableId,
'class' => 'info_table', 'class' => 'info_table',
'style' => 'width: 100%', 'style' => 'width: 99%',
'columns' => $columns, 'columns' => $columns,
'column_names' => $column_names, 'column_names' => $column_names,
'ajax_url' => 'include/ajax/module', 'ajax_url' => 'include/ajax/module',
@ -539,6 +539,7 @@ class DataMatrix extends Widget
'direction' => 'desc', 'direction' => 'desc',
], ],
'csv' => 0, 'csv' => 0,
'dom_elements' => 'frtilp',
] ]
); );
} catch (\Exception $e) { } catch (\Exception $e) {
@ -643,7 +644,14 @@ class DataMatrix extends Widget
} }
$columns_sort[] = ($key + 1); $columns_sort[] = ($key + 1);
$column_names[] = $name; $column_names[] = \ui_print_truncate_text(
\io_safe_output($name),
'agent_small',
false,
true,
false,
'...'
);
} }
$data = [ $data = [

View File

@ -0,0 +1,595 @@
<?php
/**
* Widget Module status Pandora FMS Console
*
* @category Console Class
* @package Pandora FMS
* @subpackage Widget Module status
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
namespace PandoraFMS\Dashboard;
use PandoraFMS\Enterprise\Metaconsole\Node;
global $config;
/**
* Module status Widgets.
*/
class ModulesByStatus extends Widget
{
/**
* Name widget.
*
* @var string
*/
protected $name;
/**
* Title widget.
*
* @var string
*/
protected $title;
/**
* Page widget;
*
* @var string
*/
protected $page;
/**
* Class name widget.
*
* @var [type]
*/
protected $className;
/**
* Values options for each widget.
*
* @var [type]
*/
protected $values;
/**
* Configuration required.
*
* @var boolean
*/
protected $configurationRequired;
/**
* Error load widget.
*
* @var boolean
*/
protected $loadError;
/**
* Width.
*
* @var integer
*/
protected $width;
/**
* Heigth.
*
* @var integer
*/
protected $height;
/**
* Grid Width.
*
* @var integer
*/
protected $gridWidth;
/**
* Cell ID.
*
* @var integer
*/
protected $cellId;
/**
* Construct.
*
* @param integer $cellId Cell ID.
* @param integer $dashboardId Dashboard ID.
* @param integer $widgetId Widget ID.
* @param integer|null $width New width.
* @param integer|null $height New height.
* @param integer|null $gridWidth Grid width.
*/
public function __construct(
int $cellId,
int $dashboardId=0,
int $widgetId=0,
?int $width=0,
?int $height=0,
?int $gridWidth=0
) {
global $config;
// WARNING: Do not edit. This chunk must be in the constructor.
parent::__construct(
$cellId,
$dashboardId,
$widgetId
);
// Width.
$this->width = $width;
// Height.
$this->height = $height;
// Grid Width.
$this->gridWidth = $gridWidth;
// Cell Id.
$this->cellId = $cellId;
// Options.
$this->values = $this->decoders($this->getOptionsWidget());
// Positions.
$this->position = $this->getPositionWidget();
// Page.
$this->page = basename(__FILE__);
// ClassName.
$class = new \ReflectionClass($this);
$this->className = $class->getShortName();
// Title.
$this->title = __('Module status');
// Name.
if (empty($this->name) === true) {
$this->name = 'ModulesByStatus';
}
// This forces at least a first configuration.
// This forces at least a first configuration.
$this->configurationRequired = false;
if (empty($this->values['status']) === true) {
$this->configurationRequired = true;
}
$this->overflow_scrollbars = false;
}
/**
* Decoders hack for retrocompability.
*
* @param array $decoder Values.
*
* @return array Returns the values with the correct key.
*/
public function decoders(array $decoder): array
{
$values = [];
// Retrieve global - common inputs.
$values = parent::decoders($decoder);
if (isset($decoder['search']) === true) {
$values['search'] = $decoder['search'];
}
if (isset($decoder['status']) === true) {
$values['status'] = $decoder['status'];
}
if (isset($decoder['limit']) === true) {
$values['limit'] = $decoder['limit'];
}
if (isset($decoder['nodes']) === true) {
$values['nodes'] = $decoder['nodes'];
}
return $values;
}
/**
* Generates inputs for form (specific).
*
* @return array Of inputs.
*
* @throws Exception On error.
*/
public function getFormInputs(): array
{
global $config;
$values = $this->values;
// Retrieve global - common inputs.
$inputs = parent::getFormInputs();
// Search.
$inputs[] = [
'label' => __('Free search').ui_print_help_tip(__('Search filter by Module name field content'), true),
'arguments' => [
'name' => 'search',
'type' => 'text',
'value' => $values['search'],
'return' => true,
'size' => 0,
],
];
// Status fields.
$status_fields = [];
$status_fields[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
$status_fields[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
$status_fields[AGENT_MODULE_STATUS_WARNING] = __('Warning');
$status_fields[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
$status_fields[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
$status_fields[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal');
$status_selected = explode(',', $values['status']);
(isset($values['status']) === false) ? $status_selected = AGENT_MODULE_STATUS_CRITICAL_BAD : '';
$inputs[] = [
'label' => __('Status'),
'arguments' => [
'name' => 'status',
'type' => 'select',
'fields' => $status_fields,
'selected' => $status_selected,
'return' => true,
'multiple' => true,
'class' => 'overflow-hidden',
'size' => count($status_fields),
'select_all' => false,
'required' => true,
],
];
// Limit fields.
$limit_fields = [];
$limit_fields[5] = 5;
$limit_fields[10] = 10;
$limit_fields[25] = 25;
$limit_fields[100] = 100;
$limit_fields[200] = 200;
$limit_fields[500] = 500;
$limit_fields[1000] = 1000;
$limit_selected = explode(',', $values['limit']);
(isset($values['limit']) === false) ? $limit_selected = 5 : '';
$inputs[] = [
'label' => __('Limit'),
'arguments' => [
'name' => 'limit',
'type' => 'select',
'fields' => $limit_fields,
'selected' => $limit_selected,
'return' => true,
'required' => true,
'select2_enable' => false,
],
];
// Nodes.
if (is_metaconsole() === true) {
$nodes_fields = [];
$servers_ids = metaconsole_get_servers();
foreach ($servers_ids as $server) {
$nodes_fields[$server['id']] = $server['server_name'];
}
$nodes_selected = explode(',', $values['nodes']);
(isset($values['nodes']) === false) ? $nodes_selected = $servers_ids : '';
$nodes_height = count($nodes_fields);
if (count($nodes_fields) > 5) {
$nodes_height = 5;
}
$inputs[] = [
'label' => __('Nodes'),
'arguments' => [
'name' => 'nodes',
'type' => 'select',
'fields' => $nodes_fields,
'selected' => $nodes_selected,
'return' => true,
'multiple' => true,
'class' => 'overflow-hidden',
'size' => $nodes_height,
'select_all' => false,
'required' => true,
],
];
}
return $inputs;
}
/**
* Get Post for widget.
*
* @return array
*/
public function getPost():array
{
// Retrieve global - common inputs.
$values = parent::getPost();
$values['search'] = \get_parameter('search', '');
$values['status'] = \get_parameter('status', '');
$values['limit'] = \get_parameter('limit', '');
$values['nodes'] = \get_parameter('nodes', '');
return $values;
}
/**
* Draw widget.
*
* @return string;
*/
public function load()
{
$this->size = parent::getSize();
$output = '';
if (is_metaconsole() === true) {
$modules = [];
$servers_ids = array_column(metaconsole_get_servers(), 'id');
foreach ($servers_ids as $server_id) {
try {
$node = new Node((int) $server_id);
$node->connect();
$modules_tmp = $this->getInfoModules(
$this->values['search'],
$this->values['status'],
$this->values['nodes']
);
$modules[$node->id()] = $modules_tmp[0];
$node->disconnect();
} catch (\Exception $e) {
// Unexistent modules.
$node->disconnect();
}
}
} else {
$modules = $this->getInfoModules(
$this->values['search'],
$this->values['status']
);
}
if ($modules !== false && empty($modules) === false) {
// Datatables list.
try {
$info_columns = $this->columns();
$column_names = $info_columns['column_names'];
$columns = $info_columns['columns'];
$tableId = 'ModuleByStatus_'.$this->dashboardId.'_'.$this->cellId;
// Load datatables user interface.
ui_print_datatable(
[
'id' => $tableId,
'class' => 'info_table align-left-important',
'style' => 'width: 100%',
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'include/ajax/module',
'ajax_data' => [
'get_data_ModulesByStatus' => 1,
'table_id' => $tableId,
'search' => $this->values['search'],
'status' => $this->values['status'],
'nodes' => $this->values['nodes'],
],
'default_pagination' => $this->values['limit'],
'order' => [
'field' => 'last_status_change',
'direction' => 'desc',
],
'csv' => 0,
]
);
} catch (\Exception $e) {
echo $e->getMessage();
}
} else {
$output = '';
$output .= '<div class="container-center">';
$output .= \ui_print_info_message(
__('Not found modules'),
'',
true
);
$output .= '</div>';
return $output;
}
}
/**
* Get info modules.
*
* @param string $search Free search.
* @param string $status Modules status.
*
* @return array Data.
*/
private function getInfoModules(string $search, string $status): array
{
if (empty($search) === false) {
$where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND ';
}
$where .= sprintf(
'tagente_estado.estado IN (%s)
AND tagente_modulo.delete_pending = 0',
$status
);
$sql = sprintf(
'SELECT
COUNT(*) AS "modules"
FROM tagente_modulo
INNER JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
WHERE %s',
$where
);
$modules = db_get_all_rows_sql($sql);
if ($modules === false) {
$modules = [];
}
return $modules;
}
/**
* Get columns.
*
* @return array
*/
private function columns()
{
$columns = [];
$column_names = [];
if (is_metaconsole() === true) {
$column_names = [
__('Module name'),
__('Agent'),
__('Node'),
__('Last status change'),
__('Status'),
];
$columns = [
'nombre',
'alias',
'server_name',
'last_status_change',
'estado',
];
} else {
$column_names = [
__('Module name'),
__('Agent'),
__('Last status change'),
__('Status'),
];
$columns = [
'nombre',
'alias',
'last_status_change',
'estado',
];
}
$data = [
'columns' => $columns,
'column_names' => $column_names,
];
return $data;
}
/**
* Get description.
*
* @return string.
*/
public static function getDescription()
{
return __('Modules by status');
}
/**
* Get Name.
*
* @return string.
*/
public static function getName()
{
return 'ModulesByStatus';
}
/**
* Get size Modal Configuration.
*
* @return array
*/
public function getSizeModalConfiguration(): array
{
if (is_metaconsole() === true) {
$nodes_fields = array_column(metaconsole_get_servers(), 'id');
$height_counter = (((int) count($nodes_fields)) * 20);
$size = [
'width' => 450,
'height' => (520 + $height_counter),
];
} else {
$size = [
'width' => 450,
'height' => 480,
];
}
return $size;
}
}

View File

@ -424,9 +424,9 @@ class AgentModuleWidget extends Widget
array $visualData, array $visualData,
array $allModules array $allModules
):string { ):string {
$style = 'display:flex; width:96%; margin-top: 10px;'; $style = 'display:flex; width:100%; margin-top: 10px;';
$table_data = '<div style="'.$style.'">'; $table_data = '<div style="'.$style.'">';
$table_data .= '<table class="widget_agent_module transparent mrgn_0px" cellpadding="1" cellspacing="0" border="0">'; $table_data .= '<table class="info_table transparent" cellpadding="1" cellspacing="0" border="0">';
if (empty($visualData) === false) { if (empty($visualData) === false) {
$table_data .= '<th>'.__('Agents').' / '.__('Modules').'</th>'; $table_data .= '<th>'.__('Agents').' / '.__('Modules').'</th>';
@ -450,29 +450,24 @@ class AgentModuleWidget extends Widget
switch ($row['agent_status']) { switch ($row['agent_status']) {
case AGENT_STATUS_ALERT_FIRED: case AGENT_STATUS_ALERT_FIRED:
$rowcolor = COL_ALERTFIRED; $rowcolor = COL_ALERTFIRED;
$textcolor = '#000';
break; break;
case AGENT_STATUS_CRITICAL: case AGENT_STATUS_CRITICAL:
$rowcolor = COL_CRITICAL; $rowcolor = COL_CRITICAL;
$textcolor = '#FFF';
break; break;
case AGENT_STATUS_WARNING: case AGENT_STATUS_WARNING:
$rowcolor = COL_WARNING; $rowcolor = COL_WARNING;
$textcolor = '#000';
break; break;
case AGENT_STATUS_NORMAL: case AGENT_STATUS_NORMAL:
$rowcolor = COL_NORMAL; $rowcolor = COL_NORMAL;
$textcolor = '#FFF';
break; break;
case AGENT_STATUS_UNKNOWN: case AGENT_STATUS_UNKNOWN:
case AGENT_STATUS_ALL: case AGENT_STATUS_ALL:
default: default:
$rowcolor = COL_UNKNOWN; $rowcolor = COL_UNKNOWN;
$textcolor = '#FFF';
break; break;
} }
@ -484,8 +479,10 @@ class AgentModuleWidget extends Widget
false, false,
'...' '...'
); );
$table_data .= "<td style='background-color: ".$rowcolor.";'>"; $table_data .= '<td>';
$table_data .= '<div class="flex"><div class="div-state-agent" style="background-color: '.$rowcolor.';"></div>';
$table_data .= $file_name; $table_data .= $file_name;
$table_data .= '</div>';
$table_data .= '</td>'; $table_data .= '</td>';
if ($row['modules'] === null) { if ($row['modules'] === null) {
@ -494,7 +491,7 @@ class AgentModuleWidget extends Widget
foreach ($row['modules'] as $module_name => $module) { foreach ($row['modules'] as $module_name => $module) {
if ($this->values['mTypeShow'] === '1') { if ($this->values['mTypeShow'] === '1') {
$style = 'text-align: center;'; $style = 'text-align: left;';
$style .= ' background-color: transparent;'; $style .= ' background-color: transparent;';
$table_data .= "<td style='".$style."'>"; $table_data .= "<td style='".$style."'>";
$table_data .= $module; $table_data .= $module;
@ -509,7 +506,7 @@ class AgentModuleWidget extends Widget
continue; continue;
} }
} else { } else {
$style = 'text-align: center;'; $style = 'text-align: left;';
$style .= ' background-color: transparent;'; $style .= ' background-color: transparent;';
$table_data .= "<td style='".$style."'>"; $table_data .= "<td style='".$style."'>";
switch ($module) { switch ($module) {

View File

@ -521,7 +521,7 @@ class CustomGraphWidget extends Widget
$params = [ $params = [
'period' => $this->values['period'], 'period' => $this->values['period'],
'width' => ($size['width'] - 10), 'width' => ($size['width']),
'height' => $height, 'height' => $height,
'only_image' => false, 'only_image' => false,
'homeurl' => $config['homeurl'], 'homeurl' => $config['homeurl'],

View File

@ -663,7 +663,7 @@ class EventsListWidget extends Widget
[ [
'id' => $table_id, 'id' => $table_id,
'class' => 'info_table events', 'class' => 'info_table events',
'style' => 'width: 100%;', 'style' => 'width: 99%;',
'ajax_url' => 'operation/events/events', 'ajax_url' => 'operation/events/events',
'ajax_data' => [ 'ajax_data' => [
'get_events' => 1, 'get_events' => 1,
@ -697,6 +697,7 @@ class EventsListWidget extends Widget
'ajax_return_operation_function' => 'process_buffers', 'ajax_return_operation_function' => 'process_buffers',
'return' => true, 'return' => true,
'csv' => 0, 'csv' => 0,
'dom_elements' => 'frtilp',
] ]
); );

View File

@ -492,6 +492,7 @@ class NetworkMapWidget extends Widget
'auth_class' => 'PandoraFMS\Dashboard\Manager', 'auth_class' => 'PandoraFMS\Dashboard\Manager',
'auth_hash' => Manager::generatePublicHash(), 'auth_hash' => Manager::generatePublicHash(),
'node' => $node, 'node' => $node,
'size' => $size,
] ]
); );

View File

@ -367,7 +367,7 @@ class ServiceViewWidget extends Widget
'AR' 'AR'
); );
$output .= '<div class="white_box mgn_btt_20px mrgn_top_20px pddng_50px services_table" >'; $output .= '<div class="services_table" >';
$output .= '<div id="table_services_dashboard">'; $output .= '<div id="table_services_dashboard">';
foreach ($services as $service) { foreach ($services as $service) {
switch ($service['status']) { switch ($service['status']) {
@ -404,40 +404,6 @@ class ServiceViewWidget extends Widget
</div> </div>
</a>'; </a>';
} }
$output .= '</div>';
$output .= '<table cellspacing="0" cellpadding="0">';
$output .= '<tr>';
$output .= '<td>';
$output .= '<div class="service_status" style=" background: '.COL_UNKNOWN.';"></div>';
$output .= '</td>';
$output .= '<td>';
$output .= '<div class="service_status" style="background: '.COL_NORMAL.';"></div>';
$output .= '</td>';
$output .= '<td>';
$output .= '<div class="service_status" style="background: '.COL_WARNING.';"></div>';
$output .= '</td>';
$output .= '<td>';
$output .= '<div class="service_status" style="background: '.COL_CRITICAL.';"></div>';
$output .= '</td>';
$output .= '</tr><tr>';
$output .= '<td>';
$output .= '<div class="pdd_r_15px"><span class="font_12px">Unknown</span></div>';
$output .= '</td>';
$output .= '<td >';
$output .= '<div class="pdd_r_15px"><span class="font_12px">Normal</span></div>';
$output .= '</div>';
$output .= '<td>';
$output .= '<div class="pdd_r_15px"><span class="font_12px">Warning</span></div>';
$output .= '</td>';
$output .= '<td>';
$output .= '<div><span class="font_12px">Critical</span></div>';
$output .= '</td>';
$output .= '</tr>';
$output .= '</table>';
$output .= '</div>';
} }
return $output; return $output;

View File

@ -477,7 +477,7 @@ class SystemGroupStatusWidget extends Widget
$this->values['groupId'] = $selected_groups; $this->values['groupId'] = $selected_groups;
$this->values['status'] = explode(',', $this->values['status'][0]); $this->values['status'] = explode(',', $this->values['status'][0]);
$style = 'font-size: 12px; text-align: center;'; $style = 'font-size: 1.5em; font-weight: bolder;text-align: center;';
$table = new \stdClass(); $table = new \stdClass();
$table->class = 'group_modules_status_box'; $table->class = 'group_modules_status_box';

View File

@ -364,21 +364,6 @@ class WuxWidget extends Widget
} }
$output .= '<div>'; $output .= '<div>';
$output .= '<div>';
$output .= "<p class='font_20px'>";
if ($have_errors === true) {
$output .= __('Global status').': ';
$output .= "<span class='color: #e63c52; font_20px'>";
$output .= __('Failed');
$output .= '</span>';
} else {
$output .= __('Global status').': ';
$output .= "<span class='pandora_green_bg font_20px'>";
$output .= __('Ok');
$output .= '</span>';
}
$output .= '</div>';
$output .= '<div>'; $output .= '<div>';
$output .= \ux_console_phases_donut( $output .= \ux_console_phases_donut(

View File

@ -127,6 +127,8 @@ h1 {
.grid-stack-item .grid-stack-item-content .header-widget div:first-child { .grid-stack-item .grid-stack-item-content .header-widget div:first-child {
flex: 1; flex: 1;
text-align: center; text-align: center;
font-family: "lato-bold";
font-size: 14px;
} }
.grid-stack-item .grid-stack-item-content .header-widget div:not(:first-child) { .grid-stack-item .grid-stack-item-content .header-widget div:not(:first-child) {
@ -791,3 +793,45 @@ form.modal-dashboard
.select2-selection__rendered { .select2-selection__rendered {
max-height: 75px !important; max-height: 75px !important;
} }
.content-widget .info_table {
margin-bottom: 0px;
}
.div-state-agent {
width: 5px;
height: 20px;
border-radius: 3px;
margin-right: 5px;
}
.dataTables_length > label > select {
height: 30px;
min-height: 30px;
margin: 5px;
}
.dataTables_paginate.paging_simple_numbers {
margin-top: 10px;
height: 40px;
}
.info_table.events tr > td {
height: 1em !important;
text-align: initial;
}
.event.flex-row.h100p.nowrap .mini-criticity {
margin-left: 7px;
}
.tree-controller-recipient {
width: -webkit-fill-available !important;
}
.services_table {
padding: 0px;
background-color: #fff;
border: 0px;
width: 90%;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3809,7 +3809,7 @@ div.div_groups_status {
background-color: white; background-color: white;
border: 1px solid #ececec; border: 1px solid #ececec;
border-radius: 5px; border-radius: 5px;
margin: 20px; margin: 5px;
float: left; float: left;
} }
@ -6548,6 +6548,7 @@ table.table_modal_alternate tr td:first-child {
.flot-text .flot-x-axis div { .flot-text .flot-x-axis div {
white-space: normal; white-space: normal;
word-break: break-all; word-break: break-all;
line-height: 1.3;
} }
/*Font header feedback*/ /*Font header feedback*/
@ -9305,7 +9306,7 @@ div.stat-win-spinner img {
color: #fff !important; color: #fff !important;
font-size: 1.2em; font-size: 1.2em;
margin-right: 5px !important; margin-right: 5px !important;
margin-top: -4px; margin-top: 1px;
} }
.select2-results .select2-results

View File

@ -422,6 +422,7 @@ if (isset($config['id_user']) === false) {
unset($_POST['auth_code'], $code); unset($_POST['auth_code'], $code);
if (!$double_auth_success) { if (!$double_auth_success) {
$config['auth_error'] = __('Double auth error');
$login_failed = true; $login_failed = true;
include_once 'general/login_page.php'; include_once 'general/login_page.php';
db_pandora_audit( db_pandora_audit(
@ -447,6 +448,7 @@ if (isset($config['id_user']) === false) {
} else if (($config['auth'] === 'saml') && ($login_button_saml)) { } else if (($config['auth'] === 'saml') && ($login_button_saml)) {
$saml_user_id = enterprise_hook('saml_process_user_login'); $saml_user_id = enterprise_hook('saml_process_user_login');
if (!$saml_user_id) { if (!$saml_user_id) {
$config['auth_error'] = __('saml error');
$login_failed = true; $login_failed = true;
include_once 'general/login_page.php'; include_once 'general/login_page.php';
while (ob_get_length() > 0) { while (ob_get_length() > 0) {
@ -709,6 +711,7 @@ if (isset($config['id_user']) === false) {
login_check_failed($nick); login_check_failed($nick);
} }
$config['auth_error'] = __('User is blocked');
$login_failed = true; $login_failed = true;
} }
@ -1488,7 +1491,7 @@ ui_require_javascript_file('connection_check');
set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false)); set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
$conn_title = __('Connection with server has been lost'); $conn_title = __('Connection with server has been lost');
$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png'); ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/fail@svg.svg');
if ($config['pure'] == 0) { if ($config['pure'] == 0) {
echo '</div>'; echo '</div>';

View File

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

View File

@ -76,9 +76,9 @@ if ($fields === false) {
$data[0] = '<b>'.$field['name'].'</b>'; $data[0] = '<b>'.$field['name'].'</b>';
if ($field['display_on_front']) { if ($field['display_on_front']) {
$data[1] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']); $data[1] = html_print_image('images/validate.svg', true, ['class' => 'invert_filter']);
} else { } else {
$data[1] = html_print_image('images/delete.png', true, ['class' => 'invert_filter']); $data[1] = html_print_image('images/delete.svg', true, ['class' => 'invert_filter']);
} }
$custom_value = db_get_all_rows_sql( $custom_value = db_get_all_rows_sql(

View File

@ -314,7 +314,7 @@ if ($start_date != $current) {
if ($combined) { if ($combined) {
// Pass the $modules before the ajax call. // Pass the $modules before the ajax call.
echo '<div class="combined-graph-container center w100p"'.'data-period="'.$period.'"'.'data-stacked="'.CUSTOM_GRAPH_LINE.'"'.'data-date="'.$date.'"'.'data-height="'.$height.'"'.'>'.html_print_image('images/spinner.gif', true).'</div>'; echo '<div class="combined-graph-container center w100p white_box"'.'data-period="'.$period.'"'.'data-stacked="'.CUSTOM_GRAPH_LINE.'"'.'data-date="'.$date.'"'.'data-height="'.$height.'"'.'>'.html_print_image('images/spinner.gif', true).'</div>';
} else { } else {
foreach ($modules as $id_module) { foreach ($modules as $id_module) {
$title = modules_get_agentmodule_name($id_module); $title = modules_get_agentmodule_name($id_module);

View File

@ -131,7 +131,8 @@ if ($pure == 1) {
} }
} }
ui_print_page_header( if ($dashboard != 1) {
ui_print_page_header(
io_safe_output($networkmap['name']), io_safe_output($networkmap['name']),
'images/bricks.png', 'images/bricks.png',
false, false,
@ -141,14 +142,7 @@ ui_print_page_header(
false, false,
'', '',
$config['item_title_size_text'] $config['item_title_size_text']
); );
global $width;
global $height;
if (_id_ != '_id_') {
$width = [];
$height = [];
} }
if (empty($width)) { if (empty($width)) {

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -92,7 +92,7 @@ if (empty($dashboards) === true) {
$table->style['full_screen'] = 'text-align: center;'; $table->style['full_screen'] = 'text-align: center;';
$table->size = []; $table->size = [];
$table->size['name'] = '75%'; $table->size['name'] = '40%';
$table->size['full_screen'] = '30px'; $table->size['full_screen'] = '30px';
$table->head = []; $table->head = [];

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.769-230313 Version: 7.0NG.769-230314
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.769-230313" pandora_version="7.0NG.769-230314"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

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

View File

@ -5627,9 +5627,10 @@ sub pandora_server_statistics ($$) {
# Non-dataserver LAG calculation: # Non-dataserver LAG calculation:
if ($server->{"server_type"} != DATASERVER){ if ($server->{"server_type"} != DATASERVER){
$lag_row = get_db_single_row (
$lag_row = get_db_single_row ($dbh, $dbh,
"SELECT COUNT(tam.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag "SELECT COUNT(tam.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag
FROM ( FROM (
SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo
FROM tagente_estado FROM tagente_estado
@ -5638,7 +5639,33 @@ sub pandora_server_statistics ($$) {
AND tagente_estado.running_by = ? AND tagente_estado.running_by = ?
) tae ) tae
JOIN ( JOIN (
SELECT tagente_modulo.id_agente_modulo, tagente_modulo.flag SELECT tagente_modulo.id_agente_modulo
FROM tagente_modulo LEFT JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente
WHERE tagente.disabled = 0
AND tagente_modulo.disabled = 0
) tam
ON tae.id_agente_modulo = tam.id_agente_modulo
WHERE (UNIX_TIMESTAMP() - tae.last_execution_try) > (tae.current_interval)
AND (UNIX_TIMESTAMP() - tae.last_execution_try) < ( tae.current_interval * 10)",
$server->{"id_server"}
);
}
# Dataserver LAG calculation:
else {
$lag_row = get_db_single_row (
$dbh,
"SELECT COUNT(tam.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - tae.last_execution_try - tae.current_interval) AS lag
FROM (
SELECT tagente_estado.last_execution_try, tagente_estado.current_interval, tagente_estado.id_agente_modulo
FROM tagente_estado
WHERE tagente_estado.current_interval > 0
AND tagente_estado.last_execution_try > 0
AND tagente_estado.running_by = ?
) tae
JOIN (
SELECT tagente_modulo.id_agente_modulo
FROM tagente_modulo LEFT JOIN tagente FROM tagente_modulo LEFT JOIN tagente
ON tagente_modulo.id_agente = tagente.id_agente ON tagente_modulo.id_agente = tagente.id_agente
WHERE tagente.disabled = 0 WHERE tagente.disabled = 0
@ -5646,20 +5673,10 @@ sub pandora_server_statistics ($$) {
AND tagente_modulo.id_tipo_modulo < 5 AND tagente_modulo.id_tipo_modulo < 5
) tam ) tam
ON tae.id_agente_modulo = tam.id_agente_modulo ON tae.id_agente_modulo = tam.id_agente_modulo
WHERE (UNIX_TIMESTAMP() - tae.last_execution_try) < ( tae.current_interval * 10) WHERE (UNIX_TIMESTAMP() - tae.last_execution_try) > (tae.current_interval * 1.1)
AND (tam.flag = 1 OR (UNIX_TIMESTAMP() - tae.last_execution_try) > tae.current_interval)", $server->{"id_server"}); AND (UNIX_TIMESTAMP() - tae.last_execution_try) < ( tae.current_interval * 10)",
} $server->{"id_server"}
# Dataserver LAG calculation: );
else {
$lag_row = get_db_single_row ($dbh, "SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
FROM tagente_estado, tagente_modulo
WHERE utimestamp > 0
AND tagente_modulo.disabled = 0
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND current_interval > 0
AND running_by = ?
AND (UNIX_TIMESTAMP() - utimestamp) < ( current_interval * 10)
AND (UNIX_TIMESTAMP() - utimestamp) > current_interval", $server->{"id_server"});
} }
$server->{"module_lag"} = $lag_row->{'module_lag'}; $server->{"module_lag"} = $lag_row->{'module_lag'};

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.769 Build 230313"; my $version = "7.0NG.769 Build 230314";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.769 Build 230313"; my $version = "7.0NG.769 Build 230314";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);