Merge remote-tracking branch 'origin/develop' into ent-7861-fallo-umc-cuando-hay-db-historico
Conflicts: pandora_console/godmode/um_client/index.php
This commit is contained in:
commit
cf976f9622
|
@ -151,7 +151,7 @@ execute_cmd "yum install -y $extra_repos" "Installing extra repositories"
|
|||
execute_cmd "yum-config-manager --enable remi-php73" "Configuring PHP"
|
||||
|
||||
# Install percona Database
|
||||
[ -f /etc/resolv.conf ] && rm -rf /etc/my.cnf
|
||||
[ -f /etc/my.cnf ] && rm -rf /etc/my.cnf
|
||||
execute_cmd "yum install -y Percona-Server-server-57" "Installing Percona Server"
|
||||
|
||||
# Console dependencies
|
||||
|
@ -429,6 +429,7 @@ sed -i -e "s/^max_input_time.*/max_input_time = -1/g" /etc/php.ini
|
|||
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
|
||||
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
|
||||
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
|
||||
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
|
||||
|
||||
cat > /var/www/html/index.html << EOF_INDEX
|
||||
<meta HTTP-EQUIV="REFRESH" content="0; url=/pandora_console/">
|
||||
|
|
|
@ -149,6 +149,7 @@ EOF_INDEX
|
|||
sed -i -e "s/^max_execution_time.*/max_execution_time = 0/g" /etc/php.ini
|
||||
sed -i -e "s/^upload_max_filesize.*/upload_max_filesize = 800M/g" /etc/php.ini
|
||||
sed -i -e "s/^memory_limit.*/memory_limit = 800M/g" /etc/php.ini
|
||||
sed -i -e "s/.*post_max_size =.*/post_max_size = 800M/" /etc/php.ini
|
||||
|
||||
echo "- Setting Public URL: $PUBLICURL"
|
||||
q=$(mysql -u$DBUSER -p$DBPASS $DBNAME -h$DBHOST -sNe "select token from tconfig;" | grep public_url)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.756-210728
|
||||
Version: 7.0NG.756-210811
|
||||
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.756-210728"
|
||||
pandora_version="7.0NG.756-210811"
|
||||
|
||||
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.756';
|
||||
use constant AGENT_BUILD => '210728';
|
||||
use constant AGENT_BUILD => '210811';
|
||||
|
||||
# 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.756
|
||||
%define release 210728
|
||||
%define release 210811
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.756
|
||||
%define release 210728
|
||||
%define release 210811
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.756"
|
||||
PI_BUILD="210728"
|
||||
PI_BUILD="210811"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{210728}
|
||||
{210811}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.756 Build 210728")
|
||||
#define PANDORA_VERSION ("7.0NG.756 Build 210811")
|
||||
|
||||
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.756(Build 210728))"
|
||||
VALUE "ProductVersion", "(7.0NG.756(Build 210811))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.756-210728
|
||||
Version: 7.0NG.756-210811
|
||||
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.756-210728"
|
||||
pandora_version="7.0NG.756-210811"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -33,10 +33,19 @@ function users_extension_main_god($god=true)
|
|||
$image = 'images/user.png';
|
||||
}
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Users connected'), $image, false, '', $god);
|
||||
|
||||
// Get groups user has permission
|
||||
$check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up');
|
||||
if ($check_profile === false && !users_is_admin()) {
|
||||
return ui_print_error_message(
|
||||
__('This user does not have any associated profile'),
|
||||
'',
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
// Get groups user has permission.
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
// Is admin or has group permissions all.
|
||||
$groups = implode(',', array_keys($group_um, 1));
|
||||
|
@ -44,51 +53,85 @@ function users_extension_main_god($god=true)
|
|||
// Get user conected last 5 minutes.Show only those on which the user has permission.
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
'SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC'
|
||||
);
|
||||
} else {
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario.id_user, tusuario.last_connect
|
||||
FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user
|
||||
AND tusuario_perfil.id_grupo IN (%s)
|
||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.')
|
||||
GROUP BY tusuario.id_user
|
||||
ORDER BY last_connect DESC',
|
||||
$groups
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
$rows = db_get_all_rows_sql($sql);
|
||||
|
||||
if (empty($rows)) {
|
||||
$rows = [];
|
||||
echo "<div class='nf'>".__('No other users connected').'</div>';
|
||||
} else {
|
||||
$table = new StdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
|
@ -105,7 +148,7 @@ function users_extension_main_god($god=true)
|
|||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
// Get data
|
||||
// Get data.
|
||||
foreach ($rows as $row) {
|
||||
// Get data of user's last login.
|
||||
switch ($config['dbtype']) {
|
||||
|
@ -135,6 +178,10 @@ function users_extension_main_god($god=true)
|
|||
)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($rowPair) {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
START TRANSACTION;
|
||||
|
||||
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font';
|
||||
UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath';
|
||||
|
||||
COMMIT;
|
|
@ -1,35 +0,0 @@
|
|||
CREATE PROCEDURE updateSnmpAlerts()
|
||||
BEGIN
|
||||
DECLARE tokenId INT DEFAULT 0;
|
||||
DECLARE procedureRun INT DEFAULT 0;
|
||||
DECLARE done BOOLEAN DEFAULT FALSE;
|
||||
DECLARE a, b INT DEFAULT 0;
|
||||
DECLARE alertsCur CURSOR FOR SELECT id, id_alert_command FROM talert_actions;
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
|
||||
SELECT id_config, value INTO tokenId, procedureRun FROM tconfig WHERE token = 'update_snmp_alerts_procedure_already_run' LIMIT 1;
|
||||
|
||||
IF procedureRun < 1 THEN
|
||||
SET done = FALSE;
|
||||
|
||||
OPEN alertsCur;
|
||||
|
||||
read_loop: LOOP
|
||||
FETCH alertsCur INTO a, b;
|
||||
IF done THEN
|
||||
LEAVE read_loop;
|
||||
END IF;
|
||||
|
||||
UPDATE talert_snmp SET id_alert = b WHERE id_alert = a;
|
||||
UPDATE talert_snmp_action SET alert_type = b WHERE alert_type = a;
|
||||
END LOOP;
|
||||
|
||||
CLOSE alertsCur;
|
||||
|
||||
IF tokenId < 1 THEN
|
||||
INSERT INTO tconfig (id_config, token, value) VALUES ('', 'update_snmp_alerts_procedure_already_run', '1');
|
||||
ELSE
|
||||
UPDATE tconfig SET value = 1 WHERE token = 'update_snmp_alerts_procedure_already_run';
|
||||
END IF;
|
||||
END IF;
|
||||
END
|
|
@ -63,6 +63,7 @@ switch ($login_screen) {
|
|||
case 'error_perms':
|
||||
case 'homedir_bad_defined':
|
||||
case 'homeurl_bad_defined':
|
||||
case 'disabled_access_node':
|
||||
$logo_link = 'index.php';
|
||||
$logo_title = __('Go to Login');
|
||||
break;
|
||||
|
@ -208,6 +209,7 @@ if (is_metaconsole() === true) {
|
|||
switch ($login_screen) {
|
||||
case 'logout':
|
||||
case 'login':
|
||||
case 'disabled_access_node':
|
||||
if (!empty($page) && !empty($sec)) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
html_print_input_hidden(io_safe_input($key), io_safe_input($value));
|
||||
|
@ -508,9 +510,29 @@ if ($login_screen == 'logout') {
|
|||
echo '</div>';
|
||||
}
|
||||
|
||||
if ($login_screen === 'disabled_access_node') {
|
||||
echo '<div id="disabled_access_node" title="'.__('User node access not enabled').'">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
echo html_print_image('images/icono_logo_pandora.png', true, ['alt' => __('Centralized user in metaconsole'), 'border' => 0]);
|
||||
echo '</div>';
|
||||
echo '<div class="content_message_alert">';
|
||||
echo '<div class="text_message_alert">';
|
||||
echo '<h1>'.__('Centralized user in metaconsole').'</h1>';
|
||||
echo '<p>'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'</p>';
|
||||
echo '</div>';
|
||||
echo '<div class="button_message_alert">';
|
||||
html_print_submit_button('Ok', 'hide-login-logout', false);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
switch ($login_screen) {
|
||||
case 'error_dbconfig':
|
||||
case 'error_authconfig':
|
||||
case 'disabled_node_access':
|
||||
if (!isset($config['rb_product_name_alt'])) {
|
||||
$title = __('Problem with %s database', get_product_name());
|
||||
} else {
|
||||
|
@ -694,6 +716,29 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', '
|
|||
});
|
||||
break;
|
||||
|
||||
case 'disabled_access_node':
|
||||
$(document).ready (function () {
|
||||
$(function() {
|
||||
$("#disabled_access_node").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
width: 528,
|
||||
clickOutside: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-hide-login-logout").click (function () {
|
||||
document.location = "<?php echo ui_get_full_url('index.php'); ?>";
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
$(document).ready (function () {
|
||||
// IE9- modal warning window
|
||||
|
|
|
@ -349,7 +349,14 @@ if (isset($groups[$grupo]) || $new_agent) {
|
|||
}
|
||||
|
||||
$table_primary_group .= '<div class="label_select_child_icons"><span id="group_preview">';
|
||||
$table_primary_group .= ui_print_group_icon($grupo, true);
|
||||
if ($id_agente === 0) {
|
||||
$hidden = 'display: none;';
|
||||
} else {
|
||||
$hidden = '';
|
||||
}
|
||||
|
||||
$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden);
|
||||
|
||||
$table_primary_group .= '</span></div></div></div>';
|
||||
|
||||
$table_interval = '<div class="label_select"><p class="input_label">'.__('Interval').'</p>';
|
||||
|
@ -500,7 +507,10 @@ if (enterprise_installed()) {
|
|||
false,
|
||||
// Delete_groups.
|
||||
// Do not show the primary group in this selection.
|
||||
array_merge(($secondary_groups_selected['plain'] ?? []), [$agent['id_grupo']])
|
||||
array_merge(
|
||||
(empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [],
|
||||
[$agent['id_grupo']]
|
||||
)
|
||||
// Include_groups.
|
||||
// Size.
|
||||
// Simple_multiple_options.
|
||||
|
@ -1243,6 +1253,9 @@ ui_require_jquery_file('bgiframe');
|
|||
});
|
||||
|
||||
$("select#id_os").pandoraSelectOS ();
|
||||
$('select#grupo').pandoraSelectGroupIcon ();
|
||||
|
||||
|
||||
|
||||
var checked = $("#checkbox-cascade_protection").is(":checked");
|
||||
if (checked) {
|
||||
|
|
|
@ -2368,7 +2368,7 @@ switch ($tab) {
|
|||
|
||||
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter('id_agent_module'))); ?>';
|
||||
|
||||
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() &&
|
||||
if('<?php echo 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();
|
||||
|
@ -2402,7 +2402,7 @@ switch ($tab) {
|
|||
|
||||
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter('id_agent_module')); ?>';
|
||||
|
||||
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter('id_agent_module'))); ?>' != $('#text-name').val() && (
|
||||
if('<?php echo 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();
|
||||
|
|
|
@ -215,7 +215,7 @@ $table_simple->colspan[3][1] = 3;
|
|||
$table_simple->data[0][0] = __('Name');
|
||||
$table_simple->data[0][1] = html_print_input_text_extended(
|
||||
'name',
|
||||
io_safe_input(html_entity_decode($name, ENT_QUOTES, 'UTF-8')),
|
||||
$name,
|
||||
'text-name',
|
||||
'',
|
||||
45,
|
||||
|
|
|
@ -708,7 +708,7 @@ foreach ($simple_alerts as $alert) {
|
|||
|
||||
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible left">';
|
||||
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
|
||||
$data[3] .= '<table class="databox_color w100p">';
|
||||
$data[3] .= '<table class="databox_color w100p bg_color222">';
|
||||
$data[3] .= html_print_input_hidden('add_action', 1, true);
|
||||
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
|
||||
|
||||
|
|
|
@ -135,6 +135,10 @@ if ($id) {
|
|||
$create_wu_integria = $action['create_wu_integria'];
|
||||
}
|
||||
|
||||
if (users_can_manage_group_all('LW') === false && !$id) {
|
||||
$group = users_get_first_group(false, 'LW', false);
|
||||
}
|
||||
|
||||
// Hidden div with help hint to fill with javascript.
|
||||
html_print_div(
|
||||
[
|
||||
|
@ -623,9 +627,6 @@ $(document).ready (function () {
|
|||
$("#group option").each(function(index, value) {
|
||||
var current_group = $(value).val();
|
||||
});
|
||||
if (data.id_group != 0 && $("#group").val() != data.id_group) {
|
||||
$("#group").val(0);
|
||||
}
|
||||
|
||||
var integria_custom_fields_values = [];
|
||||
var integria_custom_fields_rvalues = [];
|
||||
|
|
|
@ -105,6 +105,7 @@ if ($update_command) {
|
|||
$alert['command'] = $command;
|
||||
$alert['description'] = $description;
|
||||
$alert['id_group'] = $id_group;
|
||||
$alert['fields_hidden'] = io_json_mb_encode($fields_hidden);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ if (isset($id)) {
|
|||
$snmp3_privacy_pass = io_output_password(
|
||||
$component['custom_string_2']
|
||||
);
|
||||
unset($tcp_send);
|
||||
$snmp3_security_level = $component['custom_string_3'];
|
||||
} else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) {
|
||||
$command_text = $component['tcp_send'];
|
||||
|
|
|
@ -331,9 +331,9 @@ echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting
|
|||
|
||||
echo "<table width='100%' cellpadding='4' cellpadding='4' class='databox filters'>";
|
||||
echo '<tr>';
|
||||
echo "<td colspan='3'>".__('Filter group').'</td>';
|
||||
echo "<td colspan='1'>".__('Filter group').'</td>';
|
||||
echo '</tr><tr>';
|
||||
echo "<td colspan='3'>".html_print_select_groups(
|
||||
echo "<td colspan='1'>".html_print_select_groups(
|
||||
$config['id_user'],
|
||||
($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RW'),
|
||||
true,
|
||||
|
|
|
@ -986,12 +986,11 @@ if ($create_alert || $update_alert) {
|
|||
echo html_print_select(get_priorities(), 'priority', $priority, '', '', '0', false, false, false);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Alert type (e-mail, event etc.)
|
||||
echo '<tr><td class="datos">'.__('Alert commands').'</td><td class="datos">';
|
||||
|
||||
// Alert type (e-mail, event etc.).
|
||||
echo '<tr><td class="datos">'.__('Alert action').'</td><td class="datos">';
|
||||
html_print_select_from_sql(
|
||||
'SELECT id, name
|
||||
FROM talert_commands
|
||||
FROM talert_actions
|
||||
ORDER BY name',
|
||||
'alert_type',
|
||||
$alert_type,
|
||||
|
@ -1481,7 +1480,7 @@ $(document).ready (function () {
|
|||
value: "1"
|
||||
});
|
||||
values.push ({
|
||||
name: "id",
|
||||
name: "id_action",
|
||||
value: this.value
|
||||
});
|
||||
values.push ({
|
||||
|
|
|
@ -231,6 +231,21 @@ if (is_ajax() !== true) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$PHPmemory_limit_min = config_return_in_bytes('800M');
|
||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== -1) {
|
||||
$msg = __(
|
||||
'\'%s\' recommended value is %s or greater. Please, change it on your PHP configuration file (php.ini) or contact with administrator',
|
||||
'memory_limit',
|
||||
'800M'
|
||||
);
|
||||
if (function_exists('ui_print_warning_message') === true) {
|
||||
ui_print_warning_message($msg);
|
||||
} else {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load styles.
|
||||
|
@ -366,21 +381,6 @@ if (is_array($config) === true) {
|
|||
}
|
||||
}
|
||||
|
||||
$PHPmemory_limit_min = config_return_in_bytes('800M');
|
||||
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
|
||||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
|
||||
$msg = __(
|
||||
'\'%s\' recommended value is %s or greater. Please, change it on your PHP configuration file (php.ini) or contact with administrator',
|
||||
'memory_limit',
|
||||
'800M'
|
||||
);
|
||||
if (function_exists('ui_print_warning_message') === true) {
|
||||
ui_print_warning_message($msg);
|
||||
} else {
|
||||
echo $msg;
|
||||
}
|
||||
}
|
||||
|
||||
$proxy = null;
|
||||
if (empty($config['update_manager_proxy_server']) === false
|
||||
|| empty($config['update_manager_proxy_port']) === false
|
||||
|
|
|
@ -941,7 +941,7 @@ class Client
|
|||
$queries = preg_split("/(;\n)|(;\n\r)/", $sql);
|
||||
foreach ($queries as $query) {
|
||||
if (empty($query) !== true) {
|
||||
if (preg_match('/^\s*LOAD\s+(.*)$/i', $query, $matches) > 0) {
|
||||
if (preg_match('/^\s*SOURCE\s+(.*)$/i', $query, $matches) > 0) {
|
||||
$filepath = dirname($mr_file).'/'.$matches[1];
|
||||
if (file_exists($filepath) === true) {
|
||||
$query = file_get_contents($filepath);
|
||||
|
@ -1342,14 +1342,14 @@ class Client
|
|||
function ($errno, $errstr) {
|
||||
throw new \Exception($errstr, $errno);
|
||||
},
|
||||
E_ERROR
|
||||
(E_ALL ^ E_NOTICE)
|
||||
);
|
||||
|
||||
register_shutdown_function(
|
||||
function () {
|
||||
$error = error_get_last();
|
||||
if (null !== $error
|
||||
&& $error['type'] === E_ERROR
|
||||
&& $error['type'] === (E_ALL ^ E_NOTICE)
|
||||
) {
|
||||
echo __('Failed to analyze package: %s', $error['message']);
|
||||
}
|
||||
|
@ -1434,7 +1434,7 @@ class Client
|
|||
function ($errno, $errstr) {
|
||||
throw new \Exception($errstr, $errno);
|
||||
},
|
||||
E_ERROR
|
||||
(E_ALL ^ E_NOTICE)
|
||||
);
|
||||
|
||||
if ($package === null) {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -423,7 +423,7 @@ if ($show_update_action_menu) {
|
|||
);
|
||||
|
||||
$data .= '<form id="update_action-'.$alert['id'].'" method="post">';
|
||||
$data .= '<table class="databox_color w100p">';
|
||||
$data .= '<table class="databox_color w100p bg_color222">';
|
||||
$data .= html_print_input_hidden(
|
||||
'update_action',
|
||||
1,
|
||||
|
|
|
@ -1599,7 +1599,6 @@ if ($get_extended_event) {
|
|||
page: "include/ajax/events",
|
||||
get_comments: 1,
|
||||
event: '.json_encode($event).',
|
||||
filter: '.json_encode($filter).'
|
||||
},
|
||||
dataType : "html",
|
||||
success: function (data) {
|
||||
|
|
|
@ -319,7 +319,7 @@ function process_user_login_remote($login, $pass, $api=false)
|
|||
defined('METACONSOLE')
|
||||
);
|
||||
|
||||
if ($return === 'error_permissions') {
|
||||
if ($result === 'error_permissions') {
|
||||
$config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator');
|
||||
return false;
|
||||
}
|
||||
|
@ -735,7 +735,14 @@ function ldap_process_user_login($login, $password)
|
|||
}
|
||||
|
||||
// Connect to the LDAP server
|
||||
$ds = @ldap_connect($config['ldap_server'], $config['ldap_port']);
|
||||
if (stripos($config['ldap_server'], 'ldap://') !== false
|
||||
|| stripos($config['ldap_server'], 'ldaps://') !== false
|
||||
|| stripos($config['ldap_server'], 'ldapi://') !== false
|
||||
) {
|
||||
$ds = @ldap_connect($config['ldap_server'].':'.$config['ldap_port']);
|
||||
} else {
|
||||
$ds = @ldap_connect($config['ldap_server'], $config['ldap_port']);
|
||||
}
|
||||
|
||||
if (!$ds) {
|
||||
$config['auth_error'] = 'Error connecting to LDAP server';
|
||||
|
@ -1393,7 +1400,7 @@ function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $ac
|
|||
}
|
||||
|
||||
if (!empty($ldap_admin_pass)) {
|
||||
$ldap_admin_pass = ' -w '.$ldap_admin_pass;
|
||||
$ldap_admin_pass = ' -w '.escapeshellarg($ldap_admin_pass);
|
||||
}
|
||||
|
||||
$dn = " -b '".$dn."'";
|
||||
|
|
|
@ -810,7 +810,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.LICENSE.LIMITED',
|
||||
'title' => __('Limited mode.'),
|
||||
'message' => io_safe_output($config['limited_mode']),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -836,7 +836,7 @@ class ConsoleSupervisor
|
|||
$msg,
|
||||
$days_to_expiry
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
]
|
||||
);
|
||||
} else if ($days_to_expiry < 0) {
|
||||
|
@ -854,7 +854,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.LICENSE.EXPIRATION',
|
||||
'title' => $title,
|
||||
'message' => $msg,
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
|
||||
]
|
||||
);
|
||||
return false;
|
||||
|
@ -931,7 +931,7 @@ class ConsoleSupervisor
|
|||
'Directory %s is not writable. Please, configure corresponding permissions.',
|
||||
$config['attachment_store']
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -953,7 +953,7 @@ class ConsoleSupervisor
|
|||
'There are more than %d files in attachment, consider cleaning up attachment directory manually.',
|
||||
$config['num_files_attachment']
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -987,7 +987,7 @@ class ConsoleSupervisor
|
|||
'Remote configuration directory %s is not readable. Please, adjust configuration.',
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -1006,7 +1006,7 @@ class ConsoleSupervisor
|
|||
'Remote configuration directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/conf'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1024,7 +1024,7 @@ class ConsoleSupervisor
|
|||
'Collections directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/collections'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1042,7 +1042,7 @@ class ConsoleSupervisor
|
|||
'MD5 directory %s is not writable. Please, adjust configuration.',
|
||||
$remote_config_dir.'/md5'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1073,7 +1073,7 @@ class ConsoleSupervisor
|
|||
$MAX_FILES_DATA_IN,
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1096,7 +1096,7 @@ class ConsoleSupervisor
|
|||
$MAX_BADXML_FILES_DATA_IN,
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1188,7 +1188,7 @@ class ConsoleSupervisor
|
|||
$modules_queued,
|
||||
$queue['queued_modules']
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1324,7 +1324,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'],
|
||||
'title' => $msg,
|
||||
'message' => $description,
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1636,7 +1636,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.HISTORYDB',
|
||||
'title' => __('Historical database not available'),
|
||||
'message' => __('Historical database is enabled, though not accessible with the current configuration.'),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1683,7 +1683,7 @@ class ConsoleSupervisor
|
|||
'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.',
|
||||
io_safe_output(get_product_name())
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1743,7 +1743,7 @@ class ConsoleSupervisor
|
|||
'Historical database maintenance problem.'
|
||||
),
|
||||
'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1782,7 +1782,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.HISTORYDB.MR',
|
||||
'title' => __('Historical database MR mismatch'),
|
||||
'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1823,7 +1823,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.EXT.ELASTICSEARCH',
|
||||
'title' => __('Log collector cannot connect to ElasticSearch'),
|
||||
'message' => __('ElasticSearch is not available using current configuration.'),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=log'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=log',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -1893,7 +1893,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
|
||||
'title' => __('Metaconsole DB is not available.'),
|
||||
'message' => __('Cannot connect with Metaconsole DB using current configuration.'),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise'),
|
||||
'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -1922,7 +1922,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.DOWNTIME',
|
||||
'title' => __('Scheduled downtime running.'),
|
||||
'message' => __('A scheduled downtime is running. Some monitoring data won\'t be available while downtime is taking place.'),
|
||||
'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'),
|
||||
'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -2083,7 +2083,7 @@ class ConsoleSupervisor
|
|||
date('M j, G:i:s ', $next_downtime_begin),
|
||||
date('M j, G:i:s ', $next_downtime_end)
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'),
|
||||
'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
|
||||
]
|
||||
);
|
||||
return;
|
||||
|
@ -2144,7 +2144,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
|
||||
'title' => __('Default password for "Admin" user has not been changed'),
|
||||
'message' => __('Please, change the default password since it is a commonly reported vulnerability.'),
|
||||
'url' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list'),
|
||||
'url' => '__url__/index.php?sec=gusuarios&sec2=godmode/users/user_list',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2180,7 +2180,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.MISC.FONTPATH',
|
||||
'title' => __('Default font doesn\'t exist'),
|
||||
'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=vis'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=vis',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2207,7 +2207,7 @@ class ConsoleSupervisor
|
|||
'Your %s has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production environment. This value is located in the main index.php file',
|
||||
get_product_name()
|
||||
),
|
||||
'url' => ui_get_full_url('index.php'),
|
||||
'url' => '__url__/index.php',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2230,7 +2230,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION',
|
||||
'title' => __('Event storm protection is enabled.'),
|
||||
'message' => __('Some events may get lost while this mode is enabled. The server must be restarted after altering this setting.'),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2257,7 +2257,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
|
||||
'title' => __('Failed to retrieve updates, please configure utility'),
|
||||
'message' => $message,
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2277,7 +2277,7 @@ class ConsoleSupervisor
|
|||
get_product_name()
|
||||
),
|
||||
'message' => __('There is a new update available. Please<a class="bolder" href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online').'"> go to Administration:Setup:Update Manager</a> for more details.'),
|
||||
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2315,7 +2315,7 @@ class ConsoleSupervisor
|
|||
'There is one or more minor releases available. <a id="aviable_updates" target="blank" href="%s">.About minor release update</a>.',
|
||||
$url
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2364,7 +2364,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.CRON.CONFIGURED',
|
||||
'title' => __('DiscoveryConsoleTasks is not configured.'),
|
||||
'message' => __($message_conf_cron),
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2468,7 +2468,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.SERVER.MISALIGNED',
|
||||
'title' => __($title_ver_misaligned),
|
||||
'message' => __($message_ver_misaligned),
|
||||
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2513,7 +2513,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE',
|
||||
'title' => __('AllowOverride is disabled'),
|
||||
'message' => __($message),
|
||||
'url' => ui_get_full_url('index.php'),
|
||||
'url' => '__url__/index.php',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -2559,7 +2559,7 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.HAMASTER.MESSAGE',
|
||||
'title' => __('Desynchronized operation on the node '.$node['host']),
|
||||
'message' => __($message),
|
||||
'url' => ui_get_full_url('index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster'),
|
||||
'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC210728';
|
||||
$build_version = 'PC210811';
|
||||
$pandora_version = 'v7.0NG.756';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -14821,6 +14821,9 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
|
|||
|
||||
// Graph width (optional).
|
||||
$width = (!empty($other) && isset($other['data'][4]) && $other['data'][4]) ? $other['data'][4] : '';
|
||||
|
||||
// If recive value its from mail call.
|
||||
$graph_font_size = $other['data'][5];
|
||||
} else {
|
||||
// Fixed parameters for _modulegraph_nh_.
|
||||
$graph_seconds = $other['data'];
|
||||
|
@ -14857,6 +14860,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
|
|||
'fullscale' => false,
|
||||
'return_img_base_64' => true,
|
||||
'image_treshold' => $graph_threshold,
|
||||
'graph_font_size' => $graph_font_size,
|
||||
];
|
||||
|
||||
// Format MIME RFC 2045 (line break 76 chars).
|
||||
|
|
|
@ -2243,7 +2243,7 @@ function config_process_config()
|
|||
if (!isset($config['fontpath'])) {
|
||||
config_update_value(
|
||||
'fontpath',
|
||||
'lato.ttf'
|
||||
'Lato-Regular.ttf'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3126,7 +3126,7 @@ function config_process_config()
|
|||
}
|
||||
|
||||
if (!isset($config['custom_report_front_font'])) {
|
||||
config_update_value('custom_report_front_font', 'lato.ttf');
|
||||
config_update_value('custom_report_front_font', 'Lato-Regular.ttf');
|
||||
}
|
||||
|
||||
if (!isset($config['custom_report_front_logo'])) {
|
||||
|
@ -3386,7 +3386,7 @@ function config_user_set_custom_config()
|
|||
}
|
||||
}
|
||||
|
||||
if ((isset($userinfo['id_skin']) && $userinfo['id_skin'] !== 0)) {
|
||||
if ((isset($userinfo['id_skin']) && (int) $userinfo['id_skin'] !== 0)) {
|
||||
if ((int) $userinfo['id_skin'] === 1) {
|
||||
$config['style'] = 'pandora';
|
||||
}
|
||||
|
@ -3402,12 +3402,10 @@ function config_user_set_custom_config()
|
|||
if ($sec2_aux != 'godmode/groups/group_list' && $skin !== false) {
|
||||
$id_user_aux = get_parameter('id');
|
||||
if ($id_user_aux == $config['id_user']) {
|
||||
if ((int) $skin === 1 || (int) $skin === 0) {
|
||||
$config['style'] = 'pandora';
|
||||
}
|
||||
|
||||
if ((int) $skin === 2) {
|
||||
if ($config['style'] === 'pandora_black' && (int) $skin === 0 || (int) $skin === 2) {
|
||||
$config['style'] = 'pandora_black';
|
||||
} else if ((int) $skin === 1 || (int) $skin === 0) {
|
||||
$config['style'] = 'pandora';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1151,7 +1151,12 @@ function events_get_all(
|
|||
$tags_names[$id_tag] = tags_get_name($id_tag);
|
||||
}
|
||||
|
||||
$_tmp .= ' AND ( ';
|
||||
if ($tags[0] === $id_tag) {
|
||||
$_tmp .= ' AND ( ';
|
||||
} else {
|
||||
$_tmp .= ' OR ( ';
|
||||
}
|
||||
|
||||
$_tmp .= sprintf(
|
||||
' tags LIKE "%s" OR',
|
||||
$tags_names[$id_tag]
|
||||
|
@ -3576,7 +3581,12 @@ function events_page_responses($event, $childrens_ids=[])
|
|||
'',
|
||||
__('None'),
|
||||
-1,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 70%'
|
||||
);
|
||||
$data[2] .= html_print_button(
|
||||
__('Update'),
|
||||
|
@ -4843,7 +4853,7 @@ function events_page_general($event)
|
|||
if (isset($event['id_agente']) && $event['id_agente'] > 0) {
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$event['id_agente'], is_metaconsole()]);
|
||||
if (!empty($secondary_groups_selected)) {
|
||||
if (empty($secondary_groups_selected['for_select']) === false) {
|
||||
$secondary_groups = implode(', ', $secondary_groups_selected['for_select']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ function upload_file($upload_file_or_zip, $default_real_directory)
|
|||
ui_print_error_message(__('Security error'));
|
||||
} else {
|
||||
if (PandoraFMS\Tools\Files::unzip($filepath, $real_directory) === false) {
|
||||
ui_print_error_message(__('No he podido descomprimir tu archivo de mierda'));
|
||||
ui_print_error_message(__('It was impossible to uncompress your file'));
|
||||
} else {
|
||||
unlink($_FILES['file']['tmp_name']);
|
||||
ui_print_success_message(__('Upload correct'));
|
||||
|
@ -969,4 +969,4 @@ function filemanager_safe_directory(
|
|||
}
|
||||
|
||||
return $directory;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -735,7 +735,7 @@ function grafico_modulo_sparse($params)
|
|||
$params['backgroundColor'] = 'white';
|
||||
}
|
||||
|
||||
if (isset($params['only_image']) === true) {
|
||||
if (isset($params['only_image']) === true && $params['vconsole'] !== true) {
|
||||
$params['backgroundColor'] = 'transparent';
|
||||
}
|
||||
|
||||
|
@ -829,7 +829,11 @@ function grafico_modulo_sparse($params)
|
|||
$params['stacked'] = 0;
|
||||
}
|
||||
|
||||
$font_size = $config['font_size'];
|
||||
if (isset($params['graph_font_size']) === true) {
|
||||
$font_size = $params['graph_font_size'];
|
||||
} else {
|
||||
$font_size = $config['font_size'];
|
||||
}
|
||||
|
||||
// If is metaconsole set 10pt size value.
|
||||
if (is_metaconsole()) {
|
||||
|
|
|
@ -2365,12 +2365,13 @@ function html_print_div(
|
|||
/**
|
||||
* Render an anchor <a> html element.
|
||||
*
|
||||
* @param array $options Parameters
|
||||
* @param array $options Parameters.
|
||||
* - id: string.
|
||||
* - style: string.
|
||||
* - title: string.
|
||||
* - href: string.
|
||||
* - content: string.
|
||||
* - onClick: string.
|
||||
* @param boolean $return Return or echo flag.
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
|
@ -2387,6 +2388,7 @@ function html_print_anchor(
|
|||
'style',
|
||||
'class',
|
||||
'title',
|
||||
'onClick',
|
||||
];
|
||||
|
||||
$output .= (isset($options['href']) === true) ? 'href="'.io_safe_input_html($options['href']).'"' : ui_get_full_url();
|
||||
|
|
|
@ -199,7 +199,7 @@ function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api
|
|||
'user_pass' => $user_pass,
|
||||
'pass' => $api_pass,
|
||||
'op' => $operation,
|
||||
'params' => html_entity_decode($params),
|
||||
'params' => io_safe_output($params),
|
||||
];
|
||||
|
||||
if ($return_type !== '') {
|
||||
|
|
|
@ -662,7 +662,7 @@ function messages_get_url($message_id)
|
|||
|
||||
// Return URL stored if is set in database.
|
||||
if (isset($messages['url'])) {
|
||||
return $messages['url'];
|
||||
return str_replace('__url__', ui_get_full_url('/'), $messages['url']);
|
||||
}
|
||||
|
||||
// Return the message direction.
|
||||
|
|
|
@ -600,7 +600,7 @@ function netflow_get_stats(
|
|||
global $config, $nfdump_date_format;
|
||||
|
||||
// Requesting remote data.
|
||||
if (defined('METACONSOLE') && $connection_name != '') {
|
||||
if (is_metaconsole() === true && empty($connection_name) === false) {
|
||||
$data = metaconsole_call_remote_api($connection_name, 'netflow_get_stats', "$start_date|$end_date|".base64_encode(json_encode($filter))."|$aggregate|$max|$absolute|".(int) $address_resolution);
|
||||
return json_decode($data, true);
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ function netflow_get_stats(
|
|||
// Execute nfdump.
|
||||
exec($command, $string);
|
||||
|
||||
if (! is_array($string)) {
|
||||
if (is_array($string) === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ function netflow_draw_item(
|
|||
) {
|
||||
$aggregate = $filter['aggregate'];
|
||||
$interval = ($end_date - $start_date);
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$width = 950;
|
||||
} else {
|
||||
$width = 850;
|
||||
|
@ -1084,12 +1084,13 @@ function netflow_draw_item(
|
|||
$connection_name,
|
||||
$address_resolution
|
||||
);
|
||||
if (empty($data)) {
|
||||
|
||||
if (empty($data) === true) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($output == 'HTML' || $output == 'PDF') {
|
||||
$html .= graph_netflow_aggregate_area(
|
||||
if ($output === 'HTML' || $output === 'PDF') {
|
||||
return graph_netflow_aggregate_area(
|
||||
$data,
|
||||
$interval,
|
||||
$width,
|
||||
|
@ -1098,9 +1099,8 @@ function netflow_draw_item(
|
|||
($output === 'HTML'),
|
||||
$end_date
|
||||
);
|
||||
return $html;
|
||||
} else if ($output == 'XML') {
|
||||
$xml .= '<aggregate>'.$aggregate."</aggregate>\n";
|
||||
} else if ($output === 'XML') {
|
||||
$xml = '<aggregate>'.$aggregate."</aggregate>\n";
|
||||
$xml .= '<resolution>'.$interval_length."</resolution>\n";
|
||||
$xml .= netflow_aggregate_area_xml($data);
|
||||
return $xml;
|
||||
|
@ -1119,18 +1119,19 @@ function netflow_draw_item(
|
|||
$connection_name,
|
||||
$address_resolution
|
||||
);
|
||||
if (empty($data)) {
|
||||
|
||||
if (empty($data) === true) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($output == 'HTML' || $output == 'PDF') {
|
||||
$html .= "<div class='w100p overflow'>";
|
||||
if ($output === 'HTML' || $output === 'PDF') {
|
||||
$html = "<div class='w100p overflow'>";
|
||||
$html .= netflow_data_table($data, $start_date, $end_date, $aggregate);
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
} else if ($output == 'XML') {
|
||||
$xml .= '<aggregate>'.$aggregate."</aggregate>\n";
|
||||
} else if ($output === 'XML') {
|
||||
$xml = '<aggregate>'.$aggregate."</aggregate>\n";
|
||||
$xml .= '<resolution>'.$interval_length."</resolution>\n";
|
||||
// Same as netflow_aggregate_area_xml.
|
||||
$xml .= netflow_aggregate_area_xml($data);
|
||||
|
@ -1159,7 +1160,8 @@ function netflow_draw_item(
|
|||
$connection_name,
|
||||
$address_resolution
|
||||
);
|
||||
if (empty($data_pie)) {
|
||||
|
||||
if (empty($data_pie) === true) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1222,51 +1224,56 @@ function netflow_draw_item(
|
|||
$connection_name,
|
||||
$address_resolution
|
||||
);
|
||||
switch ($aggregate) {
|
||||
case 'srcip':
|
||||
case 'srcport':
|
||||
$address_type = 'source_address';
|
||||
$port_type = 'source_port';
|
||||
$type = __('Sent');
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'dstip':
|
||||
case 'dstport':
|
||||
$address_type = 'destination_address';
|
||||
$port_type = 'destination_port';
|
||||
$type = __('Received');
|
||||
break;
|
||||
}
|
||||
if (empty($data_stats) === false) {
|
||||
switch ($aggregate) {
|
||||
case 'srcip':
|
||||
case 'srcport':
|
||||
$address_type = 'source_address';
|
||||
$port_type = 'source_port';
|
||||
$type = __('Sent');
|
||||
break;
|
||||
|
||||
$data_graph = [
|
||||
'name' => __('Host detailed traffic').': '.$type,
|
||||
'children' => [],
|
||||
];
|
||||
$id = -1;
|
||||
default:
|
||||
case 'dstip':
|
||||
case 'dstport':
|
||||
$address_type = 'destination_address';
|
||||
$port_type = 'destination_port';
|
||||
$type = __('Received');
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($data_stats as $sdata) {
|
||||
$data_graph['children'][] = [
|
||||
'id' => $i++,
|
||||
'name' => $sdata['agg'],
|
||||
'children' => [
|
||||
[
|
||||
'id' => $i++,
|
||||
'name' => $sdata['agg'],
|
||||
'value' => $sdata['data'],
|
||||
'tooltip_content' => network_format_bytes($sdata['data']),
|
||||
],
|
||||
],
|
||||
$data_graph = [
|
||||
'name' => __('Host detailed traffic').': '.$type,
|
||||
'children' => [],
|
||||
];
|
||||
$id = -1;
|
||||
|
||||
foreach ($data_stats as $sdata) {
|
||||
$data_graph['children'][] = [
|
||||
'id' => $id++,
|
||||
'name' => $sdata['agg'],
|
||||
'children' => [
|
||||
[
|
||||
'id' => $id++,
|
||||
'name' => $sdata['agg'],
|
||||
'value' => $sdata['data'],
|
||||
'tooltip_content' => network_format_bytes($sdata['data']),
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
return graph_netflow_host_traffic($data_graph, 'auto', 400);
|
||||
}
|
||||
return graph_netflow_host_traffic($data_graph, 'auto', 400);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($output == 'HTML' || $output == 'PDF') {
|
||||
if ($output === 'HTML' || $output === 'PDF') {
|
||||
return graph_nodata_image(300, 110, 'data');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1845,14 +1845,25 @@ function reporting_event_report_group(
|
|||
}
|
||||
|
||||
$id_meta = 0;
|
||||
$node_historical_event_enbled = '';
|
||||
if (is_metaconsole() === true && empty($content['server_name']) === false) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
$server = metaconsole_get_connection_by_id($id_meta);
|
||||
metaconsole_connect($server);
|
||||
|
||||
// Check if node historical event is enable.
|
||||
$sql = sprintf(
|
||||
'SELECT value
|
||||
FROM tconfig
|
||||
WHERE token LIKE "history_event_enabled"'
|
||||
);
|
||||
|
||||
$result = db_get_row_sql($sql);
|
||||
$node_historical_event_enbled = $result['value'];
|
||||
}
|
||||
|
||||
$history = false;
|
||||
if ($config['history_event_enabled']) {
|
||||
if ($config['history_event_enabled'] || $node_historical_event_enbled) {
|
||||
$history = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -665,7 +665,7 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
];
|
||||
$types['sql_graph_hbar'] = [
|
||||
'optgroup' => __('Graphs'),
|
||||
'name' => __('SQL horizonal bar graph'),
|
||||
'name' => __('SQL horizontal bar graph'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -723,15 +723,15 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
|
||||
$types['avg_value'] = [
|
||||
'optgroup' => __('Modules'),
|
||||
'name' => __('Avg. Value'),
|
||||
'name' => __('Avg. value'),
|
||||
];
|
||||
$types['max_value'] = [
|
||||
'optgroup' => __('Modules'),
|
||||
'name' => __('Max. Value'),
|
||||
'name' => __('Max. value'),
|
||||
];
|
||||
$types['min_value'] = [
|
||||
'optgroup' => __('Modules'),
|
||||
'name' => __('Min. Value'),
|
||||
'name' => __('Min. value'),
|
||||
];
|
||||
$types['monitor_report'] = [
|
||||
'optgroup' => __('Modules'),
|
||||
|
|
|
@ -511,6 +511,11 @@ function tags_update_policy_module_tag($id_policy_module, $tags, $autocommit=fal
|
|||
}
|
||||
}
|
||||
|
||||
if ($errn > 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5047,11 +5047,7 @@ function ui_print_agent_autocomplete_input($parameters)
|
|||
$metaconsole_enabled = $parameters['metaconsole_enabled'];
|
||||
} else {
|
||||
// If metaconsole_enabled param is not setted then pick source configuration.
|
||||
if (defined('METACONSOLE')) {
|
||||
$metaconsole_enabled = true;
|
||||
} else {
|
||||
$metaconsole_enabled = false;
|
||||
}
|
||||
$metaconsole_enabled = is_metaconsole();
|
||||
}
|
||||
|
||||
$get_only_string_modules = false;
|
||||
|
@ -5161,15 +5157,22 @@ function ui_print_agent_autocomplete_input($parameters)
|
|||
}
|
||||
';
|
||||
} else if ($from_wux_transaction != '') {
|
||||
if (is_metaconsole() === true) {
|
||||
$inputNode = 'inputs.push ("server_id=" + $("#'.$input_id_server_id.'").val());';
|
||||
} else {
|
||||
$inputNode = '';
|
||||
}
|
||||
|
||||
$javascript_code_function_select = '
|
||||
function function_select_'.$input_name.'(agent_name) {
|
||||
$("#'.$selectbox_id.'").empty();
|
||||
|
||||
var inputs = [];
|
||||
inputs.push ("id_agent=" + $("#'.$hidden_input_idagent_id.'").val());
|
||||
inputs.push ("get_agent_transactions=1");
|
||||
inputs.push ("get_agent_transactions=1");
|
||||
inputs.push ("page=enterprise/include/ajax/wux_transaction.ajax");
|
||||
|
||||
'.$inputNode.'
|
||||
|
||||
jQuery.ajax ({
|
||||
data: inputs.join ("&"),
|
||||
type: "POST",
|
||||
|
@ -5457,14 +5460,11 @@ function ui_print_agent_autocomplete_input($parameters)
|
|||
server_name = ui.item.ip;
|
||||
}
|
||||
|
||||
|
||||
if (('.((int) $use_input_id_server).')
|
||||
|| ('.((int) $print_input_id_server).')) {
|
||||
server_id = ui.item.id_server;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Put the name
|
||||
$(this).val(agent_name);
|
||||
|
||||
|
|
|
@ -169,6 +169,11 @@ function pandoraFlotPieCustom(
|
|||
var label_conf;
|
||||
var show_legend = true;
|
||||
|
||||
// Set default value if not come like a number.
|
||||
if (isNaN(width) === true) {
|
||||
width = 451;
|
||||
}
|
||||
|
||||
if (width <= 450) {
|
||||
show_legend = false;
|
||||
label_conf = {
|
||||
|
@ -222,6 +227,9 @@ function pandoraFlotPieCustom(
|
|||
conf_pie.series.pie.label = { show: false };
|
||||
}
|
||||
|
||||
// Avoid issues with 0 width values.
|
||||
$("#" + graph_id).width(width);
|
||||
|
||||
var plot = $.plot($("#" + graph_id), data, conf_pie);
|
||||
if (no_data == data.length) {
|
||||
$("#" + graph_id + " .overlay").remove();
|
||||
|
|
|
@ -170,7 +170,7 @@ function flot_area_graph(
|
|||
|
||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||
if ($params['show_legend']) {
|
||||
$return .= '<p id="legend_'.$graph_id.'" style="text-align:left; width: '.$params['width'].'px;"></p>';
|
||||
$return .= '<p id="legend_'.$graph_id.'" class="legend_background" style="text-align:left; width: '.$params['width'].'px;"></p>';
|
||||
}
|
||||
|
||||
if (isset($params['graph_combined']) === true && $params['graph_combined']
|
||||
|
@ -763,7 +763,8 @@ function flot_slicesbar_graph(
|
|||
$height = ((int) $height + 15);
|
||||
|
||||
$style = 'width:'.$width.'%;';
|
||||
$style .= 'height:'.$height.'px;';
|
||||
// Fixed height size.
|
||||
$style .= 'height: 100%;';
|
||||
$return = "<div id='".$graph_id."' class='noresizevc graph ".$adapt_key."' style='".$style."'></div>";
|
||||
|
||||
$return .= "<div id='value_".$graph_id."' class='flot_container'></div>";
|
||||
|
|
|
@ -2784,7 +2784,7 @@ function donutNarrowGraph(
|
|||
arc = d3.svg
|
||||
.arc()
|
||||
.outerRadius(radius)
|
||||
.innerRadius(radius - radius / 2.5);
|
||||
.innerRadius(radius - radius / 6);
|
||||
|
||||
svg = donutbody
|
||||
.append("svg")
|
||||
|
|
|
@ -281,11 +281,11 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) {
|
|||
$.each(data, function(i, val) {
|
||||
var s = js_html_entity_decode(val);
|
||||
|
||||
s = s.replace(/"/g, """).replace(/'/g, "'");
|
||||
i = i.replace(/"/g, """).replace(/'/g, "'");
|
||||
|
||||
$("#module").append(
|
||||
$("<option></option>")
|
||||
.html(s)
|
||||
.attr("value", i)
|
||||
.attr("title", s)
|
||||
$('<option value="' + i + '" title="' + s + '"></option>').text(val)
|
||||
);
|
||||
|
||||
all_common_modules.push(i);
|
||||
|
@ -385,12 +385,11 @@ function agent_changed_by_multiple_agents_with_alerts(
|
|||
}
|
||||
}
|
||||
jQuery.each(data, function(i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
$("#module").append(
|
||||
$("<option></option>")
|
||||
.html(s)
|
||||
.attr("value", val)
|
||||
);
|
||||
var s = js_html_entity_decode(val);
|
||||
|
||||
s = s.replace(/"/g, """).replace(/'/g, "'");
|
||||
|
||||
$("#module").append($('<option value="' + s + '"></option>').text(val));
|
||||
$("#module").fadeIn("normal");
|
||||
});
|
||||
if (selected != undefined) $("#module").attr("value", selected);
|
||||
|
@ -481,12 +480,22 @@ function alert_templates_changed_by_multiple_agents_with_alerts(
|
|||
}
|
||||
}
|
||||
jQuery.each(data, function(i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
var decoded_val = js_html_entity_decode(val);
|
||||
|
||||
decoded_val = decoded_val
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
|
||||
$("#module").append(
|
||||
$("<option></option>")
|
||||
.html(s)
|
||||
.attr("value", val)
|
||||
$(
|
||||
'<option value="' +
|
||||
decoded_val +
|
||||
'" title="' +
|
||||
decoded_val +
|
||||
'"></option>'
|
||||
).text(val)
|
||||
);
|
||||
|
||||
$("#module").fadeIn("normal");
|
||||
});
|
||||
if (selected != undefined) $("#module").attr("value", selected);
|
||||
|
|
|
@ -809,6 +809,7 @@ function dashboardLoadWuxStats(settings) {
|
|||
page: settings.page,
|
||||
wux_transaction_stats: 1,
|
||||
id_agent: settings.id_agent,
|
||||
server_id: settings.server_id,
|
||||
transaction: settings.transaction,
|
||||
view_all_stats: settings.view_all_stats,
|
||||
auth_class: settings.auth_class,
|
||||
|
@ -844,6 +845,8 @@ function processTreeSearch(settings) {
|
|||
filters.statusModule = settings.statusModule;
|
||||
filters.groupID = settings.searchGroup;
|
||||
filters.searchHirearchy = 1;
|
||||
filters.show_not_init_agents = 1;
|
||||
filters.show_not_init_modules = 1;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
@ -1144,6 +1147,11 @@ function dashboardLoadVC(settings) {
|
|||
return item;
|
||||
});
|
||||
|
||||
settings.items.map(function(item) {
|
||||
item["cellId"] = settings.cellId;
|
||||
return item;
|
||||
});
|
||||
|
||||
createVisualConsole(
|
||||
container,
|
||||
settings.props,
|
||||
|
|
|
@ -315,9 +315,9 @@ class AgentModuleWidget extends Widget
|
|||
function ($carry, $item) {
|
||||
$d = explode('|', $item);
|
||||
if (isset($d[1]) === true) {
|
||||
$carry[] = $d[1];
|
||||
$carry[] = \io_safe_output($d[1]);
|
||||
} else {
|
||||
$carry[] = $item;
|
||||
$carry[] = \io_safe_output($item);
|
||||
}
|
||||
|
||||
return $carry;
|
||||
|
@ -424,7 +424,7 @@ class AgentModuleWidget extends Widget
|
|||
|
||||
foreach ($allModules as $module_name) {
|
||||
$file_name = ui_print_truncate_text(
|
||||
$module_name,
|
||||
\io_safe_output($module_name),
|
||||
'module_small',
|
||||
false,
|
||||
true,
|
||||
|
@ -466,7 +466,7 @@ class AgentModuleWidget extends Widget
|
|||
}
|
||||
|
||||
$file_name = \ui_print_truncate_text(
|
||||
$row['agent_alias'],
|
||||
\io_safe_output($row['agent_alias']),
|
||||
'agent_small',
|
||||
false,
|
||||
true,
|
||||
|
@ -636,13 +636,13 @@ class AgentModuleWidget extends Widget
|
|||
}
|
||||
|
||||
// Extract info all modules selected.
|
||||
$target_modules = explode(
|
||||
self::MODULE_SEPARATOR,
|
||||
$this->values['mModules']
|
||||
);
|
||||
if (is_metaconsole() === true
|
||||
&& $this->values['mShowCommonModules'] === '0'
|
||||
) {
|
||||
$target_modules = $this->values['mModules'];
|
||||
if (is_metaconsole() === true) {
|
||||
$target_modules = explode(
|
||||
self::MODULE_SEPARATOR,
|
||||
$this->values['mModules']
|
||||
);
|
||||
|
||||
$all_modules = $target_modules;
|
||||
} else {
|
||||
$all_modules = Module::search(
|
||||
|
@ -661,7 +661,12 @@ class AgentModuleWidget extends Widget
|
|||
if (is_object($item) === true) {
|
||||
$carry[$item->name()] = null;
|
||||
} else {
|
||||
$carry[$item] = null;
|
||||
if ((is_metaconsole() === true
|
||||
&& $this->values['mShowCommonModules'] !== '1')
|
||||
|| is_metaconsole() === false
|
||||
) {
|
||||
$carry[$item] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return $carry;
|
||||
|
@ -699,9 +704,19 @@ class AgentModuleWidget extends Widget
|
|||
if (is_metaconsole() === true
|
||||
&& $this->values['mShowCommonModules'] === '1'
|
||||
) {
|
||||
// MC should connect to nodes and retrieve information
|
||||
// from targets.
|
||||
$modules = $agent->searchModules(
|
||||
['id_agente_modulo' => $target_modules]
|
||||
);
|
||||
|
||||
foreach ($modules as $module) {
|
||||
if ($module === null) {
|
||||
$reduceAllModules[] = null;
|
||||
} else {
|
||||
$reduceAllModules[$module->name()] = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$modules = $agent->searchModules(
|
||||
['nombre' => array_keys($reduceAllModules)]
|
||||
|
@ -714,10 +729,6 @@ class AgentModuleWidget extends Widget
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((bool) is_metaconsole() === true) {
|
||||
$reduceAllModules[$module->name()] = null;
|
||||
}
|
||||
|
||||
$visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado();
|
||||
}
|
||||
|
||||
|
@ -729,7 +740,6 @@ class AgentModuleWidget extends Widget
|
|||
}
|
||||
}
|
||||
|
||||
ksort($reduceAllModules);
|
||||
$allModules = array_keys($reduceAllModules);
|
||||
if ($allModules === null) {
|
||||
$allModules = [];
|
||||
|
|
|
@ -529,11 +529,11 @@ class EventsListWidget extends Widget
|
|||
if ($customFilter !== false) {
|
||||
$filter = $customFilter;
|
||||
$filter['tag_with'] = base64_encode(
|
||||
json_encode($filter['tag_with'])
|
||||
io_safe_output($filter['tag_with'])
|
||||
);
|
||||
|
||||
$filter['tag_without'] = base64_encode(
|
||||
json_encode($filter['tag_without'])
|
||||
io_safe_output($filter['tag_without'])
|
||||
);
|
||||
|
||||
if (!empty($filter['id_agent_module'])) {
|
||||
|
|
|
@ -414,10 +414,32 @@ class TopNWidget extends Widget
|
|||
$quantity
|
||||
);
|
||||
|
||||
$modules = @db_get_all_rows_sql(
|
||||
$sql,
|
||||
$search_in_history_db
|
||||
);
|
||||
if (is_metaconsole() === true) {
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
$modules = [];
|
||||
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect(null, $server['id']) !== NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$modules = array_merge(
|
||||
$modules,
|
||||
@db_get_all_rows_sql(
|
||||
$sql,
|
||||
$search_in_history_db
|
||||
)
|
||||
);
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$modules = @db_get_all_rows_sql(
|
||||
$sql,
|
||||
$search_in_history_db
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($modules) === true) {
|
||||
$output .= '<div class="container-center">';
|
||||
|
|
|
@ -367,6 +367,8 @@ class TopNEventByGroupWidget extends Widget
|
|||
|
||||
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
|
||||
|
||||
$event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
|
||||
|
||||
if (empty($this->values['groupId']) === true) {
|
||||
$output .= '<div class="container-center">';
|
||||
$output .= \ui_print_info_message(
|
||||
|
@ -388,12 +390,13 @@ class TopNEventByGroupWidget extends Widget
|
|||
if ($all_group === false) {
|
||||
$sql = sprintf(
|
||||
'SELECT id_agente, COUNT(*) AS count
|
||||
FROM tevento
|
||||
FROM %s
|
||||
WHERE utimestamp >= %d
|
||||
AND id_grupo IN (%s)
|
||||
GROUP BY id_agente
|
||||
ORDER BY count DESC
|
||||
LIMIT %d',
|
||||
$event_table,
|
||||
$timestamp,
|
||||
implode(',', $this->values['groupId']),
|
||||
$this->values['amountShow']
|
||||
|
@ -401,11 +404,12 @@ class TopNEventByGroupWidget extends Widget
|
|||
} else {
|
||||
$sql = sprintf(
|
||||
'SELECT id_agente, COUNT(*) AS count
|
||||
FROM tevento
|
||||
FROM %s
|
||||
WHERE utimestamp >= %d
|
||||
GROUP BY id_agente
|
||||
ORDER BY count DESC
|
||||
LIMIT %d',
|
||||
$event_table,
|
||||
$timestamp,
|
||||
$this->values['amountShow']
|
||||
);
|
||||
|
@ -428,9 +432,18 @@ class TopNEventByGroupWidget extends Widget
|
|||
if ($row['id_agente'] == 0) {
|
||||
$name = __('System');
|
||||
} else {
|
||||
$name = io_safe_output(
|
||||
agents_get_alias($row['id_agente'])
|
||||
);
|
||||
if (is_metaconsole() === true) {
|
||||
$name = (string) db_get_value(
|
||||
'alias',
|
||||
'tmetaconsole_agent',
|
||||
'id_tagente',
|
||||
(int) $row['id_agente']
|
||||
);
|
||||
} else {
|
||||
$name = io_safe_output(
|
||||
agents_get_alias($row['id_agente'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$name .= ' ('.$row['count'].')';
|
||||
|
|
|
@ -365,6 +365,8 @@ class TopNEventByModuleWidget extends Widget
|
|||
|
||||
$this->values['groupId'] = explode(',', $this->values['groupId'][0]);
|
||||
|
||||
$event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
|
||||
|
||||
if (empty($this->values['groupId']) === true) {
|
||||
$output = '<div class="container-center">';
|
||||
$output .= \ui_print_info_message(
|
||||
|
@ -389,12 +391,13 @@ class TopNEventByModuleWidget extends Widget
|
|||
id_agentmodule,
|
||||
event_type,
|
||||
COUNT(*) AS count
|
||||
FROM tevento
|
||||
FROM %s
|
||||
WHERE utimestamp >= %d
|
||||
AND id_grupo IN (%s)
|
||||
GROUP BY id_agentmodule, event_type
|
||||
ORDER BY count DESC
|
||||
LIMIT %d',
|
||||
$event_table,
|
||||
$timestamp,
|
||||
implode(',', $this->values['groupId']),
|
||||
$this->values['amountShow']
|
||||
|
@ -405,11 +408,12 @@ class TopNEventByModuleWidget extends Widget
|
|||
id_agentmodule,
|
||||
event_type,
|
||||
COUNT(*) AS count
|
||||
FROM tevento
|
||||
FROM %s
|
||||
WHERE utimestamp >= %d
|
||||
GROUP BY id_agentmodule, event_type
|
||||
ORDER BY count DESC
|
||||
LIMIT %d',
|
||||
$event_table,
|
||||
$timestamp,
|
||||
$this->values['amountShow']
|
||||
);
|
||||
|
|
|
@ -259,7 +259,7 @@ class WuxWidget extends Widget
|
|||
'label' => __('Wux transaction'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_module',
|
||||
'fields' => $fields,
|
||||
'fields' => [],
|
||||
'name' => 'transactionId',
|
||||
'selected' => $values['transactionId'],
|
||||
'return' => true,
|
||||
|
|
|
@ -270,7 +270,7 @@ class WuxStatsWidget extends Widget
|
|||
'label' => __('Wux transaction'),
|
||||
'arguments' => [
|
||||
'type' => 'autocomplete_module',
|
||||
'fields' => $fields,
|
||||
'fields' => [],
|
||||
'name' => 'transactionId',
|
||||
'selected' => $values['transactionId'],
|
||||
'return' => true,
|
||||
|
@ -326,6 +326,7 @@ class WuxStatsWidget extends Widget
|
|||
{
|
||||
global $config;
|
||||
|
||||
$server_id = ($this->values['node'] ?? '0');
|
||||
$id_agent = $this->values['agentId'];
|
||||
$transaction = $this->values['transactionId'];
|
||||
$view_all_stats = $this->values['allStats'];
|
||||
|
@ -340,6 +341,7 @@ class WuxStatsWidget extends Widget
|
|||
false
|
||||
),
|
||||
'page' => 'enterprise/include/ajax/wux_transaction.ajax',
|
||||
'server_id' => $server_id,
|
||||
'id_agent' => $id_agent,
|
||||
'transaction' => $transaction,
|
||||
'view_all_stats' => $view_all_stats,
|
||||
|
|
|
@ -1517,6 +1517,20 @@ class Item extends CachedModel
|
|||
$result['border_color'] = $border_color;
|
||||
}
|
||||
|
||||
$id_custom_graph = static::parseIntOr(
|
||||
static::issetInArray(
|
||||
$data,
|
||||
[
|
||||
'customGraphId',
|
||||
'id_custom_graph',
|
||||
]
|
||||
),
|
||||
null
|
||||
);
|
||||
if ($id_custom_graph !== null) {
|
||||
$result['id_custom_graph'] = $id_custom_graph;
|
||||
}
|
||||
|
||||
$linked_layout_node_id = static::parseIntOr(
|
||||
static::issetInArray(
|
||||
$data,
|
||||
|
|
|
@ -356,10 +356,15 @@ class View extends \HTML
|
|||
|
||||
case MODULE_GRAPH:
|
||||
$data['backgroundType'] = \get_parameter('backgroundType');
|
||||
$type = \get_parameter('choosetype');
|
||||
$data['agentId'] = \get_parameter('agentId');
|
||||
$data['metaconsoleId'] = \get_parameter('metaconsoleId');
|
||||
$data['moduleId'] = \get_parameter('moduleId');
|
||||
$data['customGraphId'] = \get_parameter('customGraphId');
|
||||
if ($type === 'module') {
|
||||
$data['customGraphId'] = 0;
|
||||
}
|
||||
|
||||
$data['graphType'] = \get_parameter('graphType');
|
||||
$data['showLegend'] = \get_parameter_switch('showLegend');
|
||||
$data['period'] = \get_parameter('period');
|
||||
|
|
|
@ -5564,7 +5564,7 @@ div#bullets_modules div {
|
|||
|
||||
/* Agent details in agent view */
|
||||
div#status_pie path {
|
||||
stroke-width: 8px;
|
||||
stroke-width: 0px;
|
||||
}
|
||||
div#status_pie {
|
||||
margin-bottom: 2em;
|
||||
|
@ -7208,7 +7208,7 @@ div.graph div.legend table {
|
|||
}
|
||||
|
||||
.bg_82B92E {
|
||||
background-color: #82b92e;
|
||||
background-color: #82b92e !important;
|
||||
}
|
||||
|
||||
.bg_B2B2B2 {
|
||||
|
@ -7233,13 +7233,13 @@ div.graph div.legend table {
|
|||
background-color: #eee;
|
||||
}
|
||||
.bg_ffd {
|
||||
background-color: #ffd036;
|
||||
background-color: #ffd036 !important;
|
||||
}
|
||||
.bg_ff5 {
|
||||
background-color: #ff5653;
|
||||
background-color: #ff5653 !important;
|
||||
}
|
||||
.bg_ff9 {
|
||||
background-color: #ff9e39;
|
||||
background-color: #ff9e39 !important;
|
||||
}
|
||||
.bg_lightgray {
|
||||
background-color: lightgray;
|
||||
|
@ -8303,3 +8303,9 @@ div.stat-win-spinner img {
|
|||
.line_height_12pt {
|
||||
line-height: 12pt;
|
||||
}
|
||||
.line_height_0pt {
|
||||
line-height: 10pt !important;
|
||||
}
|
||||
#license_error_msg_dialog {
|
||||
min-height: 350px !important;
|
||||
}
|
||||
|
|
|
@ -308,6 +308,7 @@ table.black_table_modal_alternate tr:nth-child(even) td {
|
|||
.action_buttons input[type="image"],
|
||||
.action_button_img {
|
||||
filter: brightness(4.5) contrast(50%);
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
a.pandora_pagination {
|
||||
|
@ -398,7 +399,7 @@ table#diagnostic_info tbody td div {
|
|||
}
|
||||
.ui-widget-content,
|
||||
.ui-widget-content a {
|
||||
color: #fff;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.ui-widget-content.ui-autocomplete a {
|
||||
|
@ -657,7 +658,8 @@ form ul.form_flex {
|
|||
|
||||
.graph_conteiner_inside,
|
||||
.container_table,
|
||||
.second_background {
|
||||
.second_background,
|
||||
.bg_color222 {
|
||||
background-color: #222;
|
||||
}
|
||||
|
||||
|
@ -1159,3 +1161,8 @@ a.pandora_pagination,
|
|||
padding-right: 35px;
|
||||
background-color: #222;
|
||||
}
|
||||
|
||||
.legend_background {
|
||||
background-color: #222;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -996,6 +996,7 @@ if (! isset($config['id_user'])) {
|
|||
$iduser = $_SESSION['id_usuario'];
|
||||
unset($_SESSION['id_usuario']);
|
||||
unset($iduser);
|
||||
$login_screen = 'disabled_access_node';
|
||||
include_once 'general/login_page.php';
|
||||
while (ob_get_length() > 0) {
|
||||
ob_end_flush();
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.756';
|
||||
$build = '210728';
|
||||
$build = '210811';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -388,7 +388,7 @@ $table_contact->data[] = $data;
|
|||
$data = [];
|
||||
$data[0] = '<b>'.__('Secondary groups').'</b>';
|
||||
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
|
||||
if (!$secondary_groups) {
|
||||
if (empty($secondary_groups['for_select']) === true) {
|
||||
$data[1] = '<em>'.__('N/A').'</em>';
|
||||
} else {
|
||||
$secondary_links = [];
|
||||
|
|
|
@ -79,13 +79,16 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')) {
|
|||
if ($refresh > 0) {
|
||||
$query = ui_get_url_refresh(false);
|
||||
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
|
||||
if ($config['style'] === 'pandora_black') {
|
||||
echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css"/>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php echo __('%s Snapshot data view for module (%s)', get_product_name(), $label); ?></title>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery-3.3.1.min.js'></script>
|
||||
</head>
|
||||
<body class='bg_000 grey'>
|
||||
<body class=''>
|
||||
<?php
|
||||
echo "<h2 class='center' id='title_snapshot_view'>";
|
||||
echo __('Current data at %s', $last_timestamp);
|
||||
|
|
|
@ -1498,7 +1498,7 @@ try {
|
|||
$active_filters_div .= '<div class="label box-shadow">'.__('Current filter').'</div>';
|
||||
$active_filters_div .= '<div id="current_filter" class="content">';
|
||||
if ($loaded_filter !== false) {
|
||||
$active_filters_div .= io_safe_output($loaded_filter['id_name']);
|
||||
$active_filters_div .= htmlentities(io_safe_output($loaded_filter['id_name']));
|
||||
} else {
|
||||
$active_filters_div .= __('Not set.');
|
||||
}
|
||||
|
|
|
@ -352,12 +352,12 @@ if (is_metaconsole()) {
|
|||
$filter_type = 0;
|
||||
}
|
||||
|
||||
echo "<tr class='filter_save invisible'>";
|
||||
echo "<tr class='filter_save' style='display: none;'>";
|
||||
|
||||
echo "<td colspan='6'>".ui_print_error_message('Define a name for the filter and click on Save as new filter again', '', true).'</td>';
|
||||
|
||||
echo '</tr>';
|
||||
echo "<tr class='filter_save invisible'>";
|
||||
echo "<tr class='filter_save' style='display: none;'>";
|
||||
|
||||
echo '<td><span id="filter_name_color"><b>'.__('Name').'</b></span></td>';
|
||||
echo "<td colspan='2'>".html_print_input_text(
|
||||
|
@ -373,7 +373,7 @@ if (is_metaconsole()) {
|
|||
echo "<td colspan='2'>".html_print_select_groups($config['id_user'], 'AR', $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false).'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
$advanced_toggle = '<table class="w100p">';
|
||||
$advanced_toggle = '<table style="width:100%">';
|
||||
|
||||
$advanced_toggle .= '<tr>';
|
||||
if ($netflow_disable_custom_lvfilters) {
|
||||
|
@ -381,7 +381,7 @@ if (is_metaconsole()) {
|
|||
$advanced_toggle .= '<td></td>';
|
||||
} else {
|
||||
$advanced_toggle .= '<td><b>'.__('Filter').'</b></td>';
|
||||
$advanced_toggle .= '<td colspan="2">'.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'class="mrgn_right_40px"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'class="mrgn_right_40px"', true).'</td>';
|
||||
$advanced_toggle .= '<td colspan="2">'.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true).'</td>';
|
||||
}
|
||||
|
||||
|
||||
|
@ -403,7 +403,7 @@ if (is_metaconsole()) {
|
|||
$advanced_toggle .= '<td></td>';
|
||||
$advanced_toggle .= '<td></td>';
|
||||
} else {
|
||||
$advanced_toggle .= "<td class='bolder'>".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
|
||||
$advanced_toggle .= "<td style='font-weight:bold;'>".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
|
||||
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('ip_dst', $filter['ip_dst'], false, 40, 80, true).'</td>';
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ if (is_metaconsole()) {
|
|||
$advanced_toggle .= '<td></td>';
|
||||
$advanced_toggle .= '<td></td>';
|
||||
} else {
|
||||
$advanced_toggle .= "<td class='bolder'>".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
|
||||
$advanced_toggle .= "<td style='font-weight:bold;'>".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:<br>25.46.157.214,160.253.135.249'), true).'</td>';
|
||||
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('ip_src', $filter['ip_src'], false, 40, 80, true).'</td>';
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ if (is_metaconsole()) {
|
|||
$advanced_toggle .= '<td></td>';
|
||||
$advanced_toggle .= '<td></td>';
|
||||
} else {
|
||||
$advanced_toggle .= "<td class='bolder'>".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
|
||||
$advanced_toggle .= "<td style='font-weight:bold;'>".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
|
||||
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('dst_port', $filter['dst_port'], false, 40, 80, true).'</td>';
|
||||
}
|
||||
|
||||
|
@ -430,19 +430,19 @@ if (is_metaconsole()) {
|
|||
$advanced_toggle .= '<td></td>';
|
||||
$advanced_toggle .= '<td></td>';
|
||||
} else {
|
||||
$advanced_toggle .= "<td class='bolder'>".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
|
||||
$advanced_toggle .= "<td style='font-weight:bold;'>".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:<br>80,22'), true).'</td>';
|
||||
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('src_port', $filter['src_port'], false, 40, 80, true).'</td>';
|
||||
}
|
||||
|
||||
$advanced_toggle .= '</tr>';
|
||||
|
||||
$advanced_toggle .= "<tr class='filter_advance invisible'>";
|
||||
$advanced_toggle .= "<tr class='filter_advance' style='display: none;'>";
|
||||
if ($netflow_disable_custom_lvfilters) {
|
||||
$advanced_toggle .= '<td></td>';
|
||||
$advanced_toggle .= '<td></td>';
|
||||
} else {
|
||||
$advanced_toggle .= '<td>'.ui_print_help_icon('pcap_filter', true).'</td>';
|
||||
$advanced_toggle .= "<td colspan='5'>".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "class='min-height-0px w90p'", true).'</td>';
|
||||
$advanced_toggle .= "<td colspan='5'>".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true).'</td>';
|
||||
}
|
||||
|
||||
$advanced_toggle .= '</tr>';
|
||||
|
@ -490,14 +490,14 @@ if (is_metaconsole()) {
|
|||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
|
||||
echo "<table width='100%' class='min-height-0px right'><tr><td>";
|
||||
echo "<table class='' width='100%' style='border: 0px; text-align:right;'><tr><td>";
|
||||
|
||||
echo html_print_submit_button(__('Draw'), 'draw_button', false, 'class="sub upd"', true);
|
||||
|
||||
if (!$netflow_disable_custom_lvfilters) {
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
html_print_submit_button(__('Save as new filter'), 'save_button', false, ' class="sub upd mrgn_lft_5px" onClick="return defineFilterName();"');
|
||||
html_print_submit_button(__('Update current filter'), 'update_button', false, 'class="sub upd mrgn_lft_5px"');
|
||||
html_print_submit_button(__('Save as new filter'), 'save_button', false, 'style="margin-left: 5px;" class="sub upd" onClick="return defineFilterName();"');
|
||||
html_print_submit_button(__('Update current filter'), 'update_button', false, 'style="margin-left: 5px;" class="sub upd"');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -670,11 +670,12 @@ if (is_metaconsole()) {
|
|||
// Check right filter type
|
||||
$("#radiobtn0002").attr("checked", "checked");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
// Get filter values from DB
|
||||
<?php
|
||||
if (! defined('METACONSOLE')) {
|
||||
echo ');';
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
echo 'jQuery.post ("ajax.php",';
|
||||
} else {
|
||||
echo 'jQuery.post ("'.$config['homeurl'].'../../ajax.php",';
|
||||
|
@ -701,8 +702,8 @@ if (is_metaconsole()) {
|
|||
if (i == 'aggregate')
|
||||
$("#aggregate").val(val);
|
||||
});
|
||||
},
|
||||
"json");
|
||||
}
|
||||
<?php echo ', "json");'; ?>
|
||||
|
||||
// Shows update filter button
|
||||
$("#submit-update_button").show();
|
||||
|
|
|
@ -195,8 +195,10 @@ if ($searchAgents) {
|
|||
t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR
|
||||
t1.id_agente = $aux";
|
||||
|
||||
if (count($id) >= 2) {
|
||||
for ($i = 1; $i < count($id); $i++) {
|
||||
$idCount = count($id);
|
||||
|
||||
if ($idCount >= 2) {
|
||||
for ($i = 1; $i < $idCount; $i++) {
|
||||
$aux = $id[$i]['id_agent'];
|
||||
$search_sql .= " OR t1.id_agente = $aux";
|
||||
}
|
||||
|
|
|
@ -1,24 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Data getter for policies searching
|
||||
*
|
||||
* @category Operation
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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.
|
||||
// Get global data.
|
||||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
$searchpolicies = (bool) check_acl($config['id_user'], 0, 'AW');
|
||||
|
||||
$searchpolicies = check_acl($config['id_user'], 0, 'AW');
|
||||
|
||||
if (!$searchpolicies) {
|
||||
if ($searchpolicies === false) {
|
||||
$totalPolicies = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -38,6 +53,7 @@ switch ($sortField) {
|
|||
case 'id':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectpolicieIDUp = $selected;
|
||||
$order = [
|
||||
'field' => 'id',
|
||||
|
@ -58,6 +74,7 @@ switch ($sortField) {
|
|||
case 'name':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectNameUp = $selected;
|
||||
$order = [
|
||||
'field' => 'name',
|
||||
|
@ -78,6 +95,7 @@ switch ($sortField) {
|
|||
case 'description':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'description',
|
||||
|
@ -98,6 +116,7 @@ switch ($sortField) {
|
|||
case 'last_contact':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'last_connect',
|
||||
|
@ -118,6 +137,7 @@ switch ($sortField) {
|
|||
case 'id_group':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'last_connect',
|
||||
|
@ -138,6 +158,7 @@ switch ($sortField) {
|
|||
case 'status':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
default:
|
||||
$selectStatusUp = $selected;
|
||||
$order = [
|
||||
'field' => 'is_admin',
|
||||
|
@ -174,31 +195,39 @@ switch ($sortField) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ($searchpolicies) {
|
||||
if ($searchpolicies === true) {
|
||||
/*
|
||||
We take the user groups to get policies that meet the requirements of the search
|
||||
and which the user have permission on this groups
|
||||
*/
|
||||
|
||||
$user_groups = users_get_groups($config['id_user'], 'AR', false);
|
||||
$id_user_groups = array_keys($user_groups);
|
||||
$id_user_groups_str = implode(',', $id_user_groups);
|
||||
|
||||
$sql = "SELECT id, name, description, id_group, status
|
||||
FROM tpolicies
|
||||
WHERE name LIKE '$stringSearchSQL'
|
||||
AND id_group IN ($id_user_groups_str)";
|
||||
$sql = "SELECT id, name, description, id_group, status
|
||||
FROM tpolicies
|
||||
WHERE name LIKE '$stringSearchSQL'
|
||||
AND
|
||||
(id_group IN ($id_user_groups_str)
|
||||
OR 1 = (
|
||||
SELECT is_admin
|
||||
FROM tusuario
|
||||
WHERE id_user = 'admin'
|
||||
)
|
||||
)
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
$sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
|
||||
$sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
|
||||
|
||||
$policies = db_process_sql($sql);
|
||||
|
||||
|
||||
if ($policies !== false) {
|
||||
$totalPolicies = count($policies);
|
||||
|
||||
if ($only_count) {
|
||||
if ($only_count === true) {
|
||||
unset($policies);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.756
|
||||
%define release 210728
|
||||
%define release 210811
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.756
|
||||
%define release 210728
|
||||
%define release 210811
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.756
|
||||
%define release 210728
|
||||
%define release 210811
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -105,7 +105,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('show_vc', 1),
|
||||
('inventory_changes_blacklist', '1,2,20,21'),
|
||||
('custom_report_front', 0),
|
||||
('custom_report_front_font', 'lato.ttf'),
|
||||
('custom_report_front_font', 'Lato-Regular.ttf'),
|
||||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
|
|
|
@ -5,25 +5,31 @@
|
|||
#======================================================================
|
||||
|
||||
# User and password for FTP connection
|
||||
conf_ftp_user mario
|
||||
conf_ftp_user root
|
||||
|
||||
# Use "" if your password is in blank
|
||||
conf_ftp_pass pulido
|
||||
conf_ftp_pass Password
|
||||
|
||||
#Port for FTP/SFTP connection
|
||||
#conf_ftp_port 22
|
||||
|
||||
#Set this parameter to 1 if you want stablish an SFTP connection
|
||||
conf_ftp_sftp 1
|
||||
|
||||
# Configure complete name of ftp file --> upload (Local)
|
||||
conf_ftp_putfile /home/mariopc/Descargas/ejemplo.zip
|
||||
conf_ftp_putfile /tmp/test_upload.zip
|
||||
|
||||
# Configure name of ftp file --> upload (FTP server)
|
||||
conf_ftp_putname prueba.zip
|
||||
conf_ftp_putname /tmp/test.zip
|
||||
|
||||
# Configure Ip for FTP Connection
|
||||
conf_ftp_host localhost
|
||||
|
||||
# Configure name of ftp file --> download (FTP server)
|
||||
conf_ftp_getfile prueba.zip
|
||||
conf_ftp_getfile /tmp/test.zip
|
||||
|
||||
# Configure complete name os ftp file --> download (Local)
|
||||
conf_ftp_getname prueba.zip
|
||||
conf_ftp_getname /tmp/test.zip
|
||||
|
||||
# Configure Operating System (Unix or Windows)
|
||||
conf_operating_system Unix
|
||||
|
@ -34,10 +40,10 @@ conf_operating_system Unix
|
|||
conf_ftp_compare write
|
||||
|
||||
|
||||
conf_ftp_compare_file prueba.zip
|
||||
conf_ftp_compare_file /tmp/prueba.zip
|
||||
|
||||
|
||||
conf_local_comp_file prueba.zip
|
||||
conf_local_comp_file /tmp/prueba.zip
|
||||
|
||||
|
||||
conf_local_downcomp_file /tmp/prueba.zip
|
||||
|
|
|
@ -8,6 +8,7 @@ use strict;
|
|||
use warnings;
|
||||
use Data::Dumper;
|
||||
use Net::FTP;
|
||||
use Net::SFTP::Foreign;
|
||||
use Time::HiRes qw ( gettimeofday );
|
||||
|
||||
my $archivo_cfg = $ARGV[0];
|
||||
|
@ -115,6 +116,14 @@ sub load_external_setup ($)
|
|||
if ($parametro =~ m/^conf\_ftp\_host\s(.*)/i) {
|
||||
$plugin_setup{"conf_ftp_host"} = $1;
|
||||
}
|
||||
|
||||
if ($parametro =~ m/^conf\_ftp\_port\s(.*)/i) {
|
||||
$plugin_setup{"conf_ftp_port"} = $1;
|
||||
}
|
||||
|
||||
if ($parametro =~ m/^conf\_ftp\_sftp\s(.*)/i) {
|
||||
$plugin_setup{"conf_ftp_sftp"} = $1;
|
||||
}
|
||||
|
||||
if ($parametro =~ m/^conf\_ftp\_putfile\s(.*)/i) {
|
||||
$plugin_setup{"conf_ftp_putfile"} = $1;
|
||||
|
@ -184,20 +193,38 @@ load_external_setup ($archivo_cfg);
|
|||
#-------------------------------------------------------------------------
|
||||
# Start session in FTP server
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
my $ftp = Net::FTP->new($plugin_setup{"conf_ftp_host"}) or die("Unable to connect to server: $!");#Connect FTP server
|
||||
$ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or die("Failed Login: $!");# Login at FTP server
|
||||
my $ftp;
|
||||
if (($plugin_setup{"conf_ftp_sftp"}) && ( $plugin_setup{"conf_ftp_sftp"} == 1)){
|
||||
if ($plugin_setup{"conf_ftp_port"}){
|
||||
#port => $plugin_setup{"port"},
|
||||
$ftp = Net::SFTP::Foreign->new(host => $plugin_setup{"conf_ftp_host"}, port => $plugin_setup{"conf_ftp_port"}, stderr_discard => 1, user => $plugin_setup{"conf_ftp_user"} , password => $plugin_setup{"conf_ftp_pass"},expect_log_user => 'false');
|
||||
if($ftp->error){
|
||||
die($ftp->error);
|
||||
}
|
||||
}else{
|
||||
$ftp = Net::SFTP::Foreign->new(host => $plugin_setup{"conf_ftp_host"}, stderr_discard => 1, user => $plugin_setup{"conf_ftp_user"} , password => $plugin_setup{"conf_ftp_pass"},expect_log_user => 'false');
|
||||
if($ftp->error){
|
||||
die($ftp->error);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($plugin_setup{"conf_ftp_port"}){
|
||||
$ftp = Net::FTP->new(host => $plugin_setup{"conf_ftp_host"},port => $plugin_setup{"conf_ftp_port"}) or die("Unable to connect to server: $!");#Connect FTP server
|
||||
}else{
|
||||
$ftp = Net::FTP->new($plugin_setup{"conf_ftp_host"}) or die("Unable to connect to server: $!");#Connect FTP server
|
||||
}
|
||||
$ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or die("Failed Login: $!");# Login at FTP server
|
||||
#print_module ( "Disp_FTP_$plugin_setup{conf_ftp_host}" , "generic_proc", 1, " Determines whether FTP login to $plugin_setup{conf_ftp_host} has been successful or not" );
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
# Returns the module that shows the time and transfer rate.(Upload a file)
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
my $clock0 = gettimeofday();
|
||||
$ftp->put($plugin_setup{"conf_ftp_putfile"},$plugin_setup{"conf_ftp_putname"});# Upload file at FTP server
|
||||
$ftp->put($plugin_setup{"conf_ftp_putfile"},$plugin_setup{"conf_ftp_putname"}) or die("Cannot upload file to server");# Upload file at FTP server
|
||||
my $clock1 = gettimeofday();
|
||||
my $clockd = $clock1 - $clock0;# Calculate upload transfer time
|
||||
$ftp->size($plugin_setup{"conf_ftp_putname"});# File size
|
||||
my $putrate = $ftp->size($plugin_setup{"conf_ftp_putname"})/$clockd;# Calculate rate transfer
|
||||
my $putrate = $ftp->stat($plugin_setup{"conf_ftp_putname"})->size/$clockd;# Calculate rate transfer
|
||||
my $time_puftp=sprintf("%.2f",$clockd);
|
||||
my $rate_puftp=sprintf("%.2f",$putrate);
|
||||
|
||||
|
@ -212,8 +239,8 @@ $ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or di
|
|||
$ftp->get($plugin_setup{"conf_ftp_getfile"},$plugin_setup{"conf_ftp_getname"});
|
||||
my $clock3 = gettimeofday();
|
||||
my $clockg = $clock3 - $clock2;
|
||||
$ftp->size($plugin_setup{"conf_ftp_getname"});
|
||||
my $getrate = $ftp->size($plugin_setup{"conf_ftp_getname"})/$clockg;
|
||||
#$ftp->stat($plugin_setup{"conf_ftp_getname"})->size;
|
||||
my $getrate = $ftp->stat($plugin_setup{"conf_ftp_getname"})->size/$clockg;
|
||||
my $time_getftp=sprintf("%.2f",$clockg);
|
||||
my $rate_getftp=sprintf("%.2f",$getrate);
|
||||
|
||||
|
|
|
@ -102,6 +102,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva
|
|||
if graph.text == "Id does not exist in database.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation")
|
||||
return None
|
||||
if graph.text == "The user has not enough permissions for perform this action.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
|
||||
return None
|
||||
except:
|
||||
print("Error requested api url. skipping graph generation")
|
||||
return None
|
||||
|
|
|
@ -106,6 +106,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva
|
|||
if graph.text == "Id does not exist in database.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation")
|
||||
return None
|
||||
if graph.text == "The user has not enough permissions for perform this action.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
|
||||
return None
|
||||
|
||||
except:
|
||||
print("Error requested api url. skipping graph generation")
|
||||
|
|
|
@ -1,27 +1,169 @@
|
|||
import requests, argparse, json, sys, os
|
||||
from datetime import datetime
|
||||
from base64 import b64decode
|
||||
|
||||
__version__='080621'
|
||||
|
||||
### Variables and arg parser ###
|
||||
parser = argparse.ArgumentParser(description='Bot telegram cli')
|
||||
parser = argparse.ArgumentParser(description=f'Bot telegram cli, Version: {__version__}')
|
||||
parser.add_argument('-m', '--message', help='Message to be send', required=True)
|
||||
parser.add_argument('-t', '--token', help='Bot token', required=True)
|
||||
parser.add_argument('-c', '--chat_id', help='chat id to send messages', required=True)
|
||||
parser.add_argument('--api_conf', help='Api configuration parameters in coma separate keypairs. EX "user=admin,pass=pandora,api_pass=1234,api_url=http://test.artica.es/pandora_console/include/api.php"')
|
||||
parser.add_argument('--module_graph', help='Uses pandora API to generate a module graph and attach it to the alert needs module_id and interval parameters in coma separate keypairs. EX "module_id=55,interval=3600"')
|
||||
parser.add_argument('--tmp_dir', help='Temporary path to store graph images', default='/tmp')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
def parse_dic(cValues):
|
||||
"""convert coma separate keypairs into a dic. EX "test=5,house=8,market=2" wil return "{'test': '5', 'casa': '8', 'mercado': '2'}" """
|
||||
data={}
|
||||
try :
|
||||
for kv in cValues.split(","):
|
||||
k,v = kv.strip().split("=")
|
||||
data[k.strip()]=v.strip()
|
||||
except Exception as e :
|
||||
print(f"Warning, error parsing keypairs values: {e}")
|
||||
return data
|
||||
|
||||
|
||||
def parse_api_conf(cConf):
|
||||
"""Check apiconfiguration parameters """
|
||||
if args.api_conf :
|
||||
# Parse Api config
|
||||
print ("Api config enable", file=sys.stderr)
|
||||
apid = parse_dic(cConf)
|
||||
|
||||
if apid.get("user") is None:
|
||||
print ("Warning. no user defined in api_conf keypairs, skiping graph generation.")
|
||||
return None
|
||||
|
||||
if apid.get("pass") is None:
|
||||
print ("Warning. no password defined in api_conf keypairs, skiping graph generation.")
|
||||
return None
|
||||
|
||||
if apid.get("api_pass") is None:
|
||||
print ("Warning. no api pass defined in api_conf keypairs, skiping graph generation.")
|
||||
return None
|
||||
|
||||
if apid.get("api_url") is None:
|
||||
apid['api_url'] = "http://127.0.0.1/pandora_console/include/api.php"
|
||||
#print(f"api_url: {apid['api_url']}")
|
||||
|
||||
return apid
|
||||
else:
|
||||
return None
|
||||
|
||||
def parse_graph_conf(cGraph):
|
||||
"""Check module graph parameters """
|
||||
if cGraph :
|
||||
# Parse Api config
|
||||
graphd = parse_dic(cGraph)
|
||||
if graphd.get("module_id") is None:
|
||||
print ("Warning. no module_id defined in module_graph keypairs, skiping graph generation.")
|
||||
return
|
||||
|
||||
if graphd.get("interval") is None:
|
||||
graphd["interval"] = 3600
|
||||
|
||||
return graphd
|
||||
else:
|
||||
print("Warning. no module_graph keypairs defined, skiping graph generation")
|
||||
return None
|
||||
|
||||
def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterval, sep="url_encode_separator_%7C") :
|
||||
"""Call Pandorafms api to get graph"""
|
||||
|
||||
try:
|
||||
url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}&apipass={apiPass}&api=1&user={pUser}&pass={pPass}"
|
||||
graph = requests.get(url)
|
||||
if graph.status_code != 200:
|
||||
print (f"Error requested api url, status code: {graph.status_code}. Skiping graph generation")
|
||||
return None
|
||||
if graph.text == "auth error":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation")
|
||||
return None
|
||||
if graph.text == "Id does not exist in database.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation")
|
||||
return None
|
||||
if graph.text == "The user has not enough permissions for perform this action.":
|
||||
print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation")
|
||||
return None
|
||||
|
||||
except:
|
||||
print("Error requested api url. Skiping graph generation")
|
||||
return None
|
||||
return graph
|
||||
|
||||
def send(mssg, chatId, token):
|
||||
url = f"https://api.telegram.org/bot{token}/sendMessage"
|
||||
headers = {'content-type': 'application/json'}
|
||||
|
||||
data = {
|
||||
"chat_id": chatId,
|
||||
"text": mssg
|
||||
}
|
||||
|
||||
response = requests.get(url, data=json.dumps(data), headers=headers)
|
||||
try:
|
||||
response = requests.get(url, data=json.dumps(data), headers=headers)
|
||||
r = response.json()
|
||||
print(r)
|
||||
except Exception as e :
|
||||
r = None
|
||||
exit(f"Error requesting telegram api: {e}")
|
||||
|
||||
r = response.json()
|
||||
print(r)
|
||||
|
||||
def sendMedia(mssg, chatId, token, filepath):
|
||||
url = f"https://api.telegram.org/bot{token}/sendPhoto"
|
||||
data = {
|
||||
"chat_id": chatId,
|
||||
"caption": mssg
|
||||
}
|
||||
try:
|
||||
with open(filepath, "rb") as photog:
|
||||
request = requests.post(url, data=data, files={'photo': (filepath, photog)})
|
||||
r = request.json()
|
||||
except Exception as e :
|
||||
r = None
|
||||
print(f"Error, cant add graph file: {e}")
|
||||
|
||||
if r is not None:
|
||||
r = request.json()
|
||||
print(r)
|
||||
|
||||
# Parse api config
|
||||
filecap=None
|
||||
|
||||
if args.api_conf :
|
||||
api = parse_api_conf(args.api_conf)
|
||||
# Parse graph config
|
||||
if api is not None:
|
||||
graph_cfg = parse_graph_conf(args.module_graph)
|
||||
|
||||
## Generate graph
|
||||
if graph_cfg is not None :
|
||||
graph = get_graph_by_moduleid (api["api_url"],api["user"], api["pass"], api["api_pass"], graph_cfg["module_id"], graph_cfg["interval"])
|
||||
if graph is not None:
|
||||
try:
|
||||
filename = f"{args.tmp_dir}/graph_{graph_cfg['module_id']}.{datetime.now().strftime('%s')}.png"
|
||||
with open(filename, "wb") as f:
|
||||
f.write(b64decode(graph.text))
|
||||
f.close
|
||||
print (f"Graph generated on temporary file {filename}", file=sys.stderr)
|
||||
except Exception as e :
|
||||
print(f"Error, cant generate graph file: {e}", file=sys.stderr)
|
||||
filename = None
|
||||
else: filename = None
|
||||
|
||||
if filename is not None:
|
||||
filecap=f"graph_{graph_cfg['module_id']}.{datetime.now().strftime('%s')}.png"
|
||||
|
||||
# Send message
|
||||
send(mssg=args.message, chatId=args.chat_id, token=args.token)
|
||||
|
||||
if filecap is not None:
|
||||
sendMedia(mssg='', chatId=args.chat_id, token=args.token, filepath=filename)
|
||||
try:
|
||||
os.remove(filename)
|
||||
except Exception as e:
|
||||
exit('Error: {e}')
|
|
@ -4,3 +4,6 @@ python3 pandora-telegram-cli.py -t 1412764845:AAG-OxOKISOXwhITLFFNm6oq5YD2KI72fT
|
|||
|
||||
# Pandora FMS command definition example
|
||||
python3 pandora-telegram-cli.py -t _field1_ -c _field2_ -m" _field3_"
|
||||
|
||||
# New
|
||||
python3 pandora-telegram-cli.py -m 'test message for telegram new bot script' -t 1874294647:AAHRBk4YDf1QZXh_WuZ8m7ONrAQoKbTW6eQ -c -261593656 --api_conf "user=admin,pass=pandora,api_pass=pandora,api_url=http://192.168.80.44:8080/pandora_console/include/api.php" --module_graph "module_id=402, interval=3600" --tmp_dir /tmp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.756-210728
|
||||
Version: 7.0NG.756-210811
|
||||
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.756-210728"
|
||||
pandora_version="7.0NG.756-210811"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.756";
|
||||
my $pandora_build = "210728";
|
||||
my $pandora_build = "210811";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -1424,11 +1424,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
my $threshold = shift;
|
||||
my $period = $hours * 3600; # Hours to seconds
|
||||
if($threshold == 0){
|
||||
$params->{"other"} = $period . '%7C1%7C0%7C225';
|
||||
$params->{"other"} = $period . '%7C1%7C0%7C225%7C""%7C14';
|
||||
$cid = 'module_graph_' . $hours . 'h';
|
||||
}
|
||||
else{
|
||||
$params->{"other"} = $period . '%7C1%7C1%7C225';
|
||||
$params->{"other"} = $period . '%7C1%7C1%7C225%7C""%7C14';
|
||||
$cid = 'module_graphth_' . $hours . 'h';
|
||||
}
|
||||
|
||||
|
@ -1651,7 +1651,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
$field20 = subst_alert_macros ($field20, \%macros, $pa_config, $dbh, $agent, $module, $alert);
|
||||
|
||||
# Field 1 (Integria IMS API path)
|
||||
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||
my $api_path = $config_api_path . "/include/api.php";
|
||||
|
||||
# Field 2 (Integria IMS API pass)
|
||||
my $api_pass = $config_api_pass;
|
||||
|
@ -3983,13 +3983,66 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
|||
$alert_data .= " Custom: $trap_custom_oid";
|
||||
}
|
||||
|
||||
# Assign default values to the _snmp_fx_ macros from variable bindings
|
||||
# Parse variables data.
|
||||
my @custom_values = split("\t", $trap_custom_oid);
|
||||
|
||||
# Evaluate variable filters
|
||||
my $filter_match = 1;
|
||||
for (my $i = 1; $i <= 20; $i++) {
|
||||
my $order_field = $alert->{'order_'.$i} - 1;
|
||||
|
||||
# Only values greater than 0 allowed.
|
||||
next if $order_field < 0;
|
||||
|
||||
my $filter_name = '_snmp_f' . $i . '_';
|
||||
my $filter_regex = safe_output ($alert->{$filter_name});
|
||||
my $field_value = $custom_values[$order_field];
|
||||
|
||||
# No filter for the current binding var
|
||||
next if ($filter_regex eq '');
|
||||
|
||||
# The referenced binding var does not exist
|
||||
if (! defined ($field_value)) {
|
||||
$filter_match = 0;
|
||||
last;
|
||||
}
|
||||
|
||||
# Evaluate the filter
|
||||
eval {
|
||||
local $SIG{__DIE__};
|
||||
if ($field_value !~ m/$filter_regex/) {
|
||||
$filter_match = 0;
|
||||
}
|
||||
};
|
||||
|
||||
# Probably an invalid regexp
|
||||
if ($@) {
|
||||
# Filter is ignored.
|
||||
logger($pa_config, "Invalid regex in SNMP alert #".$alert->{'id_as'}.": [".$filter_regex."]", 3);
|
||||
# Invalid regex are ignored, test next variables.
|
||||
next;
|
||||
}
|
||||
|
||||
# The filter did not match
|
||||
last if ($filter_match == 0);
|
||||
}
|
||||
|
||||
# A filter did not match
|
||||
next if ($filter_match == 0);
|
||||
|
||||
# Assign values to _snmp_fx_ macros.
|
||||
my $count;
|
||||
my @custom_values = split ("\t", $trap_custom_oid);
|
||||
for ($count = 1; defined ($custom_values[$count-1]); $count++) {
|
||||
my $macro_name = '_snmp_f' . $count . '_';
|
||||
my $order_field = $alert->{'order_'.$count};
|
||||
if ($custom_values[$count] =~ m/= \S+: (.*)/) {
|
||||
for ($count = 0; defined ($custom_values[$count]); $count++) {
|
||||
my $macro_name = '_snmp_f' . ($count+1) . '_';
|
||||
my $target = $custom_values[$count];
|
||||
|
||||
if (!defined($target)) {
|
||||
# Ignore emtpy data.
|
||||
$macros{$macro_name} = '';
|
||||
next;
|
||||
}
|
||||
|
||||
if ($target =~ m/= \S+: (.*)/) {
|
||||
my $value = $1;
|
||||
|
||||
# Strip leading and trailing double quotes
|
||||
|
@ -4009,40 +4062,6 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
|||
|
||||
# All variables
|
||||
$macros{'_snmp_argv_'} = $trap_custom_oid;
|
||||
|
||||
# Evaluate _snmp_fx_ filters
|
||||
my $filter_match = 1;
|
||||
for (my $i = 1; $i <= 10; $i++) {
|
||||
my $filter_name = '_snmp_f' . $i . '_';
|
||||
my $filter_value = safe_output ($alert->{$filter_name});
|
||||
|
||||
# No filter for the current binding var
|
||||
next if ($filter_value eq '');
|
||||
|
||||
# The referenced binding var does not exist
|
||||
if (! defined ($macros{$filter_name})) {
|
||||
$filter_match = 0;
|
||||
last;
|
||||
}
|
||||
|
||||
# Evaluate the filter
|
||||
eval {
|
||||
if ($macros{$filter_name} !~ m/$filter_value/) {
|
||||
$filter_match = 0;
|
||||
}
|
||||
};
|
||||
|
||||
# Probably an invalid regexp
|
||||
if ($@) {
|
||||
last;
|
||||
}
|
||||
|
||||
# The filter did not match
|
||||
last if ($filter_match == 0);
|
||||
}
|
||||
|
||||
# A filter did not match
|
||||
next if ($filter_match == 0);
|
||||
|
||||
# Replace macros
|
||||
$alert->{'al_field1'} = subst_alert_macros ($alert->{'al_field1'}, \%macros);
|
||||
|
@ -6458,7 +6477,7 @@ sub pandora_sync_agents_integria ($) {
|
|||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
||||
|
||||
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||
my $api_path = $config_api_path . "/include/api.php";
|
||||
|
||||
my @agents_string = '';
|
||||
my @agents = get_db_rows ($dbh, 'SELECT * FROM tagente');
|
||||
|
@ -6506,7 +6525,7 @@ sub pandora_get_integria_ticket_types($) {
|
|||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
||||
|
||||
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||
my $api_path = $config_api_path . "/include/api.php";
|
||||
|
||||
my $call_api = $api_path . '?' .
|
||||
'user=' . $config_integria_user . '&' .
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.756";
|
||||
my $pandora_build = "210728";
|
||||
my $pandora_build = "210811";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.756
|
||||
%define release 210728
|
||||
%define release 210811
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.756
|
||||
%define release 210728
|
||||
%define release 210811
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.756"
|
||||
PI_BUILD="210728"
|
||||
PI_BUILD="210811"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.756 Build 210728";
|
||||
my $version = "7.0NG.756 Build 210811";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -171,8 +171,9 @@ sub ha_keep_pandora_running($$) {
|
|||
'SELECT count(*) AS "delayed"
|
||||
FROM tserver
|
||||
WHERE ((status = -1) OR ( (unix_timestamp() - unix_timestamp(keepalive)) > (server_keepalive+1) AND status != 0 ))
|
||||
AND server_type != ? AND name = ?',
|
||||
AND server_type NOT IN (?, ?) AND name = ?',
|
||||
PandoraFMS::Tools::SATELLITESERVER,
|
||||
PandoraFMS::Tools::MFSERVER,
|
||||
$conf->{'servername'}
|
||||
);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.756 Build 210728";
|
||||
my $version = "7.0NG.756 Build 210811";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
|
@ -64,6 +64,7 @@ export interface ItemProps extends Position, Size {
|
|||
aclGroupId: number | null;
|
||||
cacheExpiration: number | null;
|
||||
colorStatus: string;
|
||||
cellId: number | null;
|
||||
}
|
||||
|
||||
export interface ItemClickEvent {
|
||||
|
@ -140,6 +141,7 @@ export function itemBasePropsDecoder(data: AnyObject): ItemProps | never {
|
|||
aclGroupId: parseIntOr(data.aclGroupId, null),
|
||||
cacheExpiration: parseIntOr(data.cacheExpiration, null),
|
||||
colorStatus: notEmptyStringOr(data.colorStatus, "#CCC"),
|
||||
cellId: parseIntOr(data.cellId, null),
|
||||
...sizePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
|
||||
...positionPropsDecoder(data) // Object spread. It will merge the properties of the two objects.
|
||||
};
|
||||
|
|
|
@ -115,6 +115,12 @@ export default class Odometer extends Item<OdometerProps> {
|
|||
"visual-console-container"
|
||||
) as HTMLElement;
|
||||
|
||||
if (backgroundColor === null) {
|
||||
backgroundColor = document.getElementById(
|
||||
`visual-console-container-${this.props.cellId}`
|
||||
) as HTMLElement;
|
||||
}
|
||||
|
||||
if (backgroundColor.style.backgroundColor == "") {
|
||||
backgroundColor.style.backgroundColor = "#fff";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue