Merge branch 'develop' into 'ent-4705-encriptado-de-nuevos-tokens'

# Conflicts:
#   pandora_console/include/functions_config.php
This commit is contained in:
Marcos Alconada 2020-01-16 09:23:42 +01:00
commit 5268c23c7a
128 changed files with 2219 additions and 842 deletions

View File

@ -9,6 +9,7 @@ RUN yum -y install \
epel-release \
unzip \
perl \
python3 \
sed \
"perl(Sys::Syslog)"

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.742-191217
Version: 7.0NG.742-200116
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.742-191217"
pandora_version="7.0NG.742-200116"
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

@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.742';
use constant AGENT_BUILD => '191217';
use constant AGENT_BUILD => '200116';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -2882,7 +2882,7 @@ sub cron_valid_date {
my $utime;
eval {
local $SIG{__DIE__} = sub {};
$utime = timelocal(0, $min, $hour, $mday, $month, $year);
$utime = strftime("%s", 0, $min, $hour, $mday, $month, $year);
};
if ($@) {
return 0;

View File

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

View File

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

View File

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

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{191217}
{200116}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.742(Build 191217)")
#define PANDORA_VERSION ("7.0NG.742(Build 200116)")
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.742(Build 191217))"
VALUE "ProductVersion", "(7.0NG.742(Build 200116))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.742-191217
Version: 7.0NG.742-200116
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.742-191217"
pandora_version="7.0NG.742-200116"
package_pear=0
package_pandora=1

View File

@ -798,11 +798,7 @@ function mainAgentsModules()
echo "<td style='text-align: center;'>";
$win_handle = dechex(crc32($module_id.$module['name']));
$graph_type = return_graphtype(modules_get_agentmodule_type($module_id));
$link = "winopeng('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'label='.rawurlencode(
urlencode(
base64_encode($module['name'])
)
).'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."')";
$link = "winopeng('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module_id.'&'.'refresh='.SECONDS_10MINUTES."', 'day_".$win_handle."')";
echo '<a href="javascript:'.$link.'">';
switch ($status) {

View File

@ -22,6 +22,17 @@ function dbmanager_query($sql, &$error, $dbconnection)
}
$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']) {
$result = mysqli_query($dbconnection, $sql);
if ($result === false) {

View File

@ -64,9 +64,11 @@ if (!empty($files)) {
$document_root = str_replace('\\', '/', io_safe_output($_SERVER['DOCUMENT_ROOT']));
$file['location'] = str_replace('\\', '/', io_safe_output($file['location']));
$relative_path = str_replace($document_root, '', $file['location']);
$file_path = base64_encode($relative_path);
$hash = md5($relative_path.$config['dbpass']);
$url = ui_get_full_url("include/get_file.php?file=$file_path&hash=$hash");
$file_name = explode('/', $file['location']);
$file_decoded = $file_name[(count($file_name) - 1)];
$file_path = base64_encode($file_decoded);
$hash = md5($file_path.$config['dbpass']);
$url = ui_get_full_url('include/get_file.php?file='.urlencode($file_path).'&hash='.$hash);
$date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m';
$data[0] = "<a href=\"$url\" target=\"_blank\">".$file['name'].'</a>';

View File

@ -0,0 +1,6 @@
START TRANSACTION;
ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0;
ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL;
COMMIT;

View File

@ -1195,6 +1195,8 @@ CREATE TABLE IF NOT EXISTS `tmap` (
`generation_method` INTEGER UNSIGNED NOT NULL default 0,
`generated` INTEGER UNSIGNED NOT NULL default 0,
`filter` TEXT,
`id_group_map` INT(10) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -1401,6 +1403,7 @@ ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL;
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;
-- ---------------------------------------------------------------------
-- Table `tusuario`

View File

@ -13,6 +13,8 @@
require_once 'include/functions_messages.php';
require_once 'include/functions_servers.php';
require_once 'include/functions_notifications.php';
require_once 'include/ajax/order_interpreter.php';
ui_require_css_file('order_interpreter');
// Check permissions
// Global errors/warnings checking.
@ -99,7 +101,8 @@ if ($config['menu_type'] == 'classic') {
if ($acl_head_search) {
// 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'])) {
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
} 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'])) {
$search_bar .= "value='".__('Enter keywords to search')."'";
} else if (strlen($config['search_keywords']) == 0) {
@ -119,9 +122,11 @@ if ($config['menu_type'] == 'classic') {
$search_bar .= "value='".$config['search_keywords']."'";
}
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
onkeyup="javascript: fieldKeyWordEmpty = false;" class="search_input" />';
$search_bar .= 'type="search" onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
onkeyup="showinterpreter()" class="search_input"/>';
$search_bar .= '<div id="result_order" class="result_order"></div>';
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
$search_bar .= '</form>';
@ -622,7 +627,7 @@ if ($config['menu_type'] == 'classic') {
});
}
// Resize event
// Resize event.
window.addEventListener("resize", function() {
attatch_to_image();
});
@ -630,7 +635,86 @@ if ($config['menu_type'] == 'classic') {
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
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.
*/

View File

@ -82,12 +82,18 @@ if (!empty($page) && !empty($sec)) {
}
$login_body_style = '';
$login_body_class = '';
// Overrides the default background with the defined by the user.
if (!empty($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."');\"";
}
// 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.
$custom_fields = [
'custom_logo_login',
@ -111,7 +117,7 @@ foreach ($custom_fields as $field) {
// Get the custom icons.
$docs_logo = ui_get_docs_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="list_icon_docs_support"><ul>';

View File

@ -40,7 +40,7 @@ if (!empty($news)) {
// Prints news dialog template
echo '<div id="news_dialog" title="" style="display: none;">';
echo '<div style="position:absolute; top:30px; left: 10px; text-align: left; right:0%; height:70px; min-width:560px; width: 95%; margin: 0 auto; border: 1px solid #FFF; line-height: 19px;">';
echo '<div style="position:absolute; top:30px; left: 10px; text-align: left; right:0%; height:70px; min-width:560px; width: 95%; margin: 0 auto; line-height: 19px;">';
echo '<span style="display: block; height: 260px; overflow: auto; text-align: justify; padding: 5px 15px 4px 10px; background: #ECECEC; border-radius: 4px;" id="new_text"></span>';
echo '<span style="font-size: 12px; display: block; margin-top: 20px;" id="new_author"></span>';
echo '<span style="font-size: 12px; display: block; font-style: italic;" id="new_timestamp"></span>';

View File

@ -612,17 +612,19 @@ if (enterprise_installed()) {
$cascade_protection,
true
).__('Cascade protection').'&nbsp;';
$table_adv_parent .= __('Module').'&nbsp;'.html_print_select(
$modules_values,
'cascade_protection_module',
$cascade_protection_module,
'',
'',
0,
true
);
}
$table_adv_parent .= __('Module').'&nbsp;'.html_print_select(
$modules_values,
'cascade_protection_module',
$cascade_protection_module,
'',
'',
0,
true
).'</div></div>';
$table_adv_parent .= '</div></div>';
// Learn mode / Normal mode.
$table_adv_module_mode = '<div class="label_select"><p class="input_label">'.__('Module definition').': </p>';
@ -667,7 +669,7 @@ $table_adv_status .= html_print_checkbox_switch(
$disabled,
true
);
$table_adv_status .= '<p class="input_label input_label_simple">'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
$table_adv_status .= '<p class="input_label input_label_simple">'.__('Disabled mode').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'</p>';
$table_adv_status .= '</div>';
// Url address.

View File

@ -32,19 +32,6 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
exit;
}
if (is_ajax()) {
$get_alert_action = (bool) get_parameter('get_alert_action');
if ($get_alert_action) {
$id = (int) get_parameter('id');
$action = alerts_get_alert_action($id);
$action['command'] = alerts_get_alert_action_alert_command($action['id']);
echo json_encode($action);
}
return;
}
$update_action = (bool) get_parameter('update_action');
$create_action = (bool) get_parameter('create_action');
$delete_action = (bool) get_parameter('delete_action');
@ -57,15 +44,22 @@ if (defined('METACONSOLE')) {
$sec = 'galertas';
}
if ((!$copy_action) && (!$delete_action)) {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_action', true);
}
}
// Header.
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
$header_help = 'alerts_action';
if ($copy_action) {
$header_help = 'alerts_config';
}
if ($delete_action) {
$header_help = 'alerts_action';
}
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, $header_help, true);
}
if ($copy_action) {
$id = get_parameter('id');
@ -83,13 +77,6 @@ if ($copy_action) {
);
include 'general/noaccess.php';
exit;
} else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_config', true);
}
}
} //end if
else {
@ -102,14 +89,7 @@ if ($copy_action) {
$is_in_group = in_array($al_action['id_group'], $own_groups);
// Then action group have to be in his own groups
if ($is_in_group) {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_config', true);
}
} else {
if (!$is_in_group) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
@ -118,13 +98,6 @@ if ($copy_action) {
exit;
}
}
} else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, 'alerts_config', true);
}
}
$result = alerts_clone_alert_action($id);
@ -162,13 +135,6 @@ if ($delete_action) {
);
include 'general/noaccess.php';
exit;
} else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, 'alert_action', true);
}
}
// If user tries to delete an action of others groups
@ -182,14 +148,7 @@ if ($delete_action) {
$is_in_group = in_array($al_action['id_group'], $own_groups);
// Then action group have to be in his own groups
if ($is_in_group) {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header();
} else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, 'alert_action', true);
}
} else {
if (!$is_in_group) {
db_pandora_audit(
'ACL Violation',
'Trying to access Alert Management'
@ -198,9 +157,6 @@ if ($delete_action) {
exit;
}
}
} else {
// Header
ui_print_page_header(__('Alerts').' &raquo; '.__('Alert actions'), 'images/gm_alerts.png', false, '', true);
}
@ -285,10 +241,14 @@ foreach ($actions as $action) {
2 => 'action_buttons',
3 => 'action_buttons',
];
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>';
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&delete_action=1&id='.$action['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
$id_action = $action['id'];
$text_confirm = __('Are you sure?');
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
onClick="copy_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/copy.png', true).'</a>';
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
onClick="delete_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/cross.png', true).'</a>';
}
array_push($table->data, $data);
@ -308,3 +268,45 @@ echo '</form>';
echo '</div>';
enterprise_hook('close_meta_frame');
?>
<script type="text/javascript">
function copy_action(id_action, text_confirm) {
if (!confirm(text_confirm)) {
return false;
} else {
jQuery.post ("ajax.php",
{
"page" : "godmode/alerts/alert_actions",
"copy_action" : 1,
"id" : id_action
},
function (data, status) {
// No data.
},
"json"
);
}
}
function delete_action(id_action, text_confirm) {
if (!confirm(text_confirm)) {
return false;
} else {
jQuery.post ("ajax.php",
{
"page" : "godmode/alerts/alert_actions",
"delete_action" : 1,
"id" : id_action
},
function (data, status) {
// No data.
},
"json"
);
}
}
</script>

View File

@ -412,65 +412,56 @@ $url_up_template = $url.'&sort_field=template&sort=up&pure='.$pure;
$url_down_template = $url.'&sort_field=template&sort=down&pure='.$pure;
$table = new stdClass();
$table_alert_list = new stdClass();
if (is_metaconsole()) {
$table->class = 'alert_list databox';
$table_alert_list->class = 'alert_list databox';
} else {
$table->class = 'info_table';
$table_alert_list->class = 'info_table';
}
$table->width = '100%';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->size = [];
$table_alert_list->width = '100%';
$table_alert_list->cellpadding = 0;
$table_alert_list->cellspacing = 0;
$table_alert_list->size = [];
$table->align = [];
$table->align[0] = 'left';
$table->align[1] = 'left';
$table->align[2] = 'left';
$table->align[3] = 'left';
$table->align[4] = 'left';
$table_alert_list->align = [];
$table_alert_list->align[0] = 'left';
$table_alert_list->align[1] = 'left';
$table_alert_list->align[2] = 'left';
$table_alert_list->align[3] = 'left';
$table_alert_list->align[4] = 'left';
$table->head = [];
$table_alert_list->head = [];
if (! $id_agente) {
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
$table->headstyle[0] = 'width: 100%; min-width: 12em;';
$table->headstyle[1] = 'min-width: 15em;';
$table->headstyle[2] = 'min-width: 20em;';
$table->headstyle[3] = 'min-width: 1em;';
$table->headstyle[4] = 'min-width: 15em;';
/*
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->size[4] = '8%';
}*/
$table_alert_list->style = [];
$table_alert_list->style[0] = 'font-weight: bold;';
$table_alert_list->head[0] = __('Agent').ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown);
} else {
$table->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
$table->headstyle[0] = 'width: 100%; min-width: 15em;';
$table->headstyle[1] = 'min-width: 15em;';
$table->headstyle[2] = 'min-width: 20em;';
$table->headstyle[3] = 'min-width: 1em;';
$table->headstyle[4] = 'min-width: 15em;';
$table_alert_list->head[0] = __('Module').ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
}
$table->head[1] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table->head[2] = __('Actions');
$table->head[3] = __('Status');
$table->head[4] = "<span title='".__('Operations')."'>".__('Op.').'</span>';
$table_alert_list->head[1] = __('Status');
$table_alert_list->head[2] = __('Template').ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
$table_alert_list->head[3] = __('Actions');
$table_alert_list->head[4] = "<span title='".__('Operations')."'>".__('Op.').'</span>';
$table->valign[0] = 'middle';
$table->valign[1] = 'middle';
$table->valign[2] = 'middle';
$table->valign[3] = 'middle';
$table->valign[4] = 'middle';
$table_alert_list->headstyle[0] = 'min-width: 200px; width:30%;';
$table_alert_list->headstyle[1] = 'min-width: 50px; width:8%';
$table_alert_list->headstyle[2] = 'min-width: 150px; width:22%;';
$table_alert_list->headstyle[3] = 'min-width: 200px; width:30%;';
$table_alert_list->headstyle[4] = 'min-width: 150px; width:10%;';
$table->style[4] = 'min-width:80px';
$table_alert_list->valign[0] = 'middle';
$table_alert_list->valign[1] = 'middle';
$table_alert_list->valign[2] = 'middle';
$table_alert_list->valign[3] = 'middle';
$table_alert_list->valign[4] = 'middle';
$table->data = [];
$table_alert_list->cellstyle = [];
$table_alert_list->data = [];
$url .= $sort_params;
@ -479,14 +470,14 @@ $iterator = 0;
foreach ($simple_alerts as $alert) {
if ($alert['disabled']) {
$table->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
$table->style[$iterator][1] = 'font-style: italic; color: #aaaaaa;';
$table_alert_list->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
$table_alert_list->style[$iterator][2] = 'font-style: italic; color: #aaaaaa;';
}
if ($rowPair) {
$table->rowclass[$iterator] = 'rowPair';
$table_alert_list->rowclass[$iterator] = 'rowPair';
} else {
$table->rowclass[$iterator] = 'rowOdd';
$table_alert_list->rowclass[$iterator] = 'rowOdd';
}
$rowPair = !$rowPair;
@ -523,38 +514,53 @@ foreach ($simple_alerts as $alert) {
$all_groups = agents_get_all_groups_agent($id_agente);
}
$module_name = modules_get_agentmodule_name($alert['id_agent_module']);
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-size: 7.2pt').'<br>';
$status = STATUS_ALERT_NOT_FIRED;
$title = '';
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');
} else {
$status = STATUS_ALERT_NOT_FIRED;
$title = __('Alert not fired');
}
$module_name = modules_get_agentmodule_name($alert['id_agent_module']);
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-weight:normal;').'<br>';
$data[1] = ui_print_status_image($status, $title, true);
$template_group = db_get_value('id_group', 'talert_templates', 'id', $alert['id_alert_template']);
// The access to the template manage page is necessary have LW permissions on template group
if (check_acl($config['id_user'], $template_group, 'LW')) {
$data[1] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$alert['id_alert_template']."'>";
$data[2] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/alerts/configure_alert_template&id='.$alert['id_alert_template']."'>";
}
$data[1] .= ui_print_truncate_text(
$data[2] .= ui_print_truncate_text(
alerts_get_alert_template_name($alert['id_alert_template']),
'module_medium',
false,
true,
true,
'[&hellip;]',
'font-size: 7.1pt'
''
);
$data[1] .= ' <a class="template_details"
$data[2] .= ' <a class="template_details"
href="'.ui_get_full_url(false, false, false, false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">';
$data[1] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help']);
$data[1] .= '</a> ';
$data[2] .= html_print_image('images/zoom.png', true, ['id' => 'template-details-'.$alert['id_alert_template'], 'class' => 'img_help action_button_img']);
$data[2] .= '</a> ';
if (check_acl($config['id_user'], $template_group, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) {
$data[1] .= '</a>';
$data[2] .= '</a>';
}
$actions = alerts_get_alert_agent_module_actions($alert['id']);
$data[2] = "<table width='70%'>";
$data[3] = "<table style='width:100%;'>";
// Get and show default actions for this alert
$default_action = db_get_sql(
'SELECT id_alert_action
@ -562,69 +568,74 @@ foreach ($simple_alerts as $alert) {
WHERE id = '.$alert['id_alert_template']
);
if ($default_action != '') {
$data[2] .= "<tr><td><ul class='action_list'><li>";
$data[2] .= db_get_sql("SELECT name FROM talert_actions WHERE id = $default_action").' <em>('.__('Default').')</em>';
$data[2] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true);
$data[2] .= '</li></ul></td>';
$data[2] .= '<td></td>';
$data[2] .= '</tr>';
$data[3] .= "<tr><td colspan='2'><ul class='action_list'><li>";
$data[3] .= db_get_sql("SELECT name FROM talert_actions WHERE id = $default_action").' <em>('.__('Default').')</em>';
$data[3] .= '</li></ul></td>';
$data[3] .= '</tr>';
}
foreach ($actions as $action_id => $action) {
$data[2] .= '<tr>';
$data[2] .= '<td>';
$data[2] .= '<ul class="action_list" style="display:inline;">';
$data[2] .= '<li style="display:inline;">';
$data[3] .= '<tr style="display: grid; grid-template-columns: 1fr 1fr; align-items: center;">';
$data[3] .= '<td>';
$data[3] .= '<ul class="action_list" style="display:inline;">';
$data[3] .= '<li style="display:inline;">';
if ($alert['disabled']) {
$data[2] .= '<font class="action_name" style="font-style: italic; color: #aaaaaa;">';
$data[3] .= '<font class="action_name" style="font-style: italic; color: #aaaaaa;">';
} else {
$data[2] .= '<font class="action_name">';
$data[3] .= '<font class="action_name">';
}
$data[2] .= ui_print_truncate_text($action['name'], (GENERIC_SIZE_TEXT + 20), false);
$data[2] .= ' <em>(';
$data[3] .= ui_print_truncate_text($action['name'], (GENERIC_SIZE_TEXT + 20), false);
$data[3] .= ' <em>(';
if ($action['fires_min'] == $action['fires_max']) {
if ($action['fires_min'] == 0) {
$data[2] .= __('Always');
$data[3] .= __('Always');
} else {
$data[2] .= __('On').' '.$action['fires_min'];
$data[3] .= __('On').' '.$action['fires_min'];
}
} else if ($action['fires_min'] < $action['fires_max']) {
if ($action['fires_min'] == 0) {
$data[2] .= __('Until').' '.$action['fires_max'];
$data[3] .= __('Until').' '.$action['fires_max'];
} else {
$data[2] .= __('From').' '.$action['fires_min'].' '.__('to').' '.$action['fires_max'];
$data[3] .= __('From').' '.$action['fires_min'].' '.__('to').' '.$action['fires_max'];
}
} else {
$data[2] .= __('From').' '.$action['fires_min'];
$data[3] .= __('From').' '.$action['fires_min'];
}
if ($action['module_action_threshold'] != 0) {
$data[2] .= ' '.__('Threshold').' '.human_time_description_alerts($action['module_action_threshold'], true, 'tiny');
$data[3] .= ' '.__('Threshold').' '.human_time_description_alerts($action['module_action_threshold'], true, 'tiny');
}
$data[2] .= ')</em>';
$data[2] .= '</font>';
$data[2] .= '</li>';
$data[2] .= '</ul>';
$data[3] .= ')</em>';
$data[3] .= '</font>';
$data[3] .= '</li>';
$data[3] .= '</ul>';
// Is possible manage actions if have LW permissions in the agent group of the alert module
$data[3] .= '</td>';
$data[3] .= '<td style=" display: flex; align-items: center;">';
$data[3] .= ui_print_help_tip(__('The default actions will be executed every time that the alert is fired and no other action is executed'), true);
// Is possible manage actions if have LW permissions in the agent group of the alert module
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW')) {
// ~ $data[2] .= '<form method="post" action="' . $url . '" class="delete_link" style="display: inline; vertical-align: -50%;">';
$data[2] .= '<form method="post" action="'.$url.'" class="delete_link" style="display: inline;">';
$data[2] .= html_print_input_image(
$data[3] .= '<form method="post" action="'.$url.'" class="delete_link" style="display: inline;">';
$data[3] .= html_print_input_image(
'delete',
'images/cross.png',
1,
'padding:0px;',
'padding:0px; margin-left:5px; margin-right:5px;',
true,
['title' => __('Delete action')]
[
'title' => __('Delete action'),
'class' => 'action_button_img',
]
);
$data[2] .= html_print_input_hidden('delete_action', 1, true);
$data[2] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[2] .= html_print_input_hidden('id_action', $action_id, true);
$data[2] .= '</form>';
$data[2] .= html_print_input_image(
$data[3] .= html_print_input_hidden('delete_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[3] .= html_print_input_hidden('id_action', $action_id, true);
$data[3] .= '</form>';
$data[3] .= html_print_input_image(
'update_action',
'images/config.png',
1,
@ -632,19 +643,20 @@ foreach ($simple_alerts as $alert) {
true,
[
'title' => __('Update action'),
'class' => 'action_button_img',
'onclick' => 'show_display_update_action(\''.$action['id'].'\',\''.$alert['id'].'\',\''.$alert['id_agent_module'].'\',\''.$action_id.'\',\''.$alert['id_agent_module'].'\')',
]
);
$data[2] .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
$data[3] .= html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
}
$data[2] .= '</td>';
$data[2] .= '</tr>';
$data[3] .= '</td>';
$data[3] .= '</tr>';
}
$data[2] .= '<div id="update_action-div" style="display:none;text-align:left">';
$data[2] .= '</div>';
$data[2] .= '</table>';
$data[3] .= '<div id="update_action-div" style="display:none;text-align:left">';
$data[3] .= '</div>';
$data[3] .= '</table>';
// Is possible manage actions if have LW permissions in the agent group of the alert module
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) {
$own_info = get_user_info($config['id_user']);
@ -660,45 +672,45 @@ foreach ($simple_alerts as $alert) {
$actions = alerts_get_alert_actions_filter(true, 'id_group IN ('.$filter_groups.')');
}
$data[2] .= '<div id="add_action-div-'.$alert['id'].'" style="display:none;text-align:left">';
$data[2] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
$data[2] .= '<table class="databox_color" style="width:100%">';
$data[2] .= html_print_input_hidden('add_action', 1, true);
$data[2] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" style="display:none;text-align:left">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post">';
$data[3] .= '<table class="databox_color" style="width:100%">';
$data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
if (! $id_agente) {
$data[2] .= '<tr class="datos2">';
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Agent');
$data[2] .= '</td>';
$data[2] .= '<td class="datos">';
$data[2] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]');
$data[2] .= '</td>';
$data[2] .= '</tr>';
$data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[3] .= __('Agent');
$data[3] .= '</td>';
$data[3] .= '<td class="datos">';
$data[3] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]');
$data[3] .= '</td>';
$data[3] .= '</tr>';
}
$data[2] .= '<tr class="datos">';
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Module');
$data[2] .= '</td>';
$data[2] .= '<td class="datos">';
$data[2] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]');
$data[2] .= '</td>';
$data[2] .= '</tr>';
$data[2] .= '<tr class="datos2">';
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Action');
$data[2] .= '</td>';
$data[2] .= '<td class="datos2">';
$data[2] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:150px');
$data[2] .= '</td>';
$data[2] .= '</tr>';
$data[2] .= '<tr class="datos">';
$data[2] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Number of alerts match from');
$data[2] .= '</td>';
$data[2] .= '<td class="datos">';
$data[2] .= html_print_input_text(
$data[3] .= '<tr class="datos">';
$data[3] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
$data[3] .= __('Module');
$data[3] .= '</td>';
$data[3] .= '<td class="datos">';
$data[3] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]');
$data[3] .= '</td>';
$data[3] .= '</tr>';
$data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[3] .= __('Action');
$data[3] .= '</td>';
$data[3] .= '<td class="datos2">';
$data[3] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:150px');
$data[3] .= '</td>';
$data[3] .= '</tr>';
$data[3] .= '<tr class="datos">';
$data[3] .= '<td class="datos" style="font-weight:bold;padding:6px;">';
$data[3] .= __('Number of alerts match from');
$data[3] .= '</td>';
$data[3] .= '<td class="datos">';
$data[3] .= html_print_input_text(
'fires_min',
0,
'',
@ -706,8 +718,8 @@ foreach ($simple_alerts as $alert) {
10,
true
);
$data[2] .= ' '.__('to').' ';
$data[2] .= html_print_input_text(
$data[3] .= ' '.__('to').' ';
$data[3] .= html_print_input_text(
'fires_max',
0,
'',
@ -715,14 +727,14 @@ foreach ($simple_alerts as $alert) {
10,
true
);
$data[2] .= '</td>';
$data[2] .= '</tr>';
$data[2] .= '<tr class="datos2">';
$data[2] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[2] .= __('Threshold');
$data[2] .= '</td>';
$data[2] .= '<td class="datos2">';
$data[2] .= html_print_input_text(
$data[3] .= '</td>';
$data[3] .= '</tr>';
$data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2" style="font-weight:bold;padding:6px;">';
$data[3] .= __('Threshold');
$data[3] .= '</td>';
$data[3] .= '<td class="datos2">';
$data[3] .= html_print_input_text(
'module_action_threshold',
'',
'',
@ -730,32 +742,16 @@ foreach ($simple_alerts as $alert) {
10,
true
);
$data[2] .= '</td>';
$data[2] .= '</tr>';
$data[2] .= '</table>';
$data[2] .= html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true);
$data[2] .= '</form>';
$data[2] .= '</div>';
$data[3] .= '</td>';
$data[3] .= '</tr>';
$data[3] .= '</table>';
$data[3] .= html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true);
$data[3] .= '</form>';
$data[3] .= '</div>';
}
$status = STATUS_ALERT_NOT_FIRED;
$title = '';
if ($alert['times_fired'] > 0) {
$status = STATUS_ALERT_FIRED;
$title = __('Alert fired').' '.$alert['internal_counter'].' '.__('time(s)');
} else if ($alert['disabled'] > 0) {
$status = STATUS_ALERT_DISABLED;
$title = __('Alert disabled');
} else {
$status = STATUS_ALERT_NOT_FIRED;
$title = __('Alert not fired');
}
$data[3] = ui_print_status_image($status, $title, true);
$table->cellclass[] = [
3 => 'action_buttons',
$table_alert_list->cellclass[] = [
1 => 'action_buttons',
4 => 'action_buttons',
];
$data[4] = '<form class="disable_alert_form" action="'.$url.'" method="post" style="display: inline;">';
@ -790,11 +786,11 @@ foreach ($simple_alerts as $alert) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
if ($policyInfo === false) {
$data[3] .= '';
$data[1] .= '';
} else {
$img = 'images/policies.png';
$data[3] .= '&nbsp;&nbsp;<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&pure='.$pure.'&id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
$data[1] .= '&nbsp;&nbsp;<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&pure='.$pure.'&id='.$policyInfo['id'].'">'.html_print_image($img, true, ['title' => $policyInfo['name']]).'</a>';
}
}
}
@ -840,11 +836,11 @@ foreach ($simple_alerts as $alert) {
$data[4] .= '</form>';
}
array_push($table->data, $data);
array_push($table_alert_list->data, $data);
}
if (isset($data)) {
html_print_table($table);
html_print_table($table_alert_list);
if ($id_agente) {
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom');
} else {
@ -864,7 +860,7 @@ if (isset($dont_display_alert_create_bttn)) {
}
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<div class="action-buttons" style="width: '.$table_alert_list->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'crtbtn', false, 'class="sub next"');
echo '</form>';

View File

@ -55,7 +55,7 @@ if ($id) {
$id_group = $filter['id_group'];
$id_name = $filter['id_name'];
$event_type = $filter['event_type'];
$severity = $filter['severity'];
$severity = explode(',', $filter['severity']);
$status = $filter['status'];
$search = $filter['search'];
$text_agent = $filter['text_agent'];
@ -123,7 +123,7 @@ if ($update || $create) {
$id_group_filter = get_parameter('id_group_filter');
$id_name = (string) get_parameter('id_name');
$event_type = get_parameter('event_type', '');
$severity = get_parameter('severity', '');
$severity = implode(',', get_parameter('severity', -1));
$status = get_parameter('status', '');
$search = get_parameter('search', '');
$text_agent = get_parameter('text_agent', '');
@ -172,6 +172,8 @@ if ($update || $create) {
'user_comment' => $user_comment,
'filter_only_alert' => $filter_only_alert,
];
$severity = explode(',', $severity);
}
if ($update) {
@ -289,15 +291,24 @@ $table->data[3][1] = html_print_select(
true
);
if (empty($severity) && $severity !== '0') {
$severity = -1;
}
$table->data[4][0] = '<b>'.__('Severity').'</b>';
$table->data[4][1] = html_print_select(
get_priorities(),
'severity',
'severity[]',
$severity,
'',
__('All'),
'-1',
true
-1,
true,
true,
true,
'',
false,
'width: 175px'
);
$fields = events_get_all_status();

View File

@ -117,6 +117,14 @@ if ($update_agents) {
$values['quiet'] = get_parameter('quiet_select');
}
if (get_parameter('safe_mode_change', -1) == 1 && get_parameter('safe_mode_module', '') != '') {
// Get the module name.
$values['safe_mode_module'] = get_parameter('safe_mode_module');
} else if (get_parameter('safe_mode_change', -1) == 0) {
// Disabled Safe Operation Mode.
$values['safe_mode_module'] = '0';
}
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($fields === false) {
@ -134,6 +142,20 @@ if ($update_agents) {
}
}
// Get the id_agente_modulo to update the 'safe_operation_mode' field.
if (isset($values['safe_mode_module']) && ($values['safe_mode_module'] != '0')) {
foreach ($id_agents as $id_agent) {
$id_module_safe[$id_agent] = db_get_value_filter(
'id_agente_modulo',
'tagente_modulo',
[
'id_agente' => $id_agent,
'nombre' => $values['safe_mode_module'],
]
);
}
}
// CONF FILE DELETION
if (isset($values['delete_conf'])) {
unset($values['delete_conf']);
@ -188,6 +210,11 @@ if ($update_agents) {
}
}
// Get the id_agent_module for this agent to update the 'safe_operation_mode' field.
if (isset($values['safe_mode_module']) && ($values['safe_mode_module'] != '0')) {
$values['safe_mode_module'] = $id_module_safe[$id_agent];
}
$result = db_process_sql_update(
'tagente',
$values,
@ -677,6 +704,27 @@ $table->data[6][1] = html_print_select(
true
);
$table->data[7][0] = __('Safe operation mode').': '.ui_print_help_tip(
__(
'This mode allow %s to disable all modules
of this agent while the selected module is on CRITICAL status',
get_product_name()
),
true
);
$table->data[7][1] .= html_print_select(
[
1 => __('Enabled'),
0 => __('Disabled'),
],
'safe_mode_change',
-1,
'',
__('No change'),
-1,
true
).'&nbsp;';
$table->data[7][1] .= __('Module').'&nbsp;'.html_print_select('', 'safe_mode_module', '', '', __('Any'), -1, true).'</div>';
ui_toggle(html_print_table($table, true), __('Advanced options'));
unset($table);
@ -810,6 +858,54 @@ $(document).ready (function () {
}
});
// Enable Safe Operation Mode if 'Enabled' is selected.
$("#safe_mode_module").attr("disabled", "disabled");
$("#safe_mode_change").on('change', function() {
if ($("#safe_mode_change").val() == 1) {
$("#safe_mode_module").removeAttr("disabled");
refreshSafeModules();
}
else {
$("#safe_mode_module").attr("disabled", "disabled");
$('#safe_mode_module').empty();
$("#safe_mode_module").append($("<option></option>").attr("value", 'Any').html('Any'));
}
});
// Fill modules in Safe Operation Mode.
function refreshSafeModules(){
var idAgents = Array();
jQuery.each ($("#id_agents option:selected"), function (i, val) {
idAgents.push($(val).val());
});
var params = {
"page" : "operation/agentes/ver_agente",
"get_agent_modules_json_for_multiple_agents" : 1,
"id_agent" : idAgents,
"selection_mode": "common"
};
jQuery.post ("ajax.php",
params,
function (data, status) {
$('#safe_mode_module').empty();
if($.type(data) === "object"){
jQuery.each (data, function (id, value) {
option = $("<option></option>").attr("value", value).html(value);
$("#safe_mode_module").append(option);
});
} else {
option = $("<option></option>").attr("value", 'None').html('None');
$("#safe_mode_module").append(option);
}
},
"json"
);
}
$("#form_agent").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
@ -833,7 +929,7 @@ $(document).ready (function () {
$("#id_group").trigger("change");
});
$("#id_agents").change (function () {
$('#id_agents').on('change', function() {
var idAgents = Array();
jQuery.each ($("#id_agents option:selected"), function (i, val) {
idAgents.push($(val).val());
@ -858,6 +954,10 @@ $(document).ready (function () {
);
$("#form_agents").attr("style", "");
if($("#safe_mode_change").val() == 1) {
refreshSafeModules();
}
});
$("#id_group").change (function () {

View File

@ -59,52 +59,36 @@ switch ($action) {
$resultOperationDB = false;
} else if (!empty($ids_serialize)) {
$ids = explode('|', $ids_serialize);
switch ($config['dbtype']) {
case 'mysql':
$items = db_get_all_rows_sql(
'
SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = '.$id_graph.'
ORDER BY `field_order`'
);
break;
}
$items = db_get_all_rows_sql(
'SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = '.$id_graph.'
ORDER BY `field_order`'
);
if ($items === false) {
$items = [];
}
// Clean the repeated order values
// Clean the repeated order values.
$order_temp = 1;
foreach ($items as $item) {
switch ($config['dbtype']) {
case 'mysql':
db_process_sql_update(
'tgraph_source',
['`field_order`' => $order_temp],
['id_gs' => $item['id_rc']]
);
break;
}
db_process_sql_update(
'tgraph_source',
['`field_order`' => $order_temp],
['id_gs' => $item['id_rc']]
);
$order_temp++;
}
switch ($config['dbtype']) {
case 'mysql':
$items = db_get_all_rows_sql(
'
SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = '.$id_graph.'
ORDER BY `field_order`'
);
break;
}
$items = db_get_all_rows_sql(
'SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = '.$id_graph.'
ORDER BY `field_order`'
);
if ($items === false) {
$items = [];
@ -116,7 +100,7 @@ switch ($action) {
$temp = [];
foreach ($items as $item) {
// Remove the contents from the block to sort
// Remove the contents from the block to sort.
if (array_search($item['id_gs'], $ids) === false) {
$temp[$item['field_order']] = $item['id_gs'];
}
@ -150,16 +134,11 @@ switch ($action) {
foreach ($items as $order => $id) {
switch ($config['dbtype']) {
case 'mysql':
db_process_sql_update(
'tgraph_source',
['`field_order`' => ($order + 1)],
['id_gs' => $id]
);
break;
}
db_process_sql_update(
'tgraph_source',
['`field_order`' => ($order + 1)],
['id_gs' => $id]
);
}
$resultOperationDB = true;
@ -211,7 +190,7 @@ if ($editGraph) {
$weights = implode(',', $weight_array);
}
// Modules table
// Modules table.
if (count($module_array) > 0) {
echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters'>";
echo '<tr>
@ -224,7 +203,7 @@ if (count($module_array) > 0) {
<th>'.__('Sort').'</th>';
$color = 0;
for ($a = 0; $a < count($module_array); $a++) {
// Calculate table line color
// Calculate table line color.
if ($color == 1) {
$tdcolor = 'datos';
$color = 0;
@ -332,7 +311,7 @@ echo '</form>';
echo '<br>';
// Configuration form
// Configuration form.
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&add_module=1&edit_graph=1&id=".$id_graph."'>";
@ -352,7 +331,7 @@ echo "<td colspan='3'>".html_print_select_groups(
true
).'</td>';
echo '</tr><tr>';
echo "<td style='vertical-align: top;'>".__('Agents').'</td>';
echo "<td style='vertical-align: top;'>".__('Agents').ui_print_help_tip(__('If you select several agents, only the common modules will be displayed'), true).'</td>';
echo '<td></td>';
echo "<td style='vertical-align: top;'>".__('Modules').'</td>';
echo '</tr><tr>';

View File

@ -125,6 +125,20 @@ if ($report_r && $report_w) {
get_graphs_container(id_container,hash,time);
}
});
$("div[id^=period_container_] a").on('click', function(e){
if ($("div[id^=period_container_][id$=_default]").css('display') == 'none') {
$('#refresh_custom_time').show();
$('#refresh_custom_time').on('click', function(e){
var time = $('input[id *= hidden-period_container_'+hash+']').val();
get_graphs_container(id_container,hash,time);
});
}
else if ($("div[id^=period_container_][id$=_manual]").css('display') == 'none') {
$('#refresh_custom_time').hide();
}
});
}
});
}

View File

@ -290,7 +290,7 @@ $table_aux = new stdClass();
foreach ($result_graphs as $graph) {
$data = [];
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text(io_safe_output($graph['name']), 70).'</a>';
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
$data[1] = ui_print_truncate_text($graph['description'], 70);

View File

@ -454,10 +454,10 @@ if (!$maps && !is_metaconsole()) {
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[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 {
$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 {
$data[3] = '';

View File

@ -905,6 +905,28 @@ $class = 'databox filters';
</td>
</tr>
<?php
if ($meta) {
?>
<tr id="row_servers" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Server'); ?></td>
<td style="">
<?php
html_print_select(
$servers,
'combo_server',
$server_name,
'',
__('Local metaconsole'),
0
);
?>
</td>
</tr>
<?php
}
?>
<tr id="row_label" style="" class="datos">
<td style="font-weight:bold;">
<?php
@ -1844,28 +1866,6 @@ $class = 'databox filters';
<td style="" id="max_items_example"></td>
</tr>
<?php
if ($meta) {
?>
<tr id="row_servers" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Server'); ?></td>
<td style="">
<?php
html_print_select(
$servers,
'combo_server',
$server_name,
'',
__('Local metaconsole'),
0
);
?>
</td>
</tr>
<?php
}
?>
<tr id="row_header" style="" class="datos">
<td style="font-weight:bold;">
<?php
@ -3546,8 +3546,19 @@ $(document).ready (function () {
// Load selected modules by default
$("#id_agents2").trigger('click');
$('#combo_server').change (function (){
$("#id_agents").html('');
$("#id_agents2").html('');
$("#module").html('');
$("#inventory_modules").html('');
})
$("#combo_group").change (
function () {
$("#id_agents").html('');
$("#id_agents2").html('');
$("#module").html('');
$("#inventory_modules").html('');
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
@ -3557,9 +3568,6 @@ $(document).ready (function () {
"recursion" : $('#checkbox-recursion').is(':checked')
},
function (data, status) {
$("#id_agents").html('');
$("#id_agents2").html('');
$("#module").html('');
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
@ -3587,9 +3595,7 @@ $(document).ready (function () {
"recursion" : $('#checkbox-recursion').is(':checked')
},
function (data, status) {
$("#id_agents").html('');
$("#id_agents2").html('');
$("#module").html('');
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
@ -5174,6 +5180,29 @@ function chooseType() {
$("#id_agents").change(event_change_id_agent_inventory);
$("#id_agents").trigger('change');
$("#combo_server").change(function() {
$('#hidden-date_selected').val('');
updateInventoryDates(
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
);
updateAgents($(this).val(),
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
);
});
$("#combo_group").change(function() {
updateAgents($(this).val(),
<?php
@ -5203,6 +5232,30 @@ function chooseType() {
$("#row_servers").show();
$("#combo_server").change(function() {
$('#hidden-date_selected').val('');
updateInventoryDates(
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
);
updateAgents($(this).val(),
<?php
echo '"'.ui_get_full_url(
false,
false,
false,
false
).'"';
?>
);
});
$("#combo_group").change(function() {
$('#hidden-date_selected').val('');
updateInventoryDates(

View File

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

View File

@ -1207,8 +1207,7 @@ switch ($action) {
$report_id_user = get_parameter('report_id_user');
$non_interactive = get_parameter('non_interactive', 0);
// Pretty font by default for pdf.
$custom_font = 'FreeSans.ttf';
$custom_font = $config['custom_report_front_font'];
switch ($type_access_selected) {
case 'group_view':
@ -1284,7 +1283,6 @@ switch ($action) {
$metaconsole_report = (int) is_metaconsole();
if ($config['custom_report_front']) {
$custom_font = $config['custom_report_front_font'];
$logo = $config['custom_report_front_logo'];
$header = $config['custom_report_front_header'];
$first_page = $config['custom_report_front_firstpage'];

View File

@ -15,7 +15,7 @@ global $config;
check_login();
// Visual console required
// Visual console required.
if (empty($visualConsole)) {
db_pandora_audit(
'ACL Violation',
@ -425,7 +425,7 @@ $table->data['all_one_item_per_agent'][1] .= html_print_input_hidden(
$table->rowstyle['all_4'] = 'display: none;';
$table->data['all_4'][0] = __('Agents');
$table->data['all_4'][0] = __('Agents').ui_print_help_tip(__('If you select several agents, only the common modules will be displayed'), true);
$agents_list = [];
if (!is_metaconsole()) {
@ -506,7 +506,7 @@ $table->data['all_8'][1] = html_print_select(
VISUAL_MAP_WIZARD_PARENTS_NONE,
true
);
$table->data['all_8'][2] = '<span id="parent_column_2_item_in_visual_map">'.__('Item in the map').'</span>'.'<span id="parent_column_2_relationship">'.ui_print_help_tip(
$table->data['all_8'][2] = '<span id="parent_column_2_item_in_visual_map">'.__('Item in the map').'</span><span id="parent_column_2_relationship">'.ui_print_help_tip(
__('The parenting relationships in %s will be drawn on the map.', get_product_name()),
true
).'</span>';

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] .= html_print_image('images/file.png', true);
$data[1] .= html_print_image('images/file.png', true, false, false, true);
$data[1] .= '</a>';
$table->data['plugin_command'] = $data;

View File

@ -1038,17 +1038,37 @@ $row++;
$row++;
$table_report->data[$row][0] = __('PDF font size');
$table_report->data[$row][1] = "<input type ='number' value=".$config['font_size_item_report']." size='1' name='font_size_item_report' min='1' max='9' step='0.1'>";
$table_report->data[$row][0] = __('PDF font size (px)');
$table_report->data[$row][1] = "<input type ='number' value=".$config['global_font_size_report']." name='global_font_size_report' min='1' max='50' step='1'>";
$row++;
$table_report->data[$row][0] = __('HTML font size for SLA (em)');
$table_report->data[$row][1] = "<input type ='number' value=".$config['font_size_item_report']." name='font_size_item_report' min='1' max='9' step='0.1'>";
$row++;
$table_report->data[$row][0] = __('PDF font family');
$table_report->data[$row][1] = html_print_select(
$fonts,
'custom_report_front_font',
$config['custom_report_front_font'],
false,
__('Default'),
'',
true
);
$row++;
$table_report->data[$row][0] = __('Graph image height for HTML reports');
$table_report->data[$row][0] .= ui_print_help_tip(
__('This is the height in pixels of the module graph or custom graph in the reports (only: HTML)'),
true
);
$table_report->data[$row][1] = html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
$row++;
$interval_description = [
@ -1072,18 +1092,6 @@ $row++;
}
}
// Font
$table_report->data['custom_report_front-font'][0] = __('Custom report front').' - '.__('Font family');
$table_report->data['custom_report_front-font'][1] = html_print_select(
$fonts,
'custom_report_front_font',
$config['custom_report_front_font'],
false,
__('Default'),
'',
true
);
// Logo
$table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip(
__("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."),
@ -1391,7 +1399,6 @@ function edit_csv_divider () {
function display_custom_report_front (show,table) {
if (show == true) {
$('tr#'+table+'-custom_report_front-font').show();
$('tr#'+table+'-custom_report_front-logo').show();
$('tr#'+table+'-custom_report_front-preview').show();
$('tr#'+table+'-custom_report_front-header').show();
@ -1399,7 +1406,6 @@ function display_custom_report_front (show,table) {
$('tr#'+table+'-custom_report_front-footer').show();
}
else {
$('tr#'+table+'-custom_report_front-font').hide();
$('tr#'+table+'-custom_report_front-logo').hide();
$('tr#'+table+'-custom_report_front-preview').hide();
$('tr#'+table+'-custom_report_front-header').hide();

View File

@ -101,7 +101,7 @@
width: 15px;
}
.fileupload_form ul li div {
display: block;
display: block !important;
}
.fileupload_form ul li.working span {
background-position: 0 -12px;

View File

@ -243,6 +243,12 @@ if ($create_user) {
$password_new = '';
$password_confirm = '';
$new_user = true;
} else if (preg_match('/^\s+|\s+$/', io_safe_output($id))) {
ui_print_error_message(__('Invalid user ID: leading or trailing blank spaces not allowed'));
$user_info = $values;
$password_new = '';
$password_confirm = '';
$new_user = true;
} else if ($password_new == '') {
ui_print_error_message(__('Passwords cannot be empty'));
$user_info = $values;

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

0
pandora_console/images/default_list.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 402 B

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -231,7 +231,7 @@ if ($save_event_filter) {
$values['id_name'] = get_parameter('id_name');
$values['id_group'] = get_parameter('id_group');
$values['event_type'] = get_parameter('event_type');
$values['severity'] = get_parameter('severity');
$values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['text_agent'] = get_parameter('text_agent');
@ -278,7 +278,7 @@ if ($update_event_filter) {
$id = get_parameter('id');
$values['id_group'] = get_parameter('id_group');
$values['event_type'] = get_parameter('event_type');
$values['severity'] = get_parameter('severity');
$values['severity'] = implode(',', get_parameter('severity', -1));
$values['status'] = get_parameter('status');
$values['search'] = get_parameter('search');
$values['text_agent'] = get_parameter('text_agent');
@ -439,8 +439,10 @@ function load_form_filter() {
$("#id_group").val(val);
if (i == 'event_type')
$("#event_type").val(val);
if (i == 'severity')
$("#severity").val(val);
if (i == 'severity') {
const multiple = val.split(",");
$("#severity").val(multiple);
}
if (i == 'status')
$("#status").val(val);
if (i == 'search')
@ -1579,7 +1581,7 @@ if ($get_list_events_agents) {
$id_agent = get_parameter('id_agent');
$server_id = get_parameter('server_id');
$event_type = get_parameter('event_type');
$severity = get_parameter('severity');
$severity = implode(',', get_parameter('severity', -1));
$status = get_parameter('status');
$search = get_parameter('search');
$id_agent_module = get_parameter('id_agent_module');

View File

@ -171,8 +171,9 @@ if ($get_graphs) {
'',
false,
$periods,
'vertical-align: middle;'
'vertical-align: middle; margin-bottom:0;'
);
$single_table .= html_print_image('images/refresh_mc.png', true, ['id' => 'refresh_custom_time', 'title' => 'Refresh graph', 'style' => 'cursor:pointer; vertical-align: middle; display:none;']);
$single_table .= '</td>';
$single_table .= '</tr>';
$single_table .= '</table>';

View File

@ -1141,11 +1141,7 @@ if (check_login()) {
$draw_events = 0;
}
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&amp;".'period='.SECONDS_1DAY.'&amp;id='.$module['id_agente_modulo'].'&amp;label='.rawurlencode(
urlencode(
base64_encode($module['nombre'])
)
).'&amp;refresh='.SECONDS_10MINUTES.'&amp;'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 700)";
$link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&amp;".'period='.SECONDS_1DAY.'&amp;id='.$module['id_agente_modulo'].'&amp;refresh='.SECONDS_10MINUTES.'&amp;'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 700)";
if (!is_snapshot_data($module['datos'])) {
$data[8] .= '<a href="javascript:'.$link.'">'.html_print_image('images/chart_curve.png', true, ['border' => '0', 'alt' => '']).'</a> &nbsp;&nbsp;';
}

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

@ -266,9 +266,10 @@ if ($install_package) {
[$version]
);
$product_name = io_safe_output(get_product_name());
db_pandora_audit(
'Update '.get_product_name(),
"Update version: $version of ".get_product_name().' by '.$config['id_user']
'Update '.$product_name,
"Update version: $version of ".$product_name.' by '.$config['id_user']
);
$return['status'] = 'success';
@ -403,6 +404,13 @@ if ($search_minor) {
$return['have_minor'] = true;
$size_mr = get_number_of_mr($package, $ent, $offline);
$return['mr'] = $size_mr;
} else {
$product_name = io_safe_output(get_product_name());
$version = get_parameter('version', '');
db_pandora_audit(
'ERROR: Update '.$product_name,
'Update version of '.$product_name.' by '.$config['id_user'].' has failed.'
);
}
echo json_encode($return);

View File

@ -1283,7 +1283,7 @@ switch ($action) {
[
'disabled' => 0,
'id_agente' => $elementFields['id_agent'],
'tagente_modulo.id_tipo_modulo IN' => '(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,17,23,3,10,33)',
'tagente_modulo.id_tipo_modulo IN' => '(17,23,3,10,33)',
]
);

View File

@ -391,13 +391,6 @@ class ConsoleSupervisor
$this->checkDefaultPassword();
/*
* Check if there's an active subscription.
* NOTIF.NEWSLETTER.SUBSCRIPTION
*/
$this->checkNewsletterSubscription();
/*
* Check if there're new updates.
* NOTIF.UPDATEMANAGER.OPENSETUP
@ -608,7 +601,6 @@ class ConsoleSupervisor
case 'NOTIF.MISC.DEVELOPBYPASS':
case 'NOTIF.MISC.FONTPATH':
case 'NOTIF.SECURITY.DEFAULT_PASSWORD':
case 'NOTIF.NEWSLETTER.SUBSCRIPTION':
case 'NOTIF.UPDATEMANAGER.OPENSETUP':
case 'NOTIF.UPDATEMANAGER.UPDATE':
case 'NOTIF.UPDATEMANAGER.MINOR':
@ -2000,41 +1992,6 @@ class ConsoleSupervisor
}
/**
* Check if instance is subscribed to newsletter.
*
* @return void
*/
public function checkNewsletterSubscription()
{
global $config;
$login = get_parameter('login', false);
// Newsletter advice.
$newsletter = db_get_value(
'middlename',
'tusuario',
'id_user',
$config['id_user']
);
if (!$config['disabled_newsletter']
&& $newsletter != 1
&& $login === false
) {
$this->notify(
[
'type' => 'NOTIF.NEWSLETTER.SUBSCRIPTION',
'title' => __('Not subscribed to the newsletter'),
'message' => __('Click <a style="font-weight:bold; text-decoration:underline" href="javascript: force_run_newsletter();"> here</a> to subscribe to the newsletter'),
'url' => 'javascript: force_run_newsletter();',
]
);
} else {
$this->cleanNotifications('NOTIF.NEWSLETTER.SUBSCRIPTION');
}
}
/**
* Check if user 'admin' is enabled and using default password.
*

View File

@ -1340,7 +1340,14 @@ class NetworkMap
if ($rel['parent_type'] == NODE_MODULE
&& $rel['child_type'] == NODE_MODULE
) {
// Keep std references.
$ref_id_parent = $id_parent;
$ref_id_child = $id_child;
// Module information available.
$id_parent = $rel['id_parent_source_data'];
$id_child = $rel['id_child_source_data'];
$priority = 1;
$valid = 1;
@ -1371,6 +1378,12 @@ class NetworkMap
'index' => $index,
'priority' => $priority,
];
// Keep node reference mapping - low precedence relationship.
$rel_map[$ref_id_parent.'_'.$ref_id_child] = [
'index' => $index,
'priority' => $priority,
];
}
} else if ($rel['parent_type'] == NODE_AGENT
&& $rel['child_type'] == NODE_AGENT
@ -1655,7 +1668,6 @@ class NetworkMap
$node['style']['label'] = $node['name'];
}
$node['style']['shape'] = 'circle';
if (isset($source_data['color'])) {
$item['color'] = $source_data['color'];
} else {
@ -2957,7 +2969,7 @@ class NetworkMap
'',
0,
true
).'&nbsp;<span id="shape_icon_in_progress" style="display: none;">'.html_print_image('images/spinner.gif', true).'</span><span id="shape_icon_correct" style="display: none;">'.html_print_image('images/dot_green.png', true).'</span><span id="shape_icon_fail" style="display: none;">'.html_print_image('images/dot_red.png', true).'</span>';
).'&nbsp;<span id="shape_icon_in_progress" style="display: none;">'.html_print_image('images/spinner.gif', true).'</span><span id="shape_icon_correct" style="display: none;">'.html_print_image('images/success.png', true, ['width' => '18px']).'</span><span id="shape_icon_fail" style="display: none;">'.html_print_image('images/icono-bad.png', true, ['width' => '18px']).'</span>';
$table->data['node_name'][0] = __('Name');
$table->data['node_name'][1] = html_print_input_text(
'edit_name_node',

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

@ -652,7 +652,6 @@ class Tree
'type' => $graphType,
'period' => SECONDS_1DAY,
'id' => $module['id'],
'label' => base64_encode($module['name']),
'refresh' => SECONDS_10MINUTES,
];

View File

@ -396,7 +396,11 @@ class WelcomeWindow extends Wizard
$logo_url = ENTERPRISE_DIR.'/';
}
$logo_url .= 'images/custom_logo/'.$config['custom_logo_white_bg'];
if (empty($config['custom_logo_white_bg']) === false) {
$logo_url .= 'images/custom_logo/'.$config['custom_logo_white_bg'];
} else {
$logo_url .= 'images/custom_logo/pandora_logo_head_white_bg.png';
}
$inputs = [
[

View File

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

View File

@ -3868,8 +3868,8 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
}
if ($type_graph_pdf === 'slicebar') {
$height_img = 90;
$params['height'] = 90;
$width_img = 360;
$height_img = 70;
}
$params_encode_json = urlencode(json_encode($params));

View File

@ -146,7 +146,7 @@ function agents_get_next_contact_time_left(int $id_agente)
if ($id_agente > 0) {
$last_contact = db_get_value_sql(
sprintf(
'SELECT format(intervalo,2) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
'SELECT CAST(intervalo AS SIGNED) - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto >= ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) as "val"
FROM `tagente`
WHERE id_agente = %d ',
$id_agente
@ -3512,13 +3512,18 @@ function agents_get_status_animation($up=true)
function agents_get_agent_id_by_alias_regex($alias_regex, $flag='i', $limit=0)
{
$agents_id = [];
$all_agents = agents_get_agents(false, ['id_agente', 'alias']);
if (is_metaconsole()) {
$all_agents = agents_meta_get_agents('AR', '|');
} else {
$all_agents = agents_get_group_agents(0, true, 'lower', false, false, true, '|');
}
$agent_match = '/'.$alias_regex.'/'.$flag;
foreach ($all_agents as $agent) {
$result_agent_match = preg_match($agent_match, $agent['alias']);
foreach ($all_agents as $agent_id => $agent_alias) {
$result_agent_match = preg_match($agent_match, $agent_alias);
if ($result_agent_match) {
$agents_id[] = $agent['id_agente'];
$agents_id[] = $agent_id;
$i++;
if ($i === $limit) {
break;

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 $thrash1 Don't use.
* @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>;
* <history_data>;<ip_target>;<module_port>;<snmp_community>;<snmp_oid>;<module_interval>;<post_process>;
* <min>;<max>;<custom_id>;<description>;<disabled_types_event>;<module_macros>;
* <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>)
* 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_|
*
* @param $thrash3 Don't use
* @param string $id Name of agent to add the module.
* @param string $thrash1 Don't use.
* @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>;
* <history_data>;<ip_target>;<module_port>;<snmp_community>;<snmp_oid>;<module_interval>;<post_process>;
* <min>;<max>;<custom_id>;<description>;<disabled_types_event>;<module_macros>;
* <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>).
* @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_|*
* @return mixed Return.
*/
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],
'critical_inverse' => $other['data'][28],
'warning_inverse' => $other['data'][29],
'ff_type' => $other['data'][30],
];
if (! $values['descripcion']) {
$values['descripcion'] = '';
// Column 'descripcion' cannot be null
// Column 'descripcion' cannot be null.
}
if (! $values['module_macros']) {
$values['module_macros'] = '';
// Column 'module_macros' cannot be null
// Column 'module_macros' cannot be null.
}
if ($agent_by_alias) {
@ -3190,7 +3190,7 @@ function api_set_create_network_module($id, $thrash1, $other, $thrash3)
}
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.'));
} else {
returnData('string', ['type' => 'string', 'data' => $idModule]);
@ -3307,6 +3307,7 @@ function api_set_update_network_module($id_module, $thrash1, $other, $thrash3)
'critical_inverse',
'warning_inverse',
'policy_linked',
'ff_type',
];
$values = [];
@ -3420,16 +3421,17 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
'min_ff_event_critical' => $other['data'][32],
'critical_inverse' => $other['data'][33],
'warning_inverse' => $other['data'][34],
'ff_type' => $other['data'][35],
];
if (! $values['descripcion']) {
$values['descripcion'] = '';
// Column 'descripcion' cannot be null
// Column 'descripcion' cannot be null.
}
if (! $values['module_macros']) {
$values['module_macros'] = '';
// Column 'module_macros' cannot be null
// Column 'module_macros' cannot be null.
}
if ($agent_by_alias) {
@ -3455,7 +3457,7 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
}
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.'));
} else {
returnData('string', ['type' => 'string', 'data' => $idModule]);
@ -3562,6 +3564,7 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3)
'critical_inverse',
'warning_inverse',
'policy_linked',
'ff_type',
];
$values = [];
@ -3669,16 +3672,17 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3)
'ff_timeout' => $other['data'][23],
'critical_inverse' => $other['data'][24],
'warning_inverse' => $other['data'][25],
'ff_type' => $other['data'][26],
];
if (! $values['descripcion']) {
$values['descripcion'] = '';
// Column 'descripcion' cannot be null
// Column 'descripcion' cannot be null.
}
if (! $values['module_macros']) {
$values['module_macros'] = '';
// Column 'module_macros' cannot be null
// Column 'module_macros' cannot be null.
}
if ($agent_by_alias) {
@ -3704,7 +3708,7 @@ function api_set_create_data_module($id, $thrash1, $other, $thrash3)
}
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.'));
} else {
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']) {
$values['descripcion'] = '';
// Column 'descripcion' cannot be null
// Column 'descripcion' cannot be null.
}
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);
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.'));
} else {
$synthetic_type = $other['data'][1];
@ -4190,6 +4194,7 @@ function api_set_update_data_module($id_module, $thrash1, $other, $thrash3)
'critical_inverse',
'warning_inverse',
'policy_linked',
'ff_type',
];
$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 = json_encode($disabled_types_event);
// SNMP version 3
// SNMP version 3.
if ($other['data'][14] == '3') {
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\'. '));
@ -4329,6 +4334,7 @@ function api_set_create_snmp_module($id, $thrash1, $other, $thrash3)
'min_ff_event_normal' => $other['data'][31],
'min_ff_event_warning' => $other['data'][32],
'min_ff_event_critical' => $other['data'][33],
'ff_type' => $other['data'][34],
];
} else {
$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_warning' => $other['data'][26],
'min_ff_event_critical' => $other['data'][27],
'ff_type' => $other['data'][28],
];
}
if (! $values['descripcion']) {
$values['descripcion'] = '';
// Column 'descripcion' cannot be null
// Column 'descripcion' cannot be null.
}
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_critical',
'policy_linked',
'ff_type',
];
} else {
$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_critical',
'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_warning' => $other['data'][21],
'min_ff_event_critical' => $other['data'][22],
'ff_type' => $other['data'][23],
];
$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_warning' => $other['data'][25],
'min_ff_event_critical' => $other['data'][26],
'ff_type' => $other['data'][27],
];
$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_warning' => $other['data'][30],
'min_ff_event_critical' => $other['data'][31],
'ff_type' => $other['data'][32],
];
} else {
$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_warning' => $other['data'][26],
'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_critical' => $other['data'][9],
'ff_timeout' => $other['data'][10],
'ff_type' => $other['data'][11],
];
$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_critical'] = $other['data'][22];
$values['ff_timeout'] = $other['data'][23];
$values['ff_type'] = $other['data'][24];
if ($name_module_policy !== false) {
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_warning'] = $other['data'][25];
$values['min_ff_event_critical'] = $other['data'][26];
$values['ff_type'] = $other['data'][27];
if ($name_module_policy !== false) {
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;
}
// Check if the module exists
// Check if the module exists.
$module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']);
if ($module_policy === false) {
@ -7241,7 +7257,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
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']);
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_warning'] = $other['data'][30];
$values['min_ff_event_critical'] = $other['data'][31];
$values['ff_type'] = $other['data'][32];
if ($name_module_policy !== false) {
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;
}
// Check if the module exists
// Check if the module exists.
$module_policy = enterprise_hook('policies_get_modules', [$id, ['id' => $other['data'][0]], 'id_module']);
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']));
// 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));
// If exists a module with same name, abort
// If exists a module with same name, abort.
if (!empty($old_configuration_data)) {
returnError('error_adding_module_conf', '-2');
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']));
// Get current configuration
// Get current configuration.
$old_configuration_data = config_agents_get_module_from_conf($id_agent, io_safe_output($module_name));
// If not exists
@ -7580,7 +7597,7 @@ function api_set_update_module_in_conf($id_agent, $module_name, $configuration_d
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) {
returnData('string', ['type' => 'string', 'data' => '1']);
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_warning' => $other['data'][31],
'min_ff_event_critical' => $other['data'][32],
'ff_type' => $other['data'][33],
];
} else {
$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_warning' => $other['data'][25],
'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;
// 1 hour by default
// 1 hour by default.
$graph_threshold = (!empty($other) && isset($other['data'][2]) && $other['data'][2]) ? $other['data'][2] : 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)) {
// avoid warnings
// avoid warnings.
$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);
if ($id_agent !== false) {
// Create cluster
// Create cluster.
$values_cluster = [
'name' => $name,
'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);
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);
}
@ -13989,7 +14008,7 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras
return;
}
// Take agent data
// Take agent data.
$row = db_get_row('tagente', 'id_agente', $id_agent);
$intervalo = $row['intervalo'];
@ -14023,7 +14042,7 @@ function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thras
}
foreach ($nc as $row2) {
// Insert each module from tnetwork_component into agent
// Insert each module from tnetwork_component into agent.
$values = [
'id_agente' => $id_agent,
'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_warning' => $row2['min_ff_event_warning'],
'min_ff_event_critical' => $row2['min_ff_event_critical'],
'ff_type' => $row2['ff_type'],
];
$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'])) {
$tags = explode(',', $row2['tags']);
} else {
$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]);
if ($module_name_check !== false) {

View File

@ -1287,7 +1287,11 @@ function config_update_config()
// Juanma (06/05/2014) New feature: Custom front page for reports.
if (!config_update_value('font_size_item_report', get_parameter('font_size_item_report', 2))) {
$error_update[] = __('Font size for items reports');
$error_update[] = __('HTML font size for SLA (em)');
}
if (!config_update_value('global_font_size_report', get_parameter('global_font_size_report', 14))) {
$error_update[] = __('PDF font size (px)');
}
if (!config_update_value('custom_report_front', get_parameter('custom_report_front'))) {
@ -1404,19 +1408,35 @@ function config_update_config()
$error_update[] = __('Database password');
}
if (!config_update_value('history_db_days', get_parameter('history_db_days'))) {
$history_db_days = get_parameter('history_db_days');
if (!is_numeric($history_db_days)
|| $history_db_days <= 0
|| !config_update_value('history_db_days', $history_db_days)
) {
$error_update[] = __('Days');
}
if (!config_update_value('history_event_days', get_parameter('history_event_days'))) {
$history_event_days = get_parameter('history_event_days');
if (!is_numeric($history_event_days)
|| $history_event_days <= 0
|| !config_update_value('history_event_days', $history_event_days)
) {
$error_update[] = __('Event Days');
}
if (!config_update_value('history_db_step', get_parameter('history_db_step'))) {
$history_db_step = get_parameter('history_db_step');
if (!is_numeric($history_db_step)
|| $history_db_step <= 0
|| !config_update_value('history_db_step', $history_db_step)
) {
$error_update[] = __('Step');
}
if (!config_update_value('history_db_delay', get_parameter('history_db_delay'))) {
$history_db_delay = get_parameter('history_db_delay');
if (!is_numeric($history_db_delay)
|| $history_db_delay <= 0
|| !config_update_value('history_db_delay', $history_db_delay)
) {
$error_update[] = __('Delay');
}
break;

View File

@ -551,8 +551,9 @@ function cron_list_table()
$report_per_agent = $args[0];
$report_name = $args[3];
$email = $args[4];
$data[2] .= '<br>- '.__('Template').": <a href='index.php?sec=reporting&sec2=operation/reporting/reporting_viewer";
$data[2] .= '&id='.$args[0]."'>".$template['name'].'</a>';
$data[2] .= '<br>- '.__('Template').': ';
$data[2] .= '<a href="'.ui_get_full_url('index.php?sec=reporting&sec2=enterprise/godmode/reporting/reporting_builder.template&action=edit&id_template='.$args[0]).'">';
$data[2] .= $template['name'].'</a>';
$data[2] .= '<br>- '.__('Agents').': '.$agents_id.'</a>';
$data[2] .= '<br>- '.__('Report per agent').': '.$report_per_agent.'</a>';
$data[2] .= '<br>- '.__('Report name').': '.$report_name.'</a>';

View File

@ -624,7 +624,37 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
break;
}
return db_process_sql($update_sql);
$result = db_process_sql($update_sql);
if ($result) {
switch ($status) {
case EVENT_STATUS_NEW:
$status_string = 'New';
break;
case EVENT_STATUS_VALIDATED:
$status_string = 'Validated';
break;
case EVENT_STATUS_INPROCESS:
$status_string = 'In process';
break;
default:
$status_string = '';
break;
}
events_comment(
$id_evento,
'',
'Change status to '.$status_string,
is_metaconsole() ? true : false,
$history
);
}
return $result;
}
@ -751,43 +781,78 @@ function events_get_all(
}
if (isset($filter['severity']) && $filter['severity'] > 0) {
switch ($filter['severity']) {
case EVENT_CRIT_MAINTENANCE:
case EVENT_CRIT_INFORMATIONAL:
case EVENT_CRIT_NORMAL:
case EVENT_CRIT_MINOR:
case EVENT_CRIT_WARNING:
case EVENT_CRIT_MAJOR:
case EVENT_CRIT_CRITICAL:
default:
$sql_filters[] = sprintf(
' AND criticity = %d ',
$filter['severity']
);
break;
if (is_array($filter['severity'])) {
if (!in_array(-1, $filter['severity'])) {
$not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']);
if ($not_normal !== false) {
unset($filter['severity'][$not_normal]);
$sql_filters[] = sprintf(
' AND criticity != %d',
EVENT_CRIT_NORMAL
);
} else {
$critical_warning = array_search(EVENT_CRIT_WARNING_OR_CRITICAL, $filter['severity']);
if ($critical_warning !== false) {
unset($filter['severity'][$critical_warning]);
$filter['severity'][] = EVENT_CRIT_WARNING;
$filter['severity'][] = EVENT_CRIT_CRITICAL;
}
case EVENT_CRIT_WARNING_OR_CRITICAL:
$sql_filters[] = sprintf(
' AND (criticity = %d OR criticity = %d)',
EVENT_CRIT_WARNING,
EVENT_CRIT_CRITICAL
);
break;
$critical_normal = array_search(EVENT_CRIT_OR_NORMAL, $filter['severity']);
if ($critical_normal !== false) {
unset($filter['severity'][$critical_normal]);
$filter['severity'][] = EVENT_CRIT_NORMAL;
$filter['severity'][] = EVENT_CRIT_CRITICAL;
}
case EVENT_CRIT_NOT_NORMAL:
$sql_filters[] = sprintf(
' AND criticity != %d',
EVENT_CRIT_NORMAL
);
break;
if (!empty($filter['severity'])) {
$filter['severity'] = implode(',', $filter['severity']);
$sql_filters[] = sprintf(
' AND criticity IN (%s)',
$filter['severity']
);
}
}
}
} else {
switch ($filter['severity']) {
case EVENT_CRIT_MAINTENANCE:
case EVENT_CRIT_INFORMATIONAL:
case EVENT_CRIT_NORMAL:
case EVENT_CRIT_MINOR:
case EVENT_CRIT_WARNING:
case EVENT_CRIT_MAJOR:
case EVENT_CRIT_CRITICAL:
default:
$sql_filters[] = sprintf(
' AND criticity = %d ',
$filter['severity']
);
break;
case EVENT_CRIT_OR_NORMAL:
$sql_filters[] = sprintf(
' AND (criticity = %d OR criticity = %d)',
EVENT_CRIT_NORMAL,
EVENT_CRIT_CRITICAL
);
break;
case EVENT_CRIT_WARNING_OR_CRITICAL:
$sql_filters[] = sprintf(
' AND (criticity = %d OR criticity = %d)',
EVENT_CRIT_WARNING,
EVENT_CRIT_CRITICAL
);
break;
case EVENT_CRIT_NOT_NORMAL:
$sql_filters[] = sprintf(
' AND criticity != %d',
EVENT_CRIT_NORMAL
);
break;
case EVENT_CRIT_OR_NORMAL:
$sql_filters[] = sprintf(
' AND (criticity = %d OR criticity = %d)',
EVENT_CRIT_NORMAL,
EVENT_CRIT_CRITICAL
);
break;
}
}
}
@ -4009,7 +4074,7 @@ function events_page_details($event, $server='')
$data = [];
$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;
$data = [];
@ -4116,7 +4181,6 @@ function events_page_details($event, $server='')
'type' => $graph_type,
'period' => SECONDS_1DAY,
'id' => $module['id_agente_modulo'],
'label' => base64_encode($module['nombre']),
'refresh' => SECONDS_10MINUTES,
];

View File

@ -106,12 +106,8 @@ if (!function_exists('mime_content_type')) {
finfo_close($finfo);
return $mimetype;
} else {
$temp = exec('file '.$filename);
if (isset($temp) && $temp != '') {
return $temp;
} else {
return 'application/octet-stream';
}
error_log('Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini');
return 'unknown';
}
}
@ -694,8 +690,9 @@ function filemanager_file_explorer(
$data[1] = '<a href="'.$url_file_clean.'">'.$fileinfo['name'].'</a>';
} else {
$hash = md5($relative_path.$config['dbpass']);
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode(base64_encode($relative_path)).'&hash='.$hash.'">'.$fileinfo['name'].'</a>';
$filename = base64_encode($relative_directory.'/'.$fileinfo['name']);
$hash = md5($filename.$config['dbpass']);
$data[1] = '<a href="'.$hack_metaconsole.'include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'">'.$fileinfo['name'].'</a>';
}
// Notice that uploaded php files could be dangerous
@ -755,8 +752,9 @@ function filemanager_file_explorer(
}
if ((!$fileinfo['is_dir']) && ($download_button)) {
$hash = md5($fileinfo['realpath'].$config['dbpass']);
$data[4] .= '<a href="include/get_file.php?file='.urlencode(base64_encode($fileinfo['realpath'])).'&hash='.$hash.'" style="vertical-align: 25%;">';
$filename = base64_encode($fileinfo['name']);
$hash = md5($filename.$config['dbpass']);
$data[4] .= '<a href="include/get_file.php?file='.urlencode($filename).'&hash='.$hash.'" style="vertical-align: 25%;">';
$data[4] .= html_print_image('images/file.png', true);
$data[4] .= '</a>';
}

View File

@ -1446,9 +1446,20 @@ function graphic_combined_module(
$data_module_graph['agent_name'] = modules_get_agentmodule_agent_name(
$agent_module_id
);
$data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias(
$agent_module_id
);
if (is_metaconsole()) {
$data_module_graph['agent_alias'] = db_get_value(
'alias',
'tagente',
'id_agente',
(int) $module_data['id_agente']
);
} else {
$data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias(
$agent_module_id
);
}
$data_module_graph['agent_id'] = $module_data['id_agente'];
$data_module_graph['module_name'] = $module_data['nombre'];
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];

View File

@ -1178,12 +1178,17 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
}
// Minutes
for ($i = 0; $i < 60; $i += 5) {
for ($i = 0; $i < 60; $i++) {
$minutes[$i] = $i;
// If minute is not a multiple of 5, then add style to option in order to hide it from minute select but still is a valid value that input can adopt. We want this in case a value that is not a multiple of 5 is entered in module's data configuration.
if (($i % 5) != 0) {
$minutes_hidden_options[$i] = 'display: none;';
}
}
// Month days
for ($i = 0; $i < 31; $i++) {
for ($i = 1; $i <= 31; $i++) {
$mdays[$i] = $i;
}
@ -1216,13 +1221,13 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
if ($to) {
$table->data[0][0] = html_print_select($hours, 'hour_to', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
$table->data[0][2] = html_print_select($mdays, 'mday_to', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][3] = html_print_select($months, 'month_to', $month, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][4] = html_print_select($wdays, 'wday_to', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
} else {
$table->data[0][0] = html_print_select($hours, 'hour_from', $hour, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options);
$table->data[0][2] = html_print_select($mdays, 'mday_from', $mday, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][3] = html_print_select($months, 'month_from', $month, '', __('Any'), '*', true, false, false, '', $disabled);
$table->data[0][4] = html_print_select($wdays, 'wday_from', $wday, '', __('Any'), '*', true, false, false, '', $disabled);
@ -3071,9 +3076,12 @@ function html_print_autocomplete_modules(
['style' => 'background: url(images/search_module.png) no-repeat right;']
);
html_print_input_hidden($name.'_hidden', $id_agent_module);
ui_print_help_tip(__('Type at least two characters to search the module.'), false);
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false);
if (!is_metaconsole()) {
ui_print_help_tip(__('Type at least two characters to search the module.'), false);
}
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false);
?>
<script type="text/javascript">
function escapeHTML (str)

View File

@ -1453,6 +1453,20 @@ function networkmap_delete_nodes($id_map)
}
/**
* Delete relations given id_map
*
* @param integer $id_map
* @return integer result
*/
function networkmap_delete_relations($id_map)
{
$result = db_process_sql_delete('trel_item', ['id_map' => $id_map]);
return $result;
}
function get_networkmaps($id)
{
$groups = array_keys(users_get_groups(null, 'IW'));

View File

@ -314,7 +314,7 @@ function profile_print_profile_table($id)
$tags = tags_get_all_tags();
$data['tags'] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true);
$data['hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true).ui_print_help_icon('no_hierarchy', true);
$data['hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true);
$data['actions'] = html_print_input_image('add', 'images/add.png', 1, '', true);
$data['actions'] .= html_print_input_hidden('id', $id, true);

View File

@ -190,6 +190,8 @@ function reporting_make_reporting_data(
$metaconsole_on = is_metaconsole();
$index_content = 0;
foreach ($contents as $content) {
$content['name'] = io_safe_input($content['name']);
$content['description'] = io_safe_input($content['description']);
if (!empty($content['id_agent_module']) && !empty($content['id_agent'])
&& tags_has_user_acl_tags($config['id_user'])
) {
@ -325,6 +327,17 @@ function reporting_make_reporting_data(
$content['id_agent']
);
// This is for metaconsole. It is an array with modules and server (id node).
if (is_array($content['id_agent_module'])) {
$modules_server_array = $content['id_agent_module'];
$modules_array = [];
foreach ($modules_server_array as $value) {
$modules_array[] = $value['module'];
}
$content['id_agent_module'] = $modules_array;
}
$modules = agents_get_modules(
$agent_value,
[
@ -760,7 +773,7 @@ function reporting_make_reporting_data(
continue;
}
$report['contents'][] = $report_control;
$report['contents'][] = $report_control;
break;
case 'top_n':
@ -1775,6 +1788,27 @@ function reporting_event_report_group(
$event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
$event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
if (isset($content['recursion']) && $content['recursion'] == 1 && $content['id_group'] != 0) {
$propagate = db_get_value(
'propagate',
'tgrupo',
'id_grupo',
$content['id_group']
);
if ($propagate) {
$children = groups_get_children($content['id_group']);
$_groups = [ $content['id_group'] ];
if (!empty($children)) {
foreach ($children as $child) {
$_groups[] = (int) $child['id_grupo'];
}
}
$content['id_group'] = $_groups;
}
}
$data = events_get_agent(
false,
$content['period'],
@ -4254,14 +4288,7 @@ function reporting_sql_graph(
case 'data':
$data = [];
foreach ($modules as $key => $value) {
$data[$value] = modules_get_agentmodule_data(
$value,
$content['period'],
$report['datetime']
);
}
$data = db_get_all_rows_sql($content['external_source']);
$return['chart'] = $data;
break;
}
@ -7578,16 +7605,18 @@ function reporting_custom_graph(
$content['name'] = __('Simple graph');
}
$module_source = db_get_all_rows_sql(
'SELECT id_agent_module
FROM tgraph_source
WHERE id_graph = '.$content['id_gs']
);
if ($type_report != 'automatic_graph') {
$module_source = db_get_all_rows_sql(
'SELECT id_agent_module
FROM tgraph_source
WHERE id_graph = '.$content['id_gs']
);
if (isset($module_source) && is_array($module_source)) {
$modules = [];
foreach ($module_source as $key => $value) {
$modules[$key] = $value['id_agent_module'];
if (isset($module_source) && is_array($module_source)) {
$modules = [];
foreach ($module_source as $key => $value) {
$modules[$key] = $value['id_agent_module'];
}
}
}
@ -7606,7 +7635,7 @@ function reporting_custom_graph(
$return['title'] = $content['name'];
$return['landscape'] = $content['landscape'];
$return['pagebreak'] = $content['pagebreak'];
$return['subtitle'] = io_safe_output($graph['name']);
$return['subtitle'] = $graph['name'];
$return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name;
$return['description'] = $content['description'];

View File

@ -130,7 +130,7 @@ function html_do_report_info($report)
$html .= '</tr>
<tr>
<td valign="top"><b>'.__('Description').': </b></td><td>'.io_safe_output($report['description']).'</td>
<td valign="top"><b>'.__('Description').': </b></td><td>'.htmlspecialchars($report['description']).'</td>
</tr>
</table>'.'</div>';
@ -447,9 +447,9 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$interval_description = $config['interval_description'];
if ($mini) {
$font_size = '1.5';
$font_size = '1.5em';
} else {
$font_size = $config['font_size_item_report'];
$font_size = $config['font_size_item_report'].'em';
}
$metaconsole_on = is_metaconsole();
@ -588,18 +588,18 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$row[] = round($sla['sla_limit'], 2).'%';
if (reporting_sla_is_not_init_from_array($sla)) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">'.__('N/A').'</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">'.__('Not init').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NOTINIT.';">'.__('N/A').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NOTINIT.';">'.__('Not init').'</span>';
} else if (reporting_sla_is_ignored_from_array($sla)) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_IGNORED.';">'.__('N/A').'</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_IGNORED.';">'.__('No data').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_IGNORED.';">'.__('N/A').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_IGNORED.';">'.__('No data').'</span>';
// Normal calculation.
} else if ($sla['sla_status']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">'.__('OK').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">'.__('OK').'</span>';
} else {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'.sla_truncate($sla['sla_value'], $config['graph_precision']).'%</span>';
$row[] = '<span style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
}
// Second table for time globals.
@ -725,11 +725,14 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$table->data['error']['cell'] = __('There are no Agent/Modules defined');
}
if (!empty($item['charts'])) {
if (empty($item['charts']) === false) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->width = '100%';
$table1->size = [];
$table1->size[0] = '10%';
if ($pdf !== 0) {
$table1->size[0] = '20%';
}
$table1->data = [];
@ -2307,7 +2310,6 @@ function reporting_html_network_interfaces_report($table, $item, $pdf=0)
$table_agent->head = [];
$table_agent->head[0] = __('Agent').' '.$agent['agent'];
$table_agent->headstyle = [];
$table_agent->headstyle[0] = 'font-size: 16px;';
$table_agent->style[0] = 'text-align: center';
$table_agent->data['interfaces'] = '';
@ -2396,7 +2398,6 @@ function reporting_html_alert_report($table, $item, $pdf=0)
'',
true
);
return true;
}
$table1->head['agent'] = __('Agent');
@ -2500,9 +2501,9 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
global $config;
if ($mini) {
$font_size = '1.5';
$font_size = '1.5em';
} else {
$font_size = $config['font_size_item_report'];
$font_size = $config['font_size_item_report'].'em';
}
$table->colspan['module']['cell'] = 3;
@ -2513,10 +2514,10 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
$table1->head = [];
$table1->data = [];
if ($item['data']['unknown'] == 1) {
$table1->data['data']['unknown'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">';
$table1->data['data']['unknown'] = '<p style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_UNKNOWN.';">';
$table1->data['data']['unknown'] .= __('Unknown').'</p>';
} else {
$table1->data['data']['ok'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">';
$table1->data['data']['ok'] = '<p style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_NORMAL.';">';
$table1->data['data']['ok'] .= html_print_image(
'images/module_ok.png',
true
@ -2527,7 +2528,7 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
)
).' %</p>';
$table1->data['data']['fail'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">';
$table1->data['data']['fail'] = '<p style="font-weight: bold; font-size: '.$font_size.' !important; color: '.COL_CRITICAL.';">';
$table1->data['data']['fail'] .= html_print_image(
'images/module_critical.png',
true
@ -2747,9 +2748,9 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
global $config;
if ($mini) {
$font_size = '1.5';
$font_size = '1.5em';
} else {
$font_size = $config['font_size_item_report'];
$font_size = $config['font_size_item_report'].'em';
}
if (isset($item['visual_format']) && $item['visual_format'] != 0
@ -2864,7 +2865,7 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e
$table->colspan['data']['cell'] = 3;
$table->cellstyle['data']['cell'] = 'text-align: left;';
$table->data['data']['cell'] = '<p style="font: bold '.$font_size.'em Arial, Sans-serif; color: #000000;">';
$table->data['data']['cell'] = '<p style="font-weight: bold; font-size: '.$font_size.'; color: #000000;">';
if ($check_empty && empty($item['data']['value'])) {
$table->data['data']['cell'] .= __('Unknown');
@ -3018,6 +3019,7 @@ function reporting_html_availability($table, $item, $pdf=0)
global $config;
$font_size = $config['font_size_item_report'].'em';
$interval_description = $config['interval_description'];
if (!empty($item['data'])) {
@ -3224,7 +3226,7 @@ function reporting_html_availability($table, $item, $pdf=0)
$table_row[] = '';
};
$table_row[] = '<span style="font-size: 1.2em; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
$table_row[] = '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($row['SLA'], $config['graph_precision']).'%</span>';
$table_row2 = [];
$table_row2[] = $row['agent'];
@ -3320,7 +3322,7 @@ function reporting_html_availability($table, $item, $pdf=0)
$item['resume']['min'],
$config['graph_precision']
).'%',
'avg' => '<span style="font-size: 1.2em; font-weight:bold;">'.sla_truncate($item['resume']['avg'], $config['graph_precision']).'%</span>',
'avg' => '<span style="font-size: '.$font_size.'; font-weight:bold;">'.sla_truncate($item['resume']['avg'], $config['graph_precision']).'%</span>',
];
if ($item['fields']['agent_max_value'] == false) {
$table1->head['max_text'] = '';
@ -3377,6 +3379,14 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
global $config;
$metaconsole_on = is_metaconsole();
$font_size = $config['font_size_item_report'].'em';
if ($pdf) {
$font_mini = '9px';
} else {
$font_mini = 'inherit';
}
if ($metaconsole_on !== false) {
$hack_metaconsole = '../../';
} else {
@ -3424,17 +3434,25 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
// Check failover availability report.
if ($item['data'][$k_chart]['failover'] === '') {
$table1 = new stdClass();
$table1->width = '99%';
$table1->width = '100%';
$table1->data = [];
$table1->size = [];
$table1->size[0] = '10%';
$table1->size[1] = '80%';
$table1->size[2] = '5%';
$table1->size[3] = '5%';
if ($pdf !== 0) {
$table1->size[0] = '20%';
$table1->size[1] = '60%';
$table1->size[2] = '10%';
$table1->size[3] = '10%';
}
$table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
$table1->data[0][1] = $chart['chart'];
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
$table1->data[0][3] = $checks_resume;
$table1->data[0][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span>';
$table1->data[0][3] = "<span style = 'font-size: ".$font_mini.";'>".$checks_resume.'</span>';
$tables_chart .= html_print_table(
$table1,
true
@ -3454,8 +3472,10 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
}
$title = '';
$checks_resume_text = $checks_resume;
$sla_value_text = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
$checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
switch ($item['data'][$k_chart]['failover']) {
case 'primary':
$title = '<b>'.__('Primary').'</b>';
@ -3472,8 +3492,8 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
case 'result':
default:
$title = '<b>'.__('Result').'</b>';
$sla_value_text = "<span style = 'font: bold 3em Arial, Sans-serif; color: ".$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: 12pt;">';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
$checks_resume_text .= $checks_resume;
$checks_resume_text .= '</span>';
break;
@ -5113,19 +5133,6 @@ function reporting_html_planned_downtimes_table($planned_downtimes)
$table->style = [];
$table->data = [];
if ($for_pdf) {
$table->titlestyle = 'background: #373737; color: #FFF; display: table-cell; font-size: 12px; border: 1px solid grey';
$table->class = 'table_sla';
for ($i = 0; $i < count($table->head); $i++) {
$table->headstyle[$i] = 'background: #666; color: #FFF; display: table-cell; font-size: 11px; border: 1px solid grey';
}
for ($i = 0; $i < count($table->head); $i++) {
$table->style[$i] = 'display: table-cell; font-size: 10px;';
}
}
foreach ($planned_downtimes as $planned_downtime) {
$data = [];
$data[0] = $planned_downtime['name'];

View File

@ -39,6 +39,9 @@ function reporting_xml_get_report($report, $filename, $return=false)
}
}
// Remove entities.
$report = io_safe_output($report);
$xml = null;
$xml = array2XML($report, 'report', $xml);
$xml = preg_replace('/(<[^>]+>)(<[^>]+>)(<[^>]+>)/', "$1\n$2\n$3", $xml);

View File

@ -919,9 +919,10 @@ function servers_get_info($id_server=-1)
// Remote servers LAG Calculation (server_type != 0).
if ($server['server_type'] != 0) {
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
$result = db_get_row_sql(
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag"
FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0
@ -935,9 +936,10 @@ function servers_get_info($id_server=-1)
);
} else {
// Local/Dataserver server LAG calculation.
// MySQL 8.0 has function lag(). So, lag must be enclosed in quotations.
$result = db_get_row_sql(
'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag,
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag
AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag"
FROM tagente_estado, tagente_modulo, tagente
WHERE utimestamp > 0
AND tagente.disabled = 0

View File

@ -47,37 +47,13 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
}
if (!empty($user_groups_ids)) {
switch ($config['dbtype']) {
case 'mysql':
$list_groups = db_get_all_rows_sql(
'
SELECT *
FROM tgrupo
WHERE id_grupo IN ('.$user_groups_ids.')
ORDER BY nombre COLLATE utf8_general_ci ASC'
);
break;
case 'postgresql':
$list_groups = db_get_all_rows_sql(
'
SELECT *
FROM tgrupo
WHERE id_grupo IN ('.$user_groups_ids.')
ORDER BY nombre ASC'
);
break;
case 'oracle':
$list_groups = db_get_all_rows_sql(
'
SELECT *
FROM tgrupo
WHERE id_grupo IN ('.$user_groups_ids.')
ORDER BY nombre ASC'
);
break;
}
$list_groups = db_get_all_rows_sql(
'
SELECT *
FROM tgrupo
WHERE id_grupo IN ('.$user_groups_ids.')
ORDER BY nombre COLLATE utf8_general_ci ASC'
);
}
$list = [];
@ -242,14 +218,36 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
$list['_server_sanity_'] = format_numeric((100 - $list['_module_sanity_']), 1);
} else if (($config['realtimestats'] == 0)) {
$group_stat = db_get_all_rows_sql(
"SELECT
SUM(ta.normal_count) as normal, SUM(ta.critical_count) as critical,
SUM(ta.warning_count) as warning,SUM(ta.unknown_count) as unknown,
SUM(ta.notinit_count) as not_init, SUM(fired_count) as alerts_fired
FROM tagente ta
WHERE disabled = 0 AND id_grupo IN ($user_groups_ids)"
);
if (users_is_admin()) {
$group_stat = db_get_all_rows_sql(
sprintf(
'SELECT
SUM(ta.normal_count) as normal, SUM(ta.critical_count) as critical,
SUM(ta.warning_count) as warning,SUM(ta.unknown_count) as unknown,
SUM(ta.notinit_count) as not_init, SUM(ta.fired_count) as alerts_fired
FROM tagente ta
WHERE ta.disabled = 0 AND ta.id_grupo IN (%s)
',
$user_groups_ids
)
);
} else {
$group_stat = db_get_all_rows_sql(
sprintf(
'SELECT
SUM(ta.normal_count) as normal, SUM(ta.critical_count) as critical,
SUM(ta.warning_count) as warning,SUM(ta.unknown_count) as unknown,
SUM(ta.notinit_count) as not_init, SUM(ta.fired_count) as alerts_fired
FROM tagente ta
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
WHERE ta.disabled = 0 AND
(ta.id_grupo IN ( %s ) OR tasg.id_group IN ( %s ))',
$user_groups_ids,
$user_groups_ids
)
);
}
$list['_agents_unknown_'] = $group_stat[0]['unknown'];
$list['_monitors_alerts_fired_'] = $group_stat[0]['alerts_fired'];
@ -303,19 +301,41 @@ function tactical_get_data($id_user=false, $user_strict=false, $acltags, $return
$list['_server_sanity_'] = format_numeric((100 - $list['_module_sanity_']), 1);
} else {
$_tag_condition = '';
$result_list = db_get_all_rows_sql(
"SELECT COUNT(*) as contado, estado
FROM tagente_estado tae INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo IN ( $user_groups_ids )
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
$_tag_condition
GROUP BY estado"
);
if (users_is_admin()) {
$result_list = db_get_all_rows_sql(
sprintf(
'SELECT COUNT(*) as contado, estado FROM tagente_estado tae
INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
AND ta.id_grupo IN ( %s )
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
GROUP BY estado',
$user_groups_ids
)
);
} else {
$result_list = db_get_all_rows_sql(
sprintf(
'SELECT COUNT(*) as contado, estado
FROM tagente_estado tae
INNER JOIN tagente ta
ON tae.id_agente = ta.id_agente
AND ta.disabled = 0
INNER JOIN tagente_modulo tam
ON tae.id_agente_modulo = tam.id_agente_modulo
AND tam.disabled = 0
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
WHERE (ta.id_grupo IN ( %s ) OR tasg.id_group IN ( %s ))
GROUP BY estado',
$user_groups_ids,
$user_groups_ids
)
);
}
if (empty($result_list)) {
$result_list = [];

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') {
$last_remote_contact = __('Never');
} else {
$last_remote_contact = ui_print_timestamp($agent['ultimo_contacto_remoto'], true);
$last_remote_contact = date_w_fixed_tz($agent['ultimo_contacto_remoto']);
}
$row = [];

View File

@ -321,7 +321,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
$output = '<table cellspacing="0" cellpadding="0" id="'.$id.'" '.$attributes.'
class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'">
<tr>
<td class="icon" rowspan="2" style="padding-right: 10px; padding-top: 3px;">'.html_print_image($icon_image, true, false, false, false, true).'</td>
<td class="icon" rowspan="2" style="padding-right: 10px; padding-top: 3px;">'.html_print_image($icon_image, true, false, false, false, false).'</td>
<td class="title" style="text-transform: uppercase; padding-top: 10px;"><b>'.$text_title.'</b></td>
<td class="icon" style="text-align: right; padding-right: 3px;">';
if (!$no_close_bool) {
@ -776,9 +776,9 @@ function ui_print_os_icon(
}
if (is_metaconsole()) {
$no_in_meta = true;
} else {
$no_in_meta = false;
} else {
$no_in_meta = true;
}
$icon = (string) db_get_value('icon_name', 'tconfig_os', 'id_os', (int) $id_os);
@ -1144,7 +1144,7 @@ function ui_format_alert_row(
$data[$index['agent_name']] = $disabledHtmlStart;
if ($agent == 0) {
$data[$index['module_name']] .= ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[&hellip;]', 'font-size: 7.2pt');
$data[$index['module_name']] .= ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[&hellip;]', '');
} else {
if (defined('METACONSOLE')) {
$agent_name = $alert['agent_name'];
@ -1155,16 +1155,16 @@ function ui_format_alert_row(
}
if (defined('METACONSOLE') || !can_user_access_node()) {
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '[&hellip;]', 'font-size:7.5pt;');
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]', '');
} else {
if ($agent_style !== false) {
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="'.$agente['nombre'].'">'.$agente['alias'].'</span></a>';
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-weight:bold" title ="'.$agente['nombre'].'">'.$agente['alias'].'</span></a>';
} else {
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="'.$agente['nombre'].'">'.$agente['alias'].'</span></a>';
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-weight:bold" title ="'.$agente['nombre'].'">'.$agente['alias'].'</span></a>';
}
}
$data[$index['module_name']] = ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[&hellip;]', 'font-size: 7.2pt');
$data[$index['module_name']] = ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[&hellip;]', '');
}
$data[$index['agent_name']] .= $disabledHtmlEnd;
@ -1184,7 +1184,7 @@ function ui_format_alert_row(
FROM talert_templates WHERE id = '.$alert['id_alert_template']
);
$data[$index['description']] .= $disabledHtmlStart.ui_print_truncate_text(io_safe_output($description), 'description', false, true, true, '[&hellip;]', 'font-size: 7.1pt').$disabledHtmlEnd;
$data[$index['description']] .= $disabledHtmlStart.ui_print_truncate_text(io_safe_output($description), 'description', false, true, true, '[&hellip;]', '').$disabledHtmlEnd;
$actions = alerts_get_alert_agent_module_actions($alert['id'], false, $alert['server_data']['id']);
@ -3333,6 +3333,7 @@ function ui_print_datatable(array $parameters)
{
extend: "csv",
text : "'.__('Export current page to CSV').'",
titleAttr: "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
fieldSeparator: "'.$config['csv_divider'].'",
exportOptions : {

View File

@ -762,7 +762,7 @@ function newsletter_wiz_modal(
__('Cancel'),
'cancel_newsletter',
false,
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel" style="color: red; width:100px;"',
'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel" style="width:100px;"',
true
);
$output .= '</div>';
@ -1166,7 +1166,7 @@ function update_manager_install_package_step2()
}
update_manager_enterprise_set_version($version);
$product_name = get_product_name();
$product_name = io_safe_output(get_product_name());
// Generate audit entry.
db_pandora_audit(

View File

@ -1593,6 +1593,7 @@ function visual_map_print_item(
case CLOCK:
if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) {
$image_prefix = (is_metaconsole()) ? '../../' : '';
if ($width == 0) {
if ($layoutData['id_metaconsole'] != 0) {
if ($layoutData['clock_animation'] == 'analogic_1') {
@ -1606,17 +1607,16 @@ function visual_map_print_item(
}
} else {
if ($layoutData['clock_animation'] == 'analogic_1') {
$img = '<img src="images/console/signes/clock.png" style="width:200px;height:240px;">';
$img = '<img src="'.$image_prefix.'images/console/signes/clock.png" style="width:200px;height:240px;">';
} else {
if ($layoutData['time_format'] == 'time') {
$img = '<img src="images/console/signes/digital-clock.png" style="width:200px;height:71px">';
$img = '<img src="'.$image_prefix.'images/console/signes/digital-clock.png" style="width:200px;height:71px">';
} else {
$img = '<img src="images/console/signes/digital-clock.png" style="width:200px;height:91px">';
$img = '<img src="'.$image_prefix.'images/console/signes/digital-clock.png" style="width:200px;height:91px">';
}
}
}
} else {
$image_prefix = ($layoutData['id_metaconsole'] != 0) ? '../../' : '';
if ($layoutData['clock_animation'] == 'analogic_1') {
$img = '<img src="'.$image_prefix.'images/console/signes/clock.png" style="width:'.$width.'px;height:'.($width + 40).'px;">';
} else {
@ -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.'">';
}
} else {
$is_meta = is_metaconsole();
$agents_critical = agents_get_agents(
[
'disabled' => 0,
@ -1908,7 +1910,10 @@ function visual_map_print_item(
],
['COUNT(*) as total'],
'AR',
false
false,
false,
0,
$is_meta
);
$agents_warning = agents_get_agents(
[
@ -1918,7 +1923,10 @@ function visual_map_print_item(
],
['COUNT(*) as total'],
'AR',
false
false,
false,
0,
$is_meta
);
$agents_unknown = agents_get_agents(
[
@ -1928,7 +1936,10 @@ function visual_map_print_item(
],
['COUNT(*) as total'],
'AR',
false
false,
false,
0,
$is_meta
);
$agents_ok = agents_get_agents(
[
@ -1938,7 +1949,10 @@ function visual_map_print_item(
],
['COUNT(*) as total'],
'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']);
$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">
$(document).ready (function () {
$("#map_linked").change(function () {
$("option[value=" + this.value + "]", this)
.attr("selected", true).siblings()
.removeAttr("selected")
$("#text-agent").val("");
$("input[name=id_agent]").val(0);
$("#module").empty();

View File

@ -29,29 +29,42 @@ if ($auth_method != 'ad' && $auth_method != 'ldap') {
$styleError = 'background:url("../images/err.png") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;';
$file = get_parameter('file', null);
$file_raw = get_parameter('file', null);
$file = base64_decode($file);
$file = base64_decode(urldecode($file_raw));
$hash = get_parameter('hash', null);
$testHash = md5($file.$config['dbpass']);
if ($hash != $testHash) {
if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['dbpass']) || !isset($_SERVER['HTTP_REFERER'])) {
echo "<h3 style='".$styleError."'>".__('Security error. Please contact the administrator.').'</h3>';
} else if (!empty($file) && !empty($hash)) {
// echo $file;
if (!file_exists($file)) {
$file = $_SERVER['DOCUMENT_ROOT'].$file;
} else {
$downloadable_file = '';
$parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
$parse_sec2_query = explode('=', $parse_all_queries[1]);
if ($parse_sec2_query[0] === 'sec2') {
switch ($parse_sec2_query[1]) {
case 'godmode/setup/file_manager':
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file;
break;
case 'extensions/files_repo':
$downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file;
break;
default:
$downloadable_file = '';
// Do nothing
break;
}
}
if (!file_exists($file)) {
if ($downloadable_file === '' || !file_exists($downloadable_file)) {
echo "<h3 style='".$styleError."'>".__('File is missing in disk storage. Please contact the administrator.').'</h3>';
} else {
header('Content-type: aplication/octet-stream;');
header('Content-type: '.mime_content_type($file).';');
header('Content-Length: '.filesize($file));
header('Content-Disposition: attachment; filename="'.basename($file).'"');
readfile($file);
header('Content-type: '.mime_content_type($downloadable_file).';');
header('Content-Length: '.filesize($downloadable_file));
header('Content-Disposition: attachment; filename="'.basename($downloadable_file).'"');
readfile($downloadable_file);
}
}

View File

@ -22,8 +22,8 @@ function include_javascript_d3($return=false)
$is_include_javascript = true;
if (is_metaconsole()) {
$output .= '<script type="text/javascript" src="'.'../../'.'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="'.'../../'.'include/graphs/pandora.d3.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="'.$config['homeurl'].'../../include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="'.$config['homeurl'].'../../include/graphs/pandora.d3.js" charset="utf-8"></script>';
} else {
$output .= '<script type="text/javascript" src="'.$config['homeurl'].'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
$output .= '<script type="text/javascript" src="'.$config['homeurl'].'include/graphs/pandora.d3.js" charset="utf-8"></script>';

View File

@ -214,8 +214,8 @@ function show_massive_response_dialog(
$("#button-submit_event_response").show();
},
close: function() {
$("#checkbox-all_validate_box").prop("checked", false);
$(".chk_val").prop("checked", false);
$("#event_response_command_window").dialog("close");
},
width: response["modal_width"],
height: response["modal_height"]

View File

@ -86,7 +86,7 @@
}
.defaultSkin table.mceLayout tr.mceLast td {
border-bottom: 1px solid #ccc;
display: none;
padding-bottom: 20px;
}
.defaultSkin table.mceToolbar,
.defaultSkin tr.mceFirst .mceToolbar tr td,

View File

@ -737,7 +737,7 @@ var TreeController = {
}
$graphImage.addClass("module-graph").click(function(e) {
e.preventDefault();
e.stopPropagation();
if (element.statusImageHTML.indexOf("data:image") != -1) {
try {
winopeng_var(
@ -776,7 +776,7 @@ var TreeController = {
'images/binary.png" /> '
);
$dataImage.addClass("module-data").click(function(e) {
e.preventDefault();
e.stopPropagation();
try {
var serverName =

View File

@ -0,0 +1,103 @@
/*
* ---------------------------------------------------------------------
* - INSTALLING DB FOR DEMOS -
* ---------------------------------------------------------------------
*/
.textBanner,
h1,
p {
font-family: "Open Sans", "lato-bolder", sans-serif;
font-size: 1vw;
color: #3f3f3f;
}
h1 {
font-size: 2vw;
margin-bottom: 40px;
text-transform: none;
}
p {
font-size: 1vw;
}
#demo_side_left {
position: absolute;
width: 342px;
height: 1000px;
background-image: url(/pandora_console/images/demo_background_left.png);
z-index: 0;
}
#demo_side_right {
position: absolute;
width: 640px;
height: 1000px;
right: 0;
background-image: url(/pandora_console/images/demo_background_right.png);
z-index: 0;
}
#demo_side_center {
position: relative;
}
#spinner_logo_demo {
background: url(/pandora_console/images/demo_logo_spinner.gif) no-repeat;
margin: 0 auto;
width: 350px;
height: 350px;
}
#text_message_demo {
text-align: center;
}
div#header_demo {
width: 100%;
height: 65px;
}
div.text_banner_demo {
width: 100%;
margin: 20px 0 60px;
text-align: center;
}
.textBanner {
font-size: 3vw;
}
.textProduct {
color: #82b92e;
}
div#container_demo {
width: 100%;
margin-top: 100px;
}
div#list_icon_docs_support {
float: left;
margin-top: 25px;
margin-left: 5%;
}
div#list_icon_docs_support ul {
margin-top: 5px;
line-height: 36px;
}
div#list_icon_docs_support ul li {
display: inline-block;
color: #979797;
vertical-align: middle;
margin-right: 5px;
font-size: 10pt;
}
div#list_icon_docs_support ul li a {
color: #979797;
font-size: 10pt;
}

View File

@ -30,7 +30,6 @@ div.mini-criticity.h100p {
form.flex-row div.filter_input,
form.flex-row ul {
width: 30%;
min-width: 300px;
display: flex;
flex-direction: row;
align-items: baseline;
@ -47,12 +46,13 @@ div.filter_input_little {
flex-direction: row;
align-items: baseline;
flex-wrap: nowrap;
margin: 0.5em 0 0.5em 1em;
margin: 0.5em 0 0.5em 0em;
}
form.flex-row div.filter_input.large {
flex: 1;
min-width: 470px;
min-width: 700px;
max-width: 100%;
}
div.filter_input > label,
@ -120,6 +120,8 @@ table.dataTable tbody td {
.filter_input {
align-items: center;
min-width: 400px;
max-width: 450px;
}
.filter_input_little > select,
@ -289,7 +291,7 @@ li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab {
border-bottom: 1px solid #ccc;
}
li.ui-tabs-tab.ui-corner-top.ui-state-default.ui-tab.ui-tabs-active.ui-state-active {
border-bottom: 1px solid #fff;
border-bottom: 2px solid #fff;
}
tr.group {

File diff suppressed because one or more lines are too long

View File

@ -33,6 +33,10 @@ div#error_buttons a {
background-repeat: repeat;
}
.login_body_trident {
background: url("../../images/backgrounds/background_pandora_console_keys.jpg") !important;
}
p.log_in {
color: #fff;
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

@ -196,6 +196,10 @@ h4 {
color: #3f3f3f;
text-transform: none;
}
table tbody tr td h4 {
color: #ffffff;
}
a {
color: #3f3f3f;
text-decoration: none;
@ -909,15 +913,15 @@ div#head {
min-width: 882px;
background-color: #fff;
color: #000;
z-index: 2;
z-index: 11;
}
.fixed_header {
z-index: 9999;
position: fixed;
left: 0;
top: 0;
width: 100%;
z-index: 11;
}
#ver {
@ -4981,11 +4985,10 @@ input:checked + .p-slider:before {
.action_buttons input[type="image"],
.action_button_img {
border-radius: 4px;
border: 1px solid #dcdcdc;
padding: 1px;
border: 1px solid #dcdcdc !important;
padding: 1px !important;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
max-width: 21px;
background-color: transparent; /*BORRAR*/
}
/* This class is for only one icon to be a button type. */

View File

@ -27,6 +27,7 @@ div#page,
#menu_tab_frame,
#menu_tab_frame_view,
#menu_tab_frame_view_bc,
ul.subsubmenu li,
input.search_input,
.filters input,
input#text-id_parent.ac_input,
@ -100,6 +101,18 @@ table.widget_list td.datos2 {
background-color: inherit;
}
/* Change inputs with autocomplete */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
-webkit-box-shadow: 0 0 0 30px #111 inset !important;
}
input:-webkit-autofill {
-webkit-text-fill-color: #fff !important;
}
/* messages */
.container {
background-color: #222;
@ -251,6 +264,10 @@ table.table_modal_alternate tr:nth-child(even) td {
filter: brightness(2.5) contrast(50%);
}
a.pandora_pagination {
color: #fff;
}
/* firts_task.css */
.new_task,
div.new_task_cluster,
@ -337,11 +354,16 @@ table#diagnostic_info tbody td div {
color: #fff;
}
.ui-widget-content.ui-autocomplete,
.ui-widget-content.ui-autocomplete a {
color: #333;
}
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
background-color: #222;
color: #fff;
background-color: #222 !important;
color: #fff !important;
}
.ui-state-active,
@ -366,6 +388,11 @@ ul.ui-tabs-nav.ui-corner-all.ui-helper-reset.ui-helper-clearfix.ui-widget-header
filter: brightness(2);
}
.ui-dialog .ui-dialog-buttonpane button {
background-color: transparent;
color: #fff;
}
/* notifications */
#notification-wrapper::before {
border-bottom-color: #111;
@ -393,6 +420,17 @@ div#box_online * {
color: #555;
}
/* news dialog */
#news_dialog #new_text {
background: #222 !important;
}
/* ipam */
.tooltipster-content {
background: #222 !important;
}
/* licence */
div#code_license_dialog div#code,
div#form_activate_licence #code {
margin-top: 20px;

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.742';
$build = '191217';
$build = '200116';
$banner = "v$version Build $build";
error_reporting(0);
@ -965,9 +965,12 @@ function install_step4()
$step5 = mysqli_query(
$connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host
IDENTIFIED BY '".$random_password."'"
"CREATE USER pandora@$host IDENTIFIED BY '".$random_password."'"
);
$step5 |= mysqli_query(
$connection,
"GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host"
);
mysqli_query($connection, 'FLUSH PRIVILEGES');
check_generic($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>");

View File

@ -317,7 +317,7 @@ $data[1] = ui_progress(
1.8,
'#BBB',
true,
floor(($agent['intervalo'] * (100 - $progress) / 100)).' s',
($agent['intervalo'] - (strtotime('now') - strtotime($agent['ultimo_contacto']))).' s',
[
'page' => 'operation/agentes/ver_agente',
'interval' => (100 / $agent['intervalo']),

View File

@ -81,8 +81,8 @@ if ($edit_networkmap) {
$id_group = $values['id_group'];
// ACL for the network map.
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
$networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM');
if (!$networkmap_write && !$networkmap_manage) {
db_pandora_audit(
@ -95,6 +95,9 @@ if ($edit_networkmap) {
$name = io_safe_output($values['name']);
// Id group of the map itself, not data source.
$id_group_map = $values['id_group_map'];
$description = $values['description'];
$filter = json_decode($values['filter'], true);
@ -267,8 +270,8 @@ if ($not_found) {
$config['id_user'],
'AR',
true,
'id_group',
$id_group,
'id_group_map',
$id_group_map,
'',
'',
'',
@ -329,6 +332,28 @@ if ($not_found) {
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
$table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source);
$table->data['source_data_group'][0] = __('Source group');
$table->data['source_data_group'][1] = html_print_select_groups(
$config['id_user'],
'AR',
true,
'id_group',
$id_group,
'',
'',
'',
true
);
$table->data['source_data_group'][1] .= html_print_image(
'images/error.png',
true,
[
'id' => 'group_change_warning',
'title' => __('Source id group changed. All elements in networkmap will be lost.'),
'style' => 'display : none',
]
);
$table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:');
$table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox(
'dont_show_subgroups',
@ -379,7 +404,7 @@ if ($not_found) {
$table->data['kval'][0] = __('Default ideal node separation');
$table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true);
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
echo '<form id="networkmap_options_form" method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_table($table);
@ -420,8 +445,11 @@ $(document).ready(function() {
.css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups")
.css('display', 'none');
$("#form_editor-source_data_group")
.css('display', 'none');
$("#form_editor-source_data_recon_task")
.css('display', '');
}
else if (source == 'ip_mask') {
$("#form_editor-source_data_ip_mask")
@ -430,6 +458,8 @@ $(document).ready(function() {
.css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups")
.css('display', 'none');
$("#form_editor-source_data_group")
.css('display', 'none');
}
else if (source == 'group') {
$("#form_editor-source_data_ip_mask")
@ -438,6 +468,8 @@ $(document).ready(function() {
.css('display', 'none');
$("#form_editor-source_data_dont_show_subgroups")
.css('display', '');
$("#form_editor-source_data_group")
.css('display', '');
}
});
@ -508,5 +540,53 @@ $(document).ready(function() {
$("input[name='source']").trigger("change");
$("#method").trigger("change");
// Control if id_group has changed.
var id_group_old = $("#id_group").val();
var id_group_changed = false;
$("#id_group").on('change',{id_group_old: id_group_old}, function () {
var id_group_new = $("#id_group").val();
if((id_group_old != id_group_new) && (update_networkmap == 1 )) {
id_group_changed = true;
$("#group_change_warning").show();
} else {
id_group_changed = false;
$("#group_change_warning").hide();
}
});
var update_networkmap = 0;
// Show advice if id_group has changed.
update_networkmap = $("input[name='update_networkmap']").val();
$( "#submit-crt" ).click(function( event ) {
if(update_networkmap == 1 && id_group_changed === true) {
confirmDialog({
title: '<?php echo __('Are you sure?'); ?>',
message: '<?php echo __('Source id group changed. All elements in Networkmap will be lost'); ?>',
ok: '<?php echo __('OK'); ?>',
cancel: '<?php echo __('Cancel'); ?>',
onDeny: function() {
// Continue execution.
return false;
},
onAccept: function () {
// Submit form
$("#networkmap_options_form").submit();
}
})
event.preventDefault();
}
});
});
</script>

Some files were not shown because too many files have changed in this diff Show More