Merge remote-tracking branch 'origin/develop' into master-alt
@ -1,14 +1,14 @@
|
||||
#docker build -t pandorafms/pandorafms-open-base-el8 -f $HOME/code/pandorafms/extras/docker/centos8/base/Dockerfile $HOME/code/pandorafms/extras/docker/centos8/base/
|
||||
#docker push pandorafms/pandorafms-open-base-el8
|
||||
|
||||
FROM centos:8
|
||||
FROM rockylinux:8
|
||||
|
||||
RUN dnf install -y --setopt=tsflags=nodocs \
|
||||
epel-release \
|
||||
dnf-utils \
|
||||
http://rpms.remirepo.net/enterprise/remi-release-8.rpm
|
||||
|
||||
RUN dnf module reset -y php && dnf module install -y php:remi-7.3
|
||||
RUN dnf module reset -y php && dnf module install -y php:remi-7.4
|
||||
RUN dnf config-manager --set-enabled powertools
|
||||
|
||||
# Install console dependencies
|
||||
|
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.759-211216
|
||||
Version: 7.0NG.759-220125
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.759-211216"
|
||||
pandora_version="7.0NG.759-220125"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -1015,7 +1015,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.759';
|
||||
use constant AGENT_BUILD => '211216';
|
||||
use constant AGENT_BUILD => '220125';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.759
|
||||
%define release 211216
|
||||
%define release 220125
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.759
|
||||
%define release 211216
|
||||
%define release 220125
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.759"
|
||||
PI_BUILD="211216"
|
||||
PI_BUILD="220125"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -1,59 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Fandora FMS - Generate SSH keys step-by-step</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="resource-type" content="document" />
|
||||
<meta name="distribution" content="global" />
|
||||
<meta name="author" content="Sancho Lerena, Raul Mateos and others" />
|
||||
<meta
|
||||
name="copyright"
|
||||
content="This is GPL software. Created by Sancho Lerena and others"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="images/logo.png" alt="" />
|
||||
</center>
|
||||
|
||||
<h2>Step-by-step generating SSH keys</h2>
|
||||
|
||||
From
|
||||
<a
|
||||
href="https://pandorafms.com/docs/index.php?title=Pandora:FAQ#How_to_generate_a_pair_of_SSH_keys_for_Pandora_Windows_agent.3F_.28SSH_Transfer_only.29"
|
||||
>Pandora FMS FAQ</a
|
||||
>.
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Go to <code>.\util</code> of your Pandora FMS agent for Windows and run
|
||||
<code>puttygen.exe</code>.<br />
|
||||
Generate keys, SSH-2_DSA, 1024:<br /><br />
|
||||
<img src="images/1.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Press Generate<br />
|
||||
Export key to OpenSSH key (Cygwin uses a port of OpenSSH)<br /><br />
|
||||
<img src="images/2.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
We have no chosen password, so press YES:<br /><br />
|
||||
<img src="images/3.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Save it as <code>c:\pandora\keys\id_dsa:</code><br /><br />
|
||||
<img src="images/4.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Now let's copy the public key to clipboard:<br /><br />
|
||||
<img src="images/5.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
and paste it as <code>c:\pandora_agent\keys\id_dsa.pub</code>, and also
|
||||
to the <code>/home/pandora/.ssh/authorized_keys</code> file.
|
||||
<br /><br />
|
||||
<img src="images/6.jpg" /><br /><br />
|
||||
</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
@ -1,62 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
Pandora FMS - Generación de claves SSH en Windows paso por paso
|
||||
</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="resource-type" content="document" />
|
||||
<meta name="distribution" content="global" />
|
||||
<meta name="author" content="Sancho Lerena, Raul Mateos y otros" />
|
||||
<meta
|
||||
name="copyright"
|
||||
content="This is GPL software. Created by Sancho Lerena and others"
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<img src="images/logo.png" alt="" />
|
||||
</center>
|
||||
<h2 class="print">Generación de claves SSH en Windows paso por paso</h2>
|
||||
|
||||
Extraído de las
|
||||
<a
|
||||
href="https://pandorafms.com/docs/index.php?title=Pandora:FAQ_ES#.C2.BFC.C3.B3mo_puedo_generar_un_par_de_claves_SHH_para_el_agente_para_Windows_.28SSH_Transfer.29_.3F"
|
||||
>
|
||||
FAQ</a
|
||||
>.
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Desde el directorio <code>.\util</code> del agente Pandora FMS para
|
||||
windows ejecutamos <code>puttygen.exe</code>.<br />
|
||||
Generamos claves SSH-2_DSA, 1024:<br /><br />
|
||||
<img src="images/1.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Pulsamos «Generate» para generar la clave.<br />
|
||||
Exportamos la clave a formato OpenSSH<br /><br />
|
||||
<img src="images/2.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
No elegimos contraseña, con lo cual pulsamos «Sí»:<br /><br />
|
||||
<img src="images/3.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Guardamos la clave como <code>C:\pandora\keys\id_dsa:</code><br /><br />
|
||||
<img src="images/4.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Ahora copiamos la clave pública al portapapeles:<br /><br />
|
||||
<img src="images/5.jpg" /><br /><br />
|
||||
</li>
|
||||
<li>
|
||||
Pegamos la clave en un nuevo fichero
|
||||
<code>C:\pandora_agent\keys\id_dsa.pub</code>, y debemos también
|
||||
añadirla al fichero <code>/home/pandora/.ssh/authorized_keys</code>.
|
||||
<br /><br />
|
||||
<img src="images/6.jpg" /><br /><br />
|
||||
</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{211216}
|
||||
{220125}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.759 Build 211216")
|
||||
#define PANDORA_VERSION ("7.0NG.759 Build 220125")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.759(Build 211216))"
|
||||
VALUE "ProductVersion", "(7.0NG.759(Build 220125))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.759-211216
|
||||
Version: 7.0NG.759-220125
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.759-211216"
|
||||
pandora_version="7.0NG.759-220125"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -202,9 +202,7 @@ function extension_api_checker()
|
||||
echo '</fieldset>';
|
||||
echo "<div class='right'>";
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
echo "<form method='post'>";
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Custom URL').'</legend>';
|
||||
html_print_table($table3);
|
||||
|
@ -302,7 +302,7 @@ function mainModuleGroups()
|
||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;';
|
||||
$table->width = '100%';
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$background_color = '#333';
|
||||
} else {
|
||||
$background_color = '#fff';
|
||||
|
@ -42,7 +42,7 @@ function pandora_realtime_graphs()
|
||||
global $config;
|
||||
check_login();
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
ui_require_css_file('pandora_black', 'include/styles/', true);
|
||||
}
|
||||
|
||||
|
@ -114,4 +114,7 @@ enterprise/include/javascript/tooltipster.bundle.min.js
|
||||
enterprise/include/styles/tooltipster.bundle.min.css
|
||||
mobile/include/javascript/jquery.mobile-1.3.1.js
|
||||
mobile/include/style/jquery.mobile-1.3.1.css
|
||||
godmode/alerts/configure_alert_special_days.php
|
||||
godmode/alerts/configure_alert_special_days.php
|
||||
godmode/admin_access_logs.php
|
||||
enterprise/extensions/backup/main.php
|
||||
enterprise/extensions/backup.php
|
5
pandora_console/extras/mr/52.sql
Normal file
@ -0,0 +1,5 @@
|
||||
START TRANSACTION;
|
||||
ALTER TABLE `tpolicy_queue` MODIFY COLUMN `progress` int(10) NOT NULL default '0';
|
||||
CREATE INDEX `IDX_tservice_element` ON `tservice_element`(`id_service`,`id_agente_modulo`);
|
||||
|
||||
COMMIT;
|
@ -480,7 +480,8 @@ CREATE TABLE IF NOT EXISTS `tservice_element` (
|
||||
`id_agent` int(10) unsigned NOT NULL default 0,
|
||||
`id_service_child` int(10) unsigned NOT NULL default 0,
|
||||
`id_server_meta` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `IDX_tservice_element` (`id_service`,`id_agente_modulo`)
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to define the modules and the weights of the modules that define a service'
|
||||
DEFAULT CHARSET=utf8;
|
||||
@ -578,7 +579,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_queue` (
|
||||
`id_policy` int(10) unsigned NOT NULL default '0',
|
||||
`id_agent` int(10) unsigned NOT NULL default '0',
|
||||
`operation` varchar(15) default '',
|
||||
`progress` int(10) unsigned NOT NULL default '0',
|
||||
`progress` int(10) NOT NULL default '0',
|
||||
`end_utimestamp` int(10) unsigned NOT NULL default 0,
|
||||
`priority` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
@ -1450,13 +1451,13 @@ ALTER TABLE `ttag` MODIFY COLUMN `name` text NOT NULL default '';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 50);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 51);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 758);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package', 759);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
|
||||
|
@ -330,8 +330,30 @@ if ($config['enterprise_installed']) {
|
||||
$reset_pass_link = 'reset_pass.php';
|
||||
// Reset password link.
|
||||
echo '<div class="reset_password">';
|
||||
echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?');
|
||||
echo '</a>';
|
||||
if ((!$config['centralized_management'])) {
|
||||
echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?');
|
||||
echo '</a>';
|
||||
} else {
|
||||
echo '<a href="javascript:centralized_mode_reset_dialog();">'.__('Forgot your password?');
|
||||
echo '</a>';
|
||||
|
||||
echo '<div id="centralized_mode_reset_dialog" title="'.__('Password reset').'" style="display:none">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]);
|
||||
echo '</div>';
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<p>'.__('This node is configured with centralized mode. Go to metaconsole to reset the password').'</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button('Ok', 'centralized_mode_reset_button', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
@ -826,5 +848,23 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
||||
});
|
||||
});
|
||||
|
||||
function centralized_mode_reset_dialog() {
|
||||
$("#centralized_mode_reset_dialog").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
width: 528,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
|
||||
$("#submit-centralized_mode_reset_button").click (function () {
|
||||
$("#centralized_mode_reset_dialog").dialog('close');
|
||||
});
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
@ -1,277 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// 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; 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.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
|
||||
check_login();
|
||||
|
||||
$enterprise_include = enterprise_include_once('godmode/admin_access_logs.php');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access audit view');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
$filter_type = (string) get_parameter('filter_type');
|
||||
$filter_user = (string) get_parameter('filter_user');
|
||||
$filter_text = (string) get_parameter('filter_text');
|
||||
$filter_period = get_parameter('filter_period', null);
|
||||
$filter_period = ($filter_period !== null) ? (int) $filter_period : 24;
|
||||
$filter_ip = (string) get_parameter('filter_ip');
|
||||
|
||||
$filter_query = '&filter_type='.$filter_type.'&filter_user='.$filter_user.'&filter_text='.$filter_text.'&filter_period='.$filter_period.'&filter_ip='.$filter_ip;
|
||||
|
||||
$csv_url = ui_get_full_url(
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
).'index.php?sec=gextensions&sec2=godmode/audit_log_csv'.$filter_query;
|
||||
$csv_img = html_print_image(
|
||||
'images/csv.png',
|
||||
true,
|
||||
[
|
||||
'title' => __(
|
||||
'Export to CSV'
|
||||
),'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$header_buttons = [
|
||||
'csv' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$csv_url.'">'.$csv_img.'</a>',
|
||||
],
|
||||
];
|
||||
|
||||
ui_print_page_header(__('%s audit', get_product_name()).' » '.__('Review Logs'), 'images/gm_log.png', false, '', true, $header_buttons);
|
||||
|
||||
$table = new stdClass();
|
||||
$table->class = 'databox filters';
|
||||
$table->cellstyle = [];
|
||||
$table->cellstyle[0] = [];
|
||||
$table->cellstyle[1] = [];
|
||||
$table->cellstyle[0][0] = 'text-align: right;';
|
||||
$table->cellstyle[0][1] = 'text-align: left;';
|
||||
$table->cellstyle[0][2] = 'text-align: right;';
|
||||
$table->cellstyle[0][3] = 'text-align: left;';
|
||||
$table->cellstyle[0][4] = 'text-align: right;';
|
||||
$table->cellstyle[0][5] = 'text-align: left;';
|
||||
$table->cellstyle[1][0] = 'text-align: right;';
|
||||
$table->cellstyle[1][1] = 'text-align: left;';
|
||||
$table->cellstyle[1][2] = 'text-align: right;';
|
||||
$table->cellstyle[1][3] = 'text-align: left;';
|
||||
$table->cellstyle[1][5] = 'text-align: right;';
|
||||
$table->data = [];
|
||||
|
||||
$data = [];
|
||||
|
||||
$data[0] = '<b>'.__('Search').'</b>';
|
||||
$data[1] = html_print_input_text('filter_text', $filter_text, __('Free text for search (*)'), 20, 40, true);
|
||||
|
||||
$data[2] = '<b>'.__('Max. hours old').'</b>';
|
||||
$data[3] = html_print_input_text('filter_period', $filter_period, __('Max. hours old'), 3, 6, true);
|
||||
|
||||
$data[4] = '<b>'.__('IP').'</b>';
|
||||
$data[5] = html_print_input_text('filter_ip', $filter_ip, __('IP'), 15, 15, true);
|
||||
|
||||
$table->data[0] = $data;
|
||||
$data = [];
|
||||
|
||||
$actions_sql = 'SELECT DISTINCT(accion), accion AS text FROM tsesion';
|
||||
$data[0] = '<b>'.__('Action').'</b>';
|
||||
$data[1] = html_print_select_from_sql($actions_sql, 'filter_type', $filter_type, '', __('All'), '', true);
|
||||
|
||||
$users_sql = 'SELECT id_user, id_user AS text FROM tusuario';
|
||||
$data[2] = '<b>'.__('User').'</b>';
|
||||
$data[3] = html_print_select_from_sql($users_sql, 'filter_user', $filter_user, '', __('All'), '', true);
|
||||
|
||||
$data[4] = '';
|
||||
$data[5] = html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"', true);
|
||||
|
||||
$table->data[1] = $data;
|
||||
|
||||
$form = '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
|
||||
$form .= html_print_table($table, true);
|
||||
$form .= '</form>';
|
||||
ui_toggle($form, __('Filter'), '', '', false);
|
||||
|
||||
$filter = '1=1';
|
||||
|
||||
if (!empty($filter_type)) {
|
||||
$filter .= sprintf(" AND accion = '%s'", $filter_type);
|
||||
}
|
||||
|
||||
if (!empty($filter_user)) {
|
||||
$filter .= sprintf(" AND id_usuario = '%s'", $filter_user);
|
||||
}
|
||||
|
||||
if (!empty($filter_text)) {
|
||||
$filter .= sprintf(" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", $filter_text, $filter_text);
|
||||
}
|
||||
|
||||
if (!empty($filter_ip)) {
|
||||
$filter .= sprintf(" AND ip_origen LIKE '%%%s%%'", $filter_ip);
|
||||
}
|
||||
|
||||
if (!empty($filter_period)) {
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -'.$filter_period.' HOUR)';
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$filter .= ' AND fecha >= NOW() - INTERVAL \''.$filter_period.' HOUR \'';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$filter .= ' AND fecha >= (SYSTIMESTAMP - INTERVAL \''.$filter_period.'\' HOUR)';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$count_sql = sprintf('SELECT COUNT(*) FROM tsesion WHERE %s', $filter);
|
||||
$count = (int) db_get_value_sql($count_sql);
|
||||
$url = 'index.php?sec=godmode&sec2=godmode/admin_access_logs'.$filter_query;
|
||||
ui_pagination($count, $url);
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tsesion
|
||||
WHERE %s
|
||||
ORDER BY fecha DESC
|
||||
LIMIT %d, %d',
|
||||
$filter,
|
||||
$offset,
|
||||
$config['block_size']
|
||||
);
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tsesion
|
||||
WHERE %s
|
||||
ORDER BY fecha DESC
|
||||
LIMIT %d OFFSET %d',
|
||||
$filter,
|
||||
$config['block_size'],
|
||||
$offset
|
||||
);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$set = [];
|
||||
$set['limit'] = $config['block_size'];
|
||||
$set['offset'] = $offset;
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tsesion
|
||||
WHERE %s
|
||||
ORDER BY fecha DESC',
|
||||
$filter
|
||||
);
|
||||
$result = oracle_recode_query($sql, $set);
|
||||
break;
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
if (empty($result)) {
|
||||
$result = [];
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->size = [];
|
||||
$table->data = [];
|
||||
$table->head = [];
|
||||
$table->align = [];
|
||||
$table->rowclass = [];
|
||||
|
||||
$table->head[0] = __('User');
|
||||
$table->head[1] = __('Action');
|
||||
$table->head[2] = __('Date');
|
||||
$table->head[3] = __('Source IP');
|
||||
$table->head[4] = __('Comments');
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->head[5] = enterprise_hook('tableHeadEnterpriseAudit', ['title1']);
|
||||
$table->head[6] = enterprise_hook('tableHeadEnterpriseAudit', ['title2']);
|
||||
}
|
||||
|
||||
$table->size[0] = 80;
|
||||
$table->size[2] = 130;
|
||||
$table->size[3] = 100;
|
||||
$table->size[4] = 200;
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->size[5] = enterprise_hook('tableHeadEnterpriseAudit', ['size1']);
|
||||
$table->size[6] = enterprise_hook('tableHeadEnterpriseAudit', ['size2']);
|
||||
$table->align[5] = enterprise_hook('tableHeadEnterpriseAudit', ['align']);
|
||||
$table->align[6] = enterprise_hook('tableHeadEnterpriseAudit', ['align2']);
|
||||
}
|
||||
|
||||
$table->colspan = [];
|
||||
$table->rowstyle = [];
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
// Get data
|
||||
foreach ($result as $row) {
|
||||
$iterator++;
|
||||
|
||||
$table->rowclass[] = $rowPair ? 'rowPair' : 'rowOdd';
|
||||
$rowPair = !$rowPair;
|
||||
|
||||
$data = [];
|
||||
$data[0] = io_safe_output($row['id_usuario']);
|
||||
$data[1] = ui_print_session_action_icon($row['accion'], true).$row['accion'];
|
||||
$data[2] = ui_print_help_tip(date($config['date_format'], $row['utimestamp']), true).ui_print_timestamp($row['utimestamp'], true);
|
||||
$data[3] = io_safe_output($row['ip_origen']);
|
||||
$data[4] = io_safe_output($row['descripcion']);
|
||||
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$data[5] = enterprise_hook('cell1EntepriseAudit', [$row['id_sesion']]);
|
||||
$data[6] = enterprise_hook('cell2EntepriseAudit', [$row['id_sesion']]);
|
||||
}
|
||||
|
||||
$table->data[] = $data;
|
||||
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
rowEnterpriseAudit($table, $iterator, $row['id_sesion']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($table->rowclass as $key => $value) {
|
||||
if (strpos($value, 'limit_scroll') !== false) {
|
||||
$table->colspan[$key] = [7];
|
||||
} else {
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->cellclass[$key][6] = 'action_buttons';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($count, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
enterprise_hook('enterpriseAuditFooter');
|
||||
}
|
@ -1385,9 +1385,15 @@ if ($update_module || $create_module) {
|
||||
$custom_integer_2_default = $module['custom_integer_2'];
|
||||
}
|
||||
|
||||
if ($id_module_type == 25) {
|
||||
if ($id_module_type === 25) {
|
||||
// Web analysis, from MODULE_WUX.
|
||||
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1', $custom_string_1_default));
|
||||
$custom_string_1 = base64_encode((string) get_parameter('custom_string_1'));
|
||||
// If the custom_string_1 parameter come empty, set the content
|
||||
// of the module (it is base64_encoded).
|
||||
if (empty($custom_string_1) === true) {
|
||||
$custom_string_1 = $custom_string_1_default;
|
||||
}
|
||||
|
||||
$custom_integer_1 = (int) get_parameter('custom_integer_1', $custom_integer_1_default);
|
||||
} else {
|
||||
$custom_string_1 = (string) get_parameter('custom_string_1', $custom_string_1_default);
|
||||
@ -1402,7 +1408,7 @@ if ($update_module || $create_module) {
|
||||
$macros = (string) get_parameter('macros');
|
||||
$macros_names = (array) get_parameter('macro_name', []);
|
||||
|
||||
if (!empty($macros)) {
|
||||
if (empty($macros) === false) {
|
||||
$macros = json_decode(base64_decode($macros), true);
|
||||
|
||||
foreach ($macros as $k => $m) {
|
||||
@ -2422,7 +2428,7 @@ switch ($tab) {
|
||||
|
||||
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>';
|
||||
|
||||
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() &&
|
||||
if('<?php echo io_safe_output(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() &&
|
||||
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>' == 19){
|
||||
|
||||
event.preventDefault();
|
||||
@ -2456,7 +2462,7 @@ switch ($tab) {
|
||||
|
||||
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>';
|
||||
|
||||
if('<?php echo modules_get_agentmodule_name(get_parameter('id_agent_module')); ?>' != $('#text-name').val() && (
|
||||
if('<?php echo io_safe_output(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && (
|
||||
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -253,6 +253,7 @@ $module_action = (string) get_parameter('module_action');
|
||||
if ($module_action === 'delete') {
|
||||
$id_agent_modules_delete = (array) get_parameter('id_delete');
|
||||
|
||||
$print_result_msg = true;
|
||||
$count_correct_delete_modules = 0;
|
||||
foreach ($id_agent_modules_delete as $id_agent_module_del) {
|
||||
$id_grupo = (int) agents_get_agent_group($id_agente);
|
||||
@ -268,12 +269,19 @@ if ($module_action === 'delete') {
|
||||
}
|
||||
|
||||
if ($id_agent_module_del < 1) {
|
||||
db_pandora_audit(
|
||||
'HACK Attempt',
|
||||
'Expected variable from form is not correct'
|
||||
);
|
||||
die(__('Nice try buddy'));
|
||||
exit;
|
||||
if (count($id_agent_modules_delete) === 1) {
|
||||
ui_print_error_message(
|
||||
__('No modules selected')
|
||||
);
|
||||
|
||||
$print_result_msg = false;
|
||||
} else {
|
||||
ui_print_error_message(
|
||||
__('There was a problem completing the operation')
|
||||
);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
@ -421,25 +429,27 @@ if ($module_action === 'delete') {
|
||||
}
|
||||
}
|
||||
|
||||
$count_modules_to_delete = count($id_agent_modules_delete);
|
||||
if ($count_correct_delete_modules == 0) {
|
||||
ui_print_error_message(
|
||||
sprintf(
|
||||
__('There was a problem completing the operation. Applied to 0/%d modules.'),
|
||||
$count_modules_to_delete
|
||||
)
|
||||
);
|
||||
} else {
|
||||
if ($count_correct_delete_modules == $count_modules_to_delete) {
|
||||
ui_print_success_message(__('Operation finished successfully.'));
|
||||
} else {
|
||||
if ($print_result_msg === true) {
|
||||
$count_modules_to_delete = count($id_agent_modules_delete);
|
||||
if ($count_correct_delete_modules == 0) {
|
||||
ui_print_error_message(
|
||||
sprintf(
|
||||
__('There was a problem completing the operation. Applied to %d/%d modules.'),
|
||||
$count_correct_delete_modules,
|
||||
__('There was a problem completing the operation. Applied to 0/%d modules.'),
|
||||
$count_modules_to_delete
|
||||
)
|
||||
);
|
||||
} else {
|
||||
if ($count_correct_delete_modules == $count_modules_to_delete) {
|
||||
ui_print_success_message(__('Operation finished successfully.'));
|
||||
} else {
|
||||
ui_print_error_message(
|
||||
sprintf(
|
||||
__('There was a problem completing the operation. Applied to %d/%d modules.'),
|
||||
$count_correct_delete_modules,
|
||||
$count_modules_to_delete
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ($module_action === 'disable') {
|
||||
|
@ -98,7 +98,7 @@ function add_component_selection($id_network_component_type)
|
||||
global $table_simple;
|
||||
global $config;
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$background_row = 'background-color: #444';
|
||||
} else {
|
||||
$background_row = 'background-color: #cfcfcf';
|
||||
|
@ -250,6 +250,7 @@ if ($create_downtime || $update_downtime) {
|
||||
} else if ($type_execution == 'periodically'
|
||||
&& $type_periodicity == 'monthly'
|
||||
&& $periodically_day_from == $periodically_day_to
|
||||
&& $periodically_time_from >= $periodically_time_to
|
||||
) {
|
||||
ui_print_error_message(
|
||||
__('Not created. Error inserting data').'. '.__('The end time must be higher than the start time')
|
||||
@ -627,20 +628,20 @@ $table->data[5][1] = "
|
||||
<tr><td>".ui_get_using_system_timezone_warning().'</td></tr>
|
||||
<tr>
|
||||
<td>'.__('Type Periodicity:').' '.html_print_select(
|
||||
[
|
||||
'weekly' => __('Weekly'),
|
||||
'monthly' => __('Monthly'),
|
||||
],
|
||||
'type_periodicity',
|
||||
$type_periodicity,
|
||||
'change_type_periodicity();',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
[
|
||||
'weekly' => __('Weekly'),
|
||||
'monthly' => __('Monthly'),
|
||||
],
|
||||
'type_periodicity',
|
||||
$type_periodicity,
|
||||
'change_type_periodicity();',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
)."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -660,31 +661,31 @@ $table->data[5][1] = "
|
||||
<tr>
|
||||
<td>".__('From day:').'</td>
|
||||
<td>'.html_print_select(
|
||||
$days,
|
||||
'periodically_day_from',
|
||||
$periodically_day_from,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
$days,
|
||||
'periodically_day_from',
|
||||
$periodically_day_from,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
).'</td>
|
||||
<td>'.__('To day:').'</td>
|
||||
<td>'.html_print_select(
|
||||
$days,
|
||||
'periodically_day_to',
|
||||
$periodically_day_to,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
$days,
|
||||
'periodically_day_to',
|
||||
$periodically_day_to,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$disabled_in_execution
|
||||
).'</td>
|
||||
<td>'.ui_print_help_tip(__('The end day must be higher than the start day'), true).'</td>
|
||||
</tr>
|
||||
@ -693,26 +694,26 @@ $table->data[5][1] = "
|
||||
<tr>
|
||||
<td>'.__('From hour:').'</td>
|
||||
<td>'.html_print_input_text(
|
||||
'periodically_time_from',
|
||||
$periodically_time_from,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
'periodically_time_from',
|
||||
$periodically_time_from,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
).ui_print_help_tip(
|
||||
__('The end time must be higher than the start time'),
|
||||
true
|
||||
).'</td>
|
||||
<td>'.__('To hour:').'</td>
|
||||
<td>'.html_print_input_text(
|
||||
'periodically_time_to',
|
||||
$periodically_time_to,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
'periodically_time_to',
|
||||
$periodically_time_to,
|
||||
'',
|
||||
7,
|
||||
7,
|
||||
true,
|
||||
$disabled_in_execution
|
||||
).ui_print_help_tip(
|
||||
__('The end time must be higher than the start time'),
|
||||
true
|
||||
@ -946,9 +947,7 @@ if (empty($downtimes_agents)) {
|
||||
|
||||
if (!$running) {
|
||||
$data[5] = '';
|
||||
if ($type_downtime != 'disable_agents_alerts'
|
||||
&& $type_downtime != 'disable_agents'
|
||||
) {
|
||||
if ($type_downtime !== 'disable_agents') {
|
||||
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).'</a>';
|
||||
}
|
||||
|
||||
@ -998,13 +997,13 @@ $table->data['module'][1] = "
|
||||
<td class='cell_delete_button' style='text-align: right; width:10%;' id=''>".'<a class="link_delete"
|
||||
onclick="if(!confirm(\''.__('Are you sure?').'\')) return false;"
|
||||
href="">'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'border' => '0',
|
||||
'alt' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'border' => '0',
|
||||
'alt' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a>'."</td>
|
||||
</tr>
|
||||
<tr class='datos2' id='add_modules_row'>
|
||||
|
@ -235,7 +235,7 @@ $search_string = (string) get_parameter('search_string', '');
|
||||
$group = (int) get_parameter('group', 0);
|
||||
$group_search = (int) get_parameter('group_search', 0);
|
||||
$id_command_search = (int) get_parameter('id_command_search', 0);
|
||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions';
|
||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&search_string='.$search_string.'&group_search='.$group_search.'&id_command_search='.$id_command_search;
|
||||
|
||||
// Filter table.
|
||||
$table_filter = new stdClass();
|
||||
|
@ -1134,7 +1134,7 @@ function show_add_action(id_alert) {
|
||||
},
|
||||
open: function() {
|
||||
$(`#add_action-div-${id_alert}`).css('overflow', 'hidden');
|
||||
$("#action_select, #action_select").select2({
|
||||
$("select[id^='action_select'], select[id^='action_select']").select2({
|
||||
tags: true,
|
||||
dropdownParent: $("#add_action-div-" + id_alert)
|
||||
});
|
||||
|
@ -21,8 +21,6 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
|
||||
|
||||
check_login();
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
@ -50,6 +48,8 @@ if (is_ajax()) {
|
||||
}
|
||||
}
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
$sec = 'advanced';
|
||||
} else {
|
||||
@ -694,8 +694,19 @@ $(document).ready (function () {
|
||||
}
|
||||
}
|
||||
else {
|
||||
var is_element_select = $("[name=field" + i + "_value]").is("select");
|
||||
|
||||
$("[name=field" + i + "_value]").val(old_value);
|
||||
if (is_element_select === true) {
|
||||
$("[name=field" + i + "_value]").trigger('change');
|
||||
}
|
||||
|
||||
|
||||
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
|
||||
|
||||
if (is_element_select === true) {
|
||||
$("[name=field" + i + "_recovery_value]").trigger('change');
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -747,6 +758,7 @@ $(document).ready (function () {
|
||||
|
||||
if ($('#field5_value').val() !== '') {
|
||||
ajax_get_integria_custom_fields($('#field5_value').val(), integria_custom_fields_values, integria_custom_fields_rvalues);
|
||||
$('#field5_value').trigger('change');
|
||||
}
|
||||
|
||||
$('#field5_value').on('change', function() {
|
||||
|
71
pandora_console/godmode/audit_log.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Audit log View.
|
||||
*
|
||||
* @category Audit log
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/class/AuditLog.class.php';
|
||||
|
||||
$ajaxPage = 'godmode/audit_log';
|
||||
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$controller = new AuditLog($ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
if ((bool) is_ajax() === true) {
|
||||
echo json_encode(['error' => '[AuditLog]'.$e->getMessage() ]);
|
||||
exit;
|
||||
} else {
|
||||
echo '[AuditLog]'.$e->getMessage();
|
||||
}
|
||||
|
||||
// Stop this execution, but continue 'globally'.
|
||||
return;
|
||||
}
|
||||
|
||||
// AJAX controller.
|
||||
if ((bool) is_ajax() === true) {
|
||||
$method = get_parameter('method');
|
||||
|
||||
if (method_exists($controller, $method) === true) {
|
||||
if ($controller->ajaxMethod($method) === true) {
|
||||
$controller->{$method}();
|
||||
} else {
|
||||
$controller->error('Unavailable method.');
|
||||
}
|
||||
} else {
|
||||
$controller->error('Method not found. ['.$method.']');
|
||||
}
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
||||
} else {
|
||||
// Run.
|
||||
$controller->run();
|
||||
}
|
@ -385,8 +385,8 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
// Audit //meter en extensiones.
|
||||
$sub['godmode/admin_access_logs']['text'] = __('System audit log');
|
||||
$sub['godmode/admin_access_logs']['id'] = 'System audit log';
|
||||
$sub['godmode/audit_log']['text'] = __('System audit log');
|
||||
$sub['godmode/audit_log']['id'] = 'System audit log';
|
||||
$sub['godmode/setup/links']['text'] = __('Links');
|
||||
$sub['godmode/setup/links']['id'] = 'Links';
|
||||
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
|
||||
@ -406,6 +406,7 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
|
||||
$sub['extensions/dbmanager']['text'] = __('DB Interface');
|
||||
$sub['extensions/dbmanager']['id'] = 'DB Interface';
|
||||
$sub['extensions/dbmanager']['sec'] = 'gbman';
|
||||
enterprise_hook('dbBackupManager');
|
||||
enterprise_hook('elasticsearch_interface_menu');
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ switch ($action) {
|
||||
$failover_type = REPORT_FAILOVER_TYPE_NORMAL;
|
||||
$server_name = '';
|
||||
$server_id = 0;
|
||||
$dyn_height = 230;
|
||||
$dyn_height = (empty($config['graph_image_height']) === false) ? $config['graph_image_height'] : REPORT_ITEM_DYNAMIC_HEIGHT;
|
||||
$landscape = false;
|
||||
$pagebreak = false;
|
||||
$summary = 0;
|
||||
@ -252,7 +252,7 @@ switch ($action) {
|
||||
$server_name = '';
|
||||
$server_id = 0;
|
||||
$get_data_editor = false;
|
||||
$dyn_height = 230;
|
||||
$dyn_height = (empty($config['graph_image_height']) === false) ? $config['graph_image_height'] : REPORT_ITEM_DYNAMIC_HEIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3914,7 +3914,7 @@ function print_SLA_list($width, $action, $idItem=null)
|
||||
<input id="hidden-id_server" name="id_server" value="" type="hidden">
|
||||
<?php
|
||||
// Set autocomplete image.
|
||||
$autocompleteImage = html_print_image(($config['style'] === 'pandora_black') ? 'images/agent_mc.menu.png' : 'images/search_agent.png', true, false, true);
|
||||
$autocompleteImage = html_print_image(($config['style'] === 'pandora_black' && !is_metaconsole()) ? 'images/agent_mc.menu.png' : 'images/search_agent.png', true, false, true);
|
||||
// Params for agent autocomplete input.
|
||||
$params = [];
|
||||
$params['show_helptip'] = true;
|
||||
@ -4004,23 +4004,23 @@ function print_SLA_list($width, $action, $idItem=null)
|
||||
],
|
||||
]
|
||||
);
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
if (!empty($services_tmp)
|
||||
&& $services_tmp != ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
) {
|
||||
foreach ($services_tmp as $service) {
|
||||
$check_module_sla = modules_check_agentmodule_exists(
|
||||
$service['sla_id_module']
|
||||
);
|
||||
$check_module_sla_value = modules_check_agentmodule_exists(
|
||||
$service['sla_value_id_module']
|
||||
);
|
||||
if ($check_module_sla
|
||||
&& $check_module_sla_value
|
||||
) {
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
$services[$service['id']] = $service['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<td class="sla_list_service_col">';
|
||||
echo html_print_select(
|
||||
|
@ -116,7 +116,7 @@ $table_remote->data['ehorus_test'] = $row;
|
||||
// Print.
|
||||
echo '<div class="center pdd_b_20px">';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
html_print_image('include/ehorus/images/ehorus-logo.png');
|
||||
} else {
|
||||
html_print_image('include/ehorus/images/ehorus-logo-grey.png');
|
||||
|
BIN
pandora_console/images/histograma.png
Normal file
After Width: | Height: | Size: 933 B |
@ -1362,6 +1362,10 @@ if ($get_extended_event) {
|
||||
$timestamp_first = $event['min_timestamp'];
|
||||
$timestamp_last = $event['max_timestamp'];
|
||||
$server_id = $event['server_id'];
|
||||
if (empty($server_id) && !empty($event['server_name']) && is_metaconsole()) {
|
||||
$server_id = metaconsole_get_id_server($event['server_name']);
|
||||
}
|
||||
|
||||
$comments = $event['comments'];
|
||||
|
||||
$event['similar_ids'] = $similar_ids;
|
||||
@ -1537,7 +1541,7 @@ if ($get_extended_event) {
|
||||
|
||||
$console_url = '';
|
||||
// If metaconsole switch to node to get details and custom fields.
|
||||
if ($meta) {
|
||||
if ($meta || (is_metaconsole() && !empty($server_id))) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
} else {
|
||||
$server = '';
|
||||
@ -1550,7 +1554,7 @@ if ($get_extended_event) {
|
||||
}
|
||||
|
||||
$connected = true;
|
||||
if ($meta) {
|
||||
if ($meta || (is_metaconsole() && !empty($server_id))) {
|
||||
if (metaconsole_connect($server) === NOERR) {
|
||||
$connected = true;
|
||||
} else {
|
||||
|
@ -1189,14 +1189,25 @@ if (check_login()) {
|
||||
|
||||
$data[8] = ' ';
|
||||
if ($module['history_data'] == 1) {
|
||||
$tresholds = true;
|
||||
if (empty((float) $module['min_warning']) === true
|
||||
&& empty((float) $module['max_warning']) === true
|
||||
&& empty($module['warning_inverse']) === true
|
||||
&& empty((float) $module['min_critical']) === true
|
||||
&& empty((float) $module['max_critical']) === true
|
||||
&& empty($module['critical_inverse']) === true
|
||||
) {
|
||||
$tresholds = false;
|
||||
}
|
||||
|
||||
$nombre_tipo_modulo = modules_get_moduletype_name($module['id_tipo_modulo']);
|
||||
$handle = 'stat'.$nombre_tipo_modulo.'_'.$module['id_agente_modulo'];
|
||||
$url = 'include/procesos.php?agente='.$module['id_agente_modulo'];
|
||||
$win_handle = dechex(crc32($module['id_agente_modulo'].$module['nombre']));
|
||||
|
||||
// Try to display the SNMP module realtime graph
|
||||
// Try to display the SNMP module realtime graph.
|
||||
$rt_button = get_module_realtime_link_graph($module);
|
||||
if (!empty($rt_button)) {
|
||||
if (empty($rt_button) === false) {
|
||||
$data[8] = $rt_button.' ';
|
||||
}
|
||||
|
||||
@ -1207,6 +1218,19 @@ if (check_login()) {
|
||||
$draw_events = 0;
|
||||
}
|
||||
|
||||
if ($tresholds === true || $graph_type === 'boolean') {
|
||||
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&refresh='.SECONDS_10MINUTES.'&'."histogram=1', 'day_".$win_handle."', 800, 480)";
|
||||
$data[8] .= '<a href="javascript:'.$link.'">'.html_print_image(
|
||||
'images/histograma.png',
|
||||
true,
|
||||
[
|
||||
'border' => '0',
|
||||
'alt' => '',
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</a> ';
|
||||
}
|
||||
|
||||
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&refresh='.SECONDS_10MINUTES.'&'."draw_events=$draw_events', 'day_".$win_handle."', 800, 480)";
|
||||
if (!is_snapshot_data($module['datos'])) {
|
||||
$data[8] .= '<a href="javascript:'.$link.'">'.html_print_image(
|
||||
@ -1349,13 +1373,34 @@ if (check_login()) {
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$output .= grafico_modulo_sparse($params);
|
||||
echo $output;
|
||||
if ($params['histogram'] === true) {
|
||||
$params['id_agent_module'] = $params['agent_module_id'];
|
||||
$params['dinamic_proc'] = 1;
|
||||
|
||||
$output .= '<div class="stat_win_histogram">';
|
||||
if ($params['compare'] === 'separated') {
|
||||
$graph = \reporting_module_histogram_graph(
|
||||
['datetime' => ($params['begin_date'] - $params['period'])],
|
||||
$params
|
||||
);
|
||||
$output .= $graph['chart'];
|
||||
}
|
||||
|
||||
$graph = \reporting_module_histogram_graph(
|
||||
['datetime' => $params['begin_date']],
|
||||
$params
|
||||
);
|
||||
$output .= $graph['chart'];
|
||||
$output .= '</div>';
|
||||
} else {
|
||||
$output .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true && empty($server_id) === false) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
echo $output;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ $ajax = true;
|
||||
|
||||
$render_map = (bool) get_parameter('render_map', false);
|
||||
$graph_javascript = (bool) get_parameter('graph_javascript', false);
|
||||
$force_remote_check = (bool) get_parameter('force_remote_check', false);
|
||||
|
||||
if ($render_map) {
|
||||
$width = (int) get_parameter('width', '400');
|
||||
@ -55,3 +56,36 @@ if ($render_map) {
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($force_remote_check) {
|
||||
$id_layout = (int) get_parameter('id_layout', false);
|
||||
$data = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
'SELECT id_agent FROM tlayout_data WHERE id_layout = %d AND id_agent <> 0',
|
||||
$id_layout
|
||||
)
|
||||
);
|
||||
|
||||
if (empty($data)) {
|
||||
echo '0';
|
||||
} else {
|
||||
$ids = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$ids[] = $value['id_agent'];
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'UPDATE `tagente_modulo` SET flag = 1 WHERE `id_agente` IN (%s)',
|
||||
implode(',', $ids)
|
||||
);
|
||||
|
||||
$result = db_process_sql($sql);
|
||||
if ($result) {
|
||||
echo true;
|
||||
} else {
|
||||
echo '0';
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1389,7 +1389,10 @@ class AgentWizard extends HTML
|
||||
foreach (array_keys($data) as $k) {
|
||||
foreach ($modulesActivated as $key => $value) {
|
||||
$valueStr = preg_replace('/\//', '\/', $value);
|
||||
if (empty(preg_match('/-'.$valueStr.'$/', $k)) === false) {
|
||||
|
||||
if (empty(preg_match('/-'.$valueStr.'$/', $k)) === false
|
||||
|| empty(preg_match('/-'.$valueStr.'_sent$/', $k)) === false
|
||||
) {
|
||||
if (empty(preg_match('/module-name-set/', $k)) === false) {
|
||||
$result[$value]['name'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-description-set/', $k)) === false) {
|
||||
@ -1417,6 +1420,42 @@ class AgentWizard extends HTML
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-unit/', $k)) === false) {
|
||||
$result[$value]['unit'] = $data['module-unit-'.$key];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-min/', $k)) === false) {
|
||||
$result[$value]['warningMin'] = $data['module-warning-min-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-max/', $k)) === false) {
|
||||
$result[$value]['warningMax'] = $data['module-warning-max-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-min/', $k)) === false) {
|
||||
$result[$value]['criticalMin'] = $data['module-critical-min-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-max/', $k)) === false) {
|
||||
$result[$value]['criticalMax'] = $data['module-critical-max-0_0-0'];
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-inv/', $k)) === false) {
|
||||
if (isset($data['module-critical-inv-0_0-0'])) {
|
||||
$result[$value]['criticalInv'] = $data['module-critical-inv-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-inv/', $k)) === false) {
|
||||
if (isset($data['module-warning-inv-0_0-0'])) {
|
||||
$result[$value]['warningInv'] = $data['module-warning-inv-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-warning-perc/', $k)) === false) {
|
||||
if (isset($data['module-warning-perc-0_0-0'])) {
|
||||
$result[$value]['warningPerc'] = $data['module-warning-perc-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
} else if (empty(preg_match('/module-critical-perc/', $k)) === false) {
|
||||
if (isset($data['module-critical-perc-0_0-0'])) {
|
||||
$result[$value]['criticalPerc'] = $data['module-critical-perc-0_0-0_sent'];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1429,6 +1468,10 @@ class AgentWizard extends HTML
|
||||
}
|
||||
}
|
||||
|
||||
if (empty(preg_match('/-'.$valueStr.'_sent$/', $k)) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (empty(preg_match('/module-warning-min/', $k)) === false) {
|
||||
$result[$value]['warningMin'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-warning-max/', $k)) === false) {
|
||||
@ -1438,9 +1481,9 @@ class AgentWizard extends HTML
|
||||
} else if (empty(preg_match('/module-critical-max/', $k)) === false) {
|
||||
$result[$value]['criticalMax'] = $data[$k];
|
||||
} else if (empty(preg_match('/module-critical-inv/', $k)) === false) {
|
||||
$result[$value]['criticalInv'] = $data[$k];
|
||||
$result[$value]['criticalInv'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-warning-inv/', $k)) === false) {
|
||||
$result[$value]['warningInv'] = $data[$k];
|
||||
$result[$value]['warningInv'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-warning-perc/', $k)) === false) {
|
||||
$result[$value]['warningPerc'] = $data[$k.'_sent'];
|
||||
} else if (empty(preg_match('/module-critical-perc/', $k)) === false) {
|
||||
|
410
pandora_console/include/class/AuditLog.class.php
Normal file
@ -0,0 +1,410 @@
|
||||
<?php
|
||||
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
/**
|
||||
* Controller for Audit Logs
|
||||
*
|
||||
* @category Controller
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
// Necessary classes for extends.
|
||||
require_once $config['homedir'].'/include/class/HTML.class.php';
|
||||
enterprise_include_once('godmode/admin_access_logs.php');
|
||||
|
||||
/**
|
||||
* Class AuditLog
|
||||
*/
|
||||
class AuditLog extends HTML
|
||||
{
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $AJAXMethods = [ 'draw' ];
|
||||
|
||||
/**
|
||||
* Ajax page.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $ajaxController;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param string $ajaxController Ajax controller.
|
||||
*/
|
||||
public function __construct(string $ajaxController)
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM') === false
|
||||
&& is_user_admin($config['id_user']) === true
|
||||
) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Audit Logs'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the ajax controller.
|
||||
$this->ajaxController = $ajaxController;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Javascript.
|
||||
ui_require_jquery_file('pandora');
|
||||
// CSS.
|
||||
ui_require_css_file('wizard');
|
||||
ui_require_css_file('discovery');
|
||||
// Datatables list.
|
||||
try {
|
||||
$columns = [
|
||||
'id_usuario',
|
||||
'accion',
|
||||
'fecha',
|
||||
'ip_origen',
|
||||
'descripcion',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('User'),
|
||||
__('Action'),
|
||||
__('Date'),
|
||||
__('Source IP'),
|
||||
__('Comments'),
|
||||
];
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
array_push(
|
||||
$columns,
|
||||
[
|
||||
'text' => 'security',
|
||||
'class' => 'w80px action_buttons show_security_info',
|
||||
],
|
||||
[
|
||||
'text' => 'action',
|
||||
'class' => 'w80px action_buttons show_extended_info',
|
||||
]
|
||||
);
|
||||
|
||||
array_push($column_names, __('S.'), __('A.'));
|
||||
}
|
||||
|
||||
$this->tableId = 'audit_logs';
|
||||
|
||||
// Header (only in Node).
|
||||
if (is_metaconsole() === false) {
|
||||
ui_print_standard_header(
|
||||
__('%s audit', get_product_name()).' » '.__('Review Logs'),
|
||||
'images/gm_log.png',
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
[],
|
||||
[
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('Admin Tools'),
|
||||
],
|
||||
[
|
||||
'link' => '',
|
||||
'label' => __('System Audit log'),
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
// Only in case of Metaconsole, format the frame.
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
// Load datatables user interface.
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => $this->tableId,
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => $this->ajaxController,
|
||||
'ajax_data' => ['method' => 'draw'],
|
||||
'ajax_postprocces' => 'process_datatables_item(item)',
|
||||
'no_sortable_columns' => [-1],
|
||||
'order' => [
|
||||
'field' => 'date',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Search'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_text',
|
||||
'name' => 'filter_text',
|
||||
],
|
||||
[
|
||||
'label' => __('Max. hours old'),
|
||||
'type' => 'text',
|
||||
'class' => 'w100px',
|
||||
'id' => 'filter_period',
|
||||
'name' => 'filter_period',
|
||||
],
|
||||
[
|
||||
'label' => __('IP'),
|
||||
'type' => 'text',
|
||||
'class' => 'w100px',
|
||||
'id' => 'filter_ip',
|
||||
'name' => 'filter_ip',
|
||||
],
|
||||
[
|
||||
'label' => __('Action'),
|
||||
'type' => 'select_from_sql',
|
||||
'nothing' => __('All'),
|
||||
'nothing_value' => '-1',
|
||||
'sql' => 'SELECT DISTINCT(accion), accion AS text FROM tsesion',
|
||||
'class' => 'mw250px',
|
||||
'id' => 'filter_type',
|
||||
'name' => 'filter_type',
|
||||
],
|
||||
[
|
||||
'label' => __('User'),
|
||||
'type' => 'select_from_sql',
|
||||
'nothing' => __('All'),
|
||||
'nothing_value' => '-1',
|
||||
'sql' => 'SELECT id_user, id_user AS text FROM tusuario',
|
||||
'class' => 'mw250px',
|
||||
'id' => 'filter_user',
|
||||
'name' => 'filter_user',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
// Close the frame.
|
||||
close_meta_frame();
|
||||
}
|
||||
|
||||
// Load own javascript file.
|
||||
echo $this->loadJS();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the data for draw the table.
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
public function draw()
|
||||
{
|
||||
global $config;
|
||||
// Initialice filter.
|
||||
$filter = '1=1';
|
||||
// Init data.
|
||||
$data = [];
|
||||
// Count of total records.
|
||||
$count = 0;
|
||||
// Catch post parameters.
|
||||
$start = get_parameter('start', 0);
|
||||
$length = get_parameter('length', $config['block_size']);
|
||||
$order = get_datatable_order();
|
||||
$filters = get_parameter('filter', []);
|
||||
$this->filterType = $filters['filter_type'];
|
||||
$this->filterUser = $filters['filter_user'];
|
||||
$this->filterText = $filters['filter_text'];
|
||||
$this->filterPeriod = (empty($filters['filter_period']) === false) ? $filters['filter_period'] : 24;
|
||||
$this->filterIp = $filters['filter_ip'];
|
||||
|
||||
if (empty($this->filterType) === false && $this->filterType !== '-1') {
|
||||
$filter .= sprintf(" AND accion = '%s'", $this->filterType);
|
||||
}
|
||||
|
||||
if (empty($this->filterUser) === false && $this->filterUser !== '-1') {
|
||||
$filter .= sprintf(" AND id_usuario = '%s'", $this->filterUser);
|
||||
}
|
||||
|
||||
if (empty($this->filterText) === false) {
|
||||
$filter .= sprintf(
|
||||
" AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')",
|
||||
$this->filterText,
|
||||
$this->filterText
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($this->filterIp) === false) {
|
||||
$filter .= sprintf(" AND ip_origen LIKE '%%%s%%'", $this->filterIp);
|
||||
}
|
||||
|
||||
if (empty($this->filterPeriod) === false) {
|
||||
$filter .= sprintf(' AND fecha >= DATE_ADD(NOW(), INTERVAL -%d HOUR)', $this->filterPeriod);
|
||||
}
|
||||
|
||||
$count = (int) db_get_value_sql(sprintf('SELECT COUNT(*) as "total" FROM tsesion WHERE %s', $filter));
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tsesion
|
||||
WHERE %s
|
||||
ORDER BY %s
|
||||
LIMIT %d, %d',
|
||||
$filter,
|
||||
$order,
|
||||
$start,
|
||||
$length
|
||||
);
|
||||
$data = db_get_all_rows_sql($sql);
|
||||
|
||||
if (empty($data) === false) {
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
global $config;
|
||||
// Transforms array of arrays $data into an array
|
||||
// of objects, making a post-process of certain fields.
|
||||
$tmp = (object) $item;
|
||||
|
||||
$tmp->id_usuario = io_safe_output($tmp->id_usuario);
|
||||
$tmp->ip_origen = io_safe_output($tmp->ip_origen);
|
||||
$tmp->descripcion = io_safe_output($tmp->descripcion);
|
||||
$tmp->accion = ui_print_session_action_icon($tmp->accion, true).$tmp->accion;
|
||||
$tmp->utimestamp = ui_print_help_tip(
|
||||
date(
|
||||
$config['date_format'],
|
||||
$tmp->utimestamp
|
||||
),
|
||||
true
|
||||
).ui_print_timestamp($tmp->utimestamp, true);
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
$tmp->security = enterprise_hook('cell1EntepriseAudit', [$tmp->id_sesion]);
|
||||
$tmp->action = enterprise_hook('cell2EntepriseAudit', []);
|
||||
$tmp->extendedInfo = enterprise_hook('rowEnterpriseAudit', [$tmp->id_sesion]);
|
||||
}
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $data,
|
||||
'recordsTotal' => $count,
|
||||
'recordsFiltered' => $count,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if target method is available to be called using AJAX.
|
||||
*
|
||||
* @param string $method Target method.
|
||||
*
|
||||
* @return boolean True allowed, false not.
|
||||
*/
|
||||
public function ajaxMethod(string $method)
|
||||
{
|
||||
return in_array($method, $this->AJAXMethods);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load Javascript code.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public function loadJS()
|
||||
{
|
||||
// Nothing for this moment.
|
||||
ob_start();
|
||||
|
||||
// Javascript content.
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function format ( d ) {
|
||||
var output = '';
|
||||
|
||||
if (d.extendedInfo === '') {
|
||||
output = "<?php echo __('There is no additional information to display'); ?>";
|
||||
} else {
|
||||
output = d.extendedInfo;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Add event listener for opening and closing details
|
||||
$('#audit_logs tbody').on('click', 'td.show_extended_info', function () {
|
||||
var tr = $(this).closest('tr');
|
||||
var table = <?php echo 'dt_'.$this->tableId; ?>;
|
||||
var row = table.row( tr );
|
||||
|
||||
if ( row.child.isShown() ) {
|
||||
// This row is already open - close it
|
||||
row.child.hide();
|
||||
tr.removeClass('shown');
|
||||
}
|
||||
else {
|
||||
// Open this row
|
||||
row.child( format(row.data()) ).show();
|
||||
tr.addClass('shown');
|
||||
}
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
<?php
|
||||
// EOF Javascript content.
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1256,8 +1256,7 @@ class ConsoleSupervisor
|
||||
unix_timestamp() - unix_timestamp(keepalive) as downtime
|
||||
FROM tserver
|
||||
WHERE
|
||||
unix_timestamp() - unix_timestamp(keepalive) > server_keepalive
|
||||
OR status = 0'
|
||||
unix_timestamp() - unix_timestamp(keepalive) > server_keepalive'
|
||||
);
|
||||
|
||||
if ($servers === false) {
|
||||
@ -1298,13 +1297,12 @@ class ConsoleSupervisor
|
||||
FROM tserver
|
||||
WHERE
|
||||
unix_timestamp() - unix_timestamp(keepalive) <= server_keepalive
|
||||
OR status != 0'
|
||||
AND status = 1'
|
||||
);
|
||||
|
||||
if (is_array($servers_working) === true) {
|
||||
foreach ($servers_working as $server) {
|
||||
$this->cleanNotifications(
|
||||
'NOTIF.SERVER.STATUS'.$server['id_server']
|
||||
'NOTIF.SERVER.STATUS.'.$server['id_server']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ class HTML
|
||||
bool $direct=false
|
||||
) {
|
||||
global $config;
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$text_color = 'style="color: white"';
|
||||
}
|
||||
|
||||
|
@ -669,15 +669,20 @@ class Tree
|
||||
// HTML of the server type image
|
||||
$module['serverTypeHTML'] = servers_show_type($module['server_type']);
|
||||
|
||||
// Link to the Module graph
|
||||
// ACL
|
||||
// Link to the Module graph.
|
||||
// ACL.
|
||||
$acl_graphs = false;
|
||||
$module['showGraphs'] = 0;
|
||||
|
||||
// Avoid the check on the metaconsole. Too slow to show/hide an icon depending on the permissions
|
||||
if (!empty($group_id) && !is_metaconsole()) {
|
||||
$acl_graphs = check_acl_one_of_groups($config['id_user'], $all_groups, 'RR');
|
||||
} else if (!empty($all_groups)) {
|
||||
// Avoid the check on the metaconsole.
|
||||
// Too slow to show/hide an icon depending on the permissions.
|
||||
if (empty($group_id) === false && is_metaconsole() === false) {
|
||||
$acl_graphs = check_acl_one_of_groups(
|
||||
$config['id_user'],
|
||||
$all_groups,
|
||||
'RR'
|
||||
);
|
||||
} else if (empty($all_groups) === false) {
|
||||
$acl_graphs = true;
|
||||
}
|
||||
|
||||
@ -686,8 +691,24 @@ class Tree
|
||||
}
|
||||
|
||||
if ($module['showGraphs']) {
|
||||
$tresholds = true;
|
||||
if (empty((float) $module['min_warning']) === true
|
||||
&& empty((float) $module['max_warning']) === true
|
||||
&& empty($module['warning_inverse']) === true
|
||||
&& empty((float) $module['min_critical']) === true
|
||||
&& empty((float) $module['max_critical']) === true
|
||||
&& empty($module['critical_inverse']) === true
|
||||
) {
|
||||
$tresholds = false;
|
||||
}
|
||||
|
||||
$graphType = return_graphtype($module['id_module_type']);
|
||||
$url = ui_get_full_url('operation/agentes/stat_win.php', false, false, false);
|
||||
$url = ui_get_full_url(
|
||||
'operation/agentes/stat_win.php',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$winHandle = dechex(crc32($module['id'].$module['name']));
|
||||
|
||||
$graph_params = [
|
||||
@ -697,20 +718,20 @@ class Tree
|
||||
'refresh' => SECONDS_10MINUTES,
|
||||
];
|
||||
|
||||
if (is_metaconsole()) {
|
||||
// Set the server id
|
||||
if (is_metaconsole() === true) {
|
||||
// Set the server id.
|
||||
$graph_params['server'] = $module['serverID'];
|
||||
}
|
||||
|
||||
$graph_params_str = http_build_query($graph_params);
|
||||
$moduleGraphURL = "$url?$graph_params_str";
|
||||
$moduleGraphURL = $url.'?'.$graph_params_str;
|
||||
|
||||
$module['moduleGraph'] = [
|
||||
'url' => $moduleGraphURL,
|
||||
'handle' => $winHandle,
|
||||
];
|
||||
|
||||
// Info to be able to open the snapshot image new page
|
||||
// Info to be able to open the snapshot image new page.
|
||||
$module['snapshot'] = ui_get_snapshot_link(
|
||||
[
|
||||
'id_module' => $module['id'],
|
||||
@ -720,6 +741,16 @@ class Tree
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
if ($tresholds === true || $graphType === 'boolean') {
|
||||
$graph_params['histogram'] = 1;
|
||||
$graph_params_str_th = http_build_query($graph_params);
|
||||
$moduleGraphURLTh = $url.'?'.$graph_params_str_th;
|
||||
$module['histogramGraph'] = [
|
||||
'url' => $moduleGraphURLTh,
|
||||
'handle' => $winHandle,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$module_alerts = alerts_get_alerts_agent_module($module['id']);
|
||||
|
@ -430,6 +430,7 @@ class TreeService extends Tree
|
||||
$tmp['searchChildren'] = 1;
|
||||
} else {
|
||||
$tmp['searchChildren'] = 0;
|
||||
$tmp['noAcl'] = 1;
|
||||
}
|
||||
|
||||
$tmp['showEventsBtn'] = 1;
|
||||
|
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC211216';
|
||||
$build_version = 'PC220125';
|
||||
$pandora_version = 'v7.0NG.759';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -113,6 +113,7 @@ define('SECONDS_3YEARS', 94608000);
|
||||
// Separator constats.
|
||||
define('SEPARATOR_COLUMN', ';');
|
||||
define('SEPARATOR_ROW', chr(10));
|
||||
define('SEPARATOR_META_MODULE', '|-|-|-|');
|
||||
// Chr(10) is \n.
|
||||
define('SEPARATOR_COLUMN_CSV', '#');
|
||||
define('SEPARATOR_ROW_CSV', "@\n");
|
||||
@ -456,6 +457,8 @@ define('REPORT_ITEM_ORDER_BY_ASCENDING', 2);
|
||||
define('REPORT_ITEM_ORDER_BY_DESCENDING', 1);
|
||||
define('REPORT_ITEM_ORDER_BY_UNSORT', 0);
|
||||
|
||||
define('REPORT_ITEM_DYNAMIC_HEIGHT', 230);
|
||||
|
||||
define('REPORT_OLD_TYPE_SIMPLE_GRAPH', 1);
|
||||
define('REPORT_OLD_TYPE_CUSTOM_GRAPH', 2);
|
||||
define('REPORT_OLD_TYPE_SLA', 3);
|
||||
|
@ -874,10 +874,10 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
|
||||
*
|
||||
* @return the first value of the first row of a table result from query.
|
||||
*/
|
||||
function mysql_db_get_value_sql($sql, $dbconnection=false)
|
||||
function mysql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||
{
|
||||
$sql .= ' LIMIT 1';
|
||||
$result = mysql_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
||||
$result = mysql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -977,10 +977,10 @@ function oracle_recode_query($sql, $values, $join='AND', $return=true)
|
||||
*
|
||||
* @return the first value of the first row of a table result from query.
|
||||
*/
|
||||
function oracle_db_get_value_sql($sql, $dbconnection=false)
|
||||
function oracle_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||
{
|
||||
$sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2';
|
||||
$result = oracle_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
||||
$result = oracle_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -686,10 +686,10 @@ function postgresql_db_format_array_where_clause_sql($values, $join='AND', $pref
|
||||
*
|
||||
* @return the first value of the first row of a table result from query.
|
||||
*/
|
||||
function postgresql_db_get_value_sql($sql, $dbconnection=false)
|
||||
function postgresql_db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||
{
|
||||
$sql .= ' LIMIT 1';
|
||||
$result = postgresql_db_get_all_rows_sql($sql, false, true, $dbconnection);
|
||||
$result = postgresql_db_get_all_rows_sql($sql, $search_history_db, true, $dbconnection);
|
||||
|
||||
if ($result === false) {
|
||||
return false;
|
||||
|
@ -4185,6 +4185,9 @@ function generator_chart_to_pdf(
|
||||
) {
|
||||
$width_img = 650;
|
||||
$height_img = ($params['height'] + 50);
|
||||
} else if ($type_graph_pdf === 'hbar') {
|
||||
$width_img = ($params['width'] ?? 550);
|
||||
$height_img = $params['height'];
|
||||
} else {
|
||||
$width_img = 550;
|
||||
$height_img = $params['height'];
|
||||
@ -5966,3 +5969,24 @@ function send_test_email(
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (function_exists('str_contains') === false) {
|
||||
|
||||
|
||||
/**
|
||||
* Checks if $needle is found in $haystack and returns a boolean value.
|
||||
* For lower than PHP8 versions.
|
||||
*
|
||||
* @param string $haystack The string who can have the needle.
|
||||
* @param string $needle The needle.
|
||||
*
|
||||
* @return boolean True if haystack contains the needle.
|
||||
*/
|
||||
function str_contains(string $haystack, string $needle)
|
||||
{
|
||||
return $needle !== '' && mb_strpos($haystack, $needle) !== false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -162,9 +162,13 @@ function agents_locate_agent(string $field)
|
||||
*
|
||||
* @return array|boolean Agents ids or false if error.
|
||||
*/
|
||||
function agents_get_agent_id_by_alias($alias)
|
||||
function agents_get_agent_id_by_alias($alias, $is_metaconsole=false)
|
||||
{
|
||||
return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')");
|
||||
if ($is_metaconsole === true) {
|
||||
return db_get_all_rows_sql("SELECT id_tagente FROM tmetaconsole_agent WHERE upper(alias) LIKE upper('%$alias%')");
|
||||
} else {
|
||||
return db_get_all_rows_sql("SELECT id_agente FROM tagente WHERE upper(alias) LIKE upper('%$alias%')");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -906,7 +910,11 @@ function agents_process_manage_config($source_id_agent, $destiny_id_agents, $cop
|
||||
[
|
||||
'nombre' => $module['nombre'],
|
||||
'disabled' => false,
|
||||
]
|
||||
],
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
// Keep all modules repeated
|
||||
@ -1439,7 +1447,8 @@ function agents_get_modules(
|
||||
$filter=false,
|
||||
$indexed=true,
|
||||
$get_not_init_modules=true,
|
||||
$force_tags=false
|
||||
$force_tags=false,
|
||||
$filter_include_sql=true
|
||||
) {
|
||||
global $config;
|
||||
|
||||
@ -1538,18 +1547,18 @@ function agents_get_modules(
|
||||
}
|
||||
}
|
||||
|
||||
if ($value[0] == '%') {
|
||||
if ($value[0] == '%' && $filter_include_sql === true) {
|
||||
array_push(
|
||||
$fields,
|
||||
$field.' LIKE "'.$value.'"'
|
||||
);
|
||||
} else if ($operatorDistin) {
|
||||
} else if ($operatorDistin && $filter_include_sql === true) {
|
||||
array_push($fields, $field.' <> '.substr($value, 2));
|
||||
} else if (substr($value, -1) == '%') {
|
||||
} else if (substr($value, -1) == '%' && $filter_include_sql === true) {
|
||||
array_push($fields, $field.' LIKE "'.$value.'"');
|
||||
} else if (strncmp($value, '666=666', 7) == 0) {
|
||||
array_push($fields, ' '.$value);
|
||||
} else if (preg_match('/\bin\b/i', $field)) {
|
||||
} else if (preg_match('/\bin\b/i', $field) && $filter_include_sql === true) {
|
||||
array_push($fields, $field.' '.$value);
|
||||
} else {
|
||||
array_push($fields, 'tagente_modulo.'.$field.' = "'.$value.'"');
|
||||
@ -3872,7 +3881,7 @@ function agents_get_status_animation($up=true)
|
||||
$red = 'images/heartbeat_green.gif';
|
||||
$green = 'images/heartbeat_green.gif';
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$red = 'images/heartbeat_green_black.gif';
|
||||
$green = 'images/heartbeat_green_black.gif';
|
||||
}
|
||||
|
@ -2183,6 +2183,7 @@ function get_group_alerts(
|
||||
// WHEN SELECT ALL TAGS TO FILTER ALERTS
|
||||
if ($action_filter) {
|
||||
$filter .= ' AND (talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions where id_alert_action = '.$action_filter.'))';
|
||||
$filter .= ' OR talert_template_modules.id_alert_template IN (SELECT talert_templates.id FROM talert_templates where talert_templates.id_alert_action = '.$action_filter.')';
|
||||
}
|
||||
|
||||
if (is_array($options)) {
|
||||
|
@ -9925,12 +9925,19 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
|
||||
|
||||
if (isset($other['data'][2]) && $other['data'][2] != '') {
|
||||
if ($use_agent_name === false) {
|
||||
$idAgents = agents_get_agent_id_by_alias($other['data'][2]);
|
||||
$idAgents = agents_get_agent_id_by_alias($other['data'][2], is_metaconsole());
|
||||
|
||||
if (!empty($idAgents)) {
|
||||
$idAgent = [];
|
||||
|
||||
$id_agent_field = 'id_agente';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$id_agent_field = 'id_tagente';
|
||||
}
|
||||
|
||||
foreach ($idAgents as $key => $value) {
|
||||
$idAgent[] .= $value['id_agente'];
|
||||
$idAgent[] .= $value[$id_agent_field];
|
||||
}
|
||||
|
||||
$filter[] = 'id_agente IN ('.implode(',', $idAgent).')';
|
||||
@ -9985,6 +9992,10 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($idTemplate) && $idTemplate != '') {
|
||||
$filter['id_alert_template'] = $idTemplate;
|
||||
}
|
||||
|
||||
if (isset($other['data'][5]) && $other['data'][5] != '') {
|
||||
$filter['id_usuario'] = $other['data'][5];
|
||||
}
|
||||
@ -11434,7 +11445,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
global $config;
|
||||
|
||||
$table_events = 'tevento';
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table_events = 'tmetaconsole_event';
|
||||
}
|
||||
|
||||
@ -11451,10 +11462,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
$event_view_hr = 0;
|
||||
$tag = '';
|
||||
$group_rep = 0;
|
||||
$offset = 0;
|
||||
$pagination = 40;
|
||||
$utimestamp_upper = 0;
|
||||
$utimestamp_bottom = 0;
|
||||
$id_alert_template = -1;
|
||||
|
||||
$use_agent_name = ($other['data'][16] === '1') ? true : false;
|
||||
|
||||
@ -11469,7 +11479,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
}
|
||||
|
||||
if (isset($filter['id_agentmodule'])) {
|
||||
$id_agentmodule = $filter['id_agentmodule'];
|
||||
$id_agentmodule = $filter['id_agentmodule'][0];
|
||||
}
|
||||
|
||||
if (isset($filter['id_alert_am'])) {
|
||||
@ -11488,12 +11498,8 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
$search = $filter['evento'];
|
||||
}
|
||||
|
||||
if (isset($filter['limit'])) {
|
||||
$pagination = $filter['limit'];
|
||||
}
|
||||
|
||||
if (isset($filter['offset'])) {
|
||||
$offset = $filter['offset'];
|
||||
if (isset($filter['id_alert_template'])) {
|
||||
$id_alert_template = $filter['id_alert_template'];
|
||||
}
|
||||
|
||||
$id_group = (int) $filter['id_group'];
|
||||
@ -11611,10 +11617,6 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
$sql_post .= ' AND id_agentmodule = '.$id_agentmodule;
|
||||
}
|
||||
|
||||
if ($id_alert_am != -1) {
|
||||
$sql_post .= ' AND id_alert_am = '.$id_alert_am;
|
||||
}
|
||||
|
||||
if ($id_event != -1) {
|
||||
$sql_post .= ' AND id_evento = '.$id_event;
|
||||
}
|
||||
@ -11647,6 +11649,21 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
$sql_post .= ' AND ('.$filter['sql'].') ';
|
||||
}
|
||||
|
||||
// Inject agent ID filter (it is set as the first numeric key in filter array).
|
||||
if (isset($filter[0]) === true) {
|
||||
$sql_post .= ' AND '.$filter[0];
|
||||
}
|
||||
|
||||
if ($id_alert_template !== -1) {
|
||||
$sql_post .= ' AND talert_template_modules.id_alert_template = '.$id_alert_template;
|
||||
}
|
||||
|
||||
$alert_join = '';
|
||||
|
||||
if ($id_alert_template !== -1) {
|
||||
$alert_join = ' INNER JOIN talert_template_modules ON '.$table_events.'.id_alert_am=talert_template_modules.id';
|
||||
}
|
||||
|
||||
if ($group_rep == 0) {
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
@ -11661,7 +11678,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
ORDER BY criticity DESC
|
||||
LIMIT 1';
|
||||
} else {
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$sql = 'SELECT *,
|
||||
(SELECT t2.nombre
|
||||
FROM tgrupo t2
|
||||
@ -11669,10 +11686,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
(SELECT t2.icon
|
||||
FROM tgrupo t2
|
||||
WHERE t2.id_grupo = '.$table_events.'.id_grupo) AS group_icon
|
||||
FROM '.$table_events.'
|
||||
FROM '.$table_events.$alert_join.'
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
ORDER BY utimestamp DESC
|
||||
LIMIT '.$offset.','.$pagination;
|
||||
ORDER BY utimestamp DESC';
|
||||
} else {
|
||||
$sql = 'SELECT *,
|
||||
(SELECT t1.alias
|
||||
@ -11690,10 +11706,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
SELECT tagente_modulo.id_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
|
||||
FROM '.$table_events.'
|
||||
FROM '.$table_events.$alert_join.'
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
ORDER BY utimestamp DESC
|
||||
LIMIT '.$offset.','.$pagination;
|
||||
ORDER BY utimestamp DESC';
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -11718,15 +11733,12 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
WHERE tagente_modulo.id_agente_modulo=tevento.id_agentmodule)) AS module_name
|
||||
FROM tevento
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
ORDER BY utimestamp DESC
|
||||
LIMIT '.$pagination.' OFFSET '.$offset;
|
||||
ORDER BY utimestamp DESC';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
// TODO TOTAL
|
||||
$set = [];
|
||||
$set['limit'] = $pagination;
|
||||
$set['offset'] = $offset;
|
||||
|
||||
$sql = 'SELECT *,
|
||||
(SELECT t1.alias
|
||||
@ -11764,8 +11776,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
FROM ".$table_events.'
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
GROUP BY evento, id_agentmodule
|
||||
ORDER BY timestamp_rep DESC
|
||||
LIMIT '.$offset.','.$pagination;
|
||||
ORDER BY timestamp_rep DESC';
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
@ -11776,14 +11787,11 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||
FROM ".$table_events.'
|
||||
WHERE 1=1 '.$sql_post.'
|
||||
GROUP BY evento, id_agentmodule
|
||||
ORDER BY timestamp_rep DESC
|
||||
LIMIT '.$pagination.' OFFSET '.$offset;
|
||||
ORDER BY timestamp_rep DESC';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$set = [];
|
||||
$set['limit'] = $pagination;
|
||||
$set['offset'] = $offset;
|
||||
// TODO: Remove duplicate user comments
|
||||
$sql = 'SELECT a.*, b.event_rep, b.timestamp_rep
|
||||
FROM (SELECT *
|
||||
@ -11971,7 +11979,7 @@ function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
|
||||
* @param $returnType
|
||||
* @param $user_in_db
|
||||
*/
|
||||
function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null)
|
||||
function api_get_events($node_id, $trash2, $other, $returnType, $user_in_db=null)
|
||||
{
|
||||
if ($user_in_db !== null) {
|
||||
$correct = get_events_with_user(
|
||||
@ -12016,6 +12024,10 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db=null)
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if ((int) $node_id !== 0) {
|
||||
$filterString .= ' AND server_id = '.$node_id;
|
||||
}
|
||||
|
||||
$dataRows = db_get_all_rows_filter('tmetaconsole_event', $filterString);
|
||||
} else {
|
||||
$dataRows = db_get_all_rows_filter('tevento', $filterString);
|
||||
@ -15159,12 +15171,24 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
|
||||
}
|
||||
|
||||
if ($element['type'] == 'AA') {
|
||||
$id_agent = db_get_value_sql('SELECT id_agent FROM tcluster WHERE id = '.$element['id_cluster']);
|
||||
|
||||
$module_exists_sql = sprintf(
|
||||
'SELECT id_agente_modulo FROM tagente_modulo tam INNER JOIN tcluster_agent tca WHERE tam.id_agente=tca.id_agent AND tca.id_cluster=%d AND tam.nombre="%s"',
|
||||
$element['id_cluster'],
|
||||
io_safe_input($element['name'])
|
||||
);
|
||||
|
||||
$module_exists = db_process_sql($module_exists_sql);
|
||||
|
||||
if ($module_exists === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tcluster_module = db_process_sql_insert('tcluster_item', ['name' => io_safe_input($element['name']), 'id_cluster' => $element['id_cluster'], 'critical_limit' => $element['critical_limit'], 'warning_limit' => $element['warning_limit']]);
|
||||
|
||||
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element['id_cluster']);
|
||||
|
||||
$id_parent_modulo = db_process_sql(
|
||||
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "'.io_safe_input('Cluster status').'"'
|
||||
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent.' and nombre = "'.io_safe_input('Cluster status').'"'
|
||||
);
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1');
|
||||
@ -15179,7 +15203,7 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
|
||||
'nombre' => io_safe_input($element['name']),
|
||||
'id_modulo' => 0,
|
||||
'prediction_module' => 6,
|
||||
'id_agente' => $id_agent[0]['id_agent'],
|
||||
'id_agente' => $id_agent,
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
|
||||
'custom_integer_1' => $element['id_cluster'],
|
||||
'custom_integer_2' => $tcluster_module,
|
||||
@ -15203,15 +15227,27 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
|
||||
db_pandora_audit('Report management', 'Failed to assign AA item module to cluster '.$element['name']);
|
||||
}
|
||||
} else if ($element['type'] == 'AP') {
|
||||
$id_agent = db_process_sql('select id_agent from tcluster where id = '.$element['id_cluster']);
|
||||
$id_agent = db_get_value_sql('SELECT id_agent FROM tcluster WHERE id = '.$element['id_cluster']);
|
||||
|
||||
$id_parent_modulo = db_process_sql(
|
||||
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent[0]['id_agent'].' and nombre = "'.io_safe_input('Cluster status').'"'
|
||||
$module_exists_sql = sprintf(
|
||||
'SELECT id_agente_modulo FROM tagente_modulo tam INNER JOIN tcluster_agent tca WHERE tam.id_agente=tca.id_agent AND tca.id_cluster=%d AND tam.nombre="%s"',
|
||||
$element['id_cluster'],
|
||||
io_safe_input($element['name'])
|
||||
);
|
||||
|
||||
$tcluster_balanced_module = db_process_sql_insert('tcluster_item', ['name' => $element['name'], 'id_cluster' => $element['id_cluster'], 'item_type' => 'AP', 'is_critical' => $element['is_critical']]);
|
||||
$module_exists = db_process_sql($module_exists_sql);
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1');
|
||||
if ($module_exists === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$id_parent_modulo = db_process_sql(
|
||||
'select id_agente_modulo from tagente_modulo where id_agente = '.$id_agent.' and nombre = "'.io_safe_input('Cluster status').'"'
|
||||
);
|
||||
|
||||
$tcluster_balanced_module = db_process_sql_insert('tcluster_item', ['name' => io_safe_input($element['name']), 'id_cluster' => $element['id_cluster'], 'item_type' => 'AP', 'is_critical' => $element['is_critical']]);
|
||||
|
||||
$get_module_type = db_process_sql('select id_tipo_modulo,descripcion,min_warning,min_critical,module_interval,ip_target,id_module_group from tagente_modulo where nombre = "'.io_safe_input($element['name']).'" limit 1');
|
||||
|
||||
$get_module_type_value = $get_module_type[0]['id_tipo_modulo'];
|
||||
$get_module_description_value = $get_module_type[0]['descripcion'];
|
||||
@ -15220,33 +15256,28 @@ function api_set_add_cluster_item($thrash1, $thrash2, $other, $thrash3)
|
||||
$get_module_interval_value = $get_module_type[0]['module_interval'];
|
||||
$get_module_type_nombre = db_process_sql('select nombre from ttipo_modulo where id_tipo = '.$get_module_type_value);
|
||||
$get_module_type_nombre_value = $get_module_type_nombre[0]['nombre'];
|
||||
|
||||
if (strpos($get_module_type_nombre_value, 'inc') != false) {
|
||||
$get_module_type_value_normal = 4;
|
||||
} else if (strpos($get_module_type_nombre_value, 'proc') != false) {
|
||||
$get_module_type_value_normal = 2;
|
||||
} else if (strpos($get_module_type_nombre_value, 'data') != false) {
|
||||
$get_module_type_value_normal = 1;
|
||||
} else if (strpos($get_module_type_nombre_value, 'string') != false) {
|
||||
$get_module_type_value_normal = 3;
|
||||
} else {
|
||||
$get_module_type_value_normal = 1;
|
||||
}
|
||||
$get_module_ip_target = $get_module_type[0]['ip_target'];
|
||||
$get_module_id_module_group = $get_module_type[0]['id_module_group'];
|
||||
$get_module_id_flag = $get_module_type[0]['flag'];
|
||||
$get_module_dynamic_two_tailed = $get_module_type[0]['dynamic_two_tailed'];
|
||||
|
||||
$values_module = [
|
||||
'nombre' => $element['name'],
|
||||
'id_modulo' => 5,
|
||||
'id_modulo' => 0,
|
||||
'prediction_module' => 7,
|
||||
'id_agente' => $id_agent[0]['id_agent'],
|
||||
'id_agente' => $id_agent,
|
||||
'parent_module_id' => $id_parent_modulo[0]['id_agente_modulo'],
|
||||
'custom_integer_1' => $element['id_cluster'],
|
||||
'custom_integer_2' => $tcluster_balanced_module,
|
||||
'id_tipo_modulo' => $get_module_type_value_normal,
|
||||
'id_tipo_modulo' => 1,
|
||||
'descripcion' => $get_module_description_value,
|
||||
'min_warning' => $get_module_warning_value,
|
||||
'min_critical' => $get_module_critical_value,
|
||||
'tcp_port' => $element['is_critical'],
|
||||
'module_interval' => $get_module_interval_value,
|
||||
'ip_target' => $get_module_ip_target,
|
||||
'tcp_port' => 1,
|
||||
'id_module_group' => $get_module_id_module_group,
|
||||
];
|
||||
|
||||
$id_module = modules_create_agent_module($values_module['id_agente'], $values_module['nombre'], $values_module, true);
|
||||
@ -16559,7 +16590,11 @@ function api_get_user_info($thrash1, $thrash2, $other, $returnType)
|
||||
|
||||
$other = json_decode(base64_decode($other['data']), true);
|
||||
|
||||
$sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"';
|
||||
$sql = sprintf(
|
||||
'SELECT * FROM tusuario WHERE id_user = "%s" and password = "%s"',
|
||||
mysql_escape_string_sql($other[0]['id_user']),
|
||||
mysql_escape_string_sql($other[0]['password'])
|
||||
);
|
||||
|
||||
$user_info = db_get_all_rows_sql($sql);
|
||||
|
||||
|
@ -414,21 +414,21 @@ function db_get_value_filter($field, $table, $filter, $where_join='AND', $search
|
||||
*
|
||||
* @return mixed the first value of the first row of a table result from query.
|
||||
*/
|
||||
function db_get_value_sql($sql, $dbconnection=false)
|
||||
function db_get_value_sql($sql, $dbconnection=false, $search_history_db=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
return mysql_db_get_value_sql($sql, $dbconnection);
|
||||
return mysql_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||
|
||||
break;
|
||||
case 'postgresql':
|
||||
return postgresql_db_get_value_sql($sql, $dbconnection);
|
||||
return postgresql_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||
|
||||
break;
|
||||
case 'oracle':
|
||||
return oracle_db_get_value_sql($sql, $dbconnection);
|
||||
return oracle_db_get_value_sql($sql, $dbconnection, $search_history_db);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1157,7 +1157,7 @@ function events_get_all(
|
||||
}
|
||||
|
||||
if ($tags[0] === $id_tag) {
|
||||
$_tmp .= ' AND ( ';
|
||||
$_tmp .= ' AND (( ';
|
||||
} else {
|
||||
$_tmp .= ' OR ( ';
|
||||
}
|
||||
@ -1185,7 +1185,7 @@ function events_get_all(
|
||||
$_tmp .= ') ';
|
||||
}
|
||||
|
||||
$sql_filters[] = $_tmp;
|
||||
$sql_filters[] = $_tmp.')';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1555,7 +1555,7 @@ function graphic_combined_module(
|
||||
|
||||
$long_index = '';
|
||||
|
||||
if ($config['style'] === 'pandora_black' && ($params['pdf'] === false || $params['pdf'] === null )
|
||||
if (($config['style'] === 'pandora_black' && !is_metaconsole()) && ($params['pdf'] === false || $params['pdf'] === null )
|
||||
) {
|
||||
$background_color = '#222';
|
||||
$params['legend_color'] = '#fff';
|
||||
|
@ -609,24 +609,15 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0)
|
||||
*
|
||||
* @return integer Status of the agents.
|
||||
*/
|
||||
function groups_get_status($id_group=0, $strict_user=false)
|
||||
function groups_get_status($id_group=0, $ignore_alerts=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/functions_reporting.php';
|
||||
|
||||
if ($strict_user) {
|
||||
$acltags = tags_get_user_groups_and_tags($config['id_user'], 'AR', $strict_user);
|
||||
$group_status = group_get_data($config['id_user'], $strict_user, $acltags, false, 'group');
|
||||
$data['monitor_alerts_fired'] = $groups_status['_monitors_alerts_fired_'];
|
||||
$data['agent_critical'] = $groups_status['_agents_critical_'];
|
||||
$data['agent_warning'] = $groups_status['_agents_warning_'];
|
||||
$data['agent_unknown'] = $groups_status['_agents_unknown_'];
|
||||
} else {
|
||||
$data = reporting_get_group_stats_resume($id_group);
|
||||
}
|
||||
$data = reporting_get_group_stats_resume($id_group);
|
||||
|
||||
if ($data['monitor_alerts_fired'] > 0) {
|
||||
if ($data['monitor_alerts_fired'] > 0 && $ignore_alerts == false) {
|
||||
return AGENT_STATUS_ALERT_FIRED;
|
||||
} else if ($data['agent_critical'] > 0) {
|
||||
return AGENT_STATUS_CRITICAL;
|
||||
@ -991,31 +982,31 @@ function groups_get_agents_counter($group, $agent_filter=[], $module_filter=[],
|
||||
switch ($agent_status) {
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
if (($total > 0) && ($critical == 0) && ($warning > 0)) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NORMAL:
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1026,23 +1017,23 @@ function groups_get_agents_counter($group, $agent_filter=[], $module_filter=[],
|
||||
} else {
|
||||
if (array_search(AGENT_STATUS_CRITICAL, $agent_status) !== false) {
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_WARNING, $agent_status) !== false) {
|
||||
if ($total > 0 && $critical = 0 && $warning > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_UNKNOWN, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NOT_INIT, $agent_status) !== false) {
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NORMAL, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
// Invalid status
|
||||
|
@ -471,7 +471,7 @@ function html_print_select_groups(
|
||||
global $config;
|
||||
$select2_css = 'select2.min';
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$select2_css = 'select2_dark.min';
|
||||
}
|
||||
|
||||
@ -777,11 +777,11 @@ function html_print_select(
|
||||
|
||||
if ($style === false) {
|
||||
$styleText = ' ';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$styleText = 'style="color: white"';
|
||||
}
|
||||
} else {
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$style .= ' color: white';
|
||||
}
|
||||
|
||||
@ -922,7 +922,7 @@ function html_print_select(
|
||||
}
|
||||
|
||||
$select2 = 'select2.min';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$select2 = 'select2_dark.min';
|
||||
}
|
||||
|
||||
@ -1181,6 +1181,7 @@ function html_print_select_multiple_filtered(
|
||||
) {
|
||||
$output .= '<div class="item-filter flex-row-vcenter">';
|
||||
|
||||
$output .= '<div style="display:none">';
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'style' => 'display:none;',
|
||||
@ -1190,6 +1191,7 @@ function html_print_select_multiple_filtered(
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
$output .= '</div>';
|
||||
|
||||
$f = "filterAvailableItems(this.value,'".$rid."','".__('None')."')";
|
||||
$output .= html_print_input(
|
||||
@ -1312,7 +1314,7 @@ function html_print_select_multiple_filtered(
|
||||
'input_class' => 'flex-row-vcenter',
|
||||
'label' => __('Group recursion'),
|
||||
'name' => 'id-group-recursion-selected-select-'.$rid,
|
||||
'type' => 'checkbox',
|
||||
'type' => 'switch',
|
||||
'script' => $reload_content,
|
||||
'return' => true,
|
||||
]
|
||||
@ -1329,6 +1331,8 @@ function html_print_select_multiple_filtered(
|
||||
) {
|
||||
$output .= '<div class="item-filter flex-row-vcenter">';
|
||||
|
||||
$output .= '<div style="display:none">';
|
||||
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'style' => 'display:none;',
|
||||
@ -1338,6 +1342,7 @@ function html_print_select_multiple_filtered(
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
$output .= '</div>';
|
||||
|
||||
$f = "filterSelectedItems(this.value,'".$rid."','".__('None')."')";
|
||||
$output .= html_print_input(
|
||||
@ -1475,7 +1480,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
||||
'return' => true,
|
||||
'nothing' => __('All'),
|
||||
'nothing_value' => 0,
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\')',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
$output .= '</div>';
|
||||
@ -1528,7 +1533,7 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
||||
'return' => true,
|
||||
'multiple' => true,
|
||||
'style' => 'min-width: 200px;max-width:200px;',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\')',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
|
||||
@ -1545,39 +1550,29 @@ function html_print_select_multiple_modules_filtered(array $data):string
|
||||
'name' => 'filtered-module-show-common-modules-'.$uniqId,
|
||||
'selected' => $data['mShowCommonModules'],
|
||||
'return' => true,
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\')',
|
||||
'script' => 'fmModuleChange(\''.$uniqId.'\', '.is_metaconsole().')',
|
||||
]
|
||||
);
|
||||
|
||||
if ($data['mAgents'] !== null) {
|
||||
$all_modules = select_modules_for_agent_group(
|
||||
$all_modules = get_modules_agents(
|
||||
$data['mModuleGroup'],
|
||||
explode(',', $data['mAgents']),
|
||||
$data['mShowCommonModules'],
|
||||
false
|
||||
false,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$all_modules = [];
|
||||
}
|
||||
|
||||
if ($data['mShowSelectedOtherGroups']) {
|
||||
$selected_modules_ids = explode(',', $data['mModules']);
|
||||
|
||||
foreach ($selected_modules_ids as $id) {
|
||||
if (!array_key_exists($id, $all_modules)) {
|
||||
$module_data = modules_get_agentmodule($id);
|
||||
$all_modules[$id] = $module_data['nombre'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$output .= html_print_input(
|
||||
[
|
||||
'label' => __('Modules'),
|
||||
'type' => 'select',
|
||||
'fields' => $all_modules,
|
||||
'name' => 'filtered-module-modules-'.$uniqId,
|
||||
'selected' => explode(',', $data['mModules']),
|
||||
'selected' => explode((is_metaconsole() === true) ? SEPARATOR_META_MODULE : ',', $data['mModules']),
|
||||
'return' => true,
|
||||
'multiple' => true,
|
||||
'style' => 'min-width: 200px;max-width:200px;',
|
||||
@ -2430,6 +2425,38 @@ function html_print_div(
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an <pre> tag for show code.
|
||||
* For debug purposes, see for `hd()` function.
|
||||
*
|
||||
* @param string $content Content of tag.
|
||||
* @param boolean $return Return the tag string formed.
|
||||
* @param array $attributes Attributes availables for pre tags.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function html_print_code(
|
||||
string $content,
|
||||
bool $return=true,
|
||||
array $attributes=[]
|
||||
) {
|
||||
$output = '<pre';
|
||||
if (empty($attributes) === false) {
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
$output .= ' '.$attribute.'="'.io_safe_input_html($value).'"';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= sprintf('>%s</pre>', $content);
|
||||
|
||||
if ($return === true) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an anchor <a> html element.
|
||||
*
|
||||
@ -2783,7 +2810,7 @@ function html_print_input_number(array $settings):string
|
||||
global $config;
|
||||
$text_color = '';
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$text_color = 'style="color: white"';
|
||||
}
|
||||
|
||||
@ -4260,7 +4287,7 @@ function html_print_autocomplete_modules(
|
||||
|
||||
$text_color = '';
|
||||
$module_icon = 'images/search_module.png';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$text_color = 'color: white';
|
||||
$module_icon = 'images/brick.menu.png';
|
||||
}
|
||||
@ -4562,7 +4589,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
||||
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$style = 'style="color: white"';
|
||||
}
|
||||
|
||||
@ -5223,7 +5250,7 @@ function html_print_autocomplete_users_from_integria(
|
||||
global $config;
|
||||
|
||||
$user_icon = 'images/user_green.png';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$user_icon = 'images/header_user.png';
|
||||
}
|
||||
|
||||
@ -5330,7 +5357,7 @@ function html_print_tabs(array $tabs)
|
||||
|
||||
$bg_color = '';
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$bg_color = 'style="background-color: #222"';
|
||||
}
|
||||
|
||||
@ -5432,7 +5459,7 @@ function html_print_select_search(
|
||||
|
||||
$select2_css = 'select2.min';
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$select2_css = 'select2_dark.min';
|
||||
}
|
||||
|
||||
|
@ -158,35 +158,86 @@ function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($user_level_conf === null) {
|
||||
$user_level_conf = (bool) $config['integria_user_level_conf'];
|
||||
}
|
||||
if (is_metaconsole()) {
|
||||
$servers = metaconsole_get_connection_names();
|
||||
foreach ($servers as $key => $server) {
|
||||
$connection = metaconsole_get_connection($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user_info = users_get_user_by_id($config['id_user']);
|
||||
$integria_enabled = db_get_sql(
|
||||
'SELECT `value` FROM tconfig WHERE `token` = "integria_enabled"'
|
||||
);
|
||||
|
||||
// API access data.
|
||||
if ($api_hostname === null) {
|
||||
$api_hostname = $config['integria_hostname'];
|
||||
}
|
||||
if (!$integria_enabled) {
|
||||
metaconsole_restore_db();
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($api_pass === null) {
|
||||
$api_pass = $config['integria_api_pass'];
|
||||
}
|
||||
// integria_user_level_conf, integria_hostname, integria_api_pass, integria_user, integria_user_level_user, integria_pass, integria_user_level_pass
|
||||
$config_aux = db_get_all_rows_sql('SELECT `token`, `value` FROM `tconfig` WHERE `token` IN ("integria_user_level_conf", "integria_hostname", "integria_api_pass", "integria_user", "integria_user_level_user", "integria_pass", "integria_user_level_pass")');
|
||||
$user_info = users_get_user_by_id($config['id_user']);
|
||||
foreach ($config_aux as $key => $conf) {
|
||||
if ($conf['token'] === 'integria_user_level_conf') {
|
||||
$user_level_conf = $conf['value'];
|
||||
}
|
||||
|
||||
// Integria user and password.
|
||||
if ($user === null || $user_level_conf === true) {
|
||||
$user = $config['integria_user'];
|
||||
if ($conf['token'] === 'integria_hostname') {
|
||||
$api_hostname = $conf['value'];
|
||||
}
|
||||
|
||||
if ($user_level_conf === true) {
|
||||
$user = $user_info['integria_user_level_user'];
|
||||
if ($conf['token'] === 'integria_api_pass') {
|
||||
$api_pass = $conf['value'];
|
||||
}
|
||||
|
||||
if ($conf['token'] === 'integria_user') {
|
||||
$user = $conf['value'];
|
||||
}
|
||||
|
||||
if ($conf['token'] === 'integria_pass') {
|
||||
$user_pass = $conf['value'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_level_conf == true) {
|
||||
$user = $user_info['integria_user_level_user'];
|
||||
$user_pass = $user_info['integria_user_level_pass'];
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
if ($user_level_conf === null) {
|
||||
$user_level_conf = (bool) $config['integria_user_level_conf'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_pass === null || $user_level_conf === true) {
|
||||
$user_pass = $config['integria_pass'];
|
||||
$user_info = users_get_user_by_id($config['id_user']);
|
||||
|
||||
if ($user_level_conf === true) {
|
||||
$user_pass = $user_info['integria_user_level_pass'];
|
||||
// API access data.
|
||||
if ($api_hostname === null) {
|
||||
$api_hostname = $config['integria_hostname'];
|
||||
}
|
||||
|
||||
if ($api_pass === null) {
|
||||
$api_pass = $config['integria_api_pass'];
|
||||
}
|
||||
|
||||
// Integria user and password.
|
||||
if ($user === null || $user_level_conf === true) {
|
||||
$user = $config['integria_user'];
|
||||
|
||||
if ($user_level_conf === true) {
|
||||
$user = $user_info['integria_user_level_user'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_pass === null || $user_level_conf === true) {
|
||||
$user_pass = $config['integria_pass'];
|
||||
|
||||
if ($user_level_conf === true) {
|
||||
$user_pass = $user_info['integria_user_level_pass'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,11 +545,12 @@ function io_input_password($password)
|
||||
* Process the given password read from the Pandora FMS Database,
|
||||
* decrypting it if necessary.
|
||||
*
|
||||
* @param string password Password read from the DB.
|
||||
* @param string $password Password read from the DB.
|
||||
* @param string $wrappedBy Wrap the password with the informed character.
|
||||
*
|
||||
* @return string The processed password.
|
||||
*/
|
||||
function io_output_password($password)
|
||||
function io_output_password($password, $wrappedBy='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
@ -562,11 +563,14 @@ function io_output_password($password)
|
||||
]
|
||||
);
|
||||
|
||||
if ($plaintext === ENTERPRISE_NOT_HOOK) {
|
||||
return io_safe_output($password);
|
||||
}
|
||||
$output = ($plaintext === ENTERPRISE_NOT_HOOK) ? $password : $plaintext;
|
||||
|
||||
return io_safe_output($plaintext);
|
||||
return sprintf(
|
||||
'%s%s%s',
|
||||
$wrappedBy,
|
||||
io_safe_output($output),
|
||||
$wrappedBy
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,7 +189,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
|
||||
[
|
||||
'nombre' => $module['nombre'],
|
||||
'disabled' => false,
|
||||
]
|
||||
],
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
// The module already exist in the target
|
||||
@ -203,7 +207,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
|
||||
[
|
||||
'nombre' => $module['nombre'],
|
||||
'disabled' => true,
|
||||
]
|
||||
],
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
// If the module exist but disabled, we enable it
|
||||
@ -3231,9 +3239,10 @@ function modules_get_first_date($id_agent_module, $datelimit=0)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// check datatype string or normal
|
||||
// Check datatype string or normal.
|
||||
$table = 'tagente_datos';
|
||||
$module_type_str = modules_get_agentmodule_type($id_agent_module);
|
||||
$module_type = modules_get_agentmodule_type($id_agent_module);
|
||||
$module_type_str = modules_get_type_name($module_type);
|
||||
if (strstr($module_type_str, 'string') !== false) {
|
||||
$table = 'tagente_datos_string';
|
||||
}
|
||||
@ -3555,7 +3564,7 @@ function modules_get_agentmodule_mininterval_no_async($id_agent)
|
||||
}
|
||||
|
||||
|
||||
function get_modules_agents($id_module_group, $id_agents, $selection, $select_mode=true)
|
||||
function get_modules_agents($id_module_group, $id_agents, $selection, $select_mode=true, $useName=false)
|
||||
{
|
||||
if ((bool) is_metaconsole() === true) {
|
||||
if ($select_mode === true) {
|
||||
@ -3675,8 +3684,14 @@ function get_modules_agents($id_module_group, $id_agents, $selection, $select_mo
|
||||
|
||||
$modules = array_reduce(
|
||||
$modules,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre'];
|
||||
function ($carry, $item) use ($useName) {
|
||||
// Only works in select mode.
|
||||
if ($useName === true) {
|
||||
$carry[io_safe_input($item['nombre'])] = $item['nombre'];
|
||||
} else {
|
||||
$carry[$item['id_node'].'|'.$item['id_agente_modulo']] = $item['nombre'];
|
||||
}
|
||||
|
||||
return $carry;
|
||||
},
|
||||
[]
|
||||
|
@ -8775,6 +8775,8 @@ function reporting_increment($report, $content)
|
||||
|
||||
$return['data'] = [];
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($return['from']);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
|
||||
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC';
|
||||
@ -8801,17 +8803,23 @@ function reporting_increment($report, $content)
|
||||
$connection = false;
|
||||
}
|
||||
|
||||
$old_data = db_get_value_sql($sql1);
|
||||
$old_data = db_get_value_sql($sql1, false, $search_in_history_db);
|
||||
|
||||
$last_data = db_get_value_sql($sql2);
|
||||
$last_data = db_get_value_sql($sql2, false, $search_in_history_db);
|
||||
}
|
||||
} else {
|
||||
$old_data = db_get_value_sql(
|
||||
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.'
|
||||
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC'
|
||||
AND utimestamp <= '.(time() - $period).' ORDER BY utimestamp DESC',
|
||||
false,
|
||||
$search_in_history_db
|
||||
);
|
||||
|
||||
$last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC');
|
||||
$last_data = db_get_value_sql(
|
||||
'SELECT datos FROM tagente_datos WHERE id_agente_modulo = '.$id_agent_module.' ORDER BY utimestamp DESC',
|
||||
false,
|
||||
$search_in_history_db
|
||||
);
|
||||
}
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
@ -9374,7 +9382,7 @@ function reporting_custom_graph(
|
||||
$modules = [];
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key]['module'] = $value['id_agent_module'];
|
||||
$modules[$key]['server'] = $value['id_server'];
|
||||
$modules[$key]['id_server'] = $value['id_server'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9817,19 +9825,21 @@ function reporting_set_conf_charts(
|
||||
$content,
|
||||
&$ttl
|
||||
) {
|
||||
global $config;
|
||||
|
||||
switch ($type) {
|
||||
case 'dinamic':
|
||||
default:
|
||||
$only_image = false;
|
||||
$width = 900;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : 230;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : $config['graph_image_height'];
|
||||
$ttl = 1;
|
||||
break;
|
||||
|
||||
case 'static':
|
||||
$ttl = 2;
|
||||
$only_image = true;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : 230;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : $config['graph_image_height'];
|
||||
$width = 650;
|
||||
break;
|
||||
|
||||
@ -14155,7 +14165,7 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
|
||||
if (modules_is_disable_agent($content['id_agent_module'])
|
||||
|| modules_is_not_init($content['id_agent_module'])
|
||||
) {
|
||||
if ($metaconsole_on) {
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
// Restore db connection.
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
@ -14179,6 +14189,9 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
|
||||
if ($modules_is_string === false) {
|
||||
if ($agentmodule_info['max_critical'] == 0) {
|
||||
$max_value_critical = null;
|
||||
if ((bool) $content['dinamic_proc'] === true) {
|
||||
$max_value_critical = 0.01;
|
||||
}
|
||||
} else {
|
||||
$max_value_critical = $agentmodule_info['max_critical'];
|
||||
}
|
||||
@ -14386,28 +14399,37 @@ function reporting_module_histogram_graph($report, $content, $pdf=0)
|
||||
|
||||
$width_graph = 100;
|
||||
$height_graph = 80;
|
||||
$return['chart'] = flot_slicesbar_graph(
|
||||
$array_result,
|
||||
$time_total,
|
||||
$width_graph,
|
||||
$height_graph,
|
||||
$legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$homeurl,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
[],
|
||||
true,
|
||||
$ttl,
|
||||
$content['sizeForTicks'],
|
||||
true
|
||||
);
|
||||
if (empty($array_result) === false) {
|
||||
$return['chart'] = flot_slicesbar_graph(
|
||||
$array_result,
|
||||
$time_total,
|
||||
$width_graph,
|
||||
$height_graph,
|
||||
$legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$homeurl,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
[],
|
||||
true,
|
||||
$ttl,
|
||||
$content['sizeForTicks'],
|
||||
true,
|
||||
$report['datetime']
|
||||
);
|
||||
} else {
|
||||
$return['chart'] = graph_nodata_image(
|
||||
$width_graph,
|
||||
$height_graph,
|
||||
'area'
|
||||
);
|
||||
}
|
||||
|
||||
if ($metaconsole_on) {
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
// Restore db connection.
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ function html_do_report_info($report)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$background_color = '#222';
|
||||
} else {
|
||||
$background_color = '#f5f5f5';
|
||||
@ -5346,7 +5346,7 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1
|
||||
|
||||
$agent_data = [];
|
||||
$agent_data[0] = html_print_image('images/agent_notinit.png', true, ['title' => __('Agents not init')]);
|
||||
$agent_data[1] = "<a style='color: ".COL_NOTINIT.";' href='".$links['agents_not_init']."'><b><span class='blue_color_ligther font_12pt bolder big_data'>".format_numeric($data['agent_not_init']).'</span></b></a>';
|
||||
$agent_data[1] = "<a style='color: ".COL_NOTINIT.";' href='".$links['agents_not_init']."'><b><span class='blue_color font_12pt bolder big_data'>".format_numeric($data['agent_not_init']).'</span></b></a>';
|
||||
|
||||
$agent_data[2] = '';
|
||||
$agent_data[3] = '';
|
||||
|
@ -1347,7 +1347,16 @@ function servers_get_server_string_name(int $server)
|
||||
return __('WUX server');
|
||||
|
||||
case SERVER_TYPE_ENTERPRISE_SATELLITE:
|
||||
return __('Satellite');
|
||||
return __('Satellite server');
|
||||
|
||||
case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL:
|
||||
return __('Transactional server');
|
||||
|
||||
case SERVER_TYPE_ALERT:
|
||||
return __('Alert server');
|
||||
|
||||
case SERVER_TYPE_NCM:
|
||||
return __('NCM server');
|
||||
|
||||
default:
|
||||
return __('N/A');
|
||||
|
@ -1627,31 +1627,31 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
|
||||
switch ($agent_status) {
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
if ($total > 0 && $critical = 0 && $warning > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_NORMAL:
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1662,23 +1662,23 @@ function tags_get_agents_counter($id_tag, $groups_and_tags=[], $agent_filter=[],
|
||||
} else {
|
||||
if (array_search(AGENT_STATUS_CRITICAL, $agent_status) !== false) {
|
||||
if ($critical > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_WARNING, $agent_status) !== false) {
|
||||
if ($total > 0 && $critical = 0 && $warning > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_UNKNOWN, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NOT_INIT, $agent_status) !== false) {
|
||||
if ($total == 0 || $total == $not_init) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
} else if (array_search(AGENT_STATUS_NORMAL, $agent_status) !== false) {
|
||||
if ($critical == 0 && $warning == 0 && $unknown == 0 && $normal > 0) {
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
// Invalid status.
|
||||
|
@ -1203,7 +1203,7 @@ function ui_format_alert_row(
|
||||
|
||||
$actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']);
|
||||
|
||||
if (empty($actions) === false) {
|
||||
if (empty($actions) === false || $actionDefault != '') {
|
||||
$actionText = '<div><ul class="action_list">';
|
||||
foreach ($actions as $action) {
|
||||
$actionText .= '<div class="mrgn_btn_5px" ><span class="action_name"><li>'.$action['name'];
|
||||
@ -1215,9 +1215,9 @@ function ui_format_alert_row(
|
||||
}
|
||||
|
||||
$actionText .= '</ul></div>';
|
||||
} else {
|
||||
|
||||
if ($actionDefault != '') {
|
||||
$actionText = db_get_sql(
|
||||
$actionText .= db_get_sql(
|
||||
sprintf(
|
||||
'SELECT name FROM talert_actions WHERE id = %d',
|
||||
$actionDefault
|
||||
@ -4964,7 +4964,7 @@ function ui_print_agent_autocomplete_input($parameters)
|
||||
// Default value.
|
||||
$icon_agent = 'images/search_agent.png';
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$text_color = 'style="color: white"';
|
||||
$icon_agent = 'images/agent_mc.menu.png';
|
||||
}
|
||||
@ -5820,7 +5820,7 @@ function ui_print_agent_autocomplete_input($parameters)
|
||||
$html = '';
|
||||
|
||||
$text_color = '';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$text_color = 'color: white';
|
||||
}
|
||||
|
||||
|
@ -2850,9 +2850,6 @@ function get_donut_module_data($id_module)
|
||||
foreach ($values as $val) {
|
||||
if ($index < $max_elements) {
|
||||
$data = explode(',', $val);
|
||||
if ($data[1] == 0) {
|
||||
$data[1] = __('No data');
|
||||
}
|
||||
|
||||
if ($no_data_to_show) {
|
||||
$values_to_return[$index]['tag_name'] = $data[0];
|
||||
@ -2865,10 +2862,6 @@ function get_donut_module_data($id_module)
|
||||
$total += (int) $data[1];
|
||||
$index++;
|
||||
} else {
|
||||
if ($data[1] == 0) {
|
||||
$data[1] = __('No data');
|
||||
}
|
||||
|
||||
$data = explode(',', $val);
|
||||
$values_to_return[$index]['tag_name'] = __('Others').': '.$data[1];
|
||||
$values_to_return[$index]['color'] = $colors[$index];
|
||||
@ -2881,6 +2874,7 @@ function get_donut_module_data($id_module)
|
||||
$values_to_return[$ind]['percent'] = (($donut_data['value'] * 100) / $total);
|
||||
}
|
||||
|
||||
// sort array
|
||||
$new_values_to_return = [];
|
||||
while (!empty($values_to_return)) {
|
||||
$first = true;
|
||||
@ -3426,7 +3420,7 @@ function visual_map_get_status_element($layoutData)
|
||||
break;
|
||||
|
||||
case GROUP_ITEM:
|
||||
$group_status = groups_get_status($layoutData['id_group']);
|
||||
$group_status = groups_get_status($layoutData['id_group'], true);
|
||||
|
||||
switch ($group_status) {
|
||||
case AGENT_STATUS_ALERT_FIRED:
|
||||
|
@ -220,7 +220,7 @@ function vbar_graph(
|
||||
$options['x']['font']['color'] = '#545454';
|
||||
if ($options['pdf'] === true) {
|
||||
$options['x']['font']['color'] = '#000';
|
||||
} else if ($config['style'] === 'pandora_black') {
|
||||
} else if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$options['x']['font']['color'] = '#fff';
|
||||
}
|
||||
}
|
||||
@ -238,7 +238,7 @@ function vbar_graph(
|
||||
// Grid color axes x.
|
||||
if (isset($options['x']['color']) === false) {
|
||||
$options['x']['color'] = '#ffffff';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$options['x']['color'] = '#222';
|
||||
}
|
||||
}
|
||||
@ -305,7 +305,7 @@ function vbar_graph(
|
||||
$options['y']['font']['color'] = '#545454';
|
||||
if ($options['pdf'] === true) {
|
||||
$options['y']['font']['color'] = '#000';
|
||||
} else if ($config['style'] === 'pandora_black') {
|
||||
} else if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$options['y']['font']['color'] = '#fff';
|
||||
}
|
||||
}
|
||||
@ -323,7 +323,7 @@ function vbar_graph(
|
||||
// Grid color axes y.
|
||||
if (isset($options['y']['color']) === false) {
|
||||
$options['y']['color'] = '#ffffff';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$options['y']['color'] = '#222';
|
||||
}
|
||||
}
|
||||
@ -361,7 +361,7 @@ function vbar_graph(
|
||||
|
||||
if (isset($options['grid']['color']) === false) {
|
||||
$options['grid']['color'] = '#ffffff';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$options['grid']['color'] = '#111';
|
||||
}
|
||||
}
|
||||
@ -373,7 +373,7 @@ function vbar_graph(
|
||||
'#ffffff',
|
||||
],
|
||||
];
|
||||
if ($config['style'] === 'pandora_black' && $ttl === 1) {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
|
||||
$options['grid']['backgroundColor'] = [
|
||||
'colors' => [
|
||||
'#222',
|
||||
@ -746,11 +746,11 @@ function hbar_graph(
|
||||
return generator_chart_to_pdf('hbar', $params);
|
||||
}
|
||||
|
||||
if ($config['style'] === 'pandora_black' && $ttl === 1) {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
|
||||
$backgroundColor = '#222';
|
||||
}
|
||||
|
||||
if ($config['style'] === 'pandora_black' && $ttl === 1) {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole() && $ttl === 1) {
|
||||
$tick_color = '#fff';
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ function pandoraFlotHBars(
|
||||
"#e63c52",
|
||||
"#FFA631",
|
||||
"#f3b200",
|
||||
"#5BB6E5",
|
||||
"#4a83f3",
|
||||
"#F2919D",
|
||||
"#82b92e"
|
||||
];
|
||||
@ -437,25 +437,23 @@ function pandoraFlotHBars(
|
||||
var format = new Array();
|
||||
for (var i = 0; i < labels_total.length; i++) {
|
||||
var label = labels_total[i][1];
|
||||
// var shortLabel = reduceText(label, 25);
|
||||
var title = label;
|
||||
if (label.length > 30) {
|
||||
label = reduceText(label, 30);
|
||||
}
|
||||
var div_attributes =
|
||||
'style="font-size:' +
|
||||
font_size +
|
||||
"pt !important;" +
|
||||
" margin: 0; max-width: 150px;" +
|
||||
"margin-right:5px";
|
||||
+"margin-left: -1.5em";
|
||||
+"text-align: right";
|
||||
"margin: 0; max-width: 200px;" +
|
||||
"margin-right:5px;" +
|
||||
"margin-left: -1.5em" +
|
||||
"text-align: right" +
|
||||
"text-overflow: ellipsis;" +
|
||||
"overflow: hidden;" +
|
||||
"white-space: pre;";
|
||||
|
||||
if (label.indexOf("<br>") != -1) {
|
||||
div_attributes += "min-height: 2.5em;";
|
||||
}
|
||||
|
||||
div_attributes += '" title="' + title + '" style="overflow: hidden;"';
|
||||
div_attributes += '" title="' + label + '" style="overflow: hidden;"';
|
||||
|
||||
format.push([i, "<div " + div_attributes + ">" + label + "</div>"]);
|
||||
}
|
||||
@ -3270,5 +3268,6 @@ function reduceText(text, maxLength) {
|
||||
if (text.length <= maxLength) return text;
|
||||
var firstSlideEnd = parseInt((maxLength - 3) / 1.6);
|
||||
var str_cut = text.substr(0, firstSlideEnd);
|
||||
return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3);
|
||||
//return str_cut + "...<br>" + text.substr(-firstSlideEnd - 3);
|
||||
return str_cut + "..." + text.substr(-firstSlideEnd - 3);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ function d3_bullet_chart(
|
||||
$font = array_shift(explode('.', array_pop(explode('/', $font))));
|
||||
|
||||
$invert_color = '';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$invert_color = 'filter: invert(100%);';
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ function flot_area_graph(
|
||||
break;
|
||||
}
|
||||
|
||||
if ($config['style'] === 'pandora_black' && ($params['pdf'] === false || $params['pdf'] === null) && (isset($is_mobile) === false || $is_mobile === false)
|
||||
if (($config['style'] === 'pandora_black' && !is_metaconsole()) && ($params['pdf'] === false || $params['pdf'] === null) && (isset($is_mobile) === false || $is_mobile === false)
|
||||
) {
|
||||
$background_style = '#222';
|
||||
$params['grid_color'] = '#fff';
|
||||
@ -553,11 +553,6 @@ function flot_hcolumn_chart($graph_data, $width, $height, $water_mark, $font='',
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($pdf === true) {
|
||||
$background_color = 'white';
|
||||
$tick_color = '#000';
|
||||
}
|
||||
|
||||
// Include_javascript_dependencies_flot_graph().
|
||||
$return = '';
|
||||
|
||||
|
@ -683,10 +683,10 @@ function update_link(row_index, id_link) {
|
||||
temp_link["text_end"] = data["text_end"];
|
||||
|
||||
$.each(graph.nodes, function(k, node) {
|
||||
if (node["id_agent"] == data["id_db_target"]) {
|
||||
if (node["id_db"] == data["id_db_target"]) {
|
||||
temp_link["target"] = graph.nodes[k];
|
||||
}
|
||||
if (node["id_agent"] == data["id_db_source"]) {
|
||||
if (node["id_db"] == data["id_db_source"]) {
|
||||
temp_link["source"] = graph.nodes[k];
|
||||
}
|
||||
});
|
||||
@ -703,9 +703,21 @@ function update_link(row_index, id_link) {
|
||||
.append("g")
|
||||
.attr("id", "layer_graph_nodes_" + networkmap_id);
|
||||
|
||||
var graph_links_aux = graph.links.filter(function(d, i) {
|
||||
if (typeof d["source"] === "undefined") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof d["target"] === "undefined") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return d;
|
||||
});
|
||||
|
||||
force
|
||||
.nodes(graph.nodes)
|
||||
.links(graph.links)
|
||||
.links(graph_links_aux)
|
||||
.start();
|
||||
|
||||
window.node = layer_graph_nodes.selectAll(".node");
|
||||
@ -2353,9 +2365,21 @@ function refresh_holding_area() {
|
||||
.append("g")
|
||||
.attr("id", "layer_graph_nodes_" + networkmap_id);
|
||||
|
||||
var graph_links_aux = graph.links.filter(function(d, i) {
|
||||
if (typeof d["source"] === "undefined") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof d["target"] === "undefined") {
|
||||
return false;
|
||||
}
|
||||
|
||||
return d;
|
||||
});
|
||||
|
||||
force
|
||||
.nodes(graph.nodes)
|
||||
.links(graph.links)
|
||||
.links(graph_links_aux)
|
||||
.start();
|
||||
|
||||
window.node = layer_graph_nodes.selectAll(".node");
|
||||
|
@ -211,7 +211,7 @@ function fmAgentChange(uniqId) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function fmModuleChange(uniqId) {
|
||||
function fmModuleChange(uniqId, isMeta) {
|
||||
var idModuleGroup = $("#filtered-module-module-group-" + uniqId).val();
|
||||
var idAgents = $("#filtered-module-agents-" + uniqId).val();
|
||||
var showCommonModules = $(
|
||||
@ -230,14 +230,20 @@ function fmModuleChange(uniqId) {
|
||||
$("#filtered-module-modules-" + uniqId).html("");
|
||||
if (data) {
|
||||
jQuery.each(data, function(id, value) {
|
||||
var option = $("<option></option>")
|
||||
.attr(
|
||||
"value",
|
||||
value["id_node"]
|
||||
? value["id_node"] + "|" + value["id_agente_modulo"]
|
||||
: value["id_agente_modulo"]
|
||||
)
|
||||
.html(value["nombre"]);
|
||||
var option = $("<option></option>");
|
||||
if (isMeta === true) {
|
||||
option
|
||||
.attr(
|
||||
"value",
|
||||
value["id_node"]
|
||||
? value["id_node"] + "|" + value["id_agente_modulo"]
|
||||
: value["id_agente_modulo"]
|
||||
)
|
||||
.html(value["nombre"]);
|
||||
} else {
|
||||
option.attr("value", value).html(value);
|
||||
}
|
||||
|
||||
$("#filtered-module-modules-" + uniqId).append(option);
|
||||
});
|
||||
}
|
||||
|
@ -388,8 +388,8 @@ function initialiceLayout(data) {
|
||||
dashboardId: data.dashboardId,
|
||||
widgetId: widgetId
|
||||
},
|
||||
width: widgetId == 14 || widgetId == 2 ? 750 : 450,
|
||||
maxHeight: 600,
|
||||
width: widgetId == 14 || widgetId == 2 || widgetId == 23 ? 750 : 450,
|
||||
maxHeight: 610,
|
||||
minHeight: 400
|
||||
},
|
||||
onsubmit: {
|
||||
|
@ -942,7 +942,9 @@ function add_macro_field(macro, row_model_id, type_copy, k) {
|
||||
.children()
|
||||
.eq(1)
|
||||
.children()
|
||||
.attr("type", "password");
|
||||
.attr("type", "password")
|
||||
.removeAttr("value")
|
||||
.val(macro_value);
|
||||
} else {
|
||||
$("#" + row_id)
|
||||
.children()
|
||||
@ -955,7 +957,9 @@ function add_macro_field(macro, row_model_id, type_copy, k) {
|
||||
$("#" + row_id)
|
||||
.children()
|
||||
.eq(1)
|
||||
.attr("type", "password");
|
||||
.attr("type", "password")
|
||||
.removeAttr("value")
|
||||
.val(macro_value);
|
||||
} else {
|
||||
$("#" + row_id)
|
||||
.children()
|
||||
|
@ -976,6 +976,11 @@ var TreeController = {
|
||||
"</span>"
|
||||
);
|
||||
|
||||
// Avoiding 'undefined' text.
|
||||
if (typeof element.value === "undefined") {
|
||||
element.value = "";
|
||||
}
|
||||
|
||||
// Value.
|
||||
$content.append(
|
||||
'<span class="module-value">' + element.value + "</span>"
|
||||
@ -985,6 +990,35 @@ var TreeController = {
|
||||
typeof element.showGraphs != "undefined" &&
|
||||
element.showGraphs != 0
|
||||
) {
|
||||
// Graph histogram pop-up
|
||||
if (typeof element.histogramGraph != "undefined") {
|
||||
var graphImageHistogram = $(
|
||||
'<img src="' +
|
||||
(controller.baseURL.length > 0
|
||||
? controller.baseURL
|
||||
: "") +
|
||||
'images/histograma.png" /> '
|
||||
);
|
||||
|
||||
graphImageHistogram
|
||||
.addClass("module-graph")
|
||||
.click(function(e) {
|
||||
e.stopPropagation();
|
||||
try {
|
||||
winopeng_var(
|
||||
element.histogramGraph.url,
|
||||
element.histogramGraph.handle,
|
||||
800,
|
||||
480
|
||||
);
|
||||
} catch (error) {
|
||||
// console.log(error);
|
||||
}
|
||||
});
|
||||
|
||||
$content.append(graphImageHistogram);
|
||||
}
|
||||
|
||||
// Graph pop-up
|
||||
if (typeof element.moduleGraph != "undefined") {
|
||||
if (element.statusImageHTML.indexOf("data:image") != -1) {
|
||||
@ -1178,24 +1212,26 @@ var TreeController = {
|
||||
disabled == false
|
||||
) {
|
||||
if (element.type == "agent" || element.type == "module") {
|
||||
$content
|
||||
.click(function(e) {
|
||||
_getTreeDetailData(
|
||||
element.type,
|
||||
element.id,
|
||||
element.serverID,
|
||||
function(error, data) {
|
||||
if (error) {
|
||||
// console.error(error);
|
||||
} else {
|
||||
controller.detailRecipient
|
||||
.render(element.name, data)
|
||||
.open();
|
||||
if (typeof element.noAcl === "undefined") {
|
||||
$content
|
||||
.click(function(e) {
|
||||
_getTreeDetailData(
|
||||
element.type,
|
||||
element.id,
|
||||
element.serverID,
|
||||
function(error, data) {
|
||||
if (error) {
|
||||
// console.error(error);
|
||||
} else {
|
||||
controller.detailRecipient
|
||||
.render(element.name, data)
|
||||
.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
})
|
||||
.css("cursor", "pointer");
|
||||
);
|
||||
})
|
||||
.css("cursor", "pointer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ class Widget
|
||||
if (empty($values['background']) === true) {
|
||||
$values['background'] = '#ffffff';
|
||||
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$values['background'] = '#222222';
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ use PandoraFMS\Module;
|
||||
*/
|
||||
class AgentModuleWidget extends Widget
|
||||
{
|
||||
const MODULE_SEPARATOR = '|-|-|-|';
|
||||
|
||||
/**
|
||||
* Name widget.
|
||||
@ -309,16 +308,12 @@ class AgentModuleWidget extends Widget
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$values['mModules'] = implode(
|
||||
self::MODULE_SEPARATOR,
|
||||
SEPARATOR_META_MODULE,
|
||||
array_reduce(
|
||||
$values['mModules'],
|
||||
function ($carry, $item) {
|
||||
$d = explode('|', $item);
|
||||
if (isset($d[1]) === true) {
|
||||
$carry[] = \io_safe_output($d[1]);
|
||||
} else {
|
||||
$carry[] = \io_safe_output($item);
|
||||
}
|
||||
$carry[] = (isset($d[1]) === true) ? $d[1] : $item;
|
||||
|
||||
return $carry;
|
||||
},
|
||||
@ -639,7 +634,7 @@ class AgentModuleWidget extends Widget
|
||||
$target_modules = $this->values['mModules'];
|
||||
if (is_metaconsole() === true) {
|
||||
$target_modules = explode(
|
||||
self::MODULE_SEPARATOR,
|
||||
SEPARATOR_META_MODULE,
|
||||
$this->values['mModules']
|
||||
);
|
||||
|
||||
@ -648,8 +643,17 @@ class AgentModuleWidget extends Widget
|
||||
if (is_array($target_modules) === true
|
||||
|| is_numeric($target_modules) === true
|
||||
) {
|
||||
$target_modules = array_reduce(
|
||||
$target_modules,
|
||||
function ($carry, $item) {
|
||||
$carry[] = io_safe_output($item);
|
||||
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
|
||||
$all_modules = Module::search(
|
||||
['id_agente_modulo' => $target_modules]
|
||||
['nombre' => $target_modules]
|
||||
);
|
||||
} else {
|
||||
// From previous definitions.
|
||||
@ -660,29 +664,28 @@ class AgentModuleWidget extends Widget
|
||||
}
|
||||
|
||||
if ($all_modules !== null) {
|
||||
$reduceAllModules = array_reduce(
|
||||
$all_modules,
|
||||
function ($carry, $item) {
|
||||
if ($item === null) {
|
||||
if (is_metaconsole() === true
|
||||
&& $this->values['mShowCommonModules'] === '1'
|
||||
) {
|
||||
$reduceAllModules = [];
|
||||
} else {
|
||||
$reduceAllModules = array_reduce(
|
||||
$all_modules,
|
||||
function ($carry, $item) {
|
||||
if ($item === null) {
|
||||
return $carry;
|
||||
}
|
||||
|
||||
if (is_object($item) === true) {
|
||||
$carry[$item->name()] = null;
|
||||
} else {
|
||||
$carry[io_safe_output($item)] = null;
|
||||
}
|
||||
|
||||
return $carry;
|
||||
}
|
||||
|
||||
if (is_object($item) === true) {
|
||||
$carry[$item->name()] = null;
|
||||
} else {
|
||||
if ((is_metaconsole() === true
|
||||
&& $this->values['mShowCommonModules'] !== '1')
|
||||
|| is_metaconsole() === false
|
||||
) {
|
||||
$carry[$item] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$reduceAllModules = [];
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$visualData = [];
|
||||
@ -709,14 +712,26 @@ class AgentModuleWidget extends Widget
|
||||
$visualData[$agent_id]['agent_status'] = $agent->lastStatus();
|
||||
$visualData[$agent_id]['agent_name'] = $agent->name();
|
||||
$visualData[$agent_id]['agent_alias'] = $agent->alias();
|
||||
$visualData[$agent_id]['modules'] = [];
|
||||
|
||||
if (is_metaconsole() === true
|
||||
&& $this->values['mShowCommonModules'] === '1'
|
||||
) {
|
||||
// MC should connect to nodes and retrieve information
|
||||
// from targets.
|
||||
$tmpModules = array_reduce(
|
||||
$target_modules,
|
||||
function ($carry, $item) {
|
||||
// In this case, the modules come with '» ' chain.
|
||||
$tmpCarry = explode('» ', $item);
|
||||
$carry[trim($tmpCarry[1])] = null;
|
||||
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
|
||||
$modules = $agent->searchModules(
|
||||
['id_agente_modulo' => $target_modules]
|
||||
['nombre' => array_keys($tmpModules)]
|
||||
);
|
||||
|
||||
foreach ($modules as $module) {
|
||||
|
@ -750,7 +750,7 @@ class EventsListWidget extends Widget
|
||||
$table->data[$i] = $data;
|
||||
|
||||
$bg_color = 'background: #E8E8E8;';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
$bg_color = 'background: #222;';
|
||||
}
|
||||
|
||||
|
@ -378,6 +378,8 @@ class GraphModuleHistogramWidget extends Widget
|
||||
|
||||
$size = parent::getSize();
|
||||
|
||||
$output = '';
|
||||
|
||||
// Desactive scroll bars only this item.
|
||||
$id_agent = $this->values['agentId'];
|
||||
$id_module = $this->values['moduleId'];
|
||||
|
@ -350,7 +350,7 @@ class GroupsStatusWidget extends Widget
|
||||
// Agent Not Init.
|
||||
$table->data[2][1] = $this->getCellCounter(
|
||||
$stats['agent_not_init'],
|
||||
'#5bb6e5'
|
||||
'#4a83f3'
|
||||
);
|
||||
|
||||
$data .= html_print_table($table, true);
|
||||
@ -424,7 +424,7 @@ class GroupsStatusWidget extends Widget
|
||||
// Modules Not Init.
|
||||
$table->data[2][1] = $this->getCellCounter(
|
||||
$stats['monitor_not_init'],
|
||||
'#5bb6e5'
|
||||
'#4a83f3'
|
||||
);
|
||||
|
||||
$data .= html_print_table($table, true);
|
||||
|
@ -323,11 +323,22 @@ class MapsStatusWidget extends Widget
|
||||
$data = [];
|
||||
|
||||
$url = $config['homeurl'];
|
||||
$url .= 'index.php?sec=visualc';
|
||||
$url .= '&sec2=operation/visual_console/render_view&refr=60';
|
||||
if (\is_metaconsole() === true) {
|
||||
$url .= sprintf(
|
||||
'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&refr=%s&id_visualmap=%s',
|
||||
$config['vc_refr'],
|
||||
$id_layout
|
||||
);
|
||||
} else {
|
||||
$url .= sprintf(
|
||||
'index.php?sec=visualc&sec2=operation/visual_console/render_view&refr=%s&id=%s',
|
||||
$config['vc_refr'],
|
||||
$id_layout
|
||||
);
|
||||
}
|
||||
|
||||
// This will give us the group name.
|
||||
$data[0] = '<a href="'.$url.'&id='.$id_layout.'">';
|
||||
$data[0] = '<a href="'.$url.'">';
|
||||
$data[0] .= $user_layouts[$id_layout]['name'];
|
||||
$data[0] .= '</a>';
|
||||
|
||||
|
@ -253,6 +253,14 @@ class NetworkMapWidget extends Widget
|
||||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
|
||||
$inputs[] = [
|
||||
'label' => \ui_print_info_message(
|
||||
__('It is recommended to have only one such widget in the control panel.'),
|
||||
'',
|
||||
true
|
||||
),
|
||||
];
|
||||
|
||||
// Default values.
|
||||
if (isset($values['xOffset']) === false) {
|
||||
$values['xOffset'] = 0;
|
||||
@ -317,7 +325,7 @@ class NetworkMapWidget extends Widget
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'name' => 'networkmapId',
|
||||
'selected' => $values['networkmapId'],
|
||||
'selected' => $selected,
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
@ -318,7 +318,7 @@ class ServiceViewWidget extends Widget
|
||||
|
||||
// Css Files.
|
||||
\ui_require_css_file('tree', 'include/styles/', true);
|
||||
if ($config['style'] == 'pandora_black') {
|
||||
if ($config['style'] == 'pandora_black' && !is_metaconsole()) {
|
||||
\ui_require_css_file('pandora_black', 'include/styles/', true);
|
||||
}
|
||||
|
||||
|
@ -455,6 +455,7 @@ class TopNWidget extends Widget
|
||||
|
||||
$data_hbar = [];
|
||||
foreach ($modules as $module) {
|
||||
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
|
||||
$item_name = '';
|
||||
$item_name = $module['aliasAgent'].' - '.$module['nameModule'];
|
||||
$data_hbar[$item_name]['g'] = $module[$display];
|
||||
|
@ -542,7 +542,7 @@ class TreeViewWidget extends Widget
|
||||
|
||||
// Css Files.
|
||||
\ui_require_css_file('tree', 'include/styles/', true);
|
||||
if ($config['style'] == 'pandora_black') {
|
||||
if ($config['style'] == 'pandora_black' && !is_metaconsole()) {
|
||||
\ui_require_css_file('pandora_black', 'include/styles/', true);
|
||||
}
|
||||
|
||||
|