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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.738-190829 Version: 7.0NG.738-190911
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,7 +53,7 @@ static EvtUpdateBookmarkT EvtUpdateBookmarkF = NULL;
* @param name Module name. * @param name Module name.
* @param service_name Service internal name to check. * @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) { : Pandora_Module (name) {
int i; int i;
vector<wstring> query; vector<wstring> query;
@ -93,6 +93,13 @@ Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source
query.push_back(ss.str()); 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 // Fill the filter
if (query.size() == 0) { if (query.size() == 0) {
this->filter = L"*"; this->filter = L"*";
@ -579,4 +586,4 @@ Pandora_Module_Logchannel::GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEv
} }
return pBuffer; return pBuffer;
} }

View File

@ -75,7 +75,7 @@ namespace Pandora_Modules {
LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId); LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId);
public: 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 (); void run ();
}; };
} }

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.738-190829 Version: 7.0NG.738-190911
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.738-190829" pandora_version="7.0NG.738-190911"
package_pear=0 package_pear=0
package_pandora=1 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 '<h1>'.__('ERROR').'</h1>';
echo '<p>'.$config['auth_error'].'</p>'; echo '<p>'.$config['auth_error'].'</p>';
echo '</div>'; echo '</div>';
echo '<div class="text_message_alert">'; if ($config['enable_pass_policy']) {
echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>'; echo '<div class="text_message_alert">';
echo '</div>'; echo '<p><strong>Remaining attempts: '.$attemps.'</strong></p>';
echo '</div>';
}
echo '<div class="button_message_alert">'; echo '<div class="button_message_alert">';
html_print_submit_button('Ok', 'hide-login-error', false); html_print_submit_button('Ok', 'hide-login-error', false);
echo '</div>'; echo '</div>';

View File

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

View File

@ -1358,7 +1358,11 @@ if ($update_module || $create_module) {
$parent_module_id = (int) get_parameter('parent_module_id'); $parent_module_id = (int) get_parameter('parent_module_id');
$ip_target = (string) get_parameter('ip_target'); $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'; $ip_target = 'auto';
} }
@ -1381,11 +1385,7 @@ if ($update_module || $create_module) {
$ff_type = (int) get_parameter('ff_type'); $ff_type = (int) get_parameter('ff_type');
$each_ff = (int) get_parameter('each_ff'); $each_ff = (int) get_parameter('each_ff');
$ff_timeout = (int) get_parameter('ff_timeout'); $ff_timeout = (int) get_parameter('ff_timeout');
$unit = (string) get_parameter('unit_select'); $unit = (string) get_parameter('unit');
if ($unit == 'none') {
$unit = (string) get_parameter('unit_text');
}
$id_tag = (array) get_parameter('id_tag_selected'); $id_tag = (array) get_parameter('id_tag_selected');
$serialize_ops = (string) get_parameter('serialize_ops'); $serialize_ops = (string) get_parameter('serialize_ops');
$critical_instructions = (string) get_parameter('critical_instructions'); $critical_instructions = (string) get_parameter('critical_instructions');
@ -1559,8 +1559,14 @@ if ($update_module) {
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ($key == 1) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;'; if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;'; $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;'; $values['plugin_parameter'] .= $value.'&#x0a;';
} else { } else {
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
@ -1757,8 +1763,14 @@ if ($create_module) {
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ($key == 1) {
$values['plugin_parameter'] .= 'http_auth_user&#x20;'.$http_user.'&#x0a;'; if ($http_user) {
$values['plugin_parameter'] .= 'http_auth_pass&#x20;'.$http_pass.'&#x0a;'; $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;'; $values['plugin_parameter'] .= $value.'&#x0a;';
} else { } else {
$values['plugin_parameter'] .= $value.'&#x0a;'; $values['plugin_parameter'] .= $value.'&#x0a;';
@ -2095,8 +2107,7 @@ if ($delete_module) {
} }
} }
// MODULE DUPLICATION // MODULE DUPLICATION.
// ==================.
if (!empty($duplicate_module)) { if (!empty($duplicate_module)) {
// DUPLICATE agent module ! // DUPLICATE agent module !
$id_duplicate_module = $duplicate_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); $updateGIS = get_parameter('update_gis', 0);
if ($updateGIS) { if ($updateGIS) {
$updateGisData = get_parameter('update_gis_data'); $updateGisData = get_parameter('update_gis_data');
@ -2231,8 +2280,11 @@ switch ($tab) {
break; break;
case 'alert': 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; $dont_display_alert_create_bttn = true;
include 'godmode/alerts/alert_list.php'; include 'godmode/alerts/alert_list.php';
break; break;

View File

@ -443,6 +443,14 @@ ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modific
if ($agents !== false) { if ($agents !== false) {
// Urls to sort the table. // 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_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_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'; $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 { } else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente& echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab& 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>'; echo '</strong>';
@ -629,7 +637,7 @@ if ($agents !== false) {
// Group icon and name // Group icon and name
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>'; echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
// Description // 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 // Action
// When there is only one element in page it's necesary go back page. // When there is only one element in page it's necesary go back page.
if ((count($agents) == 1) && ($offset >= $config['block_size'])) { 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[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); $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( $table->data[1][1] = html_print_select_groups(
$config['id_user'], $config['id_user'],
$access, $access,
users_can_manage_group_all(), $returnAllGroup,
'id_group_filter', 'id_group_filter',
$id_group_filter, $id_group_filter,
'', '',

View File

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

View File

@ -143,12 +143,12 @@ $table->data[3] = $data;
$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[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', 'target',
3,
1,
$event_response['target'], $event_response['target'],
'', 'style="min-height:initial;"',
100,
255,
true true
); );

View File

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

View File

@ -1317,7 +1317,7 @@ $class = 'databox filters';
if (metaconsole_load_external_db($connection) == NOERR) { if (metaconsole_load_external_db($connection) == NOERR) {
$agent_name = db_get_value_filter( $agent_name = db_get_value_filter(
'nombre', 'alias',
'tagente', 'tagente',
['id_agente' => $idAgent] ['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 // Filter report items created from metaconsole in normal console list and the opposite
if (defined('METACONSOLE') and $config['metaconsole'] == 1) { 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 { } else {
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))'; $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[0] = '5px';
$table->size[1] = '15%'; $table->size[1] = '15%';
$table->size[4] = '8%'; $table->size[4] = '8%';
$table->size[6] = '90px'; $table->size[6] = '120px';
$table->size[7] = '30px'; $table->size[7] = '30px';
$table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>'; $table->head[0] = '<span title="'.__('Position').'">'.__('P.').'</span>';

View File

@ -1,4 +1,22 @@
<script type="text/javascript"> <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() { function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) { if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true); $(".check_delete").prop("checked", true);
@ -578,7 +596,7 @@ switch ($action) {
break; break;
} }
if (! $delete) { if (! $delete && !empty($type_access_selected)) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access report builder deletion' 'Trying to access report builder deletion'

View File

@ -100,7 +100,15 @@ if ($update_filter > -2) {
'filter' => $filter, 'filter' => $filter,
'unified_filters_id' => $new_unified_id, '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); $result = db_process_sql_insert('tsnmp_filter', $values);
}
} else { } else {
for ($i = 0; $i < $index_post; $i++) { for ($i = 0; $i < $index_post; $i++) {
$filter = get_parameter('filter_'.$i); $filter = get_parameter('filter_'.$i);
@ -109,12 +117,28 @@ if ($update_filter > -2) {
'filter' => $filter, 'filter' => $filter,
'unified_filters_id' => $new_unified_id, 'unified_filters_id' => $new_unified_id,
]; ];
$result = db_process_sql_insert('tsnmp_filter', $values); 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) { 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 { } else {
ui_print_success_message(__('Successfully created')); ui_print_success_message(__('Successfully created'));
} }
@ -215,8 +239,10 @@ 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'); $result_unified = db_get_all_rows_sql('SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC');
$aglomerate_result = []; $aglomerate_result = [];
foreach ($result_unified as $res) { if (is_array($result_unified) === true) {
$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'); 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 = new stdClass();
@ -282,7 +308,8 @@ if ($edit_filter > -2) {
?> ?>
<script type="text/javascript"> <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']; ?>"; var homeurl = "<?php echo $config['homeurl']; ?>";
$(document).ready (function () { $(document).ready (function () {

View File

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

View File

@ -30,19 +30,21 @@ if ($php_version_array[0] < 7) {
$tab = get_parameter('tab', 'online'); $tab = get_parameter('tab', 'online');
$buttons = [ $buttons['setup'] = [
'setup' => [ 'active' => ($tab == 'setup') ? true : false,
'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>',
'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, '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>', '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' => [ }
'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>', $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 = ''; $password_confirm = '';
$new_user = true; $new_user = true;
} else { } 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'].'"'; $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) { if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
@ -264,7 +310,10 @@ if ($create_user) {
$info .= '}'; $info .= '}';
} }
$result = create_user($id, $password_new, $values); $can_create = false;
if ($result) { if ($result) {
$res = save_pass_history($id, $password_new); $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'); $id_action = (int) get_parameter('id_action');
$actions = alerts_get_alert_agent_module_actions($id_alert); $actions = alerts_get_alert_agent_module_actions($id_alert);
$action_opction = db_get_row( $action_option = db_get_row(
'talert_template_module_actions', 'talert_template_module_actions',
'id_alert_template_module', 'id',
$id_alert $id_action
); );
$data .= '<form id="update_action-'.$alert['id'].'" method="post">'; $data .= '<form id="update_action-'.$alert['id'].'" method="post">';
@ -242,7 +242,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos">'; $data .= '<td class="datos">';
$data .= html_print_input_text( $data .= html_print_input_text(
'fires_min_ajax', 'fires_min_ajax',
$action_opction['fires_min'], $action_option['fires_min'],
'', '',
4, 4,
10, 10,
@ -251,7 +251,7 @@ if ($show_update_action_menu) {
$data .= ' '.__('to').' '; $data .= ' '.__('to').' ';
$data .= html_print_input_text( $data .= html_print_input_text(
'fires_max_ajax', 'fires_max_ajax',
$action_opction['fires_max'], $action_option['fires_max'],
'', '',
4, 4,
10, 10,
@ -266,7 +266,7 @@ if ($show_update_action_menu) {
$data .= '<td class="datos2">'; $data .= '<td class="datos2">';
$data .= html_print_input_text( $data .= html_print_input_text(
'module_action_threshold_ajax', 'module_action_threshold_ajax',
$action_opction['module_action_threshold'], $action_option['module_action_threshold'],
'', '',
4, 4,
10, 10,

View File

@ -1151,7 +1151,12 @@ if (check_login()) {
} }
$server_name = ''; $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) { if ($module['estado'] == 3) {

View File

@ -727,7 +727,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.LICENSE.LIMITED', 'type' => 'NOTIF.LICENSE.LIMITED',
'title' => __('Limited mode.'), 'title' => __('Limited mode.'),
'message' => io_safe_output($config['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 { } else {
@ -745,7 +745,7 @@ class ConsoleSupervisor
'Your license will expire in %d days. Please, contact our sales department.', 'Your license will expire in %d days. Please, contact our sales department.',
$days_to_expiry $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) { } else if ($days_to_expiry < 0) {
@ -755,7 +755,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.LICENSE.EXPIRATION', 'type' => 'NOTIF.LICENSE.EXPIRATION',
'title' => __('Expired license'), 'title' => __('Expired license'),
'message' => __('Your license has expired. Please, contact our sales department.'), '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; return false;
@ -832,7 +832,7 @@ class ConsoleSupervisor
'Directory %s is not writable. Please, configure corresponding permissions.', 'Directory %s is not writable. Please, configure corresponding permissions.',
$config['attachment_store'] $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; return;
@ -854,7 +854,7 @@ class ConsoleSupervisor
'There are more than %d files in attachment, consider cleaning up attachment directory manually.', 'There are more than %d files in attachment, consider cleaning up attachment directory manually.',
$config['num_files_attachment'] $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 { } else {
@ -886,7 +886,7 @@ class ConsoleSupervisor
'Remote configuration directory %s is not readable. Please, adjust configuration.', 'Remote configuration directory %s is not readable. Please, adjust configuration.',
$config['remote_config'] $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; return;
@ -905,7 +905,7 @@ class ConsoleSupervisor
'Remote configuration directory %s is not writable. Please, adjust configuration.', 'Remote configuration directory %s is not writable. Please, adjust configuration.',
$config['remote_config'].'/conf' $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 { } else {
@ -923,7 +923,7 @@ class ConsoleSupervisor
'Collections directory %s is not writable. Please, adjust configuration.', 'Collections directory %s is not writable. Please, adjust configuration.',
$config['remote_config'].'/collections' $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 { } else {
@ -941,7 +941,7 @@ class ConsoleSupervisor
'MD5 directory %s is not writable. Please, adjust configuration.', 'MD5 directory %s is not writable. Please, adjust configuration.',
$config['remote_config'].'/md5' $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 { } else {
@ -972,7 +972,7 @@ class ConsoleSupervisor
$MAX_FILES_DATA_IN, $MAX_FILES_DATA_IN,
$config['remote_config'] $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 { } else {
@ -995,7 +995,7 @@ class ConsoleSupervisor
$MAX_BADXML_FILES_DATA_IN, $MAX_BADXML_FILES_DATA_IN,
$config['remote_config'] $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 { } else {
@ -1081,7 +1081,7 @@ class ConsoleSupervisor
$modules_queued, $modules_queued,
$queue['queued_modules'] $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 { } else {
@ -1191,7 +1191,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'], 'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'],
'title' => $msg, 'title' => $msg,
'message' => $description, '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', 'type' => 'NOTIF.HISTORYDB',
'title' => __('Historical database not available'), 'title' => __('Historical database not available'),
'message' => __('Historical database is enabled, though not accessible with the current configuration.'), '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 { } 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.', '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()) 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 { } else {
@ -1606,7 +1606,7 @@ class ConsoleSupervisor
'Historical database maintenance problem.' '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()), '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 { } else {
@ -1645,7 +1645,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.HISTORYDB.MR', 'type' => 'NOTIF.HISTORYDB.MR',
'title' => __('Historical database MR mismatch'), '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.'), '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 { } else {
@ -1687,7 +1687,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.EXT.ELASTICSEARCH', 'type' => 'NOTIF.EXT.ELASTICSEARCH',
'title' => __('Log collector cannot connect to ElasticSearch'), 'title' => __('Log collector cannot connect to ElasticSearch'),
'message' => __('ElasticSearch is not available using current configuration.'), '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 { } else {
@ -1757,7 +1757,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.METACONSOLE.DB_CONNECTION', 'type' => 'NOTIF.METACONSOLE.DB_CONNECTION',
'title' => __('Metaconsole DB is not available.'), 'title' => __('Metaconsole DB is not available.'),
'message' => __('Cannot connect with Metaconsole DB using current configuration.'), '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', 'type' => 'NOTIF.DOWNTIME',
'title' => __('Scheduled downtime running.'), 'title' => __('Scheduled downtime running.'),
'message' => __('A scheduled downtime is running. Some monitoring data won\'t be available while downtime is taking place.'), '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; return;
@ -1947,7 +1947,7 @@ class ConsoleSupervisor
date('M j, G:i:s ', $next_downtime_begin), date('M j, G:i:s ', $next_downtime_begin),
date('M j, G:i:s ', $next_downtime_end) 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; return;
@ -2043,7 +2043,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD', 'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD',
'title' => __('Default password for "Admin" user has not been changed'), 'title' => __('Default password for "Admin" user has not been changed'),
'message' => __('Please, change the default password since it is a commonly reported vulnerability.'), '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 { } else {
@ -2069,7 +2069,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.MISC.FONTPATH', 'type' => 'NOTIF.MISC.FONTPATH',
'title' => __('Default font doesn\'t exist'), 'title' => __('Default font doesn\'t exist'),
'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'), '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 { } 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', '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() get_product_name()
), ),
'url' => 'index.php', 'url' => ui_get_full_url('index.php'),
] ]
); );
} else { } else {
@ -2119,7 +2119,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION', 'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION',
'title' => __('Event storm protection is enabled.'), '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.'), '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 { } else {
@ -2146,7 +2146,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP', 'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP',
'title' => __('Failed to retrieve updates, please configure utility'), 'title' => __('Failed to retrieve updates, please configure utility'),
'message' => $message, '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', 'New %s Console update',
get_product_name() 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.'), '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' => 'index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online', 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online'),
] ]
); );
} else { } 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>.', '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
), ),
'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 { } else {
@ -2253,7 +2253,7 @@ class ConsoleSupervisor
'type' => 'NOTIF.CRON.CONFIGURED', 'type' => 'NOTIF.CRON.CONFIGURED',
'title' => __('DiscoveryConsoleTasks is not configured.'), 'title' => __('DiscoveryConsoleTasks is not configured.'),
'message' => __($message_conf_cron), '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 { } else {

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC190829'; $build_version = 'PC190911';
$pandora_version = 'v7.0NG.738'; $pandora_version = 'v7.0NG.738';
// Do not overwrite default timezone set if defined. // 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_AA', 6);
define('MODULE_PREDICTION_CLUSTER_AP', 7); 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. // SNMP CONSTANTS.
define('SNMP_DIR_MIBS', 'attachment/mibs'); define('SNMP_DIR_MIBS', 'attachment/mibs');

View File

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

View File

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

View File

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

View File

@ -3100,7 +3100,7 @@ function reporting_historical_data($report, $content)
$return['type'] = 'historical_data'; $return['type'] = 'historical_data';
$period = $content['period']; $period = $content['period'];
$date_limit = (time() - $period); $date_limit = ($report['datetime'] - $period);
if (empty($content['name'])) { if (empty($content['name'])) {
$content['name'] = __('Historical data'); $content['name'] = __('Historical data');
} }
@ -3169,7 +3169,7 @@ function reporting_historical_data($report, $content)
FROM tagente_datos_string FROM tagente_datos_string
WHERE id_agente_modulo ='.$content['id_agent_module'].' WHERE id_agente_modulo ='.$content['id_agent_module'].'
AND utimestamp >'.$date_limit.' AND utimestamp >'.$date_limit.'
AND utimestamp <='.time(), AND utimestamp <='.$report['datetime'],
true true
); );
break; break;
@ -3180,7 +3180,7 @@ function reporting_historical_data($report, $content)
FROM tagente_datos FROM tagente_datos
WHERE id_agente_modulo ='.$content['id_agent_module'].' WHERE id_agente_modulo ='.$content['id_agent_module'].'
AND utimestamp >'.$date_limit.' AND utimestamp >'.$date_limit.'
AND utimestamp <='.time(), AND utimestamp <='.$report['datetime'],
true true
); );
break; 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) function visual_map_get_image_status_element($layoutData, $status=false)
{ {
$metaconsole_hack = ''; $img = 'images/console/icons/'.$layoutData['image'];
if (is_metaconsole()) {
$metaconsole_hack = '../../';
}
$img = $metaconsole_hack.'images/console/icons/'.$layoutData['image'];
if ($layoutData['type'] == 5) { if ($layoutData['type'] == 5) {
// ICON ELEMENT // ICON ELEMENT

View File

@ -91,6 +91,11 @@ function pandora_session_write($session_id, $data)
{ {
$session_id = addslashes($session_id); $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()) { if (is_ajax()) {
// Avoid session upadte while processing ajax responses - notifications. // Avoid session upadte while processing ajax responses - notifications.
if (get_parameter('check_new_notifications', false)) { if (get_parameter('check_new_notifications', false)) {

View File

@ -291,21 +291,9 @@ final class Group extends Item
$width = (int) $data['width']; $width = (int) $data['width'];
$height = (int) $data['height']; $height = (int) $data['height'];
if ($width === 0 || $height === 0) { 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); $sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
$imageHeight = $sizeImage[1]; $data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
if ($width === 0) {
$data['width'] = 70;
}
if ($height === 0) {
$data['height'] = ($imageHeight > 70) ? 70 : $imageHeight;
}
} }
$data['html'] = '<img src="'.$data['statusImageSrc'].'">'; $data['html'] = '<img src="'.$data['statusImageSrc'].'">';

View File

@ -120,21 +120,9 @@ final class Icon extends Item
$width = (int) $data['width']; $width = (int) $data['width'];
$height = (int) $data['height']; $height = (int) $data['height'];
if ($width === 0 || $height === 0) { 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); $sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
$imageHeight = $sizeImage[1]; $data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
if ($width === 0) {
$data['width'] = 70;
}
if ($height === 0) {
$data['height'] = ($imageHeight > 70) ? 70 : $imageHeight;
}
} }
return $data; return $data;

View File

@ -184,23 +184,9 @@ final class StaticGraph extends Item
$width = (int) $data['width']; $width = (int) $data['width'];
$height = (int) $data['height']; $height = (int) $data['height'];
if ($width === 0 || $height === 0) { 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); $sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
$imageHeight = $sizeImage[1]; $data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
if ($width === 0) {
$data['width'] = 70;
}
if ($height === 0) {
$data['height'] = ($imageHeight > 70) ? 70 : $imageHeight;
}
} }
// Get last value. // Get last value.

View File

@ -392,3 +392,11 @@ div#box_online * {
#text_wizard { #text_wizard {
color: #555; 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'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.738'; $version = '7.0NG.738';
$build = '190829'; $build = '190911';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -624,6 +624,13 @@ if (empty($agents)) {
$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. // 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_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'; $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] = '<div class="left_'.$agent['id_agente'].'">';
$data[0] .= '<span>'; $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>'; $data[0] .= '</span>';
if ($agent['quiet']) { if ($agent['quiet']) {
@ -772,7 +779,7 @@ foreach ($agents as $agent) {
$data[0] .= '</div></div>'; $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] = ''; $data[10] = '';

View File

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

View File

@ -795,7 +795,7 @@ switch ($tab) {
echo "<div style='width: ".$table->width."; margin-top: 5px;'>"; echo "<div style='width: ".$table->width."; margin-top: 5px;'>";
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">'; echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_input_hidden('new_networkmap', 1); html_print_input_hidden('new_networkmap', 1);
html_print_submit_button(__('Create networkmap'), 'crt', false, 'class="sub next" style="float: right;"'); html_print_submit_button(__('Create network map'), 'crt', false, 'class="sub next" style="float: right;"');
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
@ -803,7 +803,7 @@ switch ($tab) {
echo "<div style='width: ".$table->width."; margin-top: 5px;'>"; echo "<div style='width: ".$table->width."; margin-top: 5px;'>";
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">'; echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_input_hidden('new_empty_networkmap', 1); html_print_input_hidden('new_empty_networkmap', 1);
html_print_submit_button(__('Create empty networkmap'), 'crt', false, 'class="sub next" style="float: right; margin-right:20px;"'); html_print_submit_button(__('Create empty network map'), 'crt', false, 'class="sub next" style="float: right; margin-right:20px;"');
echo '</form>'; echo '</form>';
echo '</div>'; echo '</div>';
} }

View File

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

View File

@ -17,7 +17,7 @@ error_reporting(1);
$MAX_MARQUEE_EVENTS = 10; $MAX_MARQUEE_EVENTS = 10;
$MARQUEE_INTERVAL = 90; $MARQUEE_INTERVAL = 90;
$MARQUEE_FONT_SIZE = '32px'; $MARQUEE_FONT_SIZE = '32px';
$MARQUEE_SPEED = 12; $MARQUEE_SPEED = 9;
$output = ''; $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>'; $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 { } else {
$agent_id = $agent['id_agente']; $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'] = "<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>"; $row['source'] .= "<strong>$agent_name</strong></a>";
} }

View File

@ -1,17 +1,31 @@
<?php <?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; global $config;
enterprise_include('operation/snmpconsole/snmp_view.php'); enterprise_include('operation/snmpconsole/snmp_view.php');
enterprise_include('include/functions_snmp.php'); enterprise_include('include/functions_snmp.php');
@ -31,7 +45,7 @@ if (!$agent_a && !$agent_w) {
exit; exit;
} }
// Read parameters // Read parameters.
$filter_severity = (int) get_parameter('filter_severity', -1); $filter_severity = (int) get_parameter('filter_severity', -1);
$filter_fired = (int) get_parameter('filter_fired', -1); $filter_fired = (int) get_parameter('filter_fired', -1);
$filter_status = (int) get_parameter('filter_status', 0); $filter_status = (int) get_parameter('filter_status', 0);
@ -61,7 +75,7 @@ foreach ($user_groups as $id => $name) {
$i++; $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>'; $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>'; $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']) { 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>'; $fullscreen['text'] = '<a target="_top" href="'.$url.'&pure=0&refresh='.$refr.'">'.html_print_image('images/normal_screen.png', true, ['title' => __('Normal screen')]).'</a>';
} else { } 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>'; $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'])) { if (isset($_POST['deletebt'])) {
$trap_ids = get_parameter_post('snmptrapid', []); $trap_ids = get_parameter_post('snmptrapid', []);
if (is_array($trap_ids) && check_acl($config['id_user'], 0, 'IW')) { 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'])) { if (isset($_POST['updatebt'])) {
$trap_ids = get_parameter_post('snmptrapid', []); $trap_ids = get_parameter_post('snmptrapid', []);
if (is_array($trap_ids) && check_acl($config['id_user'], 0, 'IW')) { 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'); $all_traps = db_get_all_rows_sql('SELECT DISTINCT source FROM ttrap');
if (empty($all_traps)) { if (empty($all_traps)) {
$all_traps = []; $all_traps = [];
} }
// Set filters // Set filters.
$agents = []; $agents = [];
$oids = []; $oids = [];
$severities = get_priorities(); $severities = get_priorities();
@ -206,7 +220,7 @@ foreach ($all_traps as $trap) {
$prea = array_keys($user_groups); $prea = array_keys($user_groups);
$ids = join(',', $prea); $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))'); $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']) { switch ($config['dbtype']) {
@ -244,6 +258,10 @@ switch ($config['dbtype']) {
} }
} }
break; break;
default:
// Default.
break;
} }
if (empty($address_by_user_groups)) { 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 ) OR source='' OR source NOT IN (SELECT direccion FROM tagente WHERE direccion IS NOT NULL)) %s
ORDER BY timestamp DESC"; ORDER BY timestamp DESC";
break; break;
default:
// Default.
break;
} }
switch ($config['dbtype']) { 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)) ) OR source='' OR source NOT IN (SELECT direccion FROM tagente WHERE direccion IS NOT NULL))
%s"; %s";
break; break;
default:
// Default.
break;
} }
// $whereSubquery = 'WHERE 1=1'; // $whereSubquery = 'WHERE 1=1';
@ -372,6 +398,10 @@ if ($free_search_string != '') {
text LIKE \'%'.$free_search_string.'%\' OR text LIKE \'%'.$free_search_string.'%\' OR
description LIKE \'%'.$free_search_string.'%\')'; description LIKE \'%'.$free_search_string.'%\')';
break; break;
default:
// Default.
break;
} }
} }
@ -422,7 +452,7 @@ if ($trap_type == 5) {
$whereSubquery .= ' AND type = '.$trap_type; $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') { if ($group_by && $config['dbtype'] != 'oracle') {
$where_without_group = $whereSubquery; $where_without_group = $whereSubquery;
$whereSubquery .= ' GROUP BY source,oid'; $whereSubquery .= ' GROUP BY source,oid';
@ -444,6 +474,10 @@ switch ($config['dbtype']) {
$sql = sprintf($sql, $whereSubquery); $sql = sprintf($sql, $whereSubquery);
$sql = oracle_recode_query($sql, $set); $sql = oracle_recode_query($sql, $set);
break; break;
default:
// Default.
break;
} }
$sql_all = sprintf($sql_all, $whereSubquery); $sql_all = sprintf($sql_all, $whereSubquery);
@ -458,7 +492,7 @@ $table->size = [];
$table->size[0] = '120px'; $table->size[0] = '120px';
$table->data = []; $table->data = [];
// Alert status select // Alert status select.
$table->data[1][0] = '<strong>'.__('Alert').'</strong>'; $table->data[1][0] = '<strong>'.__('Alert').'</strong>';
$table->data[1][1] = html_print_select( $table->data[1][1] = html_print_select(
$alerted, $alerted,
@ -470,7 +504,7 @@ $table->data[1][1] = html_print_select(
true true
); );
// Block size for pagination select // Block size for pagination select.
$table->data[2][0] = '<strong>'.__('Block size for pagination').'</strong>'; $table->data[2][0] = '<strong>'.__('Block size for pagination').'</strong>';
$paginations[25] = 25; $paginations[25] = 25;
$paginations[50] = 50; $paginations[50] = 50;
@ -487,7 +521,7 @@ $table->data[2][1] = html_print_select(
true true
); );
// Severity select // Severity select.
$table->data[1][2] = '<strong>'.__('Severity').'</strong>'; $table->data[1][2] = '<strong>'.__('Severity').'</strong>';
$table->data[1][3] = html_print_select( $table->data[1][3] = html_print_select(
$severities, $severities,
@ -499,7 +533,7 @@ $table->data[1][3] = html_print_select(
true true
); );
// Status // Status.
$table->data[3][0] = '<strong>'.__('Status').'</strong>'; $table->data[3][0] = '<strong>'.__('Status').'</strong>';
$status_array[-1] = __('All'); $status_array[-1] = __('All');
@ -515,7 +549,7 @@ $table->data[3][1] = html_print_select(
true 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( $table->data[2][3] = '<strong>'.__('Free search').'</strong>'.ui_print_help_tip(
__( __(
'Search by any alphanumeric field in the trap. '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][2] = '<strong>'.__('To (Time)').'</strong>';
$table->data[5][3] = html_print_input_text('time_to_trap', $time_to_trap, false, 15, 10, true); $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); $table->data[6][1] = '<strong>'.__('Trap type').'</strong>'.ui_print_help_tip(__('Search by trap type'), true);
$trap_types = [ $trap_types = [
-1 => __('None'), -1 => __('None'),
@ -565,14 +599,14 @@ $table->data[6][2] = html_print_select(
false 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') { if ($config['dbtype'] != 'oracle') {
$table->data[3][3] = '<strong>'.__('Group by Enterprise String/IP').'</strong>'; $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] = __('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); $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 .= html_print_table($table, true);
$filter .= '<div style="width: '.$table->width.'; text-align: right;">'; $filter .= '<div style="width: '.$table->width.'; text-align: right;">';
$filter .= html_print_submit_button(__('Update'), 'search', false, 'class="sub upd"', true); $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); $traps = db_get_all_rows_sql($sql);
$trapcount = (int) db_get_value_sql($sql_count); $trapcount = (int) db_get_value_sql($sql_count);
// No traps // No traps.
if (empty($traps)) { if (empty($traps)) {
// Header // Header.
ui_print_page_header( ui_print_page_header(
__('SNMP Console'), __('SNMP Console'),
'images/op_snmp.png', 'images/op_snmp.png',
@ -638,24 +672,24 @@ if (empty($traps)) {
echo '<div id="menu_tab">'; echo '<div id="menu_tab">';
echo '<ul class="mn">'; echo '<ul class="mn">';
// Normal view button // Normal view button.
echo '<li class="nomn">'; 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 '<a href="'.$urlPagination.'">';
echo html_print_image('images/normal_screen.png', true, ['title' => __('Exit fullscreen')]); echo html_print_image('images/normal_screen.png', true, ['title' => __('Exit fullscreen')]);
echo '</a>'; echo '</a>';
echo '</li>'; echo '</li>';
// Auto refresh control // Auto refresh control.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<div class="dashboard-refr" style="margin-top: 6px;">'; echo '<div class="dashboard-refr" style="margin-top: 6px;">';
echo '<div class="dashboard-countdown" style="display: inline;"></div>'; 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;">'; 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('pure', 1);
html_print_input_hidden('refresh', ($refr > 0 ? $refr : $default_refr)); html_print_input_hidden('refresh', ($refr > 0 ? $refr : $default_refr));
// Dashboard name // Dashboard name.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<div class="dashboard-title">'.__('SNMP Traps').'</div>'; echo '<div class="dashboard-title">'.__('SNMP Traps').'</div>';
echo '</li>'; echo '</li>';
@ -688,7 +722,7 @@ if (empty($traps)) {
ui_require_javascript_file('wz_jsgraphics'); ui_require_javascript_file('wz_jsgraphics');
ui_require_javascript_file('pandora_visual_console'); ui_require_javascript_file('pandora_visual_console');
} else { } else {
// Header // Header.
ui_print_page_header( ui_print_page_header(
__('SNMP Console'), __('SNMP Console'),
'images/op_snmp.png', 'images/op_snmp.png',
@ -710,18 +744,19 @@ unset($table);
print_snmp_tags_active_filters($filter_resume); print_snmp_tags_active_filters($filter_resume);
if (($config['dbtype'] == 'oracle') && ($traps !== false)) { 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']); 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); 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->cellpadding = 0;
$table->cellspacing = 0; $table->cellspacing = 0;
@ -795,7 +830,7 @@ $table->headstyle[9] = 'text-align: center';
$table->style[8] = 'background: #F3F3F3; color: #111 !important;'; $table->style[8] = 'background: #F3F3F3; color: #111 !important;';
// Skip offset records // Skip offset records.
$idx = 0; $idx = 0;
if ($traps !== false) { if ($traps !== false) {
foreach ($traps as $trap) { foreach ($traps as $trap) {
@ -809,7 +844,7 @@ if ($traps !== false) {
$severity = $trap['alerted'] == 1 ? $trap['priority'] : 1; $severity = $trap['alerted'] == 1 ? $trap['priority'] : 1;
} }
// Status // Status.
if ($trap['status'] == 0) { if ($trap['status'] == 0) {
$data[0] = html_print_image( $data[0] = html_print_image(
'images/pixel_red.png', '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); $table->cellclass[$idx][1] = get_priority_class($severity);
$agent = agents_get_agent_with_ip($trap['source']); $agent = agents_get_agent_with_ip($trap['source']);
if ($agent === false) { if ($agent === false) {
@ -851,7 +886,7 @@ if ($traps !== false) {
'</strong></a>'; '</strong></a>';
} }
// OID // OID.
$table->cellclass[$idx][2] = get_priority_class($severity); $table->cellclass[$idx][2] = get_priority_class($severity);
if (! empty($trap['text'])) { if (! empty($trap['text'])) {
$enterprise_string = $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>'; $data[2] = '<a href="javascript: toggleVisibleExtendedInfo('.$trap['id_trap'].');">'.$enterprise_string.'</a>';
// Count // Count.
if ($group_by) { if ($group_by) {
$sql = "SELECT * FROM ttrap WHERE 1=1 $sql = "SELECT * FROM ttrap WHERE 1=1
$where_without_group $where_without_group
@ -875,7 +910,7 @@ if ($traps !== false) {
$data[3] = '<strong>'.$count_group_traps.'</strong></a>'; $data[3] = '<strong>'.$count_group_traps.'</strong></a>';
} }
// Value // Value.
$table->cellclass[$idx][4] = get_priority_class($severity); $table->cellclass[$idx][4] = get_priority_class($severity);
if (empty($trap['value'])) { if (empty($trap['value'])) {
$data[4] = __('N/A'); $data[4] = __('N/A');
@ -883,7 +918,7 @@ if ($traps !== false) {
$data[4] = ui_print_truncate_text($trap['value'], GENERIC_SIZE_TEXT, false); $data[4] = ui_print_truncate_text($trap['value'], GENERIC_SIZE_TEXT, false);
} }
// User // User.
$table->cellclass[$idx][5] = get_priority_class($severity); $table->cellclass[$idx][5] = get_priority_class($severity);
if (!empty($trap['status'])) { 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>'; $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] = '--'; $data[5] = '--';
} }
// Timestamp // Timestamp.
$table->cellclass[$idx][6] = get_priority_class($severity); $table->cellclass[$idx][6] = get_priority_class($severity);
$data[6] = '<span title="'.$trap['timestamp'].'">'; $data[6] = '<span title="'.$trap['timestamp'].'">';
$data[6] .= ui_print_timestamp($trap['timestamp'], true); $data[6] .= ui_print_timestamp($trap['timestamp'], true);
$data[6] .= '</span>'; $data[6] .= '</span>';
// Use alert severity if fired // Use alert severity if fired.
if (!empty($trap['alerted'])) { if (!empty($trap['alerted'])) {
$data[7] = html_print_image('images/pixel_yellow.png', true, ['width' => '20', 'height' => '20', 'border' => '0', 'title' => __('Alert fired')]); $data[7] = html_print_image('images/pixel_yellow.png', true, ['width' => '20', 'height' => '20', 'border' => '0', 'title' => __('Alert fired')]);
} else { } else {
$data[7] = html_print_image('images/pixel_gray.png', true, ['width' => '20', 'height' => '20', 'border' => '0', 'title' => __('Alert not fired')]); $data[7] = html_print_image('images/pixel_gray.png', true, ['width' => '20', 'height' => '20', 'border' => '0', 'title' => __('Alert not fired')]);
} }
// Actions // Actions.
$data[8] = ''; $data[8] = '';
if (empty($trap['status']) && check_acl($config['id_user'], 0, 'IW')) { 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'] == '') { if ($trap['source'] == '') {
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']); $is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
if ($is_admin) { 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 { } else {
$agent_trap_group = db_get_value('id_grupo', 'tagente', 'nombre', $trap['source']); $agent_trap_group = db_get_value('id_grupo', 'tagente', 'nombre', $trap['source']);
if ((check_acl($config['id_user'], $agent_trap_group, 'IM'))) { 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); array_push($table->data, $data);
// Hiden file for description // Hiden file for description.
$string = '<table style="border:solid 1px #D3D3D3;" width="90%" class="toggle"> $string = '<table style="border:solid 1px #D3D3D3;" width="90%" class="toggle">
<tr> <tr>
<td align="left" valign="top" width="15%">'.'<b>'.__('Variable bindings:').'</b></td> <td align="left" valign="top" width="15%">'.'<b>'.__('Variable bindings:').'</b></td>
<td align="left" >'; <td align="left" >';
if ($group_by) { 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>'; $string .= '<a href='.$new_url.'>'.__('See more details').'</a>';
} else { } else {
// Print binding vars separately // Print binding vars separately.
$binding_vars = explode("\t", $trap['oid_custom']); $binding_vars = explode("\t", $trap['oid_custom']);
foreach ($binding_vars as $var) { foreach ($binding_vars as $var) {
$string .= $var.'<br/>'; $string .= $var.'<br/>';
@ -1007,7 +1043,7 @@ if ($traps !== false) {
break; 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) { if ($group_by) {
@ -1060,7 +1096,7 @@ if ($traps !== false) {
} }
} }
// No matching traps // No matching traps.
if ($idx == 0) { if ($idx == 0) {
echo '<div class="nf">'.__('No matching traps found').'</div>'; echo '<div class="nf">'.__('No matching traps found').'</div>';
} else { } else {

View File

@ -40,6 +40,9 @@ ob_start('ui_process_page_head');
// Enterprise main // Enterprise main
enterprise_include('index.php'); 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'; require_once 'include/functions_visual_map.php';
$hash = get_parameter('hash'); $hash = get_parameter('hash');
@ -96,31 +99,40 @@ if ($layout) {
echo '<div id="vc-container"></div>'; echo '<div id="vc-container"></div>';
} }
// Floating menu - Start // Floating menu - Start.
echo '<div id="vc-controls" style="z-index:300;">'; echo '<div id="vc-controls" style="z-index:300;">';
echo '<div id="menu_tab">'; 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 '<li class="nomn">';
echo '<a href="javascript: show_dialog_qrcode();">'; echo '<a href="javascript: show_dialog_qrcode();">';
echo '<img class="vc-qr" src="../../images/qrcode_icon_2.jpg"/>'; echo '<img class="vc-qr" src="../../images/qrcode_icon_2.jpg"/>';
echo '</a>'; echo '</a>';
echo '</li>'; echo '</li>';
// Countdown // Countdown.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<div class="vc-refr">'; echo '<div class="vc-refr">';
echo '<div class="vc-countdown"></div>';
echo '<div id="vc-refr-form">'; echo '<div id="vc-refr-form">';
echo __('Refresh').':'; 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 '</div>'; echo '</div>';
echo '</li>'; echo '</li>';
// Console name // Console name.
echo '<li class="nomn">'; echo '<li class="nomn">';
echo '<div class="vc-title">'.$layout_name.'</div>'; echo '<div class="vc-title">'.$layout_name.'</div>';
echo '</li>'; echo '</li>';
@ -129,15 +141,15 @@ echo '</ul>';
echo '</div>'; echo '</div>';
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 style="display: none;" id="qrcode_container" title="'.__('QR code of the page').'">';
echo '<div id="qrcode_container_image"></div>'; echo '<div id="qrcode_container_image"></div>';
echo '</div>'; echo '</div>';
ui_require_jquery_file('countdown'); ui_require_jquery_file('countdown', 'include/javascript/', true);
ui_require_javascript_file('wz_jsgraphics'); ui_require_javascript_file('wz_jsgraphics', 'include/javascript/', true);
ui_require_javascript_file('pandora_visual_console'); ui_require_javascript_file('pandora_visual_console', 'include/javascript/', true);
$ignored_params['refr'] = ''; $ignored_params['refr'] = '';
?> ?>

View File

@ -42,6 +42,9 @@ ob_start('ui_process_page_head');
// Enterprise main. // Enterprise main.
enterprise_include('index.php'); 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'; require_once 'include/functions_visual_map.php';
$hash = (string) get_parameter('hash'); $hash = (string) get_parameter('hash');
@ -134,7 +137,7 @@ if (!users_can_manage_group_all('AR')) {
} }
$ignored_params['refr'] = ''; $ignored_params['refr'] = '';
ui_require_javascript_file('pandora_visual_console'); ui_require_javascript_file('pandora_visual_console', 'include/javascript/', true);
include_javascript_d3(); include_javascript_d3();
visual_map_load_client_resources(); visual_map_load_client_resources();
@ -157,6 +160,10 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
var props = <?php echo (string) $visualConsole; ?>; var props = <?php echo (string) $visualConsole; ?>;
var items = <?php echo '['.implode($visualConsoleItems, ',').']'; ?>; var items = <?php echo '['.implode($visualConsoleItems, ',').']'; ?>;
var baseUrl = "<?php echo ui_get_full_url('/', false, false, false); ?>"; 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) { var handleUpdate = function (prevProps, newProps) {
if (!newProps) return; if (!newProps) return;

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.738-190829 Version: 7.0NG.738-190911
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.738 PS190829"; my $version = "7.0NG.738 PS190911";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -136,7 +136,7 @@ sub pandora_purgedb ($$) {
pandora_delete_old_export_data ($dbh, $ulimit_timestamp); pandora_delete_old_export_data ($dbh, $ulimit_timestamp);
# Delete sessions data # Delete sessions data
pandora_delete_old_session_data ($dbh, $ulimit_timestamp); pandora_delete_old_session_data (\%conf, $dbh, $ulimit_timestamp);
# Delete old inventory data # 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_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->{'_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->{'_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->{'_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'"); $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. # Delete old session data.
############################################################################## ##############################################################################
sub pandora_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"); 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') { while(db_delete_limit ($dbh, 'tsessions_php', 'last_active < ?', $SMALL_OPERATION_STEP, $ulimit_timestamp) ne '0E0') {
usleep (10000); 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; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.738 PS190829"; my $version = "7.0NG.738 PS190911";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);