Merge remote-tracking branch 'origin/develop' into ent-8912-Problemas-en-recuperación-alertas-de-evento---Necesaria-refactorizacion
This commit is contained in:
commit
59ea9a716e
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.762-220620
|
||||
Version: 7.0NG.762-220622
|
||||
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-220622"
|
||||
|
||||
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 => '220622';
|
||||
|
||||
# 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 220622
|
||||
|
||||
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 220622
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.762"
|
||||
PI_BUILD="220620"
|
||||
PI_BUILD="220622"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{220620}
|
||||
{220622}
|
||||
|
||||
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 220622")
|
||||
|
||||
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 220622))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.762-220620
|
||||
Version: 7.0NG.762-220622
|
||||
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-220622"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -35,7 +35,10 @@ ALTER TABLE `treset_pass` MODIFY COLUMN `id_user` VARCHAR(255) NOT NULL DEFAULT
|
|||
ALTER TABLE `tuser_task_scheduled` MODIFY COLUMN `id_usuario` VARCHAR(255) NOT NULL DEFAULT '0';
|
||||
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 `tservice` ADD COLUMN `enable_sunburst` TINYINT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `asynchronous` TINYINT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `tservice` ADD COLUMN `rca` TEXT;
|
||||
|
||||
ALTER TABLE `tdashboard` MODIFY `name` TEXT NOT NULL DEFAULT '';
|
||||
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `field1_recovery` TEXT AFTER `recovery_notify`;
|
||||
|
@ -47,6 +50,8 @@ ALTER TABLE `tevent_alert` ADD COLUMN `field8_recovery` TEXT AFTER `field7_recov
|
|||
ALTER TABLE `tevent_alert` ADD COLUMN `field9_recovery` TEXT AFTER `field8_recovery`;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `field10_recovery` TEXT AFTER `field9_recovery`;
|
||||
|
||||
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",
|
||||
|
@ -58,3 +63,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');
|
||||
|
|
|
@ -337,7 +337,7 @@ if (($create != '') || ($view != '')) {
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Name');
|
||||
$data[1] = '<input type="text" name="form_name" size=100 value="'.$form_name.'">';
|
||||
$data[1] = '<input type="text" class="text_input" name="form_name" size=100 value="'.$form_name.'">';
|
||||
$table->colspan['plugin_name'][1] = 3;
|
||||
$table->data['plugin_name'] = $data;
|
||||
|
||||
|
@ -399,7 +399,7 @@ if (($create != '') || ($view != '')) {
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Plugin command').ui_print_help_tip(__('Specify interpreter and plugin path. The server needs permissions to run it.'), true);
|
||||
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf" size=100 value="'.$form_execute.'" '.$disabled.'>';
|
||||
$data[1] = '<input type="text" name="form_execute" id="form_execute" class="command_component command_advanced_conf text_input" size=100 value="'.$form_execute.'" '.$disabled.'>';
|
||||
if ($locked) {
|
||||
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ if (($create != '') || ($view != '')) {
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Plug-in parameters');
|
||||
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf" size=100 value="'.$parameters.'" '.$disabled.'>';
|
||||
$data[1] = '<input type="text" name="form_parameters" id="form_parameters" class="command_component command_advanced_conf text_input" size=100 value="'.$parameters.'" '.$disabled.'>';
|
||||
if ($locked) {
|
||||
$data[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_advanced_conf lock', 'class' => 'invert_filter']);
|
||||
}
|
||||
|
@ -484,13 +484,13 @@ if (($create != '') || ($view != '')) {
|
|||
$datam = [];
|
||||
$datam[0] = __('Description')."<span class='normal_weight'> ($macro_name)</span>";
|
||||
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
|
||||
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro'", true);
|
||||
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_macro text_input'", true);
|
||||
if ($locked) {
|
||||
$datam[1] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
|
||||
}
|
||||
|
||||
$datam[2] = __('Default value')."<span class='normal_weight'> ($macro_name)</span>";
|
||||
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro'", true);
|
||||
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_macro text_input'", true);
|
||||
if ($locked) {
|
||||
$datam[3] .= html_print_image('images/lock_mc.png', true, ['class' => 'command_macro lock', 'class' => 'invert_filter']);
|
||||
}
|
||||
|
|
|
@ -114,11 +114,11 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) {
|
|||
echo "'>";
|
||||
echo '<tr>
|
||||
<td class="datos">'.__('Link name').'</td>
|
||||
<td class="datos"><input type="text" name="name" size="35" value="'.$nombre.'"></td>';
|
||||
<td class="datos"><input type="text" class="text_input" name="name" size="50" value="'.$nombre.'"></td>';
|
||||
echo '</tr><tr>
|
||||
<td class="datos2">'.__('Link').'</td>
|
||||
<td class="datos2">
|
||||
<input type="text" name="link" size="50" value="'.$link.'"></td>';
|
||||
<input type="text" class="text_input" name="link" size="50" value="'.$link.'"></td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo "<table width='100%'>";
|
||||
|
|
|
@ -181,7 +181,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Subject').'<br>';
|
||||
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'" >';
|
||||
$data[0] .= '<input type="text" class="text_input" name="subject" size="35" value="'.$subject.'" >';
|
||||
|
||||
$data[1] = __('Group').'<br>';
|
||||
$data[1] .= '<div class="w250px">';
|
||||
|
|
|
@ -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 = 'PC220622';
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* 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
|
||||
|
@ -2688,10 +2688,10 @@ function events_print_event_table(
|
|||
// Get class name, for the link color, etc.
|
||||
$data[$i] = "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event['id_agente']."'>".agents_get_alias($event['id_agente']).'</A>';
|
||||
// For System or SNMP generated alerts.
|
||||
} else if ($event['event_type'] == 'system') {
|
||||
} else if ($event['event_type'] === 'system') {
|
||||
$data[$i] = __('System');
|
||||
} else {
|
||||
$data[$i] = __('Alert').'SNMP';
|
||||
$data[$i] = '';
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
|
|
@ -2690,7 +2690,9 @@ function html_print_input_password(
|
|||
}
|
||||
|
||||
if ($class) {
|
||||
$attr['class'] = $class;
|
||||
$attr['class'] = $class.' '.'password_input';
|
||||
} else {
|
||||
$attr['class'] = 'password_input';
|
||||
}
|
||||
|
||||
if ($disabled === false) {
|
||||
|
@ -2761,7 +2763,9 @@ function html_print_input_text(
|
|||
}
|
||||
|
||||
if ($class != '') {
|
||||
$attr['class'] = $class;
|
||||
$attr['class'] = $class.' '.'text_input';
|
||||
} else {
|
||||
$attr['class'] = 'text_input';
|
||||
}
|
||||
|
||||
if ($onChange != '') {
|
||||
|
@ -4554,7 +4558,7 @@ function html_print_autocomplete_modules(
|
|||
100,
|
||||
false,
|
||||
'',
|
||||
['style' => 'background: url('.$module_icon.') no-repeat right; '.$text_color.'']
|
||||
['style' => 'border: none; padding: 2px 5px; margin-bottom: 4px; border-bottom: 1px solid #ccc; border-radius: 0; background: url('.$module_icon.') no-repeat right; '.$text_color.'']
|
||||
);
|
||||
html_print_input_hidden($name.'_hidden', $id_agent_module);
|
||||
|
||||
|
|
|
@ -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);';
|
||||
|
|
|
@ -5882,7 +5882,7 @@ function ui_print_agent_autocomplete_input($parameters)
|
|||
}
|
||||
|
||||
$attrs = [];
|
||||
$attrs['style'] = 'padding-right: 20px; background: url('.$icon_image.') no-repeat right; '.$text_color.'';
|
||||
$attrs['style'] = 'padding-right: 20px; padding: 2px 5px; margin-bottom: 4px; border: none; border-bottom: 1px solid #ccc; border-radius: 0; background: url('.$icon_image.') no-repeat right; '.$text_color.'';
|
||||
|
||||
if (!$disabled_javascript_on_blur_function) {
|
||||
$attrs['onblur'] = $javascript_on_blur_function_name.'()';
|
||||
|
|
|
@ -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;" +
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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.
|
||||
|
|
|
@ -9054,3 +9054,21 @@ div#err_msg_centralised {
|
|||
padding-top: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.text_input {
|
||||
background-color: transparent !important;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
margin-bottom: 4px;
|
||||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
.password_input {
|
||||
background-color: transparent !important;
|
||||
border: none !important;
|
||||
border-radius: 0 !important;
|
||||
border-bottom: 1px solid #ccc !important;
|
||||
margin-bottom: 4px !important;
|
||||
padding: 2px 5px !important;
|
||||
}
|
||||
|
|
|
@ -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 = '220622';
|
||||
$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 = '';
|
||||
}
|
||||
|
|
|
@ -2311,7 +2311,7 @@ function process_datatables_item(item) {
|
|||
item.evento = evn;
|
||||
|
||||
/* Group name */
|
||||
if (item.id_grupo == "0") {
|
||||
if (typeof item.id_grupo === 'undefined' || item.id_grupo == "0") {
|
||||
item.id_grupo = "<?php echo __('All'); ?>";
|
||||
} else {
|
||||
item.id_grupo = item.group_name;
|
||||
|
@ -2331,7 +2331,7 @@ function process_datatables_item(item) {
|
|||
}
|
||||
})(item.custom_data);
|
||||
|
||||
if (item_custom_data_obj !== false) {
|
||||
if (item_custom_data_obj !== false && item_custom_data_obj !== null) {
|
||||
for (const [attr_name, val] of Object.entries(item_custom_data_obj)) {
|
||||
custom_data_str += attr_name + ' = ' + val + '<br>';
|
||||
}
|
||||
|
|
|
@ -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 220622
|
||||
|
||||
# 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 220622
|
||||
|
||||
# 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 220622
|
||||
%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`),
|
||||
|
@ -2818,6 +2819,8 @@ CREATE TABLE IF NOT EXISTS `tservice` (
|
|||
`evaluate_sla` INT NOT NULL DEFAULT 0,
|
||||
`is_favourite` TINYINT NOT NULL DEFAULT 0,
|
||||
`enable_sunburst` TINYINT NOT NULL DEFAULT 0,
|
||||
`asynchronous` TINYINT NOT NULL DEFAULT 0,
|
||||
`rca` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to define services to monitor'
|
||||
|
@ -3476,6 +3479,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-220622
|
||||
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-220622"
|
||||
|
||||
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 = "220622";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -3005,10 +3005,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
|
||||
|
@ -3029,6 +3029,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 = "220622";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -40,6 +40,7 @@ use PandoraFMS::ProducerConsumerServer;
|
|||
|
||||
# Inherits from PandoraFMS::ProducerConsumerServer
|
||||
our @ISA = qw(PandoraFMS::ProducerConsumerServer);
|
||||
our @EXPORT = qw(start_snmptrapd);
|
||||
|
||||
# Global variables
|
||||
my @TaskQueue :shared;
|
||||
|
@ -442,26 +443,29 @@ sub start_snmptrapd ($) {
|
|||
|
||||
# Manual start of snmptrapd
|
||||
if ($config->{'snmp_trapd'} eq 'manual') {
|
||||
logger ($config, "No SNMP trap daemon configured. Start snmptrapd manually.", 1);
|
||||
print_message ($config, " [*] No SNMP trap daemon configured. Start snmptrapd manually.", 1);
|
||||
my $noSNMPTrap = "No SNMP trap daemon configured. Start snmptrapd manually.";
|
||||
logger ($config, $noSNMPTrap, 1);
|
||||
print_message ($config, " [*] $noSNMPTrap", 1);
|
||||
|
||||
if (! -f $config->{'snmp_logfile'}) {
|
||||
logger ($config, "SNMP log file " . $config->{'snmp_logfile'} . " not found.", 1);
|
||||
print_message ($config, " [E] SNMP log file " . $config->{'snmp_logfile'} . " not found.", 1);
|
||||
my $noLogFile = "SNMP log file " . $config->{'snmp_logfile'} . " not found.";
|
||||
logger ($config, $noLogFile, 1);
|
||||
print_message ($config, " [E] $noLogFile", 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if ( -e $pid_file && open (PIDFILE, $pid_file)) {
|
||||
my $pid = <PIDFILE> + 0;
|
||||
close PIDFILE;
|
||||
close PIDFILE;
|
||||
|
||||
# Check if snmptrapd is running
|
||||
if ($snmptrapd_running = kill (0, $pid)) {
|
||||
logger ($config, "snmptrapd (pid $pid) is already running, attempting to kill it...", 1);
|
||||
print_message ($config, "snmptrapd (pid $pid) is already running, attempting to kill it...", 1);
|
||||
my $alreadyRunning = "snmptrapd (pid $pid) is already running, attempting to kill it...";
|
||||
logger ($config, $alreadyRunning, 1);
|
||||
print_message ($config, " [*] $alreadyRunning ", 1);
|
||||
kill (9, $pid);
|
||||
}
|
||||
}
|
||||
|
@ -471,17 +475,20 @@ sub start_snmptrapd ($) {
|
|||
|
||||
# Select agent-addr field of the PDU or PDU source address for V1 traps
|
||||
my $address_format = ($config->{'snmp_pdu_address'} eq '0' ? '%a' : '%b');
|
||||
|
||||
|
||||
my $snmptrapd_args = ' -t -On -n' . $snmp_ignore_authfailure . ' -Lf ' . $config->{'snmp_logfile'} . ' -p ' . $pid_file;
|
||||
$snmptrapd_args .= ' --format1=SNMPv1[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]' . $address_format . '[**]%N[**]%w[**]%W[**]%q[**]%v\\\n';
|
||||
$snmptrapd_args .= ' --format2=SNMPv2[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%b[**]%v\\\n';
|
||||
|
||||
if (system ($config->{'snmp_trapd'} . $snmptrapd_args . " >$DEVNULL 2>&1") != 0) {
|
||||
logger ($config, " [E] Could not start snmptrapd.", 1);
|
||||
print_message ($config, " [E] Could not start snmptrapd.", 1);
|
||||
my $showError = "Could not start snmptrapd.";
|
||||
logger ($config, $showError, 1);
|
||||
print_message ($config, " [E] $showError ", 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
print_message ($config, " [*] snmptrapd started and running.", 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.762
|
||||
%define release 220620
|
||||
%define release 220622
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.762
|
||||
%define release 220620
|
||||
%define release 220622
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.762"
|
||||
PI_BUILD="220620"
|
||||
PI_BUILD="220622"
|
||||
|
||||
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 220622";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -49,11 +49,15 @@
|
|||
}
|
||||
|
||||
/var/log/pandora/pandora_snmptrap.log {
|
||||
su pandora apache
|
||||
weekly
|
||||
missingok
|
||||
size 500000
|
||||
rotate 1
|
||||
maxage 30
|
||||
notifempty
|
||||
postrotate
|
||||
pandora_manage /etc/pandora/pandora_server.conf --start_snmptrapd > /dev/null 2>/dev/null || true
|
||||
endscript
|
||||
copytruncate
|
||||
}
|
||||
|
|
|
@ -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 220622";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -231,6 +231,7 @@ sub help_screen{
|
|||
print "\nTOOLS:\n\n" unless $param ne '';
|
||||
help_screen_line('--exec_from_file', '<file_path> <option_to_execute> <option_params>', "Execute any CLI option \n\t with macros from CSV file");
|
||||
help_screen_line('--create_snmp_trap', '<name> <oid> <description> <severity>', "Create a new trap definition. \n\tSeverity 0 (Maintenance), 1(Info) , 2 (Normal), 3 (Warning), 4 (Critical), 5 (Minor) and 6 (Major)");
|
||||
help_screen_line('--start_snmptrapd', '[no parameters needed]', "Start the snmptrap process or restart if it is running");
|
||||
print "\nSETUP:\n\n" unless $param ne '';
|
||||
help_screen_line('--set_event_storm_protection', '<value>', "Enable (1) or disable (0) event \n\t storm protection");
|
||||
|
||||
|
@ -279,7 +280,7 @@ sub api_call($$$;$$$$) {
|
|||
my $ua = new LWP::UserAgent;
|
||||
my $url = $pa_config->{"console_api_url"};
|
||||
my $response = $ua->post($url, $params);
|
||||
|
||||
|
||||
if ($response->is_success) {
|
||||
$content = $response->decoded_content();
|
||||
}
|
||||
|
@ -1188,6 +1189,16 @@ sub cli_enable_group() {
|
|||
pandora_enable_group ($conf, $dbh, $id_group);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Start snmptrap process.
|
||||
# Related option: --start_snmptrapd
|
||||
##############################################################################
|
||||
sub cli_start_snmptrapd() {
|
||||
use PandoraFMS::SNMPServer;
|
||||
print_log "[INFO] Starting snmptrap process. \n";
|
||||
PandoraFMS::SNMPServer::start_snmptrapd(\%conf);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Create an agent.
|
||||
# Related option: --created_agent
|
||||
|
@ -7546,6 +7557,10 @@ sub pandora_manage_main ($$$) {
|
|||
param_check($ltotal, 1);
|
||||
cli_enable_group();
|
||||
}
|
||||
elsif ($param eq '--start_snmptrapd') {
|
||||
#param_check($ltotal, 0);
|
||||
cli_start_snmptrapd();
|
||||
}
|
||||
elsif ($param eq '--create_agent') {
|
||||
param_check($ltotal, 8, 4);
|
||||
cli_create_agent();
|
||||
|
|
Loading…
Reference in New Issue