Merge remote-tracking branch 'origin/develop' into ent-7074-Command-Center

This commit is contained in:
Daniel Barbero Martin 2021-04-29 08:34:41 +02:00
commit 2ca981b03e
44 changed files with 20812 additions and 18779 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.754-210428
Version: 7.0NG.754-210429
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.754
%define release 210428
%define release 210429
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.754
%define release 210428
%define release 210429
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.754"
PI_BUILD="210428"
PI_BUILD="210429"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210428}
{210429}
ViewReadme
{Yes}

View File

@ -81,6 +81,7 @@ Pandora_Module::Pandora_Module (string name) {
this->module_ff_type = "";
this->module_alert_template = "";
this->module_crontab = "";
this->module_wait_timeout = 500;
}
/**
@ -1722,3 +1723,18 @@ Pandora_Module::isIntensive () {
return true;
}
/**
* Set the WaitForSingleObject timeout.
*
* @param timeout Timeout in milliseconds.
*/
void
Pandora_Module::setWaitTimeout (int timeout) {
if (timeout < 0) {
return;
}
this->module_wait_timeout = timeout;
}

View File

@ -216,6 +216,7 @@ namespace Pandora_Modules {
string getDataOutput (Pandora_Data *data);
void cleanDataList ();
int module_wait_timeout;
public:
Pandora_Module (string name);
virtual ~Pandora_Module ();
@ -231,6 +232,7 @@ namespace Pandora_Modules {
int getInterval ();
int getIntensiveInterval ();
void setTimeout (int timeout);
void setWaitTimeout (int timeout);
int getTimeout ();
string getSave ();
bool getAsync ();

View File

@ -172,7 +172,7 @@ Pandora_Module_Exec::run () {
string output;
int tickbase = GetTickCount();
while ( (dwRet = WaitForSingleObject (pi.hProcess, 500)) != WAIT_ABANDONED ) {
while ( (dwRet = WaitForSingleObject (pi.hProcess, this->module_wait_timeout)) != WAIT_ABANDONED ) {
PeekNamedPipe (out_read, buffer, BUFSIZE, &read, &avail, NULL);
if (avail > 0) {
ReadFile (out_read, buffer, BUFSIZE, &read, NULL);
@ -180,11 +180,6 @@ Pandora_Module_Exec::run () {
output += (char *) buffer;
}
/* Change the output encoding */
if (this->native_encoding != -1){
changeOutputEncoding(&output);
}
if (dwRet == WAIT_OBJECT_0) {
break;
} else if(this->getTimeout() < GetTickCount() - tickbase) {
@ -220,6 +215,10 @@ Pandora_Module_Exec::run () {
}
// Command output mode
else if (!output.empty()) {
/* Change the output encoding */
if (this->native_encoding != -1){
changeOutputEncoding(&output);
}
this->setOutput (output);
} else {
this->setOutput ("");
@ -471,4 +470,3 @@ void Pandora_Module_Exec::changeOutputEncoding(string * string_change){
}
}

View File

@ -124,6 +124,7 @@ using namespace Pandora_Strutils;
#define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ")
#define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ")
string
parseLine (string line, string token) {
@ -178,7 +179,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags;
string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval;
string module_native_encoding, module_alert_template, module_ff_type;
string macro;
string macro, module_wait_timeout;
Pandora_Module *module;
bool numeric;
Module_Type type;
@ -260,6 +261,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_alert_template = "";
module_user_session = "";
macro = "";
module_wait_timeout = "";
stringtok (tokens, definition, "\n");
@ -291,6 +293,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_exec == "") {
module_exec = parseLine (line, TOKEN_EXEC);
}
if (module_wait_timeout == "") {
module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT);
}
if (module_proc == "") {
module_proc = parseLine (line, TOKEN_PROC);
}
@ -1130,6 +1135,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_timeout != "") {
module->setTimeout (atoi (module_timeout.c_str ()));
}
if (module_wait_timeout != "") {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_proc != "") {
module = new Pandora_Module_Proc (module_name,
@ -1230,6 +1238,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_timeout != ""){
module->setTimeout(atoi(module_timeout.c_str()));
}
if (module_wait_timeout != "") {
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
}
} else if (module_ping != "") {
if (module_ping_count == "") {
module_ping_count = "1";

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.754-210428
Version: 7.0NG.754-210429
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -26,4 +26,6 @@ UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event&#x20;name\",\"Eve
UPDATE `tskin` SET `name` = 'Default&#x20;theme' , `relative_path` = 'pandora.css' WHERE `id` = 1;
UPDATE `tskin` SET `name` = 'Black&#x20;theme' , `relative_path` = 'Black&#x20;theme' , `description` = 'Black&#x20;theme' WHERE `id` = 2;
ALTER TABLE tevent_filter ADD COLUMN `server_id` int(10) NOT NULL default 0;
COMMIT;

View File

@ -1506,6 +1506,7 @@ ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10);
ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL;
ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL;
ALTER TABLE tevent_filter ADD COLUMN `server_id` int(10) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tusuario`

View File

@ -115,7 +115,12 @@ function add_component_selection($id_network_component_type)
'',
'---'.__('Manual setup').'---',
0,
true
true,
false,
true,
'',
false,
'width: 460px; '
);
$data[1] .= '</span>';
$data[1] .= ' <span id="component_loading" class="invisible">';

View File

@ -257,6 +257,11 @@ if ($save_event_filter) {
$values['id_extra'] = get_parameter('id_extra');
$values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
$exists = (bool) db_get_value_filter(
'id_filter',
'tevent_filter',
@ -305,6 +310,10 @@ if ($update_event_filter) {
$values['user_comment'] = get_parameter('user_comment');
$values['id_source_event'] = get_parameter('id_source_event');
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
if (io_safe_output($values['tag_with']) == '["0"]') {
$values['tag_with'] = '[]';
}
@ -371,6 +380,13 @@ if ($get_filter_values) {
}
}
if (is_metaconsole()) {
$server_name = db_get_value('server_name', 'tmetaconsole_setup', 'id', $event_filter['server_id']);
if ($server_name !== false) {
$event_filter['server_name'] = $server_name;
}
}
$event_filter['module_search'] = io_safe_output(db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $event_filter['id_agent_module']]));
}
@ -476,7 +492,6 @@ function load_form_filter() {
},
function (data) {
jQuery.each (data, function (i, val) {
console.log(val);
if (i == 'id_name')
$("#hidden-id_name").val(val);
if (i == 'id_group'){
@ -522,6 +537,10 @@ function load_form_filter() {
$("#text-user_comment").val(val);
if (i == 'id_source_event')
$("#text-id_source_event").val(val);
if (i == 'server_id')
$("#server_id").val(val);
if (i == 'server_name')
$("#select2-server_id-container").text(val);
if(i == 'date_from')
$("#text-date_from").val(val);
if(i == 'date_to')
@ -752,7 +771,8 @@ function save_new_filter() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val()
},
function (data) {
$("#info_box").hide();
@ -822,7 +842,8 @@ function save_update_filter() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id": $("#server_id").val()
},
function (data) {

View File

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

View File

@ -3013,15 +3013,11 @@ function events_get_agent(
) {
global $config;
if (!is_numeric($date)) {
if (is_numeric($date) === false) {
$date = time_w_fixed_tz($date);
}
if (is_metaconsole() && $events_group === false) {
$id_server = true;
}
if (empty($date)) {
if (empty($date) === true) {
$date = get_system_time();
}
@ -3156,7 +3152,7 @@ function events_get_agent(
}
}
if (is_metaconsole() && $id_server) {
if (is_metaconsole() === true && empty($id_server) === false) {
$sql_where .= ' AND server_id = '.$id_server;
}
@ -3173,7 +3169,7 @@ function events_get_agent(
} else {
return events_get_events_no_grouped(
$sql_where,
(is_metaconsole() === true && $id_server === false) ? true : false,
(is_metaconsole() === true && empty($id_server) === false) ? true : false,
$history
);
}
@ -3750,7 +3746,7 @@ function events_page_responses($event, $childrens_ids=[])
['id_group' => $id_groups]
);
if (empty($event_responses)) {
if (empty($event_responses) || (!check_acl($config['id_user'], 0, 'EW') && !check_acl($config['id_user'], 0, 'EM'))) {
$data[1] = '<i>'.__('N/A').'</i>';
} else {
$responses = [];

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,7 @@
text-overflow: ellipsis;
white-space: nowrap;
color: white;
text-align: left;
}
.select2-container .select2-selection--single .select2-selection__clear {
position: relative;

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.754';
$build = '210428';
$build = '210429';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -1926,3 +1926,21 @@ switch ($tab) {
}
break;
}
?>
<script type="text/javascript">
// I do not understand, nor do I agree with this operation, but it is what it is.
$(document).ready (function () {
$('.ehorus_tab').hover(ehorus_tab_show, ehorus_tab_hide);
});
function ehorus_tab_show() {
$('.subsubmenu').show("fast");
}
function ehorus_tab_hide() {
setTimeout(function() {
$('.subsubmenu').hide("fast");
},15000);
}
</script>

View File

@ -509,6 +509,7 @@ if ($loaded_filter !== false && $from_event_graph != 1) {
$id_extra = $filter['id_extra'];
$user_comment = $filter['user_comment'];
$id_source_event = $filter['id_source_event'];
$server_id = $filter['server_id'];
}
}
@ -2126,9 +2127,6 @@ function process_datatables_item(item) {
/* Group name */
if (item.id_grupo == "0") {
var severity_value = "<?php echo $severity; ?>";
const multiple = severity_value.split(",");
$("#severity").val(multiple);
item.id_grupo = "<?php echo __('All'); ?>";
} else {
item.id_grupo = item.group_name;

View File

@ -132,6 +132,10 @@ if (is_ajax()) {
$values['id_source_event'] = get_parameter('id_source_event');
}
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
$exists = (bool) db_get_value_filter(
'id_filter',
'tevent_filter',
@ -183,6 +187,10 @@ if (is_ajax()) {
$values['id_source_event'] = get_parameter('id_source_event');
}
if (is_metaconsole()) {
$values['server_id'] = get_parameter('server_id');
}
if (io_safe_output($values['tag_with']) == '["0"]') {
$values['tag_with'] = '[]';
}
@ -1365,6 +1373,8 @@ $(document).ready( function() {
$("#text-user_comment").val(val);
if (i == 'id_source_event')
$("#text-id_source_event").val(val);
if (i == 'server_id')
$("#server_id").val(val);
});
reorder_tags_inputs();
// Update the info with the loaded filter
@ -1405,9 +1415,10 @@ $(document).ready( function() {
$("#text-id_extra").val('');
$("#text-user_comment").val('');
$("#text-id_source_event").val('');
$("#server_id").val('');
clear_tags_inputs();
// Update the view of filter load with no loaded filters message
$('#filter_loaded_span').html($('#not_filter_loaded_text').html());
@ -1483,6 +1494,8 @@ $(document).ready( function() {
$("#text-module_search").val(val);
if(i == 'id_source_event')
$("#text-id_source_event").val(val);
if(i == 'server_id')
$("#server_id").val(val);
}
});
reorder_tags_inputs();
@ -1553,7 +1566,8 @@ $(document).ready( function() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id" : $("#server_id").val()
},
function (data) {
@ -1655,8 +1669,8 @@ $(document).ready( function() {
"source": $("#text-source").val(),
"id_extra": $("#text-id_extra").val(),
"user_comment": $("#text-user_comment").val(),
"id_source_event": $("#text-id_source_event").val()
"id_source_event": $("#text-id_source_event").val(),
"server_id" : $("#server_id").val()
},
function (data) {
$(".info_box").hide();

View File

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

View File

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

View File

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

View File

@ -1218,6 +1218,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` (
`id_extra` tinytext NOT NULL,
`user_comment` text NOT NULL,
`id_source_event` int(10) NULL default 0,
`server_id` int(10) NOT NULL default 0,
PRIMARY KEY (`id_filter`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.754-210428
Version: 7.0NG.754-210429
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -237,8 +237,15 @@ sub get_command_id ($$) {
########################################################################
sub get_agent_id ($$) {
my ($dbh, $agent_name) = @_;
my $is_meta = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token like 'metaconsole'");
my $rc;
if($is_meta == 1) {
$rc = get_db_value ($dbh, "SELECT id_agente FROM tmetaconsole_agent WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
} else {
$rc = get_db_value ($dbh, "SELECT id_agente FROM tagente WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
}
my $rc = get_db_value ($dbh, "SELECT id_agente FROM tagente WHERE nombre = ? OR direccion = ?", safe_input($agent_name), $agent_name);
return defined ($rc) ? $rc : -1;
}

View File

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

View File

@ -1733,7 +1733,7 @@ sub cron_check_interval {
my ($down, $up) = cron_get_interval($elem_cron);
# Check if it is not a range
if (!defined($up)) {
if (!defined($up) || $up eq $down) {
return ($down == $elem_curr_time) ? 1 : 0;
}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.754
%define release 210428
%define release 210429
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.754
%define release 210428
%define release 210429
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

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

View File

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