refactor events meta pandora_enterprise#9086
This commit is contained in:
commit
c42852a18f
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.762-220620
|
||||
Version: 7.0NG.762-220621
|
||||
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.762-220620"
|
||||
pandora_version="7.0NG.762-220621"
|
||||
|
||||
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.762';
|
||||
use constant AGENT_BUILD => '220620';
|
||||
use constant AGENT_BUILD => '220621';
|
||||
|
||||
# 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.762
|
||||
%define release 220620
|
||||
%define release 220621
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.762
|
||||
%define release 220620
|
||||
%define release 220621
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.762"
|
||||
PI_BUILD="220620"
|
||||
PI_BUILD="220621"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{220620}
|
||||
{220621}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.762 Build 220620")
|
||||
#define PANDORA_VERSION ("7.0NG.762 Build 220621")
|
||||
|
||||
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.762(Build 220620))"
|
||||
VALUE "ProductVersion", "(7.0NG.762(Build 220621))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.762-220620
|
||||
Version: 7.0NG.762-220621
|
||||
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.762-220620"
|
||||
pandora_version="7.0NG.762-220621"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -38,6 +38,8 @@ ALTER TABLE `tbackup` MODIFY COLUMN `id_user` VARCHAR(255) DEFAULT '';
|
|||
ALTER TABLE `tservice` ADD COLUMN `enable_sunburst` tinyint(1) NOT NULL default 0;
|
||||
ALTER TABLE `tdashboard` MODIFY `name` TEXT NOT NULL DEFAULT '';
|
||||
|
||||
ALTER TABLE `tagente` ADD COLUMN `satellite_server` INT NOT NULL default 0;
|
||||
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `satellite_server` INT NOT NULL default 0;
|
||||
SET @st_oum763 = (SELECT IF(
|
||||
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tautoconfig' AND table_schema = DATABASE() AND column_name = 'disabled') > 0,
|
||||
"SELECT 1",
|
||||
|
@ -49,3 +51,4 @@ EXECUTE pr_oum763;
|
|||
DEALLOCATE PREPARE pr_oum763;
|
||||
|
||||
COMMIT;
|
||||
|
||||
|
|
|
@ -245,8 +245,11 @@ if (!$new_agent && $alias != '') {
|
|||
}
|
||||
|
||||
// Remote configuration available.
|
||||
$remote_agent = false;
|
||||
if (isset($filename)) {
|
||||
if (file_exists($filename['md5'])) {
|
||||
$remote_agent = true;
|
||||
|
||||
$agent_name = agents_get_name($id_agente);
|
||||
$agent_name = io_safe_output($agent_name);
|
||||
$agent_md5 = md5($agent_name, false);
|
||||
|
@ -427,6 +430,42 @@ $table_server .= html_print_select(
|
|||
true
|
||||
).'<div class="label_select_child_icons"></div></div></div>';
|
||||
|
||||
|
||||
$table_satellite = '';
|
||||
if ($remote_agent === true) {
|
||||
// Satellite server selector.
|
||||
$satellite_servers = db_get_all_rows_filter(
|
||||
'tserver',
|
||||
['server_type' => SERVER_TYPE_ENTERPRISE_SATELLITE],
|
||||
[
|
||||
'id_server',
|
||||
'name',
|
||||
]
|
||||
);
|
||||
|
||||
$satellite_names = [];
|
||||
if (empty($satellite_servers) === false) {
|
||||
foreach ($satellite_servers as $s_server) {
|
||||
$satellite_names[$s_server['id_server']] = $s_server['name'];
|
||||
}
|
||||
|
||||
$table_satellite = '<div class="label_select"><p class="input_label">'.__('Satellite').'</p>';
|
||||
$table_satellite .= '<div class="label_select_parent">';
|
||||
|
||||
$table_satellite .= html_print_input(
|
||||
[
|
||||
'type' => 'select',
|
||||
'fields' => $satellite_names,
|
||||
'name' => 'satellite_server',
|
||||
'selected' => $satellite_server,
|
||||
'nothing' => __('None'),
|
||||
'nothinf_value' => 0,
|
||||
'return' => true,
|
||||
]
|
||||
).'<div class="label_select_child_icons"></div></div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Description.
|
||||
$table_description = '<div class="label_select"><p class="input_label">'.__('Description').'</p>';
|
||||
$table_description .= html_print_textarea(
|
||||
|
@ -443,7 +482,7 @@ $table_description .= html_print_textarea(
|
|||
echo '<div class="first_row">
|
||||
<div class="box-shadow agent_options '.$agent_options_update.' white_box">
|
||||
<div class="agent_options_column_left">'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'</div>
|
||||
<div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_description.'</div>
|
||||
<div class="agent_options_column_right">'.$table_interval.$table_os.$table_server.$table_satellite.$table_description.'</div>
|
||||
</div>';
|
||||
if (!$new_agent && $alias != '') {
|
||||
echo $table_qr_code;
|
||||
|
|
|
@ -155,6 +155,7 @@ $alert_d7 = 1;
|
|||
$alert_recovery = 0;
|
||||
$alert_priority = 0;
|
||||
$server_name = '';
|
||||
$satellite_server = 0;
|
||||
$grupo = 0;
|
||||
$id_os = 9;
|
||||
// Windows.
|
||||
|
@ -985,6 +986,7 @@ if ($update_agent) {
|
|||
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
$secondary_groups = (string) get_parameter('secondary_hidden', '');
|
||||
$satellite_server = (int) get_parameter('satellite_server', 0);
|
||||
|
||||
if ($fields === false) {
|
||||
$fields = [];
|
||||
|
@ -1092,6 +1094,7 @@ if ($update_agent) {
|
|||
'quiet' => $quiet,
|
||||
'cps' => $cps,
|
||||
'safe_mode_module' => $safe_mode_module,
|
||||
'satellite_server' => $satellite_server,
|
||||
];
|
||||
|
||||
if ($config['metaconsole_agent_cache'] == 1) {
|
||||
|
@ -1230,6 +1233,7 @@ if ($id_agente) {
|
|||
$cps = $agent['cps'];
|
||||
$safe_mode_module = $agent['safe_mode_module'];
|
||||
$safe_mode = ($safe_mode_module) ? 1 : 0;
|
||||
$satellite_server = (int) $agent['satellite_server'];
|
||||
}
|
||||
|
||||
$update_module = (bool) get_parameter('update_module');
|
||||
|
|
|
@ -203,20 +203,22 @@ if (is_ajax() !== true) {
|
|||
var clientMode = '<?php echo $mode; ?>';
|
||||
</script>
|
||||
<?php
|
||||
$server_version = (string) db_get_value_sql(
|
||||
'SELECT `version` FROM `tserver` ORDER BY `master` DESC'
|
||||
);
|
||||
if ($server_version !== false
|
||||
&& preg_match('/NG\.(\d\.*\d*?) /', $server_version, $matches) > 0
|
||||
) {
|
||||
if ((float) $matches[1] !== (float) $current_package) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'Master server version %s does not match console version %s.',
|
||||
(float) $matches[1],
|
||||
(float) $current_package
|
||||
)
|
||||
);
|
||||
if (function_exists('db_get_value_sql') === true) {
|
||||
$server_version = (string) db_get_value_sql(
|
||||
'SELECT `version` FROM `tserver` ORDER BY `master` DESC'
|
||||
);
|
||||
if ($server_version !== false
|
||||
&& preg_match('/NG\.(\d\.*\d*?) /', $server_version, $matches) > 0
|
||||
) {
|
||||
if ((float) $matches[1] !== floor((float) $current_package)) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'Master server version %s does not match console version %s.',
|
||||
(float) $matches[1],
|
||||
(float) $current_package
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1528,7 +1528,7 @@ class ConsoleSupervisor
|
|||
$this->cleanNotifications('NOTIF.PHP.UPLOAD_MAX_FILESIZE');
|
||||
}
|
||||
|
||||
if ($PHPmemory_limit < $PHPmemory_limit_min && $PHPmemory_limit !== '-1') {
|
||||
if ($PHPmemory_limit < $PHPmemory_limit_min && (int) $PHPmemory_limit !== -1) {
|
||||
$url = 'http://php.net/manual/en/ini.core.php#ini.memory-limit';
|
||||
if ($config['language'] == 'es') {
|
||||
$url = 'http://php.net/manual/es/ini.core.php#ini.memory-limit';
|
||||
|
@ -2145,8 +2145,8 @@ class ConsoleSupervisor
|
|||
[
|
||||
'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION',
|
||||
'title' => __('This instance is not registered in the Update manager section'),
|
||||
'message' => __('Click <a class="bolder underline" href="javascript: force_run_register();"> here</a> to start the registration process'),
|
||||
'url' => 'javascript: force_run_register();',
|
||||
'message' => __('Click here to start the registration process'),
|
||||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
|
@ -2166,7 +2166,7 @@ class ConsoleSupervisor
|
|||
// Check default password for "admin".
|
||||
$admin_with_default_pass = db_get_value_sql(
|
||||
'SELECT count(*) FROM tusuario
|
||||
WHERE
|
||||
WHERE
|
||||
id_user="admin"
|
||||
AND password="1da7ee7d45b96d0e1f45ee4ee23da560"
|
||||
AND is_admin=1
|
||||
|
@ -2441,11 +2441,11 @@ class ConsoleSupervisor
|
|||
config_update_value('last_um_check', $future, true);
|
||||
|
||||
$messages = update_manager_get_messages();
|
||||
|
||||
if (is_array($messages) === true) {
|
||||
$source_id = get_notification_source_id(
|
||||
'Official communication'
|
||||
);
|
||||
|
||||
foreach ($messages as $message) {
|
||||
if (isset($message['url']) === false) {
|
||||
$message['url'] = '#';
|
||||
|
@ -2476,8 +2476,8 @@ class ConsoleSupervisor
|
|||
// List all servers except satellite server.
|
||||
$server_version_list = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
'SELECT `name`, `version`
|
||||
FROM tserver
|
||||
'SELECT `name`, `version`
|
||||
FROM tserver
|
||||
WHERE server_type != %d
|
||||
GROUP BY `version`',
|
||||
SERVER_TYPE_ENTERPRISE_SATELLITE
|
||||
|
@ -2490,7 +2490,7 @@ class ConsoleSupervisor
|
|||
foreach ($server_version_list as $server) {
|
||||
if (strpos(
|
||||
$server['version'],
|
||||
$config['current_package']
|
||||
(string) floor($config['current_package'])
|
||||
) === false
|
||||
) {
|
||||
$missed++;
|
||||
|
@ -2511,6 +2511,8 @@ class ConsoleSupervisor
|
|||
'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
|
||||
]
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC220620';
|
||||
$build_version = 'PC220621';
|
||||
$pandora_version = 'v7.0NG.762';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -53,8 +53,10 @@ enterprise_include_once('include/functions_clusters.php');
|
|||
enterprise_include_once('include/functions_alerts.php');
|
||||
|
||||
// Clases.
|
||||
use PandoraFMS\Agent;
|
||||
use PandoraFMS\Module;
|
||||
use PandoraFMS\Enterprise\Cluster;
|
||||
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||
use PandoraFMS\SpecialDay;
|
||||
|
||||
|
||||
|
@ -1842,18 +1844,18 @@ function api_set_update_agent_field($id_agent, $use_agent_alias, $params)
|
|||
/**
|
||||
* Create a new agent, and print the id for new agent.
|
||||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $id_node Id_node target (if metaconsole)
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <agent_name>;<ip>;<id_parent>;<id_group>;
|
||||
* <cascade_protection>;<interval_sec>;<id_os>;<id_server>;<custom_id>;<learning_mode>;<disabled>;<description> in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example:
|
||||
* @param array $other it's array, $other as param is <agent_name>;<ip>;<id_parent>;<id_group>;
|
||||
* <cascade_protection>;<interval_sec>;<id_os>;<id_server>;<custom_id>;<learning_mode>;<disabled>;<description> in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example:
|
||||
*
|
||||
* api.php?op=set&op2=new_agent&other=pepito|1.1.1.1|0|4|0|30|8|10||0|0|nose%20nose&other_mode=url_encode_separator_|
|
||||
* api.php?op=set&op2=new_agent&other=pepito|1.1.1.1|0|4|0|30|8|10||0|0|nose%20nose&other_mode=url_encode_separator_|
|
||||
*
|
||||
* @param $thrash3 Don't use.
|
||||
*/
|
||||
function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
|
||||
function api_set_new_agent($id_node, $thrash2, $other, $trhash3)
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -1862,158 +1864,117 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((int) $other['data'][3] == 0) {
|
||||
returnError('For security reasons, the agent was not created. Use a group other than 0.');
|
||||
return;
|
||||
}
|
||||
|
||||
$alias = io_safe_input(
|
||||
trim(
|
||||
preg_replace(
|
||||
'/[\/\\\|%#&$]/',
|
||||
'',
|
||||
preg_replace(
|
||||
'/x20;/',
|
||||
' ',
|
||||
$other['data'][0]
|
||||
try {
|
||||
$agent = new Agent();
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
if ($id_node <= 0) {
|
||||
throw new Exception('No node id specified');
|
||||
}
|
||||
|
||||
$node = new Node($id_node);
|
||||
$id_agente = $node->callApi(
|
||||
'new_agent',
|
||||
'set',
|
||||
null,
|
||||
null,
|
||||
$other['data'],
|
||||
null
|
||||
);
|
||||
} else {
|
||||
$alias = io_safe_input(
|
||||
trim(
|
||||
preg_replace(
|
||||
'/[\/\\\|%#&$]/',
|
||||
'',
|
||||
preg_replace(
|
||||
'/x20;/',
|
||||
' ',
|
||||
$other['data'][0]
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$direccion_agente = io_safe_input($other['data'][1]);
|
||||
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
|
||||
$id_parent = (int) $other['data'][2];
|
||||
$grupo = (int) $other['data'][3];
|
||||
$cascade_protection = (int) $other['data'][4];
|
||||
$cascade_protection_module = (int) $other['data'][5];
|
||||
$intervalo = (string) $other['data'][6];
|
||||
$id_os = (int) $other['data'][7];
|
||||
$server_name = (string) $other['data'][8];
|
||||
$custom_id = (string) $other['data'][9];
|
||||
$modo = (int) $other['data'][10];
|
||||
$disabled = (int) $other['data'][11];
|
||||
$comentarios = (string) $other['data'][12];
|
||||
$alias_as_name = (int) $other['data'][13];
|
||||
$update_module_count = (int) $config['metaconsole_agent_cache'] == 1;
|
||||
|
||||
if ($cascade_protection == 1) {
|
||||
if (($id_parent != 0) && (db_get_value_sql(
|
||||
'SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = '.$id_parent.' AND id_agente_modulo = '.$cascade_protection_module
|
||||
) === false)
|
||||
) {
|
||||
returnError('Cascade protection is not applied because it is not a parent module.');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$cascadeProtectionModule = 0;
|
||||
}
|
||||
|
||||
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$server_name.'"');
|
||||
|
||||
// Check if agent exists (BUG WC-50518-2).
|
||||
if ($alias == '' && $alias_as_name === 0) {
|
||||
returnError('No agent alias specified');
|
||||
} else if (agents_get_agent_id($nombre_agente)) {
|
||||
returnError('The agent name already exists in DB.');
|
||||
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
|
||||
returnError('The group does not exist.');
|
||||
} else if (group_allow_more_agents($grupo, true, 'create') === false) {
|
||||
returnError('Agent cannot be created due to the maximum agent limit for this group');
|
||||
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
|
||||
returnError('The OS does not exist.');
|
||||
} else if ($server_name === false) {
|
||||
returnError('The '.get_product_name().' Server does not exist.');
|
||||
} else {
|
||||
if ($alias_as_name === 1) {
|
||||
$exists_alias = db_get_row_sql('SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"');
|
||||
$nombre_agente = $alias;
|
||||
}
|
||||
|
||||
$exists_ip = false;
|
||||
|
||||
if ($config['unique_ip'] && $direccion_agente != '') {
|
||||
$exists_ip = db_get_row_sql('SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"');
|
||||
}
|
||||
|
||||
if (!$exists_alias && !$exists_ip) {
|
||||
$id_agente = db_process_sql_insert(
|
||||
'tagente',
|
||||
[
|
||||
'nombre' => $nombre_agente,
|
||||
'alias' => $alias,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'direccion' => $direccion_agente,
|
||||
'id_grupo' => $grupo,
|
||||
'intervalo' => $intervalo,
|
||||
'comentarios' => $comentarios,
|
||||
'modo' => $modo,
|
||||
'id_os' => $id_os,
|
||||
'disabled' => $disabled,
|
||||
'cascade_protection' => $cascade_protection,
|
||||
'cascade_protection_module' => $cascade_protection_module,
|
||||
'server_name' => $server_name,
|
||||
'id_parent' => $id_parent,
|
||||
'custom_id' => $custom_id,
|
||||
'os_version' => '',
|
||||
'agent_version' => '',
|
||||
'timezone_offset' => 0,
|
||||
'icon_path' => '',
|
||||
'url_address' => '',
|
||||
'update_module_count' => $update_module_count,
|
||||
]
|
||||
);
|
||||
enterprise_hook('update_agent', [$id_agente]);
|
||||
} else {
|
||||
$id_agente = false;
|
||||
}
|
||||
|
||||
if ($id_agente !== false) {
|
||||
// Create address for this agent in taddress.
|
||||
if ($direccion_agente != '') {
|
||||
agents_add_address($id_agente, $direccion_agente);
|
||||
$direccion_agente = io_safe_input($other['data'][1]);
|
||||
$id_parent = (int) $other['data'][2];
|
||||
$grupo = (int) $other['data'][3];
|
||||
$cascade_protection = (int) $other['data'][4];
|
||||
$cascade_protection_module = (int) $other['data'][5];
|
||||
$intervalo = (string) $other['data'][6];
|
||||
$id_os = (int) $other['data'][7];
|
||||
$server_name = (string) $other['data'][8];
|
||||
$custom_id = (string) $other['data'][9];
|
||||
$modo = (int) $other['data'][10];
|
||||
$disabled = (int) $other['data'][11];
|
||||
$comentarios = (string) html_entity_decode($other['data'][12]);
|
||||
$alias_as_name = (int) $other['data'][13];
|
||||
$update_module_count = (int) $config['metaconsole_agent_cache'] == 1;
|
||||
|
||||
$agent->nombre($alias);
|
||||
$agent->alias($alias);
|
||||
$agent->alias_as_name($alias_as_name);
|
||||
$agent->direccion($direccion_agente);
|
||||
$agent->id_grupo($grupo);
|
||||
$agent->intervalo($intervalo);
|
||||
$agent->comentarios($comentarios);
|
||||
$agent->modo($modo);
|
||||
$agent->id_os($id_os);
|
||||
$agent->disabled($disabled);
|
||||
$agent->cascade_protection($cascade_protection);
|
||||
$agent->cascade_protection_module($cascade_protection_module);
|
||||
$agent->server_name($server_name);
|
||||
$agent->id_parent($id_parent);
|
||||
$agent->custom_id($custom_id);
|
||||
$agent->timezone_offset(0);
|
||||
$agent->update_module_count($update_module_count);
|
||||
|
||||
if ($cascade_protection == 1) {
|
||||
if ($id_parent != 0) {
|
||||
try {
|
||||
$parent = new Agent($id_parent);
|
||||
} catch (\Exception $e) {
|
||||
returnError('Cascade protection is not applied because it is not a parent module.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$info = '{"Name":"'.$nombre_agente.'",
|
||||
"IP":"'.$direccion_agente.'",
|
||||
"Group":"'.$grupo.'",
|
||||
"Interval":"'.$intervalo.'",
|
||||
"Comments":"'.$comentarios.'",
|
||||
"Mode":"'.$modo.'",
|
||||
"ID_parent:":"'.$id_parent.'",
|
||||
"Server":"'.$server_name.'",
|
||||
"ID os":"'.$id_os.'",
|
||||
"Disabled":"'.$disabled.'",
|
||||
"Custom ID":"'.$custom_id.'",
|
||||
"Cascade protection":"'.$cascade_protection.'",
|
||||
"Cascade protection module":"'.$cascade_protection_module.'"}';
|
||||
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$server_name.'"');
|
||||
|
||||
$unsafe_alias = io_safe_output($alias);
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_AGENT_MANAGEMENT,
|
||||
'Created agent '.$unsafe_alias,
|
||||
false,
|
||||
true,
|
||||
$info
|
||||
);
|
||||
} else {
|
||||
$id_agente = 0;
|
||||
|
||||
if ($exists_alias) {
|
||||
$agent_creation_error = 'Could not be created because name already exists';
|
||||
} else if ($exists_ip) {
|
||||
$agent_creation_error = 'Could not be created because IP already exists';
|
||||
// Check if agent exists (BUG WC-50518-2).
|
||||
if ($alias == '' && $alias_as_name === 0) {
|
||||
returnError('No agent alias specified');
|
||||
} else if (agents_get_agent_id($nombre_agente)) {
|
||||
returnError('The agent name already exists in DB.');
|
||||
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
|
||||
returnError('The group does not exist.');
|
||||
} else if (group_allow_more_agents($grupo, true, 'create') === false) {
|
||||
returnError('Agent cannot be created due to the maximum agent limit for this group');
|
||||
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
|
||||
returnError('The OS does not exist.');
|
||||
} else if ($server_name === false) {
|
||||
returnError('The '.get_product_name().' Server does not exist.');
|
||||
} else {
|
||||
$agent_creation_error = 'Could not be created for unknown reason';
|
||||
}
|
||||
if ($alias_as_name === 1) {
|
||||
$exists_alias = db_get_row_sql('SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"');
|
||||
$nombre_agente = $alias;
|
||||
}
|
||||
|
||||
returnError($agent_creation_error);
|
||||
return;
|
||||
$exists_ip = false;
|
||||
|
||||
if ($config['unique_ip'] && $direccion_agente != '') {
|
||||
$exists_ip = db_get_row_sql('SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"');
|
||||
}
|
||||
|
||||
$agent->save((bool) $alias_as_name);
|
||||
$id_agente = $agent->id_agente();
|
||||
$agent->updateFromCache();
|
||||
}
|
||||
}
|
||||
|
||||
returnData(
|
||||
|
@ -2023,6 +1984,9 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
|
|||
'data' => $id_agente,
|
||||
]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
returnError($e->getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,10 +84,7 @@ function get_notification_targets(int $id_message)
|
|||
|
||||
if (is_array($ret)) {
|
||||
foreach ($ret as $row) {
|
||||
array_push(
|
||||
$targets['users'],
|
||||
get_user_fullname($row['id_user'])
|
||||
);
|
||||
array_push($targets['users'], get_user_fullname($row['id_user']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,8 +224,10 @@ function check_notification_readable(int $id_message)
|
|||
*
|
||||
* @return array [users] and [groups] with the targets.
|
||||
*/
|
||||
function get_notification_source_targets(int $id_source, ?string $subtype=null)
|
||||
{
|
||||
function get_notification_source_targets(
|
||||
int $id_source,
|
||||
?string $subtype=null
|
||||
) {
|
||||
$ret = [];
|
||||
|
||||
$filter = '';
|
||||
|
@ -484,7 +483,8 @@ function notifications_add_group_to_source($source_id, $groups)
|
|||
continue;
|
||||
}
|
||||
|
||||
$res = $res && db_process_sql_insert(
|
||||
$res = $res &&
|
||||
db_process_sql_insert(
|
||||
'tnotification_source_group',
|
||||
[
|
||||
'id_group' => $group,
|
||||
|
@ -525,7 +525,8 @@ function notifications_add_users_to_source($source_id, $users)
|
|||
continue;
|
||||
}
|
||||
|
||||
$res = $res && db_process_sql_insert(
|
||||
$res = $res &&
|
||||
db_process_sql_insert(
|
||||
'tnotification_source_user',
|
||||
[
|
||||
'id_user' => $user,
|
||||
|
@ -551,7 +552,13 @@ function notifications_add_users_to_source($source_id, $users)
|
|||
function notifications_get_group_source_not_configured($source_id)
|
||||
{
|
||||
$groups_selected = notifications_get_group_sources_for_select($source_id);
|
||||
$all_groups = users_get_groups_for_select(false, 'AR', false, true, $groups_selected);
|
||||
$all_groups = users_get_groups_for_select(
|
||||
false,
|
||||
'AR',
|
||||
false,
|
||||
true,
|
||||
$groups_selected
|
||||
);
|
||||
return array_diff($all_groups, $groups_selected);
|
||||
}
|
||||
|
||||
|
@ -566,12 +573,10 @@ function notifications_get_group_source_not_configured($source_id)
|
|||
*/
|
||||
function notifications_get_user_source_not_configured($source_id)
|
||||
{
|
||||
$users_selected = array_keys(notifications_get_user_sources_for_select($source_id));
|
||||
$users = get_users(
|
||||
'id_user',
|
||||
['!id_user' => $users_selected],
|
||||
['id_user']
|
||||
$users_selected = array_keys(
|
||||
notifications_get_user_sources_for_select($source_id)
|
||||
);
|
||||
$users = get_users('id_user', ['!id_user' => $users_selected], ['id_user']);
|
||||
return index_array($users, 'id_user', 'id_user');
|
||||
}
|
||||
|
||||
|
@ -587,8 +592,8 @@ function notifications_get_user_source_not_configured($source_id)
|
|||
function notifications_build_user_enable_return($status, $enabled)
|
||||
{
|
||||
return [
|
||||
'status' => ((bool) $status === true) ? 1 : 0,
|
||||
'enabled' => ((bool) $enabled === true) ? 1 : 0,
|
||||
'status' => (bool) $status === true ? 1 : 0,
|
||||
'enabled' => (bool) $enabled === true ? 1 : 0,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -625,16 +630,11 @@ function notifications_get_user_label_status($source, $user, $label)
|
|||
|
||||
$common_groups = array_intersect(
|
||||
array_keys(users_get_groups($user)),
|
||||
array_keys(
|
||||
notifications_get_group_sources_for_select($source['id'])
|
||||
)
|
||||
array_keys(notifications_get_group_sources_for_select($source['id']))
|
||||
);
|
||||
// No group found, return no permissions.
|
||||
$value = empty($common_groups) ? false : $source[$label];
|
||||
return notifications_build_user_enable_return(
|
||||
$value,
|
||||
false
|
||||
);
|
||||
return notifications_build_user_enable_return($value, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -681,13 +681,7 @@ function notifications_get_counters()
|
|||
{
|
||||
$num_notifications = 0;
|
||||
$last_id = 0;
|
||||
$last_message = messages_get_overview(
|
||||
'timestamp',
|
||||
'DESC',
|
||||
false,
|
||||
false,
|
||||
1
|
||||
);
|
||||
$last_message = messages_get_overview('timestamp', 'DESC', false, false, 1);
|
||||
if (!empty($last_message)) {
|
||||
$num_notifications = messages_get_count();
|
||||
$last_id = $last_message[0]['id_mensaje'];
|
||||
|
@ -718,7 +712,9 @@ function notifications_get_counters()
|
|||
function notifications_print_ball($num_notifications, $last_id)
|
||||
{
|
||||
$no_notifications = (int) $num_notifications === 0;
|
||||
$class_status = ($no_notifications) ? 'notification-ball-no-messages' : 'notification-ball-new-messages';
|
||||
$class_status = $no_notifications
|
||||
? 'notification-ball-no-messages'
|
||||
: 'notification-ball-new-messages';
|
||||
return sprintf(
|
||||
'<div
|
||||
%s
|
||||
|
@ -728,7 +724,7 @@ function notifications_print_ball($num_notifications, $last_id)
|
|||
>
|
||||
%s
|
||||
</div>',
|
||||
($no_notifications) ? '' : 'onclick="addNotifications(event)"',
|
||||
$no_notifications ? '' : 'onclick="addNotifications(event)"',
|
||||
$class_status,
|
||||
$last_id,
|
||||
$num_notifications
|
||||
|
@ -799,7 +795,7 @@ function notifications_print_global_source_configuration($source)
|
|||
'type' => 'switch',
|
||||
'id' => 'nt-'.$source['id'].'.'.$type.'-subtype',
|
||||
'class' => 'elem-clickable',
|
||||
'value' => (isset($blacklist[$type]) === false),
|
||||
'value' => isset($blacklist[$type]) === false,
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
|
@ -833,14 +829,11 @@ function notifications_print_global_source_configuration($source)
|
|||
*
|
||||
* @return string HTML with the generated selector
|
||||
*/
|
||||
function notifications_print_source_select_box(
|
||||
$info_selec,
|
||||
$id,
|
||||
$source_id
|
||||
) {
|
||||
$title = ($id === 'users') ? __('Notified users') : __('Notified groups');
|
||||
$add_title = ($id === 'users') ? __('Add users') : __('Add groups');
|
||||
$delete_title = ($id === 'users') ? __('Delete users') : __('Delete groups');
|
||||
function notifications_print_source_select_box($info_selec, $id, $source_id)
|
||||
{
|
||||
$title = $id === 'users' ? __('Notified users') : __('Notified groups');
|
||||
$add_title = $id === 'users' ? __('Add users') : __('Add groups');
|
||||
$delete_title = $id === 'users' ? __('Delete users') : __('Delete groups');
|
||||
|
||||
// Generate the HTML.
|
||||
return sprintf(
|
||||
|
@ -873,11 +866,7 @@ function notifications_print_source_select_box(
|
|||
true,
|
||||
[
|
||||
'title' => $add_title,
|
||||
'onclick' => sprintf(
|
||||
"add_source_dialog('%s', '%s')",
|
||||
$id,
|
||||
$source_id
|
||||
),
|
||||
'onclick' => sprintf("add_source_dialog('%s', '%s')", $id, $source_id),
|
||||
]
|
||||
),
|
||||
html_print_image(
|
||||
|
@ -1062,7 +1051,6 @@ function notifications_print_dropdown()
|
|||
function notifications_print_dropdown_element($message_info)
|
||||
{
|
||||
$action = '';
|
||||
|
||||
switch ($message_info['description']) {
|
||||
case 'Official communication':
|
||||
$action = 'show_modal(this.id);';
|
||||
|
|
|
@ -29,6 +29,12 @@ function chordDiagram(recipient, elements, matrix, width) {
|
|||
var width = 700;
|
||||
var margin = 150;
|
||||
var padding = 0.02;
|
||||
var consoleStyle = document.getElementById("hidden-selected_style_theme")
|
||||
.value;
|
||||
var textColor =
|
||||
consoleStyle === "pandora_black" ? "rgb(240, 240, 240)" : "rgb(0, 0, 0)";
|
||||
var tooltipColor =
|
||||
consoleStyle === "pandora_black" ? "rgb(0, 0, 0)" : "rgb(240, 240, 240)";
|
||||
|
||||
function chart(selection) {
|
||||
selection.each(function(data) {
|
||||
|
@ -103,7 +109,6 @@ function chordDiagram(recipient, elements, matrix, width) {
|
|||
const chords = chord.chords();
|
||||
let aux = 0;
|
||||
$.each(chords, function(key, value) {
|
||||
console.log(aux);
|
||||
if (aux < 5) {
|
||||
if (
|
||||
(value.source.index == i && value.target.subindex == i) ||
|
||||
|
@ -159,6 +164,7 @@ function chordDiagram(recipient, elements, matrix, width) {
|
|||
.attr("text-anchor", function(d) {
|
||||
return d.angle > Math.PI ? "end" : null;
|
||||
})
|
||||
.attr("style", "fill: " + textColor)
|
||||
.attr("transform", function(d) {
|
||||
return (
|
||||
"rotate(" +
|
||||
|
@ -266,7 +272,12 @@ function chordDiagram(recipient, elements, matrix, width) {
|
|||
|
||||
$("#tooltip").attr(
|
||||
"style",
|
||||
"background: #fff;" +
|
||||
"background: " +
|
||||
tooltipColor +
|
||||
";" +
|
||||
"color: " +
|
||||
textColor +
|
||||
";" +
|
||||
"position: absolute;" +
|
||||
"display: inline-block;" +
|
||||
"width: auto;" +
|
||||
|
@ -393,6 +404,16 @@ function treeMap(recipient, data, width, height) {
|
|||
var isIE = true;
|
||||
var chartWidth = width;
|
||||
var chartHeight = height;
|
||||
var consoleStyle = document.getElementById("hidden-selected_style_theme")
|
||||
.value;
|
||||
$("#tooltip").css(
|
||||
"color",
|
||||
consoleStyle === "pandora_black" ? "rgb(240, 240, 240)" : "rgb(0, 0, 0)"
|
||||
);
|
||||
$("#tooltip").css(
|
||||
"background-color",
|
||||
consoleStyle === "pandora_black" ? "rgb(0, 0, 0)" : "rgb(240, 240, 240)"
|
||||
);
|
||||
if (width === "auto") {
|
||||
chartWidth = $(recipient).innerWidth();
|
||||
}
|
||||
|
@ -761,6 +782,7 @@ function treeMap(recipient, data, width, height) {
|
|||
$("#tooltip").attr(
|
||||
"style",
|
||||
"background: #fff;" +
|
||||
"color: #111;" +
|
||||
"position: absolute;" +
|
||||
"display: block;" +
|
||||
"width: 200px;" +
|
||||
|
@ -1023,6 +1045,7 @@ function sunburst(recipient, data, width, height, tooltip = true) {
|
|||
$("#tooltip").attr(
|
||||
"style",
|
||||
"background: #fff;" +
|
||||
"color: #111;" +
|
||||
"position: absolute;" +
|
||||
"display: block;" +
|
||||
"width: 200px;" +
|
||||
|
|
|
@ -248,7 +248,7 @@ class Agent extends Entity
|
|||
|
||||
|
||||
/**
|
||||
* Calculates cascade protection service value for this service.
|
||||
* Calculates cascade protection _nameice value for this service.
|
||||
*
|
||||
* @param integer|null $id_node Meta searching node will use this field.
|
||||
*
|
||||
|
@ -621,4 +621,25 @@ class Agent extends Entity
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update agent in metaconsole
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updateFromCache()
|
||||
{
|
||||
$res = (bool) \enterprise_hook(
|
||||
'agent_update_from_cache',
|
||||
[
|
||||
$this->id_agente(),
|
||||
$this->toArray(),
|
||||
$this->server_name(),
|
||||
]
|
||||
);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -258,8 +258,8 @@ class TopNWidget extends Widget
|
|||
|
||||
// Order.
|
||||
$fields = [
|
||||
1 => __('Descending'),
|
||||
2 => __('Ascending'),
|
||||
1 => __('Ascending'),
|
||||
2 => __('Descending'),
|
||||
3 => __('By agent name'),
|
||||
];
|
||||
|
||||
|
@ -466,7 +466,7 @@ class TopNWidget extends Widget
|
|||
];
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
|
||||
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20, false, true, false);
|
||||
$item_name = $module['aliasAgent'].' - '.$module['nameModule'];
|
||||
$data_hbar[$item_name]['g'] = $module[$display];
|
||||
// Calculation of max-min values for show in graph.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Index.
|
||||
*
|
||||
|
@ -53,8 +54,8 @@ $develop_bypass = 0;
|
|||
|
||||
if ($develop_bypass != 1) {
|
||||
// If no config file, automatically try to install.
|
||||
if (! file_exists('include/config.php')) {
|
||||
if (! file_exists('install.php')) {
|
||||
if (!file_exists('include/config.php')) {
|
||||
if (!file_exists('install.php')) {
|
||||
$url = explode('/', $_SERVER['REQUEST_URI']);
|
||||
$flag_url = 0;
|
||||
foreach ($url as $key => $value) {
|
||||
|
@ -128,8 +129,8 @@ if ($develop_bypass != 1) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((! file_exists('include/config.php'))
|
||||
|| (! is_readable('include/config.php'))
|
||||
if ((!file_exists('include/config.php'))
|
||||
|| (!is_readable('include/config.php'))
|
||||
) {
|
||||
$login_screen = 'error_noconfig';
|
||||
include 'general/error_screen.php';
|
||||
|
@ -224,9 +225,9 @@ ob_start('ui_process_page_head');
|
|||
enterprise_include_once('index.php');
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo 'var dispositivo = navigator.userAgent.toLowerCase();';
|
||||
echo 'if( dispositivo.search(/iphone|ipod|ipad|android/) > -1 ){';
|
||||
echo 'document.location = "'.ui_get_full_url('/mobile').'"; }';
|
||||
echo 'var dispositivo = navigator.userAgent.toLowerCase();';
|
||||
echo 'if( dispositivo.search(/iphone|ipod|ipad|android/) > -1 ){';
|
||||
echo 'document.location = "'.ui_get_full_url('/mobile').'"; }';
|
||||
echo '</script>';
|
||||
|
||||
// This tag is included in the buffer passed to ui_process_page_head so
|
||||
|
@ -275,7 +276,7 @@ if (strlen($search) > 0) {
|
|||
|
||||
// Login process.
|
||||
enterprise_include_once('include/auth/saml.php');
|
||||
if (! isset($config['id_user'])) {
|
||||
if (!isset($config['id_user'])) {
|
||||
// Clear error messages.
|
||||
unset($_COOKIE['errormsg']);
|
||||
setcookie('errormsg', null, -1);
|
||||
|
@ -731,9 +732,9 @@ if (! isset($config['id_user'])) {
|
|||
}
|
||||
|
||||
// Boolean parameters.
|
||||
$correct_pass_change = (boolean) get_parameter('correct_pass_change', false);
|
||||
$reset = (boolean) get_parameter('reset', false);
|
||||
$first = (boolean) get_parameter('first', false);
|
||||
$correct_pass_change = (bool) get_parameter('correct_pass_change', false);
|
||||
$reset = (bool) get_parameter('reset', false);
|
||||
$first = (bool) get_parameter('first', false);
|
||||
// Strings.
|
||||
$reset_hash = get_parameter('reset_hash');
|
||||
$pass1 = get_parameter_post('pass1');
|
||||
|
@ -955,7 +956,7 @@ if (! isset($config['id_user'])) {
|
|||
exit('</html>');
|
||||
} else {
|
||||
if (((bool) $user_in_db['is_admin'] === false)
|
||||
&& ( (bool) $user_in_db['not_login'] === true
|
||||
&& ((bool) $user_in_db['not_login'] === true
|
||||
|| (is_metaconsole() === false
|
||||
&& has_metaconsole() === true
|
||||
&& is_management_allowed() === false
|
||||
|
@ -1170,7 +1171,7 @@ if (has_metaconsole() === true
|
|||
$err .= '</div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
infoMessage({
|
||||
title: '<?php echo __('Warning'); ?>',
|
||||
text: '<?php echo $err; ?>',
|
||||
|
@ -1208,7 +1209,7 @@ if ($searchPage) {
|
|||
$main_sec = $sec;
|
||||
}
|
||||
} else if ($sec == 'gextensions') {
|
||||
$main_sec = get_parameter('extension_in_menu');
|
||||
$main_sec = get_parameter('extension_in_menu');
|
||||
if (empty($main_sec) === true) {
|
||||
$main_sec = $sec;
|
||||
}
|
||||
|
@ -1379,12 +1380,12 @@ if ($config['pure'] == 0) {
|
|||
// Main pure.
|
||||
}
|
||||
|
||||
html_print_div(
|
||||
echo html_print_div(
|
||||
['id' => 'wiz_container'],
|
||||
true
|
||||
);
|
||||
|
||||
html_print_div(
|
||||
echo html_print_div(
|
||||
['id' => 'um_msg_receiver'],
|
||||
true
|
||||
);
|
||||
|
@ -1426,26 +1427,27 @@ require 'include/php_to_js_values.php';
|
|||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
// When there are less than 5 rows, all rows must be white
|
||||
var theme = "<?php echo $config['style']; ?>";
|
||||
if(theme === 'pandora'){
|
||||
if($('table.info_table tr').length < 5){
|
||||
if (theme === 'pandora') {
|
||||
if ($('table.info_table tr').length < 5) {
|
||||
$('table.info_table tbody > tr').css('background-color', '#fff');
|
||||
}
|
||||
}
|
||||
|
||||
// When the user scrolls down 400px from the top of the document, show the
|
||||
// button.
|
||||
window.onscroll = function() {scrollFunction()};
|
||||
window.onscroll = function() {
|
||||
scrollFunction()
|
||||
};
|
||||
|
||||
function scrollFunction() {
|
||||
if (document.body.scrollTop > 400 || document.documentElement.scrollTop > 400) {
|
||||
if(document.getElementById("top_btn")){
|
||||
if (document.getElementById("top_btn")) {
|
||||
document.getElementById("top_btn").style.display = "block";
|
||||
}
|
||||
} else {
|
||||
if(document.getElementById("top_btn")){
|
||||
if (document.getElementById("top_btn")) {
|
||||
document.getElementById("top_btn").style.display = "none";
|
||||
}
|
||||
}
|
||||
|
@ -1455,48 +1457,49 @@ require 'include/php_to_js_values.php';
|
|||
function topFunction() {
|
||||
|
||||
/*
|
||||
* Safari.
|
||||
* document.body.scrollTop = 0;
|
||||
* For Chrome, Firefox, IE and Opera.
|
||||
* document.documentElement.scrollTop = 0;
|
||||
*/
|
||||
* Safari.
|
||||
* document.body.scrollTop = 0;
|
||||
* For Chrome, Firefox, IE and Opera.
|
||||
* document.documentElement.scrollTop = 0;
|
||||
*/
|
||||
|
||||
$("HTML, BODY").animate({ scrollTop: 0 }, 500);
|
||||
$("HTML, BODY").animate({
|
||||
scrollTop: 0
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// Initial load of page.
|
||||
$(document).ready(adjustFooter);
|
||||
|
||||
|
||||
// Every resize of window.
|
||||
$(window).resize(adjustFooter);
|
||||
|
||||
|
||||
// Every show/hide call may need footer re-layout.
|
||||
(function() {
|
||||
var oShow = jQuery.fn.show;
|
||||
var oHide = jQuery.fn.hide;
|
||||
|
||||
jQuery.fn.show = function () {
|
||||
|
||||
jQuery.fn.show = function() {
|
||||
var rv = oShow.apply(this, arguments);
|
||||
adjustFooter();
|
||||
return rv;
|
||||
};
|
||||
jQuery.fn.hide = function () {
|
||||
jQuery.fn.hide = function() {
|
||||
var rv = oHide.apply(this, arguments);
|
||||
adjustFooter();
|
||||
return rv;
|
||||
};
|
||||
})();
|
||||
|
||||
function first_time_identification () {
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
function first_time_identification() {
|
||||
jQuery.post("ajax.php", {
|
||||
"page": "general/register",
|
||||
"load_wizards": 'initial'
|
||||
},
|
||||
function (data) {
|
||||
$('#wiz_container').empty ()
|
||||
.html (data);
|
||||
run_configuration_wizard ();
|
||||
function(data) {
|
||||
$('#wiz_container').empty()
|
||||
.html(data);
|
||||
run_configuration_wizard();
|
||||
},
|
||||
"html"
|
||||
);
|
||||
|
@ -1512,42 +1515,42 @@ require 'include/php_to_js_values.php';
|
|||
);
|
||||
return;
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
jQuery.post("ajax.php", {
|
||||
"page": "godmode/setup/setup_notifications",
|
||||
"get_notification": 1,
|
||||
"id": match[2]
|
||||
},
|
||||
function (data) {
|
||||
function(data) {
|
||||
notifications_hide();
|
||||
try {
|
||||
var json = JSON.parse(data);
|
||||
$('#um_msg_receiver')
|
||||
.empty ()
|
||||
.html (json.mensaje);
|
||||
.empty()
|
||||
.html(json.mensaje);
|
||||
|
||||
$('#um_msg_receiver').prop('title', json.subject);
|
||||
|
||||
|
||||
// Launch modal.
|
||||
$("#um_msg_receiver").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
width: 800,
|
||||
buttons: [
|
||||
{
|
||||
text: "OK",
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
height: 600,
|
||||
buttons: [{
|
||||
text: "OK",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
],
|
||||
}],
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
closeOnEscape: false,
|
||||
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
|
||||
open: function(event, ui) {
|
||||
$(".ui-dialog-titlebar-close").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$(".ui-widget-overlay").css("background", "#000");
|
||||
|
@ -1563,30 +1566,30 @@ require 'include/php_to_js_values.php';
|
|||
);
|
||||
}
|
||||
|
||||
//Dynamically assign footer position and width.
|
||||
function adjustFooter() {
|
||||
/*
|
||||
if (document.readyState !== 'complete' || $('#container').position() == undefined) {
|
||||
return;
|
||||
//Dynamically assign footer position and width.
|
||||
function adjustFooter() {
|
||||
/*
|
||||
if (document.readyState !== 'complete' || $('#container').position() == undefined) {
|
||||
return;
|
||||
}
|
||||
// minimum top value (upper limit) for div#foot
|
||||
var ulim = $('#container').position().top + $('#container').outerHeight(true);
|
||||
// window height. $(window).height() returns wrong value on Opera and Google Chrome.
|
||||
var wh = document.documentElement.clientHeight;
|
||||
// save div#foot's height for latter use
|
||||
var h = $('#foot').height();
|
||||
// new top value for div#foot
|
||||
var t = (ulim + $('#foot').outerHeight() > wh) ? ulim : wh - $('#foot').outerHeight();
|
||||
/*
|
||||
if ($('#foot').position().top != t) {
|
||||
$('#foot').css({ position: "absolute", top: t, left: $('#foot').offset().left});
|
||||
$('#foot').height(h);
|
||||
}
|
||||
if ($('#foot').width() != $(window).width()) {
|
||||
$('#foot').width($(window).width());
|
||||
}
|
||||
*/
|
||||
}
|
||||
// minimum top value (upper limit) for div#foot
|
||||
var ulim = $('#container').position().top + $('#container').outerHeight(true);
|
||||
// window height. $(window).height() returns wrong value on Opera and Google Chrome.
|
||||
var wh = document.documentElement.clientHeight;
|
||||
// save div#foot's height for latter use
|
||||
var h = $('#foot').height();
|
||||
// new top value for div#foot
|
||||
var t = (ulim + $('#foot').outerHeight() > wh) ? ulim : wh - $('#foot').outerHeight();
|
||||
/*
|
||||
if ($('#foot').position().top != t) {
|
||||
$('#foot').css({ position: "absolute", top: t, left: $('#foot').offset().left});
|
||||
$('#foot').height(h);
|
||||
}
|
||||
if ($('#foot').width() != $(window).width()) {
|
||||
$('#foot').width($(window).width());
|
||||
}
|
||||
*/
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.762';
|
||||
$build = '220620';
|
||||
$build = '220621';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -265,6 +265,27 @@ if ($has_remote_conf) {
|
|||
['class' => 'invert_filter']
|
||||
);
|
||||
$remote_cfg .= __('Remote configuration enabled').'</p>';
|
||||
|
||||
$satellite_server = (int) db_get_value_filter(
|
||||
'satellite_server',
|
||||
'tagente',
|
||||
['id_agente' => $id_agente]
|
||||
);
|
||||
|
||||
if (empty($satellite_server) === false) {
|
||||
$satellite_name = db_get_value_filter(
|
||||
'name',
|
||||
'tserver',
|
||||
['id_server' => $satellite_server]
|
||||
);
|
||||
|
||||
$remote_cfg .= '<p>'.html_print_image(
|
||||
'images/satellite.png',
|
||||
true,
|
||||
['class' => 'invert_filter']
|
||||
);
|
||||
$remote_cfg .= $satellite_name.'</p>';
|
||||
}
|
||||
} else {
|
||||
$remote_cfg = '';
|
||||
}
|
||||
|
|
|
@ -2,20 +2,28 @@
|
|||
/**
|
||||
* Netflow live view
|
||||
*
|
||||
* @package Pandora FMS open.
|
||||
* @subpackage UI file.
|
||||
* @category Netflow
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* Pandora FMS - http://pandorafms.com
|
||||
* ==================================================
|
||||
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* 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
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
@ -40,7 +48,7 @@ if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'],
|
|||
$pure = get_parameter('pure', 0);
|
||||
|
||||
// Ajax callbacks.
|
||||
if (is_ajax()) {
|
||||
if (is_ajax() === true) {
|
||||
$get_filter_type = get_parameter('get_filter_type', 0);
|
||||
$get_filter_values = get_parameter('get_filter_values', 0);
|
||||
|
||||
|
@ -117,7 +125,7 @@ $draw = get_parameter('draw_button', '');
|
|||
$save = get_parameter('save_button', '');
|
||||
$update = get_parameter('update_button', '');
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
if (is_metaconsole() === false) {
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
__('Netflow live view'),
|
||||
|
@ -505,7 +513,7 @@ if (is_metaconsole()) {
|
|||
|
||||
echo '</form>';
|
||||
|
||||
if ($draw != '') {
|
||||
if (empty($draw) === false) {
|
||||
// Draw.
|
||||
echo '<br/>';
|
||||
|
||||
|
@ -513,6 +521,11 @@ if (is_metaconsole()) {
|
|||
if ($netflow_disable_custom_lvfilters && $filter_selected == 0) {
|
||||
ui_print_error_message(__('No filter selected'));
|
||||
} else {
|
||||
// Hidden input for handle properly the text colors.
|
||||
html_print_input_hidden(
|
||||
'selected_style_theme',
|
||||
$config['style']
|
||||
);
|
||||
// Draw the netflow chart.
|
||||
echo netflow_draw_item(
|
||||
$start_date,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.762
|
||||
%define release 220620
|
||||
%define release 220621
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.762
|
||||
%define release 220620
|
||||
%define release 220621
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.762
|
||||
%define release 220620
|
||||
%define release 220621
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -88,6 +88,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
|
|||
`alias_as_name` TINYINT NOT NULL DEFAULT 0,
|
||||
`safe_mode_module` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`cps` INT NOT NULL DEFAULT 0,
|
||||
`satellite_server` INT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
|
@ -3367,6 +3368,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
|||
`alias_as_name` TINYINT NOT NULL DEFAULT 0,
|
||||
`safe_mode_module` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`cps` INT NOT NULL DEFAULT 0,
|
||||
`satellite_server` INT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.762-220620
|
||||
Version: 7.0NG.762-220621
|
||||
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.762-220620"
|
||||
pandora_version="7.0NG.762-220621"
|
||||
|
||||
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.762";
|
||||
my $pandora_build = "220620";
|
||||
my $pandora_build = "220621";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -3001,10 +3001,10 @@ defined also the parent is updated.
|
|||
|
||||
=cut
|
||||
##########################################################################
|
||||
sub pandora_update_agent ($$$$$$$;$$) {
|
||||
sub pandora_update_agent ($$$$$$$;$$$) {
|
||||
my ($pa_config, $agent_timestamp, $agent_id, $os_version,
|
||||
$agent_version, $agent_interval, $dbh, $timezone_offset,
|
||||
$parent_agent_id) = @_;
|
||||
$parent_agent_id, $satellite_server_id) = @_;
|
||||
|
||||
# No access update for data without interval.
|
||||
# Single modules from network server, for example. This could be very Heavy for Pandora FMS
|
||||
|
@ -3025,6 +3025,7 @@ sub pandora_update_agent ($$$$$$$;$$) {
|
|||
'os_version' => $os_version,
|
||||
'timezone_offset' => $timezone_offset,
|
||||
'id_parent' => $parent_agent_id,
|
||||
'satellite_server' => $satellite_server_id
|
||||
});
|
||||
|
||||
db_do ($dbh, "UPDATE tagente SET $set WHERE id_agente = ?", @{$values}, $agent_id);
|
||||
|
|
|
@ -452,6 +452,16 @@ sub process_xml_data ($$$$$) {
|
|||
logger($pa_config, "Error retrieving information for agent ID $agent_id",10);
|
||||
return;
|
||||
}
|
||||
|
||||
# Get the ID of the Satellite Server if available.
|
||||
my $satellite_server_id = 0;
|
||||
if (defined($data->{'satellite_server'})) {
|
||||
$satellite_server_id = get_server_id($dbh, $data->{'satellite_server'}, SATELLITESERVER);
|
||||
if ($satellite_server_id < 0) {
|
||||
logger($pa_config, "Satellite Server '" . $data->{'satellite_server'} . "' does not exist.", 10);
|
||||
$satellite_server_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
# Check if agent is disabled and return if it's disabled. Disabled agents doesnt process data
|
||||
# in order to avoid not only events, also possible invalid data coming from agents.
|
||||
|
@ -536,7 +546,7 @@ sub process_xml_data ($$$$$) {
|
|||
}
|
||||
|
||||
# Update agent information
|
||||
pandora_update_agent($pa_config, $timestamp, $agent_id, $os_version, $agent_version, $interval, $dbh, $timezone_offset, $parent_id);
|
||||
pandora_update_agent($pa_config, $timestamp, $agent_id, $os_version, $agent_version, $interval, $dbh, $timezone_offset, $parent_id, $satellite_server_id);
|
||||
|
||||
# Update GIS data
|
||||
if ($pa_config->{'activate_gis'} != 0 && $agent->{'update_gis_data'} == 1) {
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.762";
|
||||
my $pandora_build = "220620";
|
||||
my $pandora_build = "220621";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.762
|
||||
%define release 220620
|
||||
%define release 220621
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.762
|
||||
%define release 220620
|
||||
%define release 220621
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.762"
|
||||
PI_BUILD="220620"
|
||||
PI_BUILD="220621"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.762 Build 220620";
|
||||
my $version = "7.0NG.762 Build 220621";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.762 Build 220620";
|
||||
my $version = "7.0NG.762 Build 220621";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue