Merge branch 'develop' into 'ent-4567-Habilitar-borrado-masivo-de-traps-con-permisos-AW'

Conflicts:
   pandora_console/operation/snmpconsole/snmp_view.php
This commit is contained in:
Tatiana Llorente 2019-09-11 18:17:39 +02:00
commit 770ac250d8
70 changed files with 554 additions and 283 deletions

View File

@ -14,6 +14,7 @@ RUN yum -y install \
# Install Pandora FMS agent
RUN cd /tmp/pandora_agent/unix \
&& chmod +x pandora_agent_installer \
&& ./pandora_agent_installer --install
# Set default variables
@ -40,7 +41,7 @@ if [ $TIMEZONE != "" ]; then\n \
fi\n \
/etc/init.d/pandora_agent_daemon start\n \
rm -f $0\n \
bash' \
tail -f /var/log/pandora/pandora_agent.log' \
>> /entrypoint.sh && \
chmod +x /entrypoint.sh

View File

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

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.738"
PI_BUILD="190829"
PI_BUILD="190911"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{190829}
{190911}
ViewReadme
{Yes}

View File

@ -1214,7 +1214,8 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_source,
module_eventtype,
module_eventcode,
module_pattern);
module_pattern,
module_application);
} else if (module_wmiquery != "") {
module = new Pandora_Module_WMIQuery (module_name,
module_wmiquery, module_wmicolumn);

View File

@ -53,7 +53,7 @@ static EvtUpdateBookmarkT EvtUpdateBookmarkF = NULL;
* @param name Module name.
* @param service_name Service internal name to check.
*/
Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern)
Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern, string application)
: Pandora_Module (name) {
int i;
vector<wstring> query;
@ -93,6 +93,13 @@ Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source
query.push_back(ss.str());
}
// Set the application
if (application != "") {
wstringstream ss;
ss << L"*[System/Provider[@Name='" << application.c_str() << L"']]";
query.push_back(ss.str());
}
// Fill the filter
if (query.size() == 0) {
this->filter = L"*";

View File

@ -75,7 +75,7 @@ namespace Pandora_Modules {
LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId);
public:
Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern);
Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern, string application);
void run ();
};
}

View File

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

View File

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

View File

@ -0,0 +1,7 @@
START TRANSACTION;
UPDATE `tlayout_data` SET `height` = 70 , `width` = 70 WHERE `height` = 0 && `width` = 0 && image NOT LIKE '%dot%' && ((`type` IN (0,5)) ||
(`type` = 10 && `image` IS NOT NULL && `image` != '' && `image` != 'none') ||
(`type` = 11 && `image` IS NOT NULL && `image` != '' && `image` != 'none' && `show_statistics` = 0));
COMMIT;

View File

@ -389,9 +389,12 @@ if (isset($login_failed)) {
echo '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$config['auth_error'].'</p>';
echo '</div>';
if ($config['enable_pass_policy']) {
echo '<div class="text_message_alert">';
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
echo '</div>';
}
echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false);
echo '</div>';

View File

@ -172,6 +172,7 @@ unset($table);
echo '<div id="right">';
// News.
require_once 'general/news_dialog.php';
$options = [];
$options['id_user'] = $config['id_user'];
$options['modal'] = false;
@ -188,6 +189,7 @@ if (!empty($news)) {
$comparation_suffix = __('ago');
}
$output_news = '<div id="news_board" class="new">';
foreach ($news as $article) {
$image = false;

View File

@ -1358,7 +1358,11 @@ if ($update_module || $create_module) {
$parent_module_id = (int) get_parameter('parent_module_id');
$ip_target = (string) get_parameter('ip_target');
if ($ip_target == '') {
// No autofill if the module is a webserver module.
if ($ip_target == ''
&& $id_module_type < MODULE_WEBSERVER_CHECK_LATENCY
&& $id_module_type > MODULE_WEBSERVER_RETRIEVE_STRING_DATA
) {
$ip_target = 'auto';
}
@ -1381,11 +1385,7 @@ if ($update_module || $create_module) {
$ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff');
$ff_timeout = (int) get_parameter('ff_timeout');
$unit = (string) get_parameter('unit_select');
if ($unit == 'none') {
$unit = (string) get_parameter('unit_text');
}
$unit = (string) get_parameter('unit');
$id_tag = (array) get_parameter('id_tag_selected');
$serialize_ops = (string) get_parameter('serialize_ops');
$critical_instructions = (string) get_parameter('critical_instructions');
@ -1559,8 +1559,14 @@ if ($update_module) {
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;';
} else {
$values['plugin_parameter'] .= $value.'&#x0a;';
@ -1757,8 +1763,14 @@ if ($create_module) {
foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) {
if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;';
}
if ($http_pass) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;';
}
$values['plugin_parameter'] .= $value.'&#x0a;';
} else {
$values['plugin_parameter'] .= $value.'&#x0a;';
@ -2095,8 +2107,7 @@ if ($delete_module) {
}
}
// MODULE DUPLICATION
// ==================.
// MODULE DUPLICATION.
if (!empty($duplicate_module)) {
// DUPLICATE agent module !
$id_duplicate_module = $duplicate_module;
@ -2142,8 +2153,46 @@ if (!empty($duplicate_module)) {
}
}
// UPDATE GIS
// ==========.
// MODULE ENABLE/DISABLE.
if ($enable_module) {
$result = modules_change_disabled($enable_module, 0);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
db_pandora_audit('Module management', 'Enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
} else {
db_pandora_audit('Module management', 'Fail to enable #'.$enable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
}
ui_print_result_message(
$result,
__('Successfully enabled'),
__('Could not be enabled')
);
}
if ($disable_module) {
$result = modules_change_disabled($disable_module, 1);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
if ($result === NOERR) {
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);
db_pandora_audit('Module management', 'Disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
} else {
db_pandora_audit('Module management', 'Fail to disable #'.$disable_module.' | '.$modulo_nombre.' | '.$agent['alias']);
}
ui_print_result_message(
$result,
__('Successfully disabled'),
__('Could not be disabled')
);
}
// UPDATE GIS.
$updateGIS = get_parameter('update_gis', 0);
if ($updateGIS) {
$updateGisData = get_parameter('update_gis_data');
@ -2231,8 +2280,11 @@ switch ($tab) {
break;
case 'alert':
// Because $id_agente is set, it will show only agent alerts.
// This var is for not display create button on alert list.
/*
* Because $id_agente is set, it will show only agent alerts
* This var is for not display create button on alert list
*/
$dont_display_alert_create_bttn = true;
include 'godmode/alerts/alert_list.php';
break;

View File

@ -443,6 +443,14 @@ ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modific
if ($agents !== false) {
// Urls to sort the table.
// Agent name size and description for Chinese and Japanese languages are adjusted
$agent_font_size = '7';
$description_font_size = '6.5';
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
$agent_font_size = '15';
$description_font_size = '11';
}
$url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
$url_down_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=down&disabled=$disabled';
$url_up_remote = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=remote&sort=up&disabled=$disabled';
@ -529,7 +537,7 @@ if ($agents !== false) {
} else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=".$agent['id_agente']."'>".'<span style="font-size: 7pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
id_agente=".$agent['id_agente']."'>".'<span style="font-size: '.$agent_font_size.'pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
}
echo '</strong>';
@ -629,7 +637,7 @@ if ($agents !== false) {
// Group icon and name
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
// Description
echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: 6.5pt;').'</td>';
echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: '.$description_font_size.'pt;').'</td>';
// Action
// When there is only one element in page it's necesary go back page.
if ((count($agents) == 1) && ($offset >= $config['block_size'])) {

View File

@ -232,10 +232,17 @@ $table->data[0][0] = '<b>'.__('Filter name').'</b>';
$table->data[0][1] = html_print_input_text('id_name', $id_name, false, 20, 80, true);
$table->data[1][0] = '<b>'.__('Save in group').'</b>'.ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true);
$returnAllGroup = users_can_manage_group_all();
// If the user can't manage All group but the filter is for All group, the user should see All group in the select.
if ($returnAllGroup === false && $id_group_filter == 0) {
$returnAllGroup = true;
}
$table->data[1][1] = html_print_select_groups(
$config['id_user'],
$access,
users_can_manage_group_all(),
$returnAllGroup,
'id_group_filter',
$id_group_filter,
'',

View File

@ -93,10 +93,11 @@ if ($strict_acl) {
users_can_manage_group_all()
);
} else {
// All users should see the filters with the All group.
$groups_user = users_get_groups(
$config['id_user'],
$access,
users_can_manage_group_all(),
true,
true
);
}

View File

@ -143,12 +143,12 @@ $table->data[3] = $data;
$data = [];
$data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon('response_macros', true);
$data[1] = html_print_input_text(
$data[1] = html_print_textarea(
'target',
3,
1,
$event_response['target'],
'',
100,
255,
'style="min-height:initial;"',
true
);

View File

@ -1930,11 +1930,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
case 'unit_select':
if ($value != -1) {
if ($value == 'none') {
$values['unit'] = (string) get_parameter('unit_text');
} else {
$values['unit'] = $value;
}
$values['unit'] = (string) get_parameter('unit');
}
break;

View File

@ -1317,7 +1317,7 @@ $class = 'databox filters';
if (metaconsole_load_external_db($connection) == NOERR) {
$agent_name = db_get_value_filter(
'nombre',
'alias',
'tagente',
['id_agente' => $idAgent]
);

View File

@ -267,7 +267,7 @@ if ($moduleFilter != 0) {
// Filter report items created from metaconsole in normal console list and the opposite
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\'))';
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\',\'text\'))';
} else {
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))';
}
@ -342,7 +342,7 @@ if ($items) {
$table->size[0] = '5px';
$table->size[1] = '15%';
$table->size[4] = '8%';
$table->size[6] = '90px';
$table->size[6] = '120px';
$table->size[7] = '30px';
$table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>';

View File

@ -1,4 +1,22 @@
<script type="text/javascript">
function dialog_message(message_id) {
$(message_id)
.css("display", "inline")
.dialog({
modal: true,
show: "blind",
hide: "blind",
width: "400px",
buttons: {
Close: function() {
$(this).dialog("close");
}
}
});
}
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true);
@ -578,7 +596,7 @@ switch ($action) {
break;
}
if (! $delete) {
if (! $delete && !empty($type_access_selected)) {
db_pandora_audit(
'ACL Violation',
'Trying to access report builder deletion'

View File

@ -100,7 +100,15 @@ if ($update_filter > -2) {
'filter' => $filter,
'unified_filters_id' => $new_unified_id,
];
if ($values['description'] == '') {
$result = false;
$msg = __('Description is empty');
} else if ($values['filter'] == '') {
$result = false;
$msg = __('Filter is empty');
} else {
$result = db_process_sql_insert('tsnmp_filter', $values);
}
} else {
for ($i = 0; $i < $index_post; $i++) {
$filter = get_parameter('filter_'.$i);
@ -109,12 +117,28 @@ if ($update_filter > -2) {
'filter' => $filter,
'unified_filters_id' => $new_unified_id,
];
if ($values['filter'] != '' && $values['description'] != '') {
$result = db_process_sql_insert('tsnmp_filter', $values);
}
}
if ($result === null) {
if ($values['description'] != '') {
$result = false;
$msg = __('Filters are empty');
} else {
$result = false;
$msg = __('Description is empty');
}
}
}
if ($result === false) {
ui_print_error_message(__('There was a problem creating the filter'));
if (!isset($msg)) {
$msg = __('There was a problem creating the filter');
}
ui_print_error_message($msg);
} else {
ui_print_success_message(__('Successfully created'));
}
@ -215,9 +239,11 @@ if ($edit_filter > -2) {
$result_unified = db_get_all_rows_sql('SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC');
$aglomerate_result = [];
if (is_array($result_unified) === true) {
foreach ($result_unified as $res) {
$aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql('SELECT * FROM tsnmp_filter WHERE unified_filters_id = '.$res['unified_filters_id'].' ORDER BY id_snmp_filter ASC');
}
}
$table = new stdClass();
$table->data = [];
@ -282,7 +308,8 @@ if ($edit_filter > -2) {
?>
<script type="text/javascript">
var id = "<?php echo $index; ?>";
// +1 because there is already a defined 'filter' field.
var id = parseInt("<?php echo $index; ?>")+1;
var homeurl = "<?php echo $config['homeurl']; ?>";
$(document).ready (function () {

View File

@ -31,6 +31,11 @@ global $config;
check_login();
if (!enterprise_installed()) {
include 'general/noaccess.php';
exit;
}
if (! check_acl($config['id_user'], 0, 'PM')
&& ! is_user_admin($config['id_user'])
) {

View File

@ -30,19 +30,21 @@ if ($php_version_array[0] < 7) {
$tab = get_parameter('tab', 'online');
$buttons = [
'setup' => [
$buttons['setup'] = [
'active' => ($tab == 'setup') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=setup">'.html_print_image('images/gm_setup.png', true, ['title' => __('Options')]).'</a>',
],
'offline' => [
];
if (enterprise_installed()) {
$buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=offline">'.html_print_image('images/box.png', true, ['title' => __('Offline update manager')]).'</a>',
],
'online' => [
];
}
$buttons['online'] = [
'active' => ($tab == 'online') ? true : false,
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online">'.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager')]).'</a>',
],
];

View File

@ -256,6 +256,52 @@ if ($create_user) {
$password_confirm = '';
$new_user = true;
} else {
$have_number = false;
$have_simbols = false;
if ($config['enable_pass_policy']) {
if ($config['pass_needs_numbers']) {
$nums = preg_match('/([[:alpha:]])*(\d)+(\w)*/', $password_confirm);
if ($nums == 0) {
ui_print_error_message(__('Password must contain numbers'));
$user_info = $values;
$password_new = '';
$password_confirm = '';
$new_user = true;
} else {
$have_number = true;
}
}
if ($config['pass_needs_symbols']) {
$symbols = preg_match('/(\w)*(\W)+(\w)*/', $password_confirm);
if ($symbols == 0) {
ui_print_error_message(__('Password must contain symbols'));
$user_info = $values;
$password_new = '';
$password_confirm = '';
$new_user = true;
} else {
$have_simbols = true;
}
}
if ($config['pass_needs_symbols'] && $config['pass_needs_numbers']) {
if ($have_number && $have_simbols) {
$result = create_user($id, $password_new, $values);
}
} else if ($config['pass_needs_symbols'] && !$config['pass_needs_numbers']) {
if ($have_simbols) {
$result = create_user($id, $password_new, $values);
}
} else if (!$config['pass_needs_symbols'] && $config['pass_needs_numbers']) {
if ($have_number) {
$result = create_user($id, $password_new, $values);
}
}
} else {
$result = create_user($id, $password_new, $values);
}
$info = '{"Id_user":"'.$values['id_user'].'","FullName":"'.$values['fullname'].'","Firstname":"'.$values['firstname'].'","Lastname":"'.$values['lastname'].'","Email":"'.$values['email'].'","Phone":"'.$values['phone'].'","Comments":"'.$values['comments'].'","Is_admin":"'.$values['is_admin'].'","Language":"'.$values['language'].'","Timezone":"'.$values['timezone'].'","Block size":"'.$values['block_size'].'"';
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
@ -264,7 +310,10 @@ if ($create_user) {
$info .= '}';
}
$result = create_user($id, $password_new, $values);
$can_create = false;
if ($result) {
$res = save_pass_history($id, $password_new);
}

View File

@ -159,10 +159,10 @@ if ($show_update_action_menu) {
$id_action = (int) get_parameter('id_action');
$actions = alerts_get_alert_agent_module_actions($id_alert);
$action_opction = db_get_row(
$action_option = db_get_row(
'talert_template_module_actions',
'id_alert_template_module',
$id_alert
'id',
$id_action
);
$data .= '<form id="update_action-'.$alert['id'].'" method="post">';
@ -242,7 +242,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos">';
$data .= html_print_input_text(
'fires_min_ajax',
$action_opction['fires_min'],
$action_option['fires_min'],
'',
4,
10,
@ -251,7 +251,7 @@ if ($show_update_action_menu) {
$data .= ' '.__('to').' ';
$data .= html_print_input_text(
'fires_max_ajax',
$action_opction['fires_max'],
$action_option['fires_max'],
'',
4,
10,
@ -266,7 +266,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos2">';
$data .= html_print_input_text(
'module_action_threshold_ajax',
$action_opction['module_action_threshold'],
$action_option['module_action_threshold'],
'',
4,
10,

View File

@ -1151,7 +1151,12 @@ if (check_login()) {
}
$server_name = '';
$data[8] .= "<a href='javascript: ".'show_module_detail_dialog('.$module['id_agente_modulo'].', '.$id_agente.', "'.$server_name.'", '.(0).', '.SECONDS_1DAY.', " '.modules_get_agentmodule_name($module['id_agente_modulo'])."\")'>".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).'</a>';
$modules_get_agentmodule_name = modules_get_agentmodule_name($module['id_agente_modulo']);
// Escape the double quotes that may have the name of the module.
$modules_get_agentmodule_name = str_replace('&quot;', '\"', $modules_get_agentmodule_name);
$data[8] .= "<a href='javascript: ".'show_module_detail_dialog('.$module['id_agente_modulo'].', '.$id_agente.', "'.$server_name.'", '.(0).', '.SECONDS_1DAY.', " '.$modules_get_agentmodule_name."\")'>".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).'</a>';
}
if ($module['estado'] == 3) {

View File

@ -727,7 +727,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.LICENSE.LIMITED',
'title' => __('Limited mode.'),
'message' => io_safe_output($config['limited_mode']),
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license',
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
]
);
} else {
@ -745,7 +745,7 @@ class ConsoleSupervisor
'Your license will expire in %d days. Please, contact our sales department.',
$days_to_expiry
),
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license',
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
]
);
} else if ($days_to_expiry < 0) {
@ -755,7 +755,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.LICENSE.EXPIRATION',
'title' => __('Expired license'),
'message' => __('Your license has expired. Please, contact our sales department.'),
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license',
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'),
]
);
return false;
@ -832,7 +832,7 @@ class ConsoleSupervisor
'Directory %s is not writable. Please, configure corresponding permissions.',
$config['attachment_store']
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=general',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'),
]
);
return;
@ -854,7 +854,7 @@ class ConsoleSupervisor
'There are more than %d files in attachment, consider cleaning up attachment directory manually.',
$config['num_files_attachment']
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=perf',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'),
]
);
} else {
@ -886,7 +886,7 @@ class ConsoleSupervisor
'Remote configuration directory %s is not readable. Please, adjust configuration.',
$config['remote_config']
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=general',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'),
]
);
return;
@ -905,7 +905,7 @@ class ConsoleSupervisor
'Remote configuration directory %s is not writable. Please, adjust configuration.',
$config['remote_config'].'/conf'
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=general',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'),
]
);
} else {
@ -923,7 +923,7 @@ class ConsoleSupervisor
'Collections directory %s is not writable. Please, adjust configuration.',
$config['remote_config'].'/collections'
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=general',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'),
]
);
} else {
@ -941,7 +941,7 @@ class ConsoleSupervisor
'MD5 directory %s is not writable. Please, adjust configuration.',
$config['remote_config'].'/md5'
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=general',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general'),
]
);
} else {
@ -972,7 +972,7 @@ class ConsoleSupervisor
$MAX_FILES_DATA_IN,
$config['remote_config']
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=perf',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'),
]
);
} else {
@ -995,7 +995,7 @@ class ConsoleSupervisor
$MAX_BADXML_FILES_DATA_IN,
$config['remote_config']
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=perf',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'),
]
);
} else {
@ -1081,7 +1081,7 @@ class ConsoleSupervisor
$modules_queued,
$queue['queued_modules']
),
'url' => 'index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'),
]
);
} else {
@ -1191,7 +1191,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'],
'title' => $msg,
'message' => $description,
'url' => 'index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'),
]
);
}
@ -1499,7 +1499,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.HISTORYDB',
'title' => __('Historical database not available'),
'message' => __('Historical database is enabled, though not accessible with the current configuration.'),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=hist_db',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=hist_db'),
]
);
} else {
@ -1546,7 +1546,7 @@ class ConsoleSupervisor
'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.',
io_safe_output(get_product_name())
),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=perf',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'),
]
);
} else {
@ -1606,7 +1606,7 @@ class ConsoleSupervisor
'Historical database maintenance problem.'
),
'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=perf',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=perf'),
]
);
} else {
@ -1645,7 +1645,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.HISTORYDB.MR',
'title' => __('Historical database MR mismatch'),
'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=hist_db',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=hist_db'),
]
);
} else {
@ -1687,7 +1687,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.EXT.ELASTICSEARCH',
'title' => __('Log collector cannot connect to ElasticSearch'),
'message' => __('ElasticSearch is not available using current configuration.'),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=log',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=log'),
]
);
} else {
@ -1757,7 +1757,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
'title' => __('Metaconsole DB is not available.'),
'message' => __('Cannot connect with Metaconsole DB using current configuration.'),
'url' => 'index.php?sec=general&sec2=godmode/setup/setup&section=enterprise',
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=enterprise'),
]
);
}
@ -1786,7 +1786,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.DOWNTIME',
'title' => __('Scheduled downtime running.'),
'message' => __('A scheduled downtime is running. Some monitoring data won\'t be available while downtime is taking place.'),
'url' => 'index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'),
]
);
return;
@ -1947,7 +1947,7 @@ class ConsoleSupervisor
date('M j, G:i:s ', $next_downtime_begin),
date('M j, G:i:s ', $next_downtime_end)
),
'url' => 'index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list',
'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'),
]
);
return;
@ -2043,7 +2043,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
'title' => __('Default password for "Admin" user has not been changed'),
'message' => __('Please, change the default password since it is a commonly reported vulnerability.'),
'url' => 'index.php?sec=gusuarios&sec2=godmode/users/user_list',
'url' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list'),
]
);
} else {
@ -2069,7 +2069,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.MISC.FONTPATH',
'title' => __('Default font doesn\'t exist'),
'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'),
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup&section=vis',
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=vis'),
]
);
} else {
@ -2096,7 +2096,7 @@ class ConsoleSupervisor
'Your %s has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production environment. This value is located in the main index.php file',
get_product_name()
),
'url' => 'index.php',
'url' => ui_get_full_url('index.php'),
]
);
} else {
@ -2119,7 +2119,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION',
'title' => __('Event storm protection is enabled.'),
'message' => __('Some events may get lost while this mode is enabled. The server must be restarted after altering this setting.'),
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup&section=general',
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=general'),
]
);
} else {
@ -2146,7 +2146,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
'title' => __('Failed to retrieve updates, please configure utility'),
'message' => $message,
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/setup&section=general',
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=general'),
]
);
}
@ -2165,8 +2165,8 @@ class ConsoleSupervisor
'New %s Console update',
get_product_name()
),
'message' => __('There is a new update available. Please<a style="font-weight:bold;" href="index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online"> go to Administration:Setup:Update Manager</a> for more details.'),
'url' => 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online',
'message' => __('There is a new update available. Please<a style="font-weight:bold;" href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online').'"> go to Administration:Setup:Update Manager</a> for more details.'),
'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online'),
]
);
} else {
@ -2204,7 +2204,7 @@ class ConsoleSupervisor
'There is one or more minor releases available. <a style="font-size:8pt;font-style:italic;" target="blank" href="%s">.About minor release update</a>.',
$url
),
'url' => 'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online',
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
]
);
} else {
@ -2253,7 +2253,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.CRON.CONFIGURED',
'title' => __('DiscoveryConsoleTasks is not configured.'),
'message' => __($message_conf_cron),
'url' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist',
'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'),
]
);
} else {

View File

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

View File

@ -355,6 +355,12 @@ define('MODULE_PREDICTION_CLUSTER', 5);
define('MODULE_PREDICTION_CLUSTER_AA', 6);
define('MODULE_PREDICTION_CLUSTER_AP', 7);
// Type of Webserver Modules.
define('MODULE_WEBSERVER_CHECK_LATENCY', 30);
define('MODULE_WEBSERVER_CHECK_SERVER_RESPONSE', 31);
define('MODULE_WEBSERVER_RETRIEVE_NUMERIC_DATA', 32);
define('MODULE_WEBSERVER_RETRIEVE_STRING_DATA', 33);
// SNMP CONSTANTS.
define('SNMP_DIR_MIBS', 'attachment/mibs');

View File

@ -2852,7 +2852,7 @@ function print_audit_csv($data)
global $config;
global $graphic_type;
$divider = $config['csv_divider'];
$divider = html_entity_decode($config['csv_divider']);
if (!$data) {
echo __('No data found to export');

View File

@ -3169,7 +3169,7 @@ function events_get_event_filter_select($manage=true)
} else {
$user_groups = users_get_groups(
$config['id_user'],
'EW',
'ER',
users_can_manage_group_all(),
true
);

View File

@ -2471,7 +2471,7 @@ function html_print_image(
if (!is_readable($working_dir.'/enterprise/meta'.$src)) {
if ($isExternalLink) {
$src = ui_get_full_url($src);
$src = ui_get_full_url($src, false, false, false);
} else {
$src = ui_get_full_url('../..'.$src);
}

View File

@ -3100,7 +3100,7 @@ function reporting_historical_data($report, $content)
$return['type'] = 'historical_data';
$period = $content['period'];
$date_limit = (time() - $period);
$date_limit = ($report['datetime'] - $period);
if (empty($content['name'])) {
$content['name'] = __('Historical data');
}
@ -3169,7 +3169,7 @@ function reporting_historical_data($report, $content)
FROM tagente_datos_string
WHERE id_agente_modulo ='.$content['id_agent_module'].'
AND utimestamp >'.$date_limit.'
AND utimestamp <='.time(),
AND utimestamp <='.$report['datetime'],
true
);
break;
@ -3180,7 +3180,7 @@ function reporting_historical_data($report, $content)
FROM tagente_datos
WHERE id_agente_modulo ='.$content['id_agent_module'].'
AND utimestamp >'.$date_limit.'
AND utimestamp <='.time(),
AND utimestamp <='.$report['datetime'],
true
);
break;

View File

@ -3278,12 +3278,7 @@ function visual_map_get_color_line_status($layoutData)
*/
function visual_map_get_image_status_element($layoutData, $status=false)
{
$metaconsole_hack = '';
if (is_metaconsole()) {
$metaconsole_hack = '../../';
}
$img = $metaconsole_hack.'images/console/icons/'.$layoutData['image'];
$img = 'images/console/icons/'.$layoutData['image'];
if ($layoutData['type'] == 5) {
// ICON ELEMENT

View File

@ -91,6 +91,11 @@ function pandora_session_write($session_id, $data)
{
$session_id = addslashes($session_id);
// If it's an api call, the session must not be created.
if (get_parameter('op', false) && get_parameter('op2', false)) {
return true;
}
if (is_ajax()) {
// Avoid session upadte while processing ajax responses - notifications.
if (get_parameter('check_new_notifications', false)) {

View File

@ -291,21 +291,9 @@ final class Group extends Item
$width = (int) $data['width'];
$height = (int) $data['height'];
if ($width === 0 || $height === 0) {
// TODO: This will be the default behaviour after we finish the
// builder. Don't delete this code.
// $sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
// $data['width'] = $sizeImage[0];
// $data['height'] = $sizeImage[1];
$sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
$imageHeight = $sizeImage[1];
if ($width === 0) {
$data['width'] = 70;
}
if ($height === 0) {
$data['height'] = ($imageHeight > 70) ? 70 : $imageHeight;
}
$data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
}
$data['html'] = '<img src="'.$data['statusImageSrc'].'">';

View File

@ -120,21 +120,9 @@ final class Icon extends Item
$width = (int) $data['width'];
$height = (int) $data['height'];
if ($width === 0 || $height === 0) {
// TODO: This will be the default behaviour after we finish the
// builder. Don't delete this code.
// $sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
// $data['width'] = $sizeImage[0];
// $data['height'] = $sizeImage[1];
$sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
$imageHeight = $sizeImage[1];
if ($width === 0) {
$data['width'] = 70;
}
if ($height === 0) {
$data['height'] = ($imageHeight > 70) ? 70 : $imageHeight;
}
$data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
}
return $data;

View File

@ -184,23 +184,9 @@ final class StaticGraph extends Item
$width = (int) $data['width'];
$height = (int) $data['height'];
if ($width === 0 || $height === 0) {
// TODO: This will be the default behaviour after we finish the
// builder. Don't delete this code.
// $sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
// $data['width'] = $sizeImage[0];
// $data['height'] = $sizeImage[1];
// Default value. Will be replaced by a dynamic image size
// calculation after the phase 3.
$sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
$imageHeight = $sizeImage[1];
if ($width === 0) {
$data['width'] = 70;
}
if ($height === 0) {
$data['height'] = ($imageHeight > 70) ? 70 : $imageHeight;
}
$data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
}
// Get last value.

View File

@ -392,3 +392,11 @@ div#box_online * {
#text_wizard {
color: #555;
}
div#code_license_dialog div#code,
div#form_activate_licence #code {
margin-top: 20px;
margin-bottom: 20px;
border: 0px;
background-color: #222;
}

View File

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

View File

@ -624,6 +624,13 @@ if (empty($agents)) {
$agents = [];
}
$agent_font_size = 'font-size: 7px';
$description_font_size = 'font-size: 6.5px';
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
$agent_font_size = 'font-size: 15px';
$description_font_size = 'font-size: 11px';
}
// Urls to sort the table.
$url_up_agente = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;refr='.$refr.'&amp;offset='.$offset.'&amp;group_id='.$group_id.'&amp;recursion='.$recursion.'&amp;search='.$search.'&amp;status='.$status.'&amp;sort_field=name&amp;sort=up';
$url_down_agente = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;refr='.$refr.'&amp;offset='.$offset.'&amp;group_id='.$group_id.'&amp;recursion='.$recursion.'&amp;search='.$search.'&amp;status='.$status.'&amp;sort_field=name&amp;sort=down';
@ -739,7 +746,7 @@ foreach ($agents as $agent) {
$data[0] = '<div class="left_'.$agent['id_agente'].'">';
$data[0] .= '<span>';
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"> <span style="font-size: 7pt;font-weight:bold" title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></a>';
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"> <span style="'.$agent_font_size.';font-weight:bold" title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></a>';
$data[0] .= '</span>';
if ($agent['quiet']) {
@ -772,7 +779,7 @@ foreach ($agents as $agent) {
$data[0] .= '</div></div>';
$data[1] = ui_print_truncate_text($agent['description'], 'description', false, true, true, '[&hellip;]', 'font-size: 6.5pt');
$data[1] = ui_print_truncate_text($agent['description'], 'description', false, true, true, '[&hellip;]', $description_font_size);
$data[10] = '';

View File

@ -244,6 +244,7 @@ $htmlForm = '<form method="post" action="index.php?sec=estado&sec2=operation/age
$htmlForm .= html_print_table($table, true);
$htmlForm .= html_print_input_hidden('filter', 1, true);
$htmlForm .= '<div class="action-buttons" style="width: '.$table->width.'">';
if (check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) {
$htmlForm .= html_print_button(
__('Save as custom graph'),
'save_custom_graph',
@ -251,7 +252,10 @@ $htmlForm .= html_print_button(
'',
'class="sub add" style=""',
true
).'&nbsp;&nbsp;'.html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub upd" style=""', true);
);
}
$htmlForm .= '&nbsp;&nbsp;'.html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub upd" style=""', true);
$htmlForm .= '</div>';
$htmlForm .= '</form>';

View File

@ -1031,15 +1031,14 @@ $adv_inputs[] = $in;
// Only alert events.
$data = html_print_select(
[
'-1' => __('All'),
'0' => __('Filter alert events'),
'1' => __('Only alert events'),
],
'filter_only_alert',
$filter_only_alert,
'',
'',
'',
__('All'),
-1,
true
);
$in = '<div class="filter_input"><label>'.__('Alert events').'</label>';

View File

@ -17,7 +17,7 @@ error_reporting(1);
$MAX_MARQUEE_EVENTS = 10;
$MARQUEE_INTERVAL = 90;
$MARQUEE_FONT_SIZE = '32px';
$MARQUEE_SPEED = 12;
$MARQUEE_SPEED = 9;
$output = '';

View File

@ -155,7 +155,7 @@ foreach ($traps_generated_by_source as $trap) {
$row['source'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&new_agent=1&direccion='.$trap['source'].'" title="'.__('Create agent').'">'.$trap['source'].'</a>';
} else {
$agent_id = $agent['id_agente'];
$agent_name = ui_print_truncate_text($agent['nombre'], 'agent_medium', true, true, true, '[&hellip;]', '');
$agent_name = ui_print_truncate_text($agent['alias'], 'agent_medium', true, true, true, '[&hellip;]', '');
$row['source'] = "<a href=\"index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$agent_id\" title=\"".__('View agent details').'">';
$row['source'] .= "<strong>$agent_name</strong></a>";
}

View File

@ -1,17 +1,31 @@
<?php
/**
* SNMP Console.
*
* @category SNMP
* @package Pandora FMS
* @subpackage Community
* @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.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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.
// Load global vars
global $config;
enterprise_include('operation/snmpconsole/snmp_view.php');
enterprise_include('include/functions_snmp.php');
@ -31,7 +45,7 @@ if (!$agent_a && !$agent_w) {
exit;
}
// Read parameters
// Read parameters.
$filter_severity = (int) get_parameter('filter_severity', -1);
$filter_fired = (int) get_parameter('filter_fired', -1);
$filter_status = (int) get_parameter('filter_status', 0);
@ -61,7 +75,7 @@ foreach ($user_groups as $id => $name) {
$i++;
}
$url = 'index.php?sec=estado&'.'sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'free_search_string='.$free_search_string.'&'.'pagination='.$pagination.'&'.'offset='.$offset.'&'.'trap_type='.$trap_type.'&'.'group_by='.$group_by.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
$url = 'index.php?sec=estado&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&free_search_string='.$free_search_string.'&pagination='.$pagination.'&offset='.$offset.'&trap_type='.$trap_type.'&group_by='.$group_by.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
$statistics['text'] = '<a href="index.php?sec=estado&sec2=operation/snmpconsole/snmp_statistics&pure='.$config['pure'].'&refr='.$refr.'">'.html_print_image('images/op_reporting.png', true, ['title' => __('Statistics')]).'</a>';
$list['text'] = '<a href="'.$url.'&pure='.$config['pure'].'&refresh='.$refr.'">'.html_print_image('images/op_snmp.png', true, ['title' => __('List')]).'</a>';
@ -70,7 +84,7 @@ $list['active'] = true;
if ($config['pure']) {
$fullscreen['text'] = '<a target="_top" href="'.$url.'&pure=0&refresh='.$refr.'">'.html_print_image('images/normal_screen.png', true, ['title' => __('Normal screen')]).'</a>';
} else {
// Fullscreen
// Fullscreen.
$fullscreen['text'] = '<a target="_top" href="'.$url.'&pure=1&refresh='.$refr.'">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).'</a>';
}
@ -131,7 +145,7 @@ if (isset($_GET['check'])) {
}
}
// Mass-process DELETE
// Mass-process DELETE.
if (isset($_POST['deletebt'])) {
$trap_ids = get_parameter_post('snmptrapid', []);
if (is_array($trap_ids) && check_acl($config['id_user'], 0, 'IW')) {
@ -161,7 +175,7 @@ if (isset($_POST['deletebt'])) {
}
}
// Mass-process UPDATE
// Mass-process UPDATE.
if (isset($_POST['updatebt'])) {
$trap_ids = get_parameter_post('snmptrapid', []);
if (is_array($trap_ids) && check_acl($config['id_user'], 0, 'IW')) {
@ -178,14 +192,14 @@ if (isset($_POST['updatebt'])) {
}
}
// All traps
// All traps.
$all_traps = db_get_all_rows_sql('SELECT DISTINCT source FROM ttrap');
if (empty($all_traps)) {
$all_traps = [];
}
// Set filters
// Set filters.
$agents = [];
$oids = [];
$severities = get_priorities();
@ -206,7 +220,7 @@ foreach ($all_traps as $trap) {
$prea = array_keys($user_groups);
$ids = join(',', $prea);
// Cuantos usuarios hay operadores con un grupo que exista y no lo tenga ningun usuario
// Cuantos usuarios hay operadores con un grupo que exista y no lo tenga ningun usuario.
$user_in_group_wo_agents = db_get_value_sql('select count(DISTINCT(id_usuario)) from tusuario_perfil where id_usuario ="'.$config['id_user'].'" and id_perfil = 1 and id_grupo in (select id_grupo from tgrupo where id_grupo in ('.$ids.') and id_grupo not in (select id_grupo from tagente))');
switch ($config['dbtype']) {
@ -244,6 +258,10 @@ switch ($config['dbtype']) {
}
}
break;
default:
// Default.
break;
}
if (empty($address_by_user_groups)) {
@ -293,6 +311,10 @@ switch ($config['dbtype']) {
) OR source='' OR source NOT IN (SELECT direccion FROM tagente WHERE direccion IS NOT NULL)) %s
ORDER BY timestamp DESC";
break;
default:
// Default.
break;
}
switch ($config['dbtype']) {
@ -335,6 +357,10 @@ switch ($config['dbtype']) {
) OR source='' OR source NOT IN (SELECT direccion FROM tagente WHERE direccion IS NOT NULL))
%s";
break;
default:
// Default.
break;
}
// $whereSubquery = 'WHERE 1=1';
@ -372,6 +398,10 @@ if ($free_search_string != '') {
text LIKE \'%'.$free_search_string.'%\' OR
description LIKE \'%'.$free_search_string.'%\')';
break;
default:
// Default.
break;
}
}
@ -422,7 +452,7 @@ if ($trap_type == 5) {
$whereSubquery .= ' AND type = '.$trap_type;
}
// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive
// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive.
if ($group_by && $config['dbtype'] != 'oracle') {
$where_without_group = $whereSubquery;
$whereSubquery .= ' GROUP BY source,oid';
@ -444,6 +474,10 @@ switch ($config['dbtype']) {
$sql = sprintf($sql, $whereSubquery);
$sql = oracle_recode_query($sql, $set);
break;
default:
// Default.
break;
}
$sql_all = sprintf($sql_all, $whereSubquery);
@ -458,7 +492,7 @@ $table->size = [];
$table->size[0] = '120px';
$table->data = [];
// Alert status select
// Alert status select.
$table->data[1][0] = '<strong>'.__('Alert').'</strong>';
$table->data[1][1] = html_print_select(
$alerted,
@ -470,7 +504,7 @@ $table->data[1][1] = html_print_select(
true
);
// Block size for pagination select
// Block size for pagination select.
$table->data[2][0] = '<strong>'.__('Block size for pagination').'</strong>';
$paginations[25] = 25;
$paginations[50] = 50;
@ -487,7 +521,7 @@ $table->data[2][1] = html_print_select(
true
);
// Severity select
// Severity select.
$table->data[1][2] = '<strong>'.__('Severity').'</strong>';
$table->data[1][3] = html_print_select(
$severities,
@ -499,7 +533,7 @@ $table->data[1][3] = html_print_select(
true
);
// Status
// Status.
$table->data[3][0] = '<strong>'.__('Status').'</strong>';
$status_array[-1] = __('All');
@ -515,7 +549,7 @@ $table->data[3][1] = html_print_select(
true
);
// Free search (search by all alphanumeric fields)
// Free search (search by all alphanumeric fields).
$table->data[2][3] = '<strong>'.__('Free search').'</strong>'.ui_print_help_tip(
__(
'Search by any alphanumeric field in the trap.
@ -542,7 +576,7 @@ $table->data[5][1] = html_print_input_text('time_from_trap', $time_from_trap, fa
$table->data[5][2] = '<strong>'.__('To (Time)').'</strong>';
$table->data[5][3] = html_print_input_text('time_to_trap', $time_to_trap, false, 15, 10, true);
// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other)
// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other).
$table->data[6][1] = '<strong>'.__('Trap type').'</strong>'.ui_print_help_tip(__('Search by trap type'), true);
$trap_types = [
-1 => __('None'),
@ -565,14 +599,14 @@ $table->data[6][2] = html_print_select(
false
);
// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive
// Disable this feature (time will decide if temporarily) in Oracle cause the group by is very confictive.
if ($config['dbtype'] != 'oracle') {
$table->data[3][3] = '<strong>'.__('Group by Enterprise String/IP').'</strong>';
$table->data[3][4] = __('Yes').'&nbsp;'.html_print_radio_button('group_by', 1, '', $group_by, true).'&nbsp;&nbsp;';
$table->data[3][4] .= __('No').'&nbsp;'.html_print_radio_button('group_by', 0, '', $group_by, true);
}
$filter = '<form method="POST" action="index.php?'.'sec=snmpconsole&'.'sec2=operation/snmpconsole/snmp_view&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure='.$config['pure'].'">';
$filter = '<form method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refresh='.((int) get_parameter('refresh', 0)).'&pure='.$config['pure'].'">';
$filter .= html_print_table($table, true);
$filter .= '<div style="width: '.$table->width.'; text-align: right;">';
$filter .= html_print_submit_button(__('Update'), 'search', false, 'class="sub upd"', true);
@ -595,9 +629,9 @@ $filter_resume['trap_type'] = $trap_types[$trap_type];
$traps = db_get_all_rows_sql($sql);
$trapcount = (int) db_get_value_sql($sql_count);
// No traps
// No traps.
if (empty($traps)) {
// Header
// Header.
ui_print_page_header(
__('SNMP Console'),
'images/op_snmp.png',
@ -638,24 +672,24 @@ if (empty($traps)) {
echo '<div id="menu_tab">';
echo '<ul class="mn">';
// Normal view button
// Normal view button.
echo '<li class="nomn">';
$normal_url = 'index.php?'.'sec=snmpconsole&'.'sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'filter_status='.$filter_status.'&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure=0&'.'trap_type='.$trap_type.'&'.'group_by='.$group_by.'&'.'free_search_string='.$free_search_string.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
$normal_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure=0&trap_type='.$trap_type.'&group_by='.$group_by.'&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
$urlPagination = $normal_url.'&'.'pagination='.$pagination.'&'.'offset='.$offset;
$urlPagination = $normal_url.'&pagination='.$pagination.'&offset='.$offset;
echo '<a href="'.$urlPagination.'">';
echo html_print_image('images/normal_screen.png', true, ['title' => __('Exit fullscreen')]);
echo '</a>';
echo '</li>';
// Auto refresh control
// Auto refresh control.
echo '<li class="nomn">';
echo '<div class="dashboard-refr" style="margin-top: 6px;">';
echo '<div class="dashboard-countdown" style="display: inline;"></div>';
$normal_url = 'index.php?'.'sec=snmpconsole&'.'sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'filter_status='.$filter_status.'&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure=1&'.'trap_type='.$trap_type.'&'.'group_by='.$group_by.'&'.'free_search_string='.$free_search_string.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
$normal_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure=1&trap_type='.$trap_type.'&group_by='.$group_by.'&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
$urlPagination = $normal_url.'&'.'pagination='.$pagination.'&'.'offset='.$offset;
$urlPagination = $normal_url.'&pagination='.$pagination.'&offset='.$offset;
echo '<form id="refr-form" method="get" action="'.$urlPagination.'" style="display: inline;">';
@ -669,7 +703,7 @@ if (empty($traps)) {
html_print_input_hidden('pure', 1);
html_print_input_hidden('refresh', ($refr > 0 ? $refr : $default_refr));
// Dashboard name
// Dashboard name.
echo '<li class="nomn">';
echo '<div class="dashboard-title">'.__('SNMP Traps').'</div>';
echo '</li>';
@ -688,7 +722,7 @@ if (empty($traps)) {
ui_require_javascript_file('wz_jsgraphics');
ui_require_javascript_file('pandora_visual_console');
} else {
// Header
// Header.
ui_print_page_header(
__('SNMP Console'),
'images/op_snmp.png',
@ -710,18 +744,19 @@ unset($table);
print_snmp_tags_active_filters($filter_resume);
if (($config['dbtype'] == 'oracle') && ($traps !== false)) {
for ($i = 0; $i < count($traps); $i++) {
$traps_size = count($traps);
for ($i = 0; $i < $traps_size; $i++) {
unset($traps[$i]['rnum']);
}
}
$url_snmp = 'index.php?'.'sec=snmpconsole&'.'sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'filter_status='.$filter_status.'&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure='.$config['pure'].'&'.'trap_type='.$trap_type.'&'.'group_by='.$group_by.'&'.'free_search_string='.$free_search_string.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
$url_snmp = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure='.$config['pure'].'&trap_type='.$trap_type.'&group_by='.$group_by.'&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
$urlPagination = $url_snmp.'&'.'pagination='.$pagination.'&'.'offset='.$offset;
$urlPagination = $url_snmp.'&pagination='.$pagination.'&offset='.$offset;
ui_pagination($trapcount, $urlPagination, $offset, $pagination);
echo '<form name="eventtable" method="POST" action="'.$url_snmp.'">';
echo '<form name="eventtable" method="POST" action="'.$urlPagination.'">';
$table->cellpadding = 0;
$table->cellspacing = 0;
@ -795,7 +830,7 @@ $table->headstyle[9] = 'text-align: center';
$table->style[8] = 'background: #F3F3F3; color: #111 !important;';
// Skip offset records
// Skip offset records.
$idx = 0;
if ($traps !== false) {
foreach ($traps as $trap) {
@ -809,7 +844,7 @@ if ($traps !== false) {
$severity = $trap['alerted'] == 1 ? $trap['priority'] : 1;
}
// Status
// Status.
if ($trap['status'] == 0) {
$data[0] = html_print_image(
'images/pixel_red.png',
@ -832,7 +867,7 @@ if ($traps !== false) {
);
}
// Agent matching source address
// Agent matching source address.
$table->cellclass[$idx][1] = get_priority_class($severity);
$agent = agents_get_agent_with_ip($trap['source']);
if ($agent === false) {
@ -851,7 +886,7 @@ if ($traps !== false) {
'</strong></a>';
}
// OID
// OID.
$table->cellclass[$idx][2] = get_priority_class($severity);
if (! empty($trap['text'])) {
$enterprise_string = $trap['text'];
@ -863,7 +898,7 @@ if ($traps !== false) {
$data[2] = '<a href="javascript: toggleVisibleExtendedInfo('.$trap['id_trap'].');">'.$enterprise_string.'</a>';
// Count
// Count.
if ($group_by) {
$sql = "SELECT * FROM ttrap WHERE 1=1
$where_without_group
@ -875,7 +910,7 @@ if ($traps !== false) {
$data[3] = '<strong>'.$count_group_traps.'</strong></a>';
}
// Value
// Value.
$table->cellclass[$idx][4] = get_priority_class($severity);
if (empty($trap['value'])) {
$data[4] = __('N/A');
@ -883,7 +918,7 @@ if ($traps !== false) {
$data[4] = ui_print_truncate_text($trap['value'], GENERIC_SIZE_TEXT, false);
}
// User
// User.
$table->cellclass[$idx][5] = get_priority_class($severity);
if (!empty($trap['status'])) {
$data[5] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit&ver='.$trap['id_usuario'].'">'.substr($trap['id_usuario'], 0, 8).'</a>';
@ -894,35 +929,36 @@ if ($traps !== false) {
$data[5] = '--';
}
// Timestamp
// Timestamp.
$table->cellclass[$idx][6] = get_priority_class($severity);
$data[6] = '<span title="'.$trap['timestamp'].'">';
$data[6] .= ui_print_timestamp($trap['timestamp'], true);
$data[6] .= '</span>';
// Use alert severity if fired
// Use alert severity if fired.
if (!empty($trap['alerted'])) {
$data[7] = html_print_image('images/pixel_yellow.png', true, ['width' => '20', 'height' => '20', 'border' => '0', 'title' => __('Alert fired')]);
} else {
$data[7] = html_print_image('images/pixel_gray.png', true, ['width' => '20', 'height' => '20', 'border' => '0', 'title' => __('Alert not fired')]);
}
// Actions
// Actions.
$data[8] = '';
if (empty($trap['status']) && check_acl($config['id_user'], 0, 'IW')) {
$data[8] .= '<a href="'.$url_snmp.'&check='.$trap['id_trap'].'">'.html_print_image('images/ok.png', true, ['border' => '0', 'title' => __('Validate')]).'</a> ';
$data[8] .= '<a href="'.$urlPagination.'&check='.$trap['id_trap'].'">'.html_print_image('images/ok.png', true, ['border' => '0', 'title' => __('Validate')]).'</a> ';
}
if ($trap['source'] == '') {
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
if ($is_admin) {
$data[8] .= '<a href="'.$url_snmp.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
$data[8] .= '<a href="'.$urlPagination.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
}
} else {
$agent_trap_group = db_get_value('id_grupo', 'tagente', 'nombre', $trap['source']);
if ((check_acl($config['id_user'], $agent_trap_group, 'IM'))) {
$data[8] .= '<a href="'.$url_snmp.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
$data[8] .= '<a href="'.$urlPagination.'&delete='.$trap['id_trap'].'&offset='.$offset.'" onClick="javascript:return confirm(\''.__('Are you sure?').'\')">'.html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete')]).'</a> ';
}
}
@ -934,18 +970,18 @@ if ($traps !== false) {
array_push($table->data, $data);
// Hiden file for description
// Hiden file for description.
$string = '<table style="border:solid 1px #D3D3D3;" width="90%" class="toggle">
<tr>
<td align="left" valign="top" width="15%">'.'<b>'.__('Variable bindings:').'</b></td>
<td align="left" >';
if ($group_by) {
$new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&'.'filter_severity='.$filter_severity.'&'.'filter_fired='.$filter_fired.'&'.'filter_status='.$filter_status.'&'.'refresh='.((int) get_parameter('refresh', 0)).'&'.'pure='.$config['pure'].'&'.'group_by=0&'.'free_search_string='.$free_search_string.'&'.'date_from_trap='.$date_from_trap.'&'.'date_to_trap='.$date_to_trap.'&'.'time_from_trap='.$time_from_trap.'&'.'time_to_trap='.$time_to_trap;
$new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_severity='.$filter_severity.'&filter_fired='.$filter_fired.'&filter_status='.$filter_status.'&refresh='.((int) get_parameter('refresh', 0)).'&pure='.$config['pure'].'&group_by=0&free_search_string='.$free_search_string.'&date_from_trap='.$date_from_trap.'&date_to_trap='.$date_to_trap.'&time_from_trap='.$time_from_trap.'&time_to_trap='.$time_to_trap;
$string .= '<a href='.$new_url.'>'.__('See more details').'</a>';
} else {
// Print binding vars separately
// Print binding vars separately.
$binding_vars = explode("\t", $trap['oid_custom']);
foreach ($binding_vars as $var) {
$string .= $var.'<br/>';
@ -1007,7 +1043,7 @@ if ($traps !== false) {
break;
}
$string .= '<tr><td align="left" valign="top">'.'<b>'.__('Trap type:').'</b>'.'</td>'.'<td align="left">'.$desc_trap_type.'</td></tr>';
$string .= '<tr><td align="left" valign="top"><b>'.__('Trap type:').'</b></td><td align="left">'.$desc_trap_type.'</td></tr>';
}
if ($group_by) {
@ -1060,7 +1096,7 @@ if ($traps !== false) {
}
}
// No matching traps
// No matching traps.
if ($idx == 0) {
echo '<div class="nf">'.__('No matching traps found').'</div>';
} else {

View File

@ -40,6 +40,9 @@ ob_start('ui_process_page_head');
// Enterprise main
enterprise_include('index.php');
$url_css = ui_get_full_url('include/styles/visual_maps.css', false, false, false);
echo '<link rel="stylesheet" href="'.$url_css.'" type="text/css" />';
require_once 'include/functions_visual_map.php';
$hash = get_parameter('hash');
@ -96,31 +99,40 @@ if ($layout) {
echo '<div id="vc-container"></div>';
}
// Floating menu - Start
// Floating menu - Start.
echo '<div id="vc-controls" style="z-index:300;">';
echo '<div id="menu_tab">';
echo '<ul class="mn">';
echo '<ul class="mn white-box-content box-shadow flex-row">';
// QR code
// QR code.
echo '<li class="nomn">';
echo '<a href="javascript: show_dialog_qrcode();">';
echo '<img class="vc-qr" src="../../images/qrcode_icon_2.jpg"/>';
echo '</a>';
echo '</li>';
// Countdown
// Countdown.
echo '<li class="nomn">';
echo '<div class="vc-refr">';
echo '<div class="vc-countdown"></div>';
echo '<div id="vc-refr-form">';
echo __('Refresh').':';
echo html_print_select(get_refresh_time_array(), 'refr', $refr, '', '', 0, true, false, false);
echo html_print_select(
get_refresh_time_array(),
'vc-refr',
$refr,
'',
'',
0,
true,
false,
false
);
echo '</div>';
echo '</div>';
echo '</li>';
// Console name
// Console name.
echo '<li class="nomn">';
echo '<div class="vc-title">'.$layout_name.'</div>';
echo '</li>';
@ -129,15 +141,15 @@ echo '</ul>';
echo '</div>';
echo '</div>';
// Floating menu - End
// QR code dialog
// QR code dialog.
echo '<div style="display: none;" id="qrcode_container" title="'.__('QR code of the page').'">';
echo '<div id="qrcode_container_image"></div>';
echo '</div>';
ui_require_jquery_file('countdown');
ui_require_javascript_file('wz_jsgraphics');
ui_require_javascript_file('pandora_visual_console');
ui_require_jquery_file('countdown', 'include/javascript/', true);
ui_require_javascript_file('wz_jsgraphics', 'include/javascript/', true);
ui_require_javascript_file('pandora_visual_console', 'include/javascript/', true);
$ignored_params['refr'] = '';
?>

View File

@ -42,6 +42,9 @@ ob_start('ui_process_page_head');
// Enterprise main.
enterprise_include('index.php');
$url_css = ui_get_full_url('include/styles/visual_maps.css', false, false, false);
echo '<link rel="stylesheet" href="'.$url_css.'" type="text/css" />';
require_once 'include/functions_visual_map.php';
$hash = (string) get_parameter('hash');
@ -134,7 +137,7 @@ if (!users_can_manage_group_all('AR')) {
}
$ignored_params['refr'] = '';
ui_require_javascript_file('pandora_visual_console');
ui_require_javascript_file('pandora_visual_console', 'include/javascript/', true);
include_javascript_d3();
visual_map_load_client_resources();
@ -157,6 +160,10 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
var props = <?php echo (string) $visualConsole; ?>;
var items = <?php echo '['.implode($visualConsoleItems, ',').']'; ?>;
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>";
var controls = document.getElementById('vc-controls');
autoHideElement(controls, 1000);
var handleUpdate = function (prevProps, newProps) {
if (!newProps) return;

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.738-190829
Version: 7.0NG.738-190911
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.738-190829"
pandora_version="7.0NG.738-190911"
package_cpan=0
package_pandora=1

View File

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

View File

@ -1205,13 +1205,13 @@ sub pandora_execute_action ($$$$$$$$$;$) {
# Address
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Subject
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Message
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module, $alert);
# Content
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module, $alert);
if($field4 eq ""){
$field4 = "text/html";
@ -3943,8 +3943,8 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
##########################################################################
# Search string for macros and substitutes them with their values.
##########################################################################
sub subst_alert_macros ($$;$$$$) {
my ($string, $macros, $pa_config, $dbh, $agent, $module) = @_;
sub subst_alert_macros ($$;$$$$$) {
my ($string, $macros, $pa_config, $dbh, $agent, $module, $alert) = @_;
my $macro_regexp = join('|', keys %{$macros});
@ -3952,14 +3952,14 @@ sub subst_alert_macros ($$;$$$$) {
if (defined($string) && $string =~ m/^(?:(")(?:.*)"|(')(?:.*)')$/) {
my $quote = $1 ? $1 : $2;
$subst_func = sub {
my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module);
my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module,$alert);
$macro =~ s/'/'\\''/g; # close, escape, open
return decode_entities($quote . "'" . $macro . "'" . $quote); # close, quote, open
};
}
else {
$subst_func = sub {
my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module);
my $macro = on_demand_macro($pa_config, $dbh, shift, $macros, $agent, $module, $alert);
return decode_entities($macro);
};
}
@ -3993,8 +3993,8 @@ sub subst_column_macros ($$;$$$$) {
##########################################################################
# Load macros that access the database on demand.
##########################################################################
sub on_demand_macro($$$$$$) {
my ($pa_config, $dbh, $macro, $macros, $agent, $module) = @_;
sub on_demand_macro($$$$$$;$) {
my ($pa_config, $dbh, $macro, $macros, $agent, $module,$alert) = @_;
# Static macro.
return $macros->{$macro} if (defined($macros->{$macro}));
@ -4010,7 +4010,7 @@ sub on_demand_macro($$$$$$) {
} elsif ($macro eq '_moduletags_') {
return (defined ($module)) ? pandora_get_module_url_tags ($pa_config, $dbh, $module->{'id_agente_modulo'}) : '';
} elsif ($macro eq '_policy_') {
return (defined ($module)) ? enterprise_hook('get_policy_name', [$dbh, $module->{'id_policy_module'}]) : '';
return (defined ($alert)) ? enterprise_hook('get_policy_name_policy_alerts_id', [$dbh, $alert->{'id_policy_alerts'}]) : '';
} elsif ($macro eq '_email_tag_') {
return (defined ($module)) ? pandora_get_module_email_tags ($pa_config, $dbh, $module->{'id_agente_modulo'}) : '';
} elsif ($macro eq '_phone_tag_') {

View File

@ -58,6 +58,7 @@ my %Agents :shared;
my $Sem :shared;
my $TaskSem :shared;
my $AgentSem :shared;
my $XMLinSem :shared;
########################################################################################
# Data Server class constructor.
@ -74,6 +75,7 @@ sub new ($$;$) {
$Sem = Thread::Semaphore->new;
$TaskSem = Thread::Semaphore->new (0);
$AgentSem = Thread::Semaphore->new (1);
$XMLinSem = Thread::Semaphore->new (1);
# Call the constructor of the parent class
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
@ -175,6 +177,7 @@ sub data_consumer ($$) {
my $agent_name = $1;
my $file_name = $pa_config->{'incomingdir'};
my $xml_err;
my $error;
# Fix path
$file_name .= "/" unless (substr ($file_name, -1, 1) eq '/');
@ -191,18 +194,37 @@ sub data_consumer ($$) {
for (0..1) {
eval {
local $SIG{__DIE__};
threads->yield;
# XML::SAX::ExpatXS is not thread safe.
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->down();
}
$xml_data = XMLin ($file_name, forcearray => 'module');
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->up();
}
};
# Invalid XML
if ($@ || ref($xml_data) ne 'HASH') {
if ($@) {
$error = 1;
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
$XMLinSem->up();
}
}
if ($error || ref($xml_data) ne 'HASH') {
if ($@) {
$xml_err = $@;
} else {
$xml_err = "Invalid XML format.";
}
logger($pa_config, "Failed to parse $file_name $xml_err", 3);
sleep (2);
next;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.738 PS190829";
my $version = "7.0NG.738 PS190911";
# Pandora server configuration
my %conf;
@ -136,7 +136,7 @@ sub pandora_purgedb ($$) {
pandora_delete_old_export_data ($dbh, $ulimit_timestamp);
# Delete sessions data
pandora_delete_old_session_data ($dbh, $ulimit_timestamp);
pandora_delete_old_session_data (\%conf, $dbh, $ulimit_timestamp);
# Delete old inventory data
@ -678,6 +678,7 @@ sub pandora_load_config_pdb ($) {
$conf->{'_netflow_nfexpire'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'netflow_nfexpire'");
$conf->{'_netflow_path'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'netflow_path'");
$conf->{'_delete_notinit'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'delete_notinit'");
$conf->{'_session_timeout'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'session_timeout'");
$conf->{'_big_operation_step_datos_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'big_operation_step_datos_purge'");
$conf->{'_small_operation_step_datos_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'small_operation_step_datos_purge'");
@ -990,12 +991,28 @@ sub pandora_delete_old_export_data {
# Delete old session data.
##############################################################################
sub pandora_delete_old_session_data {
my ($dbh, $ulimit_timestamp) = @_;
my ($conf, $dbh, $ulimit_timestamp) = @_;
my $session_timeout = $conf->{'_session_timeout'};
if ($session_timeout ne '') {
if ($session_timeout == -1) {
# The session expires in 10 years
$session_timeout = 315576000;
} else {
$session_timeout *= 60;
}
$ulimit_timestamp = time() - $session_timeout;
}
log_message ('PURGE', "Deleting old session data from tsessions_php\n");
while(db_delete_limit ($dbh, 'tsessions_php', 'last_active < ?', $SMALL_OPERATION_STEP, $ulimit_timestamp) ne '0E0') {
usleep (10000);
};
db_do ($dbh, "DELETE FROM tsessions_php WHERE
data IS NULL OR id_session REGEXP '^cron-'");
}
###############################################################################

View File

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