Merge remote-tracking branch 'origin/develop' into ent-4697-cicd-pandorafms

This commit is contained in:
fbsanchez 2020-01-02 09:13:32 +01:00
commit 154b0c367f
43 changed files with 826 additions and 88 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.742-191223 Version: 7.0NG.742-200102
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# 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. # GNU General Public License for more details.
pandora_version="7.0NG.742-191223" pandora_version="7.0NG.742-200102"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.742" PI_VERSION="7.0NG.742"
PI_BUILD="191223" PI_BUILD="200102"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{191223} {200102}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.742-191223 Version: 7.0NG.742-200102
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# 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. # GNU General Public License for more details.
pandora_version="7.0NG.742-191223" pandora_version="7.0NG.742-200102"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -22,6 +22,17 @@ function dbmanager_query($sql, &$error, $dbconnection)
} }
$sql = html_entity_decode($sql, ENT_QUOTES); $sql = html_entity_decode($sql, ENT_QUOTES);
// Extract the text in quotes to add html entities before query db.
$patttern = '/(?:"|\')+([^"\']*)(?:"|\')+/m';
$sql = preg_replace_callback(
$patttern,
function ($matches) {
return '"'.io_safe_input($matches[1]).'"';
},
$sql
);
if ($config['mysqli']) { if ($config['mysqli']) {
$result = mysqli_query($dbconnection, $sql); $result = mysqli_query($dbconnection, $sql);
if ($result === false) { if ($result === false) {

View File

@ -13,6 +13,8 @@
require_once 'include/functions_messages.php'; require_once 'include/functions_messages.php';
require_once 'include/functions_servers.php'; require_once 'include/functions_servers.php';
require_once 'include/functions_notifications.php'; require_once 'include/functions_notifications.php';
require_once 'include/ajax/order_interpreter.php';
ui_require_css_file('order_interpreter');
// Check permissions // Check permissions
// Global errors/warnings checking. // Global errors/warnings checking.
@ -99,7 +101,8 @@ if ($config['menu_type'] == 'classic') {
if ($acl_head_search) { if ($acl_head_search) {
// Search bar. // Search bar.
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">'; $search_bar = '<form autocomplete="off" method="get" style="display: inline;" name="quicksearch" action="">';
'<input autocomplete="false" name="hidden" type="text" style="display:none;">';
if (!isset($config['search_keywords'])) { if (!isset($config['search_keywords'])) {
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>'; $search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
} else { } else {
@ -110,7 +113,7 @@ if ($config['menu_type'] == 'classic') {
} }
} }
$search_bar .= '<input type="text" id="keywords" name="keywords"'; $search_bar .= '<input id="keywords" name="keywords"';
if (!isset($config['search_keywords'])) { if (!isset($config['search_keywords'])) {
$search_bar .= "value='".__('Enter keywords to search')."'"; $search_bar .= "value='".__('Enter keywords to search')."'";
} else if (strlen($config['search_keywords']) == 0) { } else if (strlen($config['search_keywords']) == 0) {
@ -119,9 +122,11 @@ if ($config['menu_type'] == 'classic') {
$search_bar .= "value='".$config['search_keywords']."'"; $search_bar .= "value='".$config['search_keywords']."'";
} }
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" $search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
onkeyup="javascript: fieldKeyWordEmpty = false;" class="search_input" />'; onkeyup="showinterpreter()" class="search_input"/>';
$search_bar .= '<div id="result_order" class="result_order"></div>';
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"'; // $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />"; $search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
$search_bar .= '</form>'; $search_bar .= '</form>';
@ -622,7 +627,7 @@ if ($config['menu_type'] == 'classic') {
}); });
} }
// Resize event // Resize event.
window.addEventListener("resize", function() { window.addEventListener("resize", function() {
attatch_to_image(); attatch_to_image();
}); });
@ -630,7 +635,86 @@ if ($config['menu_type'] == 'classic') {
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>; var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>; var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
function showinterpreter(){
document.onclick = function(e) {
$('#result_order').hide();
$('#keywords').addClass('search_input');
$('#keywords').removeClass('results-found');
$('#keywords').value = '';
$('#keywords').attr('placeholder','Enter keywords to search');
}
if(event.keyCode == 13 && $("#result_items li.active").length != 0 )
{
window.location = $('#result_items').find("li.active a").attr('href');
}
var code = event.key;
switch (code){
case 'ArrowDown':
if($("#result_items li.active").length!=0)
{
var storeTarget = $('#result_items').find("li.active").next();
$("#result_items li.active").removeClass("active");
storeTarget.focus().addClass("active");
}
else
{
$('#result_items').find("li:first").focus().addClass("active");
}
return;
case 'ArrowUp':
if($("#result_items li.active"))
{
var storeTarget = $('#result_items').find("li.active").prev();
$("#result_items li.active").removeClass("active");
storeTarget.focus().addClass("active");
}
else
{
$('#result_items').find("li:first").focus().addClass("active");
}
return;
case 'ArrowRight':
return;
case 'ArrowLeft':
return;
}
if( $('#keywords').val() === ''){
$('#keywords').addClass('search_input');
$('#keywords').removeClass('results-found');
$('#result_order').hide();
$('#keywords').attr('placeholder','Enter keywords to search');
}else {
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "html",
data: {
page: 'include/ajax/order_interpreter',
method: 'getResult',
text: $('#keywords').val(),
},
success: function (data) {
$('#result_order').html(data);
console.log(data);
},
error: function (data) {
console.error("Fatal error in AJAX call to interpreter order", data)
}
});
$('#keywords').removeClass('search_input');
$('#keywords').addClass('results-found');
$('#result_order').show();
}
}
/** /**
* Loads modal from AJAX to add feedback. * Loads modal from AJAX to add feedback.
*/ */

View File

@ -82,12 +82,18 @@ if (!empty($page) && !empty($sec)) {
} }
$login_body_style = ''; $login_body_style = '';
$login_body_class = '';
// Overrides the default background with the defined by the user. // Overrides the default background with the defined by the user.
if (!empty($config['login_background'])) { if (!empty($config['login_background'])) {
$background_url = 'images/backgrounds/'.$config['login_background']; $background_url = 'images/backgrounds/'.$config['login_background'];
$login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\""; $login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\"";
} }
// Support for Internet Explorer and Microsoft Edge browsers
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) {
$login_body_class = "class='login_body_trident'";
}
// Get alternative custom in case of db fail. // Get alternative custom in case of db fail.
$custom_fields = [ $custom_fields = [
'custom_logo_login', 'custom_logo_login',
@ -111,7 +117,7 @@ foreach ($custom_fields as $field) {
// Get the custom icons. // Get the custom icons.
$docs_logo = ui_get_docs_logo(); $docs_logo = ui_get_docs_logo();
$support_logo = ui_get_support_logo(); $support_logo = ui_get_support_logo();
echo '<div id="login_body" '.$login_body_style.'>'; echo '<div id="login_body" '.$login_body_class.' '.$login_body_style.'>';
echo '<div id="header_login">'; echo '<div id="header_login">';
echo '<div id="list_icon_docs_support"><ul>'; echo '<div id="list_icon_docs_support"><ul>';

View File

@ -454,10 +454,10 @@ if (!$maps && !is_metaconsole()) {
4 => 'action_buttons', 4 => 'action_buttons',
]; ];
$data[3] = '<a class="copy_visualmap" href="index.php?sec=network&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image('images/copy.png', true).'</a>'; $data[3] = '<a class="copy_visualmap" href="index.php?sec=network&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image('images/copy.png', true).'</a>';
$data[4] = '<a class="delete_visualmap" href="index.php?sec=network&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image('images/cross.png', true).'</a>'; $data[4] = '<a class="delete_visualmap" href="index.php?sec=network&amp;sec2=godmode/reporting/map_builder&amp;id_layout='.$map['id'].'&amp;delete_layout=1" onclick="javascript: if (!confirm(\''.__('Are you sure?').'\n'.__('Delete').': '.$map['name'].'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
} else { } else {
$data[3] = '<a class="copy_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image('images/copy.png', true).'</a>'; $data[3] = '<a class="copy_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_layout='.$map['id'].'&amp;copy_layout=1">'.html_print_image('images/copy.png', true).'</a>';
$data[4] = '<a class="delete_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_layout='.$map['id'].'&amp;delete_layout=1">'.html_print_image('images/cross.png', true).'</a>'; $data[4] = '<a class="delete_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_layout='.$map['id'].'&amp;delete_layout=1" onclick="javascript: if (!confirm(\''.__('Are you sure?').'\n'.__('Delete').': '.$map['name'].'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
} }
} else { } else {
$data[3] = ''; $data[3] = '';

View File

@ -386,7 +386,7 @@ if ($items) {
} }
$table->head[4] = __('Time lapse'); $table->head[4] = __('Time lapse');
$table->head[5] = __('Name').' / '.__('Description'); $table->head[5] = __('Name or Description');
if (check_acl($config['id_user'], 0, 'RM')) { if (check_acl($config['id_user'], 0, 'RM')) {
$table->head[6] = '<span title="'.__('Options').'">'.__('Op.').'</span>'; $table->head[6] = '<span title="'.__('Options').'">'.__('Op.').'</span>';
if ($report_w || $report_m) { if ($report_w || $report_m) {

View File

@ -398,7 +398,7 @@ if (($create != '') || ($view != '')) {
} }
$data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" style="vertical-align: bottom;">'; $data[1] .= ' <a href="index.php?sec=gservers&sec2=godmode/servers/plugin&filemanager=1&id_plugin='.$form_id.'" style="vertical-align: bottom;">';
$data[1] .= html_print_image('images/file.png', true); $data[1] .= html_print_image('images/file.png', true, false, false, true);
$data[1] .= '</a>'; $data[1] .= '</a>';
$table->data['plugin_command'] = $data; $table->data['plugin_command'] = $data;

View File

@ -0,0 +1,62 @@
<?php
/**
* Order interpreter ajax controller.
*
* @category OrderInterpreter
* @package Pandora FMS
* @subpackage New Installation Welcome Window
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/include/class/OrderInterpreter.class.php';
if (is_ajax() === false) {
return;
}
$ajaxPage = 'include/ajax/order_interpreter';
// Control call flow.
try {
// User access and validation is being processed on class constructor.
$order_interpreter = new OrderInterpreter(true, $ajaxPage);
} catch (Exception $e) {
exit;
}
// Ajax controller.
$method = get_parameter('method', '');
if (method_exists($order_interpreter, $method) === true) {
if ($order_interpreter->ajaxMethod($method) === true) {
$order_interpreter->{$method}();
} else {
$order_interpreter->error('Unavailable method.');
}
} else {
$order_interpreter->error('Method not found. ['.$method.']');
}
// Stop any execution.
exit;

View File

@ -0,0 +1,453 @@
<?php
/**
* Welcome to Pandora FMS feature.
*
* @category Class
* @package Pandora FMS
* @subpackage Order Interpreter
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
global $config;
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
ui_require_css_file('order_interpreter');
/**
* Class OrderInterpreter.
*/
class OrderInterpreter extends Wizard
{
/**
* Allowed methods to be called using AJAX request.
*
* @var array
*/
public $AJAXMethods = ['getResult'];
/**
* Url of controller.
*
* @var string
*/
public $ajaxController;
/**
* Generates a JSON error.
*
* @param string $msg Error message.
*
* @return void
*/
public function error($msg)
{
echo json_encode(
['error' => $msg]
);
}
/**
* Checks if target method is available to be called using AJAX.
*
* @param string $method Target method.
*
* @return boolean True allowed, false not.
*/
public function ajaxMethod($method)
{
global $config;
// Check access.
check_login();
return in_array($method, $this->AJAXMethods);
}
/**
* Constructor.
*
* @param string $ajax_controller Controller.
*
* @return object
* @throws Exception On error.
*/
public function __construct(
$ajax_controller='include/ajax/order_interpreter'
) {
global $config;
$this->ajaxController = $ajax_controller;
$this->pages_menu = [
[
'name' => __('Tactical View'),
'icon' => ui_get_full_url(
'images/op_monitoring.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=view&sec2=operation/agentes/tactical'
),
'acl' => check_acl(
$config['id_user'],
0,
'AR'
) || check_acl(
$config['id_user'],
0,
'AW'
),
],
[
'name' => __('Agent Management'),
'icon' => ui_get_full_url(
'images/gm_resources.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente'
),
'acl' => check_acl(
$config['id_user'],
0,
'AW'
) && check_acl(
$config['id_user'],
0,
'AD'
),
],
[
'name' => __('General Setup'),
'icon' => ui_get_full_url(
'images/gm_setup.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=general&sec2=godmode/setup/setup&section=general'
),
'acl' => check_acl(
$config['id_user'],
0,
'PM'
) || is_user_admin(
$config['id_user']
),
],
[
'name' => __('Manage Policies'),
'icon' => ui_get_full_url(
'images/gm_configuration.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=gmodules&sec2=enterprise/godmode/policies/policies'
),
'acl' => check_acl(
$config['id_user'],
0,
'AW'
),
],
[
'name' => __('List Alerts'),
'icon' => ui_get_full_url(
'images/gm_alerts.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=galertas&sec2=godmode/alerts/alert_list'
),
'acl' => check_acl(
$config['id_user'],
0,
'LW'
)
|| check_acl(
$config['id_user'],
0,
'AD'
)
|| check_acl(
$config['id_user'],
0,
'LM'
),
],
[
'name' => __('View Events'),
'icon' => ui_get_full_url(
'images/op_events.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=eventos&sec2=operation/events/events'
),
'acl' => check_acl(
$config['id_user'],
0,
'ER'
) ||
check_acl(
$config['id_user'],
0,
'EW'
) ||
check_acl(
$config['id_user'],
0,
'EM'
),
],
[
'name' => __('Dashboard'),
'icon' => ui_get_full_url(
'images/op_reporting.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=reporting&sec2=enterprise/dashboard/dashboards'
),
'acl' => check_acl(
$config['id_user'],
0,
'RR'
),
],
[
'name' => __('Visual Console'),
'icon' => ui_get_full_url(
'images/op_network.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=network&sec2=godmode/reporting/map_builder'
),
'acl' => check_acl(
$config['id_user'],
0,
'VR'
),
],
[
'name' => __('Manage Servers'),
'icon' => ui_get_full_url(
'images/gm_servers.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/modificar_server'
),
'acl' => check_acl(
$config['id_user'],
0,
'AW'
),
],
[
'name' => __('Edit User'),
'icon' => ui_get_full_url(
'images/gm_users.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=workspace&sec2=operation/users/user_edit'
),
'acl' => true,
],
[
'name' => __('Tree View'),
'icon' => ui_get_full_url(
'images/op_monitoring.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=view&sec2=operation/tree'
),
'acl' => true,
],
[
'name' => __('Network Component'),
'icon' => ui_get_full_url(
'images/gm_configuration.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components'
),
'acl' => check_acl(
$config['id_user'],
0,
'PM'
),
],
[
'name' => __('Task List'),
'icon' => ui_get_full_url(
'images/gm_discovery.menu.png'
),
'url' => ui_get_full_url(
'index.php?sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist'
),
'acl' => check_acl(
$config['id_user'],
0,
'AR'
)
|| check_acl(
$config['id_user'],
0,
'AW'
)
|| check_acl(
$config['id_user'],
0,
'AM'
)
|| check_acl(
$config['id_user'],
0,
'RR'
)
|| check_acl(
$config['id_user'],
0,
'RW'
)
|| check_acl(
$config['id_user'],
0,
'RM'
)
|| check_acl(
$config['id_user'],
0,
'PM'
),
],
[
'name' => __('Update Manager'),
'icon' => ui_get_full_url(
'images/um_messages.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup'
),
'acl' => check_acl(
$config['id_user'],
0,
'PM'
) && is_user_admin($config['id_user']),
],
[
'name' => __('Manage Agent Groups'),
'icon' => ui_get_full_url(
'images/gm_users.menu_gray.png'
),
'url' => ui_get_full_url(
'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=groups'
),
'acl' => check_acl(
$config['id_user'],
0,
'PM'
),
],
];
}
/**
* Method to print order interpreted on header search input.
*
* @return void
*/
public function getResult()
{
global $config;
// Take value from input search.
$text = get_parameter('text', '');
$array_found = [];
$iterator = 0;
$more_results = 0;
if ($text !== '') {
echo '<div class="show_result_interpreter">';
echo '<ul id="result_items">';
foreach ($this->pages_menu as $key => $value) {
if (preg_match(
'/.*'.io_safe_output($text).'.*/i',
__('GO TO '.$value['name'])
) && $value['acl']
) {
if ($iterator <= 9) {
echo '<li class="list_found" name="'.$iterator.'" id="'.$iterator.'">';
echo '
Go to &nbsp;
<img src="'.$this->pages_menu[$key]['icon'].'">';
echo '&nbsp;
<a href="'.$this->pages_menu[$key]['url'].'">
'.$value['name'].'</a><br>';
}
$iterator ++;
if ($iterator > 10) {
$more_results ++;
}
}
}
if ($iterator > 9) {
echo '</li>';
}
echo $this->loadJS();
echo '</ul>';
if ($iterator > 10) {
echo '<div class="more_results">
+ '.$more_results.' '.__('results found').'</div>';
}
if ($iterator === 0) {
echo __('No results found');
}
echo '</div>';
}
}
/**
* Load JS content.
* function to create JS actions.
*
* @return string HTML code for javascript functionality.
*/
public function loadJS()
{
ob_start();
?>
<script type="text/javascript">
</script>
<?php
return ob_get_clean();
}
}

View File

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

View File

@ -3070,21 +3070,20 @@ function api_get_policy_modules($thrash1, $thrash2, $other, $thrash3)
/** /**
* Create a network module in agent. And return the id_agent_module of new module. * Create a network module in agent.
* And return the id_agent_module of new module.
* *
* @param string $id Name of agent to add the module. * @param string $id Name of agent to add the module.
* @param $thrash1 Don't use. * @param string $thrash1 Don't use.
* @param array $other it's array, $other as param is <name_module>;<disabled>;<id_module_type>; * @param array $other It's array, $other as param is <name_module>;<disabled>;<id_module_type>;
* <id_module_group>;<min_warning>;<max_warning>;<str_warning>;<min_critical>;<max_critical>;<str_critical>;<ff_threshold>; * <id_module_group>;<min_warning>;<max_warning>;<str_warning>;<min_critical>;<max_critical>;<str_critical>;<ff_threshold>;
* <history_data>;<ip_target>;<module_port>;<snmp_community>;<snmp_oid>;<module_interval>;<post_process>; * <history_data>;<ip_target>;<module_port>;<snmp_community>;<snmp_oid>;<module_interval>;<post_process>;
* <min>;<max>;<custom_id>;<description>;<disabled_types_event>;<module_macros>; * <min>;<max>;<custom_id>;<description>;<disabled_types_event>;<module_macros>;
* <each_ff>;<ff_threshold_normal>;<ff_threshold_warning>;<ff_threshold_critical>; in this order * <each_ff>;<ff_threshold_normal>;<ff_threshold_warning>;<ff_threshold_critical>; in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>) * and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>).
* example: * @param string $thrash3 Don't use.
* * @example: api.php?op=set&op2=create_network_module&id=pepito&other=prueba|0|7|1|10|15|0|16|18|0|15|0|www.google.es|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_|*
* api.php?op=set&op2=create_network_module&id=pepito&other=prueba|0|7|1|10|15|0|16|18|0|15|0|www.google.es|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_| * @return mixed Return.
*
* @param $thrash3 Don't use
*/ */
function api_set_create_network_module($id, $thrash1, $other, $thrash3) function api_set_create_network_module($id, $thrash1, $other, $thrash3)
{ {
@ -3155,16 +3154,17 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
'min_ff_event_critical' => $other['data'][27], 'min_ff_event_critical' => $other['data'][27],
'critical_inverse' => $other['data'][28], 'critical_inverse' => $other['data'][28],
'warning_inverse' => $other['data'][29], 'warning_inverse' => $other['data'][29],
'ff_type' => $other['data'][30],
]; ];
if (! $values['descripcion']) { if (! $values['descripcion']) {
$values['descripcion'] = ''; $values['descripcion'] = '';
// Column 'descripcion' cannot be null // Column 'descripcion' cannot be null.
} }
if (! $values['module_macros']) { if (! $values['module_macros']) {
$values['module_macros'] = ''; $values['module_macros'] = '';
// Column 'module_macros' cannot be null // Column 'module_macros' cannot be null.
} }
if ($agent_by_alias) { if ($agent_by_alias) {
@ -3190,7 +3190,7 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
} }
if (is_error($idModule)) { if (is_error($idModule)) {
// TODO: Improve the error returning more info // TODO: Improve the error returning more info.
returnError('error_create_network_module', __('Error in creation network module.')); returnError('error_create_network_module', __('Error in creation network module.'));
} else { } else {
returnData('string', ['type' => 'string', 'data' => $idModule]); returnData('string', ['type' => 'string', 'data' => $idModule]);
@ -3307,6 +3307,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3)
'critical_inverse', 'critical_inverse',
'warning_inverse', 'warning_inverse',
'policy_linked', 'policy_linked',
'ff_type',
]; ];
$values = []; $values = [];
@ -3420,16 +3421,17 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
'min_ff_event_critical' => $other['data'][32], 'min_ff_event_critical' => $other['data'][32],
'critical_inverse' => $other['data'][33], 'critical_inverse' => $other['data'][33],
'warning_inverse' => $other['data'][34], 'warning_inverse' => $other['data'][34],
'ff_type' => $other['data'][35],
]; ];
if (! $values['descripcion']) { if (! $values['descripcion']) {
$values['descripcion'] = ''; $values['descripcion'] = '';
// Column 'descripcion' cannot be null // Column 'descripcion' cannot be null.
} }
if (! $values['module_macros']) { if (! $values['module_macros']) {
$values['module_macros'] = ''; $values['module_macros'] = '';
// Column 'module_macros' cannot be null // Column 'module_macros' cannot be null.
} }
if ($agent_by_alias) { if ($agent_by_alias) {
@ -3455,7 +3457,7 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
} }
if (is_error($idModule)) { if (is_error($idModule)) {
// TODO: Improve the error returning more info // TODO: Improve the error returning more info.
returnError('error_create_plugin_module', __('Error in creation plugin module.')); returnError('error_create_plugin_module', __('Error in creation plugin module.'));
} else { } else {
returnData('string', ['type' => 'string', 'data' => $idModule]); returnData('string', ['type' => 'string', 'data' => $idModule]);
@ -3562,6 +3564,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3)
'critical_inverse', 'critical_inverse',
'warning_inverse', 'warning_inverse',
'policy_linked', 'policy_linked',
'ff_type',
]; ];
$values = []; $values = [];
@ -3669,16 +3672,17 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3)
'ff_timeout' => $other['data'][23], 'ff_timeout' => $other['data'][23],
'critical_inverse' => $other['data'][24], 'critical_inverse' => $other['data'][24],
'warning_inverse' => $other['data'][25], 'warning_inverse' => $other['data'][25],
'ff_type' => $other['data'][26],
]; ];
if (! $values['descripcion']) { if (! $values['descripcion']) {
$values['descripcion'] = ''; $values['descripcion'] = '';
// Column 'descripcion' cannot be null // Column 'descripcion' cannot be null.
} }
if (! $values['module_macros']) { if (! $values['module_macros']) {
$values['module_macros'] = ''; $values['module_macros'] = '';
// Column 'module_macros' cannot be null // Column 'module_macros' cannot be null.
} }
if ($agent_by_alias) { if ($agent_by_alias) {
@ -3704,7 +3708,7 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3)
} }
if (is_error($idModule)) { if (is_error($idModule)) {
// TODO: Improve the error returning more info // TODO: Improve the error returning more info.
returnError('error_create_data_module', __('Error in creation data module.')); returnError('error_create_data_module', __('Error in creation data module.'));
} else { } else {
returnData('string', ['type' => 'string', 'data' => $idModule]); returnData('string', ['type' => 'string', 'data' => $idModule]);
@ -3785,7 +3789,7 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3)
if (! $values['descripcion']) { if (! $values['descripcion']) {
$values['descripcion'] = ''; $values['descripcion'] = '';
// Column 'descripcion' cannot be null // Column 'descripcion' cannot be null.
} }
if ($agent_by_alias) { if ($agent_by_alias) {
@ -3795,7 +3799,7 @@ function api_set_create_synthetic_module($id, $agent_by_alias, $other, $thrash3)
$idModule = modules_create_agent_module($idAgent, $name, $values, true); $idModule = modules_create_agent_module($idAgent, $name, $values, true);
if (is_error($idModule)) { if (is_error($idModule)) {
// TODO: Improve the error returning more info // TODO: Improve the error returning more info.
returnError('error_create_data_module', __('Error in creation data module.')); returnError('error_create_data_module', __('Error in creation data module.'));
} else { } else {
$synthetic_type = $other['data'][1]; $synthetic_type = $other['data'][1];
@ -4190,6 +4194,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3)
'critical_inverse', 'critical_inverse',
'warning_inverse', 'warning_inverse',
'policy_linked', 'policy_linked',
'ff_type',
]; ];
$values = []; $values = [];
@ -4277,7 +4282,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
$disabled_types_event[EVENTS_GOING_UNKNOWN] = (int) !$other['data'][27]; $disabled_types_event[EVENTS_GOING_UNKNOWN] = (int) !$other['data'][27];
$disabled_types_event = json_encode($disabled_types_event); $disabled_types_event = json_encode($disabled_types_event);
// SNMP version 3 // SNMP version 3.
if ($other['data'][14] == '3') { if ($other['data'][14] == '3') {
if ($other['data'][23] != 'AES' and $other['data'][23] != 'DES') { if ($other['data'][23] != 'AES' and $other['data'][23] != 'DES') {
returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. ')); returnError('error_create_snmp_module', __('Error in creation SNMP module. snmp3_priv_method doesn\'t exist. Set it to \'AES\' or \'DES\'. '));
@ -4329,6 +4334,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
'min_ff_event_normal' => $other['data'][31], 'min_ff_event_normal' => $other['data'][31],
'min_ff_event_warning' => $other['data'][32], 'min_ff_event_warning' => $other['data'][32],
'min_ff_event_critical' => $other['data'][33], 'min_ff_event_critical' => $other['data'][33],
'ff_type' => $other['data'][34],
]; ];
} else { } else {
$values = [ $values = [
@ -4360,12 +4366,13 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
'min_ff_event_normal' => $other['data'][25], 'min_ff_event_normal' => $other['data'][25],
'min_ff_event_warning' => $other['data'][26], 'min_ff_event_warning' => $other['data'][26],
'min_ff_event_critical' => $other['data'][27], 'min_ff_event_critical' => $other['data'][27],
'ff_type' => $other['data'][28],
]; ];
} }
if (! $values['descripcion']) { if (! $values['descripcion']) {
$values['descripcion'] = ''; $values['descripcion'] = '';
// Column 'descripcion' cannot be null // Column 'descripcion' cannot be null.
} }
if ($agent_by_alias) { if ($agent_by_alias) {
@ -4528,6 +4535,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
'min_ff_event_warning', 'min_ff_event_warning',
'min_ff_event_critical', 'min_ff_event_critical',
'policy_linked', 'policy_linked',
'ff_type',
]; ];
} else { } else {
$snmp_module_fields = [ $snmp_module_fields = [
@ -4559,6 +4567,7 @@ function api_set_update_snmp_module($id_module, $thrash1, $other, $thrash3)
'min_ff_event_warning', 'min_ff_event_warning',
'min_ff_event_critical', 'min_ff_event_critical',
'policy_linked', 'policy_linked',
'ff_type',
]; ];
} }
@ -4656,6 +4665,7 @@ function api_set_new_network_component($id, $thrash1, $other, $thrash2)
'min_ff_event_normal' => $other['data'][20], 'min_ff_event_normal' => $other['data'][20],
'min_ff_event_warning' => $other['data'][21], 'min_ff_event_warning' => $other['data'][21],
'min_ff_event_critical' => $other['data'][22], 'min_ff_event_critical' => $other['data'][22],
'ff_type' => $other['data'][23],
]; ];
$name_check = db_get_value('name', 'tnetwork_component', 'name', $id); $name_check = db_get_value('name', 'tnetwork_component', 'name', $id);
@ -4756,6 +4766,7 @@ function api_set_new_plugin_component($id, $thrash1, $other, $thrash2)
'min_ff_event_normal' => $other['data'][24], 'min_ff_event_normal' => $other['data'][24],
'min_ff_event_warning' => $other['data'][25], 'min_ff_event_warning' => $other['data'][25],
'min_ff_event_critical' => $other['data'][26], 'min_ff_event_critical' => $other['data'][26],
'ff_type' => $other['data'][27],
]; ];
$name_check = db_get_value('name', 'tnetwork_component', 'name', $id); $name_check = db_get_value('name', 'tnetwork_component', 'name', $id);
@ -4891,6 +4902,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2)
'min_ff_event_normal' => $other['data'][29], 'min_ff_event_normal' => $other['data'][29],
'min_ff_event_warning' => $other['data'][30], 'min_ff_event_warning' => $other['data'][30],
'min_ff_event_critical' => $other['data'][31], 'min_ff_event_critical' => $other['data'][31],
'ff_type' => $other['data'][32],
]; ];
} else { } else {
$values = [ $values = [
@ -4922,6 +4934,7 @@ function api_set_new_snmp_component($id, $thrash1, $other, $thrash2)
'min_ff_event_normal' => $other['data'][25], 'min_ff_event_normal' => $other['data'][25],
'min_ff_event_warning' => $other['data'][26], 'min_ff_event_warning' => $other['data'][26],
'min_ff_event_critical' => $other['data'][27], 'min_ff_event_critical' => $other['data'][27],
'ff_type' => $other['data'][28],
]; ];
} }
@ -5002,6 +5015,7 @@ function api_set_new_local_component($id, $thrash1, $other, $thrash2)
'min_ff_event_warning' => $other['data'][8], 'min_ff_event_warning' => $other['data'][8],
'min_ff_event_critical' => $other['data'][9], 'min_ff_event_critical' => $other['data'][9],
'ff_timeout' => $other['data'][10], 'ff_timeout' => $other['data'][10],
'ff_type' => $other['data'][11],
]; ];
$name_check = enterprise_hook( $name_check = enterprise_hook(
@ -6835,6 +6849,7 @@ function api_set_add_data_module_policy($id, $thrash1, $other, $thrash3)
$values['min_ff_event_warning'] = $other['data'][21]; $values['min_ff_event_warning'] = $other['data'][21];
$values['min_ff_event_critical'] = $other['data'][22]; $values['min_ff_event_critical'] = $other['data'][22];
$values['ff_timeout'] = $other['data'][23]; $values['ff_timeout'] = $other['data'][23];
$values['ff_type'] = $other['data'][24];
if ($name_module_policy !== false) { if ($name_module_policy !== false) {
if ($name_module_policy[0]['name'] == $other['data'][0]) { if ($name_module_policy[0]['name'] == $other['data'][0]) {
@ -7076,6 +7091,7 @@ function api_set_add_network_module_policy($id, $thrash1, $other, $thrash3)
$values['min_ff_event_normal'] = $other['data'][24]; $values['min_ff_event_normal'] = $other['data'][24];
$values['min_ff_event_warning'] = $other['data'][25]; $values['min_ff_event_warning'] = $other['data'][25];
$values['min_ff_event_critical'] = $other['data'][26]; $values['min_ff_event_critical'] = $other['data'][26];
$values['ff_type'] = $other['data'][27];
if ($name_module_policy !== false) { if ($name_module_policy !== false) {
if ($name_module_policy[0]['name'] == $other['data'][0]) { if ($name_module_policy[0]['name'] == $other['data'][0]) {
@ -7134,7 +7150,7 @@ function api_set_update_network_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
// Check if the module exists // Check if the module exists.
$module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']); $module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']);
if ($module_policy === false) { if ($module_policy === false) {
@ -7241,7 +7257,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
// Check if the module is already in the policy // Check if the module is already in the policy.
$name_module_policy = enterprise_hook('policies_get_modules', [$id, ['name' => $other['data'][0]], 'name']); $name_module_policy = enterprise_hook('policies_get_modules', [$id, ['name' => $other['data'][0]], 'name']);
if ($name_module_policy === ENTERPRISE_NOT_HOOK) { if ($name_module_policy === ENTERPRISE_NOT_HOOK) {
@ -7285,6 +7301,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
$values['min_ff_event_normal'] = $other['data'][29]; $values['min_ff_event_normal'] = $other['data'][29];
$values['min_ff_event_warning'] = $other['data'][30]; $values['min_ff_event_warning'] = $other['data'][30];
$values['min_ff_event_critical'] = $other['data'][31]; $values['min_ff_event_critical'] = $other['data'][31];
$values['ff_type'] = $other['data'][32];
if ($name_module_policy !== false) { if ($name_module_policy !== false) {
if ($name_module_policy[0]['name'] == $other['data'][0]) { if ($name_module_policy[0]['name'] == $other['data'][0]) {
@ -7344,7 +7361,7 @@ function api_set_update_plugin_module_policy($id, $thrash1, $other, $thrash3)
return; return;
} }
// Check if the module exists // Check if the module exists.
$module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']); $module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']);
if ($module_policy === false) { if ($module_policy === false) {
@ -7449,10 +7466,10 @@ function api_set_add_module_in_conf($id_agent, $module_name, $configuration_data
$new_configuration_data = io_safe_output(urldecode($configuration_data['data'])); $new_configuration_data = io_safe_output(urldecode($configuration_data['data']));
// Check if exist a current module with the same name in the conf file // Check if exist a current module with the same name in the conf file.
$old_configuration_data = config_agents_get_module_from_conf($id_agent, io_safe_output($module_name)); $old_configuration_data = config_agents_get_module_from_conf($id_agent, io_safe_output($module_name));
// If exists a module with same name, abort // If exists a module with same name, abort.
if (!empty($old_configuration_data)) { if (!empty($old_configuration_data)) {
returnError('error_adding_module_conf', '-2'); returnError('error_adding_module_conf', '-2');
exit; exit;
@ -7571,7 +7588,7 @@ function api_set_update_module_in_conf($id_agent, $module_name, $configuration_d
$new_configuration_data = io_safe_output(urldecode($configuration_data_serialized['data'])); $new_configuration_data = io_safe_output(urldecode($configuration_data_serialized['data']));
// Get current configuration // Get current configuration.
$old_configuration_data = config_agents_get_module_from_conf($id_agent, io_safe_output($module_name)); $old_configuration_data = config_agents_get_module_from_conf($id_agent, io_safe_output($module_name));
// If not exists // If not exists
@ -7580,7 +7597,7 @@ function api_set_update_module_in_conf($id_agent, $module_name, $configuration_d
exit; exit;
} }
// If current configuration and new configuration are equal, abort // If current configuration and new configuration are equal, abort.
if ($new_configuration_data == $old_configuration_data) { if ($new_configuration_data == $old_configuration_data) {
returnData('string', ['type' => 'string', 'data' => '1']); returnData('string', ['type' => 'string', 'data' => '1']);
exit; exit;
@ -7702,6 +7719,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3)
'min_ff_event_normal' => $other['data'][30], 'min_ff_event_normal' => $other['data'][30],
'min_ff_event_warning' => $other['data'][31], 'min_ff_event_warning' => $other['data'][31],
'min_ff_event_critical' => $other['data'][32], 'min_ff_event_critical' => $other['data'][32],
'ff_type' => $other['data'][33],
]; ];
} else { } else {
$values = [ $values = [
@ -7731,6 +7749,7 @@ function api_set_add_snmp_module_policy($id, $thrash1, $other, $thrash3)
'min_ff_event_normal' => $other['data'][24], 'min_ff_event_normal' => $other['data'][24],
'min_ff_event_warning' => $other['data'][25], 'min_ff_event_warning' => $other['data'][25],
'min_ff_event_critical' => $other['data'][26], 'min_ff_event_critical' => $other['data'][26],
'ff_type' => $other['data'][27],
]; ];
} }
@ -13508,7 +13527,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
} }
$graph_seconds = (!empty($other) && isset($other['data'][0])) ? $other['data'][0] : SECONDS_1HOUR; $graph_seconds = (!empty($other) && isset($other['data'][0])) ? $other['data'][0] : SECONDS_1HOUR;
// 1 hour by default // 1 hour by default.
$graph_threshold = (!empty($other) && isset($other['data'][2]) && $other['data'][2]) ? $other['data'][2] : 0; $graph_threshold = (!empty($other) && isset($other['data'][2]) && $other['data'][2]) ? $other['data'][2] : 0;
if (is_nan($graph_seconds) || $graph_seconds <= 0) { if (is_nan($graph_seconds) || $graph_seconds <= 0) {
@ -13624,7 +13643,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3)
]; ];
if (!isset($name)) { if (!isset($name)) {
// avoid warnings // avoid warnings.
$name = ''; $name = '';
} }
@ -13632,7 +13651,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3)
$id_agent = agents_create_agent($values_agent['nombre'], $values_agent['id_grupo'], 300, '', $values_agent); $id_agent = agents_create_agent($values_agent['nombre'], $values_agent['id_grupo'], 300, '', $values_agent);
if ($id_agent !== false) { if ($id_agent !== false) {
// Create cluster // Create cluster.
$values_cluster = [ $values_cluster = [
'name' => $name, 'name' => $name,
'cluster_type' => $cluster_type, 'cluster_type' => $cluster_type,
@ -13644,7 +13663,7 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3)
$id_cluster = db_process_sql_insert('tcluster', $values_cluster); $id_cluster = db_process_sql_insert('tcluster', $values_cluster);
if ($id_cluster === false) { if ($id_cluster === false) {
// failed to create cluster, rollback previously created agent // failed to create cluster, rollback previously created agent.
agents_delete_agent($id_agent, true); agents_delete_agent($id_agent, true);
} }
@ -13989,7 +14008,7 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras
return; return;
} }
// Take agent data // Take agent data.
$row = db_get_row('tagente', 'id_agente', $id_agent); $row = db_get_row('tagente', 'id_agente', $id_agent);
$intervalo = $row['intervalo']; $intervalo = $row['intervalo'];
@ -14023,7 +14042,7 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras
} }
foreach ($nc as $row2) { foreach ($nc as $row2) {
// Insert each module from tnetwork_component into agent // Insert each module from tnetwork_component into agent.
$values = [ $values = [
'id_agente' => $id_agent, 'id_agente' => $id_agent,
'id_tipo_modulo' => $row2['type'], 'id_tipo_modulo' => $row2['type'],
@ -14069,18 +14088,19 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras
'min_ff_event_normal' => $row2['min_ff_event_normal'], 'min_ff_event_normal' => $row2['min_ff_event_normal'],
'min_ff_event_warning' => $row2['min_ff_event_warning'], 'min_ff_event_warning' => $row2['min_ff_event_warning'],
'min_ff_event_critical' => $row2['min_ff_event_critical'], 'min_ff_event_critical' => $row2['min_ff_event_critical'],
'ff_type' => $row2['ff_type'],
]; ];
$name = $row2['name']; $name = $row2['name'];
// Put tags in array if the component has to add them later // Put tags in array if the component has to add them later.
if (!empty($row2['tags'])) { if (!empty($row2['tags'])) {
$tags = explode(',', $row2['tags']); $tags = explode(',', $row2['tags']);
} else { } else {
$tags = []; $tags = [];
} }
// Check if this module exists in the agent // Check if this module exists in the agent.
$module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agent]); $module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agent]);
if ($module_name_check !== false) { if ($module_name_check !== false) {

View File

@ -4009,7 +4009,7 @@ function events_page_details($event, $server='')
$data = []; $data = [];
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Last contact').'</div>'; $data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Last contact').'</div>';
$data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : date_w_fixed_tz($agent['ultimo_contacto']); $data[1] = ($agent['ultimo_contacto'] == '1970-01-01 00:00:00') ? '<i>'.__('N/A').'</i>' : ui_print_timestamp($agent['ultimo_contacto'], true);
$table_details->data[] = $data; $table_details->data[] = $data;
$data = []; $data = [];

View File

@ -624,7 +624,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
if ($agent['ultimo_contacto_remoto'] == '01-01-1970 00:00:00') { if ($agent['ultimo_contacto_remoto'] == '01-01-1970 00:00:00') {
$last_remote_contact = __('Never'); $last_remote_contact = __('Never');
} else { } else {
$last_remote_contact = ui_print_timestamp($agent['ultimo_contacto_remoto'], true); $last_remote_contact = date_w_fixed_tz($agent['ultimo_contacto_remoto']);
} }
$row = []; $row = [];

View File

@ -3333,6 +3333,7 @@ function ui_print_datatable(array $parameters)
{ {
extend: "csv", extend: "csv",
text : "'.__('Export current page to CSV').'", text : "'.__('Export current page to CSV').'",
titleAttr: "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'", title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
fieldSeparator: "'.$config['csv_divider'].'", fieldSeparator: "'.$config['csv_divider'].'",
exportOptions : { exportOptions : {

View File

@ -1900,6 +1900,8 @@ function visual_map_print_item(
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">'; echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
} }
} else { } else {
$is_meta = is_metaconsole();
$agents_critical = agents_get_agents( $agents_critical = agents_get_agents(
[ [
'disabled' => 0, 'disabled' => 0,
@ -1908,7 +1910,10 @@ function visual_map_print_item(
], ],
['COUNT(*) as total'], ['COUNT(*) as total'],
'AR', 'AR',
false false,
false,
0,
$is_meta
); );
$agents_warning = agents_get_agents( $agents_warning = agents_get_agents(
[ [
@ -1918,7 +1923,10 @@ function visual_map_print_item(
], ],
['COUNT(*) as total'], ['COUNT(*) as total'],
'AR', 'AR',
false false,
false,
0,
$is_meta
); );
$agents_unknown = agents_get_agents( $agents_unknown = agents_get_agents(
[ [
@ -1928,7 +1936,10 @@ function visual_map_print_item(
], ],
['COUNT(*) as total'], ['COUNT(*) as total'],
'AR', 'AR',
false false,
false,
0,
$is_meta
); );
$agents_ok = agents_get_agents( $agents_ok = agents_get_agents(
[ [
@ -1938,7 +1949,10 @@ function visual_map_print_item(
], ],
['COUNT(*) as total'], ['COUNT(*) as total'],
'AR', 'AR',
false false,
false,
0,
$is_meta
); );
$total_agents = ($agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total']); $total_agents = ($agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total']);
$stat_agent_ok = ($agents_ok[0]['total'] / $total_agents * 100); $stat_agent_ok = ($agents_ok[0]['total'] / $total_agents * 100);

View File

@ -1447,9 +1447,6 @@ function visual_map_editor_print_hack_translate_strings()
<script type="text/javascript"> <script type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
$("#map_linked").change(function () { $("#map_linked").change(function () {
$("option[value=" + this.value + "]", this)
.attr("selected", true).siblings()
.removeAttr("selected")
$("#text-agent").val(""); $("#text-agent").val("");
$("input[name=id_agent]").val(0); $("input[name=id_agent]").val(0);
$("#module").empty(); $("#module").empty();

View File

@ -33,6 +33,10 @@ div#error_buttons a {
background-repeat: repeat; background-repeat: repeat;
} }
.login_body_trident {
background: url("../../images/backgrounds/background_pandora_console_keys.jpg") !important;
}
p.log_in { p.log_in {
color: #fff; color: #fff;
padding: 0px 10px; padding: 0px 10px;

View File

@ -0,0 +1,54 @@
div.show_result_interpreter {
background-color: #fff;
color: #000;
border: 1px solid #e2e2e2;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
padding-left: 10px;
padding-top: 5px;
padding-bottom: 5px;
box-shadow: 0px 0px 15px -4px #dadada;
position: absolute;
z-index: 1;
width: 300px;
}
.more_results {
text-align: right;
margin-right: 20px;
display: grid;
}
.results-found {
background-image: url("../../images/input_zoom_gray.png");
background-position: center right 10px;
background-repeat: no-repeat;
background-size: 17px;
background-color: #f2f6f7;
padding: 0px;
margin: 0;
width: 300px;
height: 30px;
margin-left: 2px;
padding-left: 15px;
padding-right: 40px;
color: #777;
font-family: "Open Sans", sans-serif;
font-size: 8.5pt;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-color: transparent;
}
.list_found {
padding-top: 5px;
}
.active {
background: #f2f6f7;
}
.result_order {
margin-left: 2px;
display: grid;
}

View File

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

View File

@ -165,9 +165,13 @@ echo "<div style='width:100%'>".html_print_button(
check_users(); check_users();
if (first_time) { if (first_time) {
var date_first_message = unix_timestamp(data['log'][0]['timestamp']);
if(!date_first_message){
date_first_message = unix_timestamp(new Date()/1000);
}
print_messages({ print_messages({
0: {'type' : 'notification', 0: {'type' : 'notification',
'text': '<?php echo __('Connection established...get last 24h messages...'); ?>'} 'text': '<?php echo __('Connection established - Retrieving messages since '); ?>'+date_first_message}
}, true); }, true);
first_time = false; first_time = false;
} }
@ -308,4 +312,24 @@ echo "<div style='width:100%'>".html_print_button(
} }
}); });
} }
// Function to convert a timestamp to human date.
function unix_timestamp(timestamp){
var date = new Date(timestamp*1000);
const monthNames = [
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"
];
var month = monthNames[date.getMonth()];
var day = date.getDate();
var year = date.getFullYear();
var hour = date.getHours();
var min = date.getMinutes();
return month + ' ' + day + ', '+ year + ', ' + hour+ ':' + min;
}
</script> </script>

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.742-191223 Version: 7.0NG.742-200102
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# 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. # GNU General Public License for more details.
pandora_version="7.0NG.742-191223" pandora_version="7.0NG.742-200102"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -163,9 +163,11 @@ wmiserver 1
network_timeout 4 network_timeout 4
# Network timeout (in seconds) for timeout in remote execution commands (PANDORA FMS ENTERPRISE ONLY). # Network timeout (in seconds) for timeout in remote execution commands (PANDORA FMS ENTERPRISE ONLY).
rcmd_timeout 30 rcmd_timeout 30
# Remote execution modules, ssh_launcher extra option (PANDORA FMS ENTERPRISE ONLY).
ssh_launcher /usr/share/pandora_server/util/ssh_launcher.sh
# Server keepalive (in seconds) # Server keepalive (in seconds)
server_keepalive 45 server_keepalive 45

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.742"; my $pandora_version = "7.0NG.742";
my $pandora_build = "191223"; my $pandora_build = "200102";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -360,6 +360,9 @@ sub pandora_load_config {
# Discovery SAP Artica environment # Discovery SAP Artica environment
$pa_config->{"sap_artica_test"} = 0; $pa_config->{"sap_artica_test"} = 0;
# Remote execution modules, option ssh_launcher
$pa_config->{"ssh_launcher"} = "/usr/bin/ssh_launcher";
# braa for enterprise snmp server # braa for enterprise snmp server
$pa_config->{"braa"} = "/usr/bin/braa"; $pa_config->{"braa"} = "/usr/bin/braa";
@ -861,6 +864,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^sap_artica_test\s(.*)/i) { elsif ($parametro =~ m/^sap_artica_test\s(.*)/i) {
$pa_config->{'sap_artica_test'}= clean_blank($1); $pa_config->{'sap_artica_test'}= clean_blank($1);
} }
elsif ($parametro =~ m/^ssh_launcher\s(.*)/i) {
$pa_config->{'ssh_launcher'}= clean_blank($1);
}
elsif ($parametro =~ m/^nmap_timing_template\s+([0-9]*)/i) { elsif ($parametro =~ m/^nmap_timing_template\s+([0-9]*)/i) {
$pa_config->{'nmap_timing_template'}= clean_blank($1); $pa_config->{'nmap_timing_template'}= clean_blank($1);
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.742 PS191223"; my $version = "7.0NG.742 PS200102";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

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