Merge branch 'develop' into 'pandora_enterprise#2333-intracom-snmp-trap-buffer-subsystem'

# Conflicts:
#   pandora_server/lib/PandoraFMS/Config.pm
This commit is contained in:
nramon 2018-08-08 11:27:56 +02:00
commit c6dc5f9ee2
97 changed files with 1679 additions and 1236 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, AIX version # Version 7.0NG.725, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, FreeBSD Version # Version 7.0NG.725, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, HP-UX Version # Version 7.0NG.725, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, GNU/Linux # Version 7.0NG.725, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, GNU/Linux # Version 7.0NG.725, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, Solaris Version # Version 7.0NG.725, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.724 # Version 7.0NG.725
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.724, AIX version # Version 7.0NG.725, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.724 # Version 7.0NG.725
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.724, HPUX Version # Version 7.0NG.725, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724 # Version 7.0NG.725
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas # (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724 # Version 7.0NG.725
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas # (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724 # Version 7.0NG.725
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.724, Solaris version # Version 7.0NG.725, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, AIX version # Version 7.0NG.725, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.724-180723 Version: 7.0NG.725-180808
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.724-180723" pandora_version="7.0NG.725-180808"
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

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, GNU/Linux # Version 7.0NG.725, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, FreeBSD Version # Version 7.0NG.725, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, HP-UX Version # Version 7.0NG.725, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, GNU/Linux # Version 7.0NG.725, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, GNU/Linux # Version 7.0NG.725, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, NetBSD Version # Version 7.0NG.725, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.724, Solaris Version # Version 7.0NG.725, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.724'; use constant AGENT_VERSION => '7.0NG.725';
use constant AGENT_BUILD => '180723'; use constant AGENT_BUILD => '180808';
# 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

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.724 %define version 7.0NG.725
%define release 180723 %define release 180808
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.724 %define version 7.0NG.725
%define release 180723 %define release 180808
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.724" PI_VERSION="7.0NG.725"
PI_BUILD="180723" PI_BUILD="180808"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -325,7 +325,9 @@ sub print_log ($) {
$output .= "<source><![CDATA[" . $Module_name . "]]></source>\n"; $output .= "<source><![CDATA[" . $Module_name . "]]></source>\n";
$output .= "<data><![CDATA["; $output .= "<data><![CDATA[";
foreach my $line (@kdata) { foreach my $line (@kdata) {
$output .= $data->{$line}; my $processed_line = $line;
$processed_line =~ s/\]\]/]]]]><![CDATA[/g;
$output .= $processed_line;
} }
$output .= "]]></data>"; $output .= "]]></data>";
$output .= "</log_module>\n"; $output .= "</log_module>\n";
@ -343,7 +345,9 @@ sub print_log ($) {
foreach my $line (@kdata) { foreach my $line (@kdata) {
$output .= "<data><value><![CDATA["; $output .= "<data><value><![CDATA[";
foreach my $content (@{$data->{$line}}) { foreach my $content (@{$data->{$line}}) {
$output .= $content; my $processed_line = $content;
$processed_line =~ s/\]\]/]]]]><![CDATA[/g;
$output .= $processed_line;
} }
$output .= "]]></value></data>\n"; $output .= "]]></value></data>\n";
} }

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas # (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.724 # Version 7.0NG.725
# This program is Free Software, you can redistribute it and/or modify it # This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.724} {Pandora FMS Windows Agent v7.0NG.725}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{180723} {180808}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.724(Build 180723)") #define PANDORA_VERSION ("7.0NG.725(Build 180808)")
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.724(Build 180723))" VALUE "ProductVersion", "(7.0NG.725(Build 180808))"
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.724-180723 Version: 7.0NG.725-180808
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.724-180723" pandora_version="7.0NG.725-180808"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -125,7 +125,7 @@ function pandora_realtime_graphs () {
if ($graph != 'snmp_module') { if ($graph != 'snmp_module') {
$data['incremental'] = __('Incremental') . '&nbsp;&nbsp;' . html_print_checkbox ('incremental', 1, 0, true); $data['incremental'] = __('Incremental') . '&nbsp;&nbsp;' . html_print_checkbox ('incremental', 1, 0, true);
} }
$data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'clearGraph()', 'class="sub delete" style="margin-top:0px;"', true); $data['reset'] = html_print_button(__('Clear graph'), 'reset', false, 'javascript:realtimeGraphs.clearGraph();', 'class="sub delete" style="margin-top:0px;"', true);
$table->data[] = $data; $table->data[] = $data;
if ($graph == 'snmp_interface' || $graph == 'snmp_module') { if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
@ -154,7 +154,7 @@ function pandora_realtime_graphs () {
$table->colspan[2]['snmp_oid'] = 2; $table->colspan[2]['snmp_oid'] = 2;
$data['snmp_ver'] = __('Version') . '&nbsp;&nbsp;' . html_print_select ($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true); $data['snmp_ver'] = __('Version') . '&nbsp;&nbsp;' . html_print_select ($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true);
$data['snmp_ver'] .= '&nbsp;&nbsp;' . html_print_button (__('SNMP walk'), 'snmp_walk', false, 'snmpBrowserWindow()', 'class="sub next"', true); $data['snmp_ver'] .= '&nbsp;&nbsp;' . html_print_button (__('SNMP walk'), 'snmp_walk', false, 'javascript:realtimeGraphs.snmpBrowserWindow();', 'class="sub next"', true);
$table->colspan[2]['snmp_ver'] = 2; $table->colspan[2]['snmp_ver'] = 2;
$table->data[] = $data; $table->data[] = $data;
@ -176,7 +176,7 @@ function pandora_realtime_graphs () {
echo '</form>'; echo '</form>';
// Define a custom action to save the OID selected in the SNMP browser to the form // Define a custom action to save the OID selected in the SNMP browser to the form
html_print_input_hidden ('custom_action', urlencode (base64_encode('&nbsp;<a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false); html_print_input_hidden ('custom_action', urlencode (base64_encode('&nbsp;<a href="javascript:realtimeGraphs.setOID();"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
html_print_input_hidden ('incremental_base', '0'); html_print_input_hidden ('incremental_base', '0');
echo '<script type="text/javascript" src="'.ui_get_full_url("extensions/realtime_graphs/realtime_graphs.js").'"></script>'; echo '<script type="text/javascript" src="'.ui_get_full_url("extensions/realtime_graphs/realtime_graphs.js").'"></script>';

View File

@ -1,6 +1,13 @@
var max_data_plot = 100; (function () {
var numberOfPoints = 100;
var refresh = parseInt($('#refresh').val());
var incremental = $('#checkbox-incremental').is(':checked') || $('#hidden-incremental').val() == 1;
var lastIncVal = null;
var intervalRef = null;
var currentXHR = null;
var options = { var plot;
var plotOptions = {
legend: { container: $("#chartLegend") }, legend: { container: $("#chartLegend") },
xaxis: { xaxis: {
tickFormatter: function (timestamp, axis) { tickFormatter: function (timestamp, axis) {
@ -28,96 +35,100 @@ var options = {
} }
}, },
colors: ['#6db431'] colors: ['#6db431']
};
function updatePlot (data) {
plot = $.plot($('.graph'), data, plotOptions);
} }
var data = []; function requestData () {
var id = $('.graph').attr('id');
var plot = $.plot("#" + id, data, options);
var refresh = parseInt($('#refresh').val());
var incremental = $('#checkbox-incremental').is(':checked') || $('#hidden-incremental').val() == 1;
var incremental_base = 0;
var last_inc = 0;
var to;
refresh_graph();
function refresh_graph () {
var refresh = parseInt($('#refresh').val());
var postvars = new Array();
var postvars = {};
postvars['graph'] = $('#graph :selected').val();
postvars['graph_title'] = $('#graph :selected').html();
postvars['snmp_community'] = $('#text-snmp_community').val();
postvars['snmp_oid'] = $('#text-snmp_oid').val();
postvars['snmp_ver'] = $('#snmp_version :selected').val();
postvars['snmp_address'] = $('#text-ip_target').val();
postvars['refresh'] = refresh;
var rel_path = $("#hidden-rel_path").val(); var rel_path = $("#hidden-rel_path").val();
$.ajax({ currentXHR = $.ajax({
url: rel_path + "extensions/realtime_graphs/ajax.php", url: rel_path + "extensions/realtime_graphs/ajax.php",
type: "POST", type: "POST",
dataType: "json", dataType: "json",
data: postvars, data: {
graph: $('#graph :selected').val(),
graph_title: $('#graph :selected').html(),
snmp_community: $('#text-snmp_community').val(),
snmp_oid: $('#text-snmp_oid').val(),
snmp_ver: $('#snmp_version :selected').val(),
snmp_address: $('#text-ip_target').val(),
refresh: refresh
},
success: function (serie) { success: function (serie) {
var timestamp = serie.data[0][0]; var timestamp = serie.data[0][0];
data = plot.getData(); var data = plot.getData();
if (data.length == 0) {
for(i = 0; i < max_data_plot; i ++) { if (data.length === 0) {
step = i * (refresh/1000); for (i = 0; i < numberOfPoints; i++) {
var step = i * (refresh / 1000);
serie.data.unshift([timestamp - step, 0]); serie.data.unshift([timestamp - step, 0]);
} }
serie = [serie]; serie = [serie];
plot = $.plot("#" + id, serie, options); updatePlot(serie);
return; return;
} }
data[0].label = serie.label; data[0].label = serie.label;
if (data[0].data.length >= max_data_plot) { if (data[0].data.length >= numberOfPoints) {
data[0].data.shift(); data[0].data.shift();
} }
if (incremental) { if (incremental) {
var last_item = parseInt(data[0].data.length)-1; var currentVal = serie.data[0][1];
var last_value = data[0].data[last_item][1]; // Try to avoid the first value, cause we need at least two values to get the increment
serie.data[0][1] = lastIncVal == null ? 0 : currentVal - lastIncVal;
var current_value = serie.data[0][1];
serie.data[0][1] = current_value - last_inc;
last_inc = current_value;
// Incremental is always positive // Incremental is always positive
if (serie.data[0][1] < 0) { if (serie.data[0][1] < 0) serie.data[0][1] = 0;
serie.data[0][1] = 0; // Store the current value to use it into the next request
} lastIncVal = currentVal;
} }
data[0].data.push(serie.data[0]); data[0].data.push(serie.data[0]);
$.plot("#" + id, data, options); updatePlot(data);
} }
}); });
to = window.setTimeout(refresh_graph, refresh);
} }
$('#graph').change(function() { function startDataPooling () {
$('form#realgraph').submit(); intervalRef = window.setInterval(requestData, refresh);
}); }
$('#refresh').change(function() { function resetDataPooling () {
var refresh = parseInt($('#refresh').val()); if (currentXHR !== null) currentXHR.abort();
// Stop and start the interval
window.clearInterval(intervalRef);
startDataPooling();
}
// Stop and start the Timeout function clearGraph () {
clearTimeout(to); var data = plot.getData();
to = window.setTimeout(refresh_graph, refresh); if (data.length === 0) return;
});
for (i = 0; i < data[0].data.length; i ++) {
data[0].data[i][1] = 0;
}
if (incremental) lastIncVal = null;
updatePlot(data);
resetDataPooling();
}
// Set the form OID to the value selected in the SNMP browser
function setOID () {
if ($('#snmp_browser_version').val() == '3') {
$('#text-snmp_oid').val($('#table1-0-1').text());
} else {
$('#text-snmp_oid').val($('#snmp_selected_oid').text());
}
// Close the SNMP browser
$('.ui-dialog-titlebar-close').trigger('click');
}
// Show the SNMP browser window // Show the SNMP browser window
function snmpBrowserWindow () { function snmpBrowserWindow () {
@ -147,46 +158,29 @@ function snmpBrowserWindow () {
}); });
} }
// Set the form OID to the value selected in the SNMP browser $('#graph').change(function() {
function setOID () { $('form#realgraph').submit();
});
if($('#snmp_browser_version').val() == '3'){ $('#refresh').change(function () {
$('#text-snmp_oid').val($('#table1-0-1').text()); refresh = parseInt($('#refresh').val());
} else { resetDataPooling();
$('#text-snmp_oid').val($('#snmp_selected_oid').text()); });
}
// Close the SNMP browser
$('.ui-dialog-titlebar-close').trigger('click');
}
$('#checkbox-incremental').change(function() { $('#checkbox-incremental').change(function() {
incremental = $('#checkbox-incremental').is(':checked'); incremental = $('#checkbox-incremental').is(':checked');
clearGraph(); clearGraph();
}); });
function firstNotZero(data) { updatePlot([]);
var notZero = 0; requestData();
for(i = 0; i < data[0].data.length; i ++) { startDataPooling();
if (data[0].data[i][1] != 0) {
return data[0].data[i][1]; // Expose this functions
} window.realtimeGraphs = {
} clearGraph: clearGraph,
setOID: setOID,
snmpBrowserWindow: snmpBrowserWindow
} }
function setOnIncremental() { })();
}
function clearGraph() {
data = plot.getData();
if (data.length == 0) {
return;
}
for(i = 0; i < data[0].data.length; i ++) {
data[0].data[i][1] = 0;
}
$.plot("#" + id, data, options);
}

View File

@ -15,7 +15,57 @@ ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL DEFAULT '0';
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT '0'; ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
DROP INDEX id_policy ON `tpolicy_agents`; DROP INDEX id_policy ON `tpolicy_agents`;
ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0'; ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0';
ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`); ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`);
ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL;
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL;
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
CREATE TABLE `tautoconfig` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`description` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tautoconfig_rules` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_autoconfig` int(10) unsigned NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`operator` enum('AND','OR') DEFAULT 'OR',
`type` enum('alias','ip-range','group','os','custom-field','script','server-name') DEFAULT 'alias',
`value` text,
`custom` text,
PRIMARY KEY (`id`),
KEY `id_autoconfig` (`id_autoconfig`),
CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `tautoconfig_actions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_autoconfig` int(10) unsigned NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`action_type` enum('set-group', 'set-secondary-group', 'apply-policy', 'launch-script', 'launch-event', 'launch-alert-action', 'raw-config') DEFAULT 'launch-event',
`value` text,
`custom` text,
PRIMARY KEY (`id`),
KEY `id_autoconfig` (`id_autoconfig`),
CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT; COMMIT;

View File

@ -0,0 +1,56 @@
START TRANSACTION;
-- ---------------------------------------------------------------------
-- Table `tlayout_template`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
`background_color` varchar(50) NOT NULL default '#FFF',
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tlayout_template_data`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_layout_template` INTEGER UNSIGNED NOT NULL,
`pos_x` INTEGER UNSIGNED NOT NULL default 0,
`pos_y` INTEGER UNSIGNED NOT NULL default 0,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
`label` TEXT,
`image` varchar(200) DEFAULT "",
`type` tinyint(1) UNSIGNED NOT NULL default 0,
`period` INTEGER UNSIGNED NOT NULL default 3600,
`module_name` text NOT NULL,
`agent_name` varchar(600) BINARY NOT NULL default '',
`id_layout_linked` INTEGER unsigned NOT NULL default '0',
`parent_item` INTEGER UNSIGNED NOT NULL default 0,
`enable_link` tinyint(1) UNSIGNED NOT NULL default 1,
`id_metaconsole` int(10) NOT NULL default 0,
`id_group` INTEGER UNSIGNED NOT NULL default 0,
`id_custom_graph` INTEGER UNSIGNED NOT NULL default 0,
`border_width` INTEGER UNSIGNED NOT NULL default 0,
`type_graph` varchar(50) NOT NULL default 'area',
`label_position` varchar(50) NOT NULL default 'down',
`border_color` varchar(200) DEFAULT "",
`fill_color` varchar(200) DEFAULT "",
`show_statistics` tinyint(2) NOT NULL default '0',
`id_layout_linked_weight` int(10) NOT NULL default '0',
`element_group` int(10) NOT NULL default '0',
`show_on_top` tinyint(1) NOT NULL default '0',
`clock_animation` varchar(60) NOT NULL default "analogic_1",
`time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
COMMIT;

View File

@ -1175,13 +1175,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 18); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 19);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '724'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '726');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tconfig_os` -- Table `tconfig_os`
@ -1669,3 +1669,98 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
ALTER TABLE tagente ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0'; ALTER TABLE tagente ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `update_secondary_groups` tinyint(1) NOT NULL default '0';
ALTER TABLE tusuario_perfil ADD COLUMN `is_secondary` tinyint(1) NOT NULL default '0'; ALTER TABLE tusuario_perfil ADD COLUMN `is_secondary` tinyint(1) NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tautoconfig`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tautoconfig` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`description` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tautoconfig_rules`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tautoconfig_rules` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_autoconfig` int(10) unsigned NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`operator` enum('AND','OR') DEFAULT 'OR',
`type` enum('alias','ip-range','group','os','custom-field','script','server-name') DEFAULT 'alias',
`value` text,
`custom` text,
PRIMARY KEY (`id`),
KEY `id_autoconfig` (`id_autoconfig`),
CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tautoconfig_actions`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_autoconfig` int(10) unsigned NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`action_type` enum('set-group', 'set-secondary-group', 'apply-policy', 'launch-script', 'launch-event', 'launch-alert-action', 'raw-config') DEFAULT 'launch-event',
`value` text,
`custom` text,
PRIMARY KEY (`id`),
KEY `id_autoconfig` (`id_autoconfig`),
CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tlayout_template`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
`background_color` varchar(50) NOT NULL default '#FFF',
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tlayout_template_data`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_layout_template` INTEGER UNSIGNED NOT NULL,
`pos_x` INTEGER UNSIGNED NOT NULL default 0,
`pos_y` INTEGER UNSIGNED NOT NULL default 0,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
`label` TEXT,
`image` varchar(200) DEFAULT "",
`type` tinyint(1) UNSIGNED NOT NULL default 0,
`period` INTEGER UNSIGNED NOT NULL default 3600,
`module_name` text NOT NULL,
`agent_name` varchar(600) BINARY NOT NULL default '',
`id_layout_linked` INTEGER unsigned NOT NULL default '0',
`parent_item` INTEGER UNSIGNED NOT NULL default 0,
`enable_link` tinyint(1) UNSIGNED NOT NULL default 1,
`id_metaconsole` int(10) NOT NULL default 0,
`id_group` INTEGER UNSIGNED NOT NULL default 0,
`id_custom_graph` INTEGER UNSIGNED NOT NULL default 0,
`border_width` INTEGER UNSIGNED NOT NULL default 0,
`type_graph` varchar(50) NOT NULL default 'area',
`label_position` varchar(50) NOT NULL default 'down',
`border_color` varchar(200) DEFAULT "",
`fill_color` varchar(200) DEFAULT "",
`show_statistics` tinyint(2) NOT NULL default '0',
`id_layout_linked_weight` int(10) NOT NULL default '0',
`element_group` int(10) NOT NULL default '0',
`show_on_top` tinyint(1) NOT NULL default '0',
`clock_animation` varchar(60) NOT NULL default "analogic_1",
`time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -370,12 +370,8 @@ foreach ($actions as $action) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'. $data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.
$action['name'].'</a>'; $action['name'].'</a>';
$data[1] = ui_print_group_icon ($action["id_group"], true) .'&nbsp;'; $data[1] = ui_print_group_icon ($action["id_group"], true) .'&nbsp;';
$hack_id_group_all = $action["id_group"];
if ($hack_id_group_all == 0) { if (check_acl($config['id_user'], $action["id_group"], "LM")) {
//To avoid check all groups instead the pseudo-group all
$hack_id_group_all = -1;
}
if (check_acl($config['id_user'], $hack_id_group_all, "LM")) {
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'" $data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">' . onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">' .
html_print_image("images/copy.png", true) . '</a>'; html_print_image("images/copy.png", true) . '</a>';

View File

@ -65,13 +65,13 @@ if ($fields_selected[0]!='') {
foreach ($fields_selected as $field_selected) { foreach ($fields_selected as $field_selected) {
switch ($field_selected) { switch ($field_selected) {
case 'id_evento': case 'id_evento':
$result = __('Event id'); $result = __('Event Id');
break; break;
case 'evento': case 'evento':
$result = __('Event name'); $result = __('Event Name');
break; break;
case 'id_agente': case 'id_agente':
$result = __('Agent name'); $result = __('Agent Name');
break; break;
case 'id_usuario': case 'id_usuario':
$result = __('User'); $result = __('User');
@ -86,10 +86,10 @@ if ($fields_selected[0]!='') {
$result = __('Timestamp'); $result = __('Timestamp');
break; break;
case 'event_type': case 'event_type':
$result = __('Event type'); $result = __('Event Type');
break; break;
case 'id_agentmodule': case 'id_agentmodule':
$result = __('Agent module'); $result = __('Module Name');
break; break;
case 'id_alert_am': case 'id_alert_am':
$result = __('Alert'); $result = __('Alert');
@ -107,7 +107,7 @@ if ($fields_selected[0]!='') {
$result = __('Source'); $result = __('Source');
break; break;
case 'id_extra': case 'id_extra':
$result = __('Extra id'); $result = __('Extra Id');
break; break;
case 'owner_user': case 'owner_user':
$result = __('Owner'); $result = __('Owner');
@ -119,8 +119,15 @@ if ($fields_selected[0]!='') {
$result = __('Instructions'); $result = __('Instructions');
break; break;
case 'server_name': case 'server_name':
$result = __('Server name'); $result = __('Server Name');
break; break;
case 'data':
$result = __('Data');
break;
case 'module_status':
$result = __('Module Status');
break;
} }
$result_selected[$field_selected] = $result; $result_selected[$field_selected] = $result;
} }
@ -149,25 +156,27 @@ $table->data = array();
$fields_available = array(); $fields_available = array();
$fields_available['id_evento'] = __('Event id'); $fields_available['id_evento'] = __('Event Id');
$fields_available['evento'] = __('Event name'); $fields_available['evento'] = __('Event Name');
$fields_available['id_agente'] = __('Agent name'); $fields_available['id_agente'] = __('Agent Name');
$fields_available['id_usuario'] = __('User'); $fields_available['id_usuario'] = __('User');
$fields_available['id_grupo'] = __('Group'); $fields_available['id_grupo'] = __('Group');
$fields_available['estado'] = __('Status'); $fields_available['estado'] = __('Status');
$fields_available['timestamp'] = __('Timestamp'); $fields_available['timestamp'] = __('Timestamp');
$fields_available['event_type'] = __('Event type'); $fields_available['event_type'] = __('Event Type');
$fields_available['id_agentmodule'] = __('Agent module'); $fields_available['id_agentmodule'] = __('Module Name');
$fields_available['id_alert_am'] = __('Alert'); $fields_available['id_alert_am'] = __('Alert');
$fields_available['criticity'] = __('Severity'); $fields_available['criticity'] = __('Severity');
$fields_available['user_comment'] = __('Comment'); $fields_available['user_comment'] = __('Comment');
$fields_available['tags'] = __('Tags'); $fields_available['tags'] = __('Tags');
$fields_available['source'] = __('Source'); $fields_available['source'] = __('Source');
$fields_available['id_extra'] = __('Extra id'); $fields_available['id_extra'] = __('Extra Id');
$fields_available['owner_user'] = __('Owner'); $fields_available['owner_user'] = __('Owner');
$fields_available['ack_utimestamp'] = __('ACK Timestamp'); $fields_available['ack_utimestamp'] = __('ACK Timestamp');
$fields_available['instructions'] = __('Instructions'); $fields_available['instructions'] = __('Instructions');
$fields_available['server_name'] = __('Server name'); $fields_available['server_name'] = __('Server Name');
$fields_available['data'] = __('Data');
$fields_available['module_status'] = __('Module Status');
//remove fields already selected //remove fields already selected
foreach ($fields_available as $key=>$available) { foreach ($fields_available as $key=>$available) {

View File

@ -650,25 +650,25 @@ $table->data['edit16'][1] = html_print_input_text ('max_retries', '', '', 5, 10,
__('Number of retries that the module will attempt to run.'), true); __('Number of retries that the module will attempt to run.'), true);
$table->data['edit22'][0] = __('Web checks').ui_print_help_icon ("web_checks", true);; $table->data['edit22'][0] = __('Web checks').ui_print_help_icon ("web_checks", true);;
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter" cols="65" rows="15"></textarea>'; $table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter_text" cols="65" rows="15"></textarea>';
$table->data['edit16'][2] = __('Port'); $table->data['edit16'][2] = __('Port');
$table->data['edit16'][3] = html_print_input_text ('tcp_port', '', '', 5, 20, true); $table->data['edit16'][3] = html_print_input_text ('tcp_port', '', '', 5, 20, true);
$table->data['edit17'][0] = __('TCP send') . ' ' . ui_print_help_icon ("tcp_send", true); $table->data['edit17'][0] = __('TCP send') . ' ' . ui_print_help_icon ("tcp_send", true);
$table->data['edit17'][1] = html_print_textarea ('tcp_send', 2, 65, '', '', true); $table->data['edit17'][1] = html_print_textarea ('tcp_send2', 2, 65, '', '', true);
$table->data['edit17'][2] = __('TCP receive'); $table->data['edit17'][2] = __('TCP receive');
$table->data['edit17'][3] = html_print_textarea ('tcp_rcv', 2, 65, '', '', true); $table->data['edit17'][3] = html_print_textarea ('tcp_rcv', 2, 65, '', '', true);
$table->data['edit18'][0] = __('WMI query') . ui_print_help_icon ('wmiquery', true); $table->data['edit18'][0] = __('WMI query') . ui_print_help_icon ('wmiquery', true);
$table->data['edit18'][1] = html_print_input_text ('snmp_oid', '', '', 35, 255, true); $table->data['edit18'][1] = html_print_input_text ('wmi_query', '', '', 35, 255, true);
$table->data['edit18'][2] = __('Key string'); $table->data['edit18'][2] = __('Key string');
$table->data['edit18'][3] = html_print_input_text ('snmp_community', '', '', 20, 60, true); $table->data['edit18'][3] = html_print_input_text ('key_string', '', '', 20, 60, true);
$table->data['edit19'][0] = __('Field number') . ui_print_help_icon ('wmifield', true); $table->data['edit19'][0] = __('Field number') . ui_print_help_icon ('wmifield', true);
$table->data['edit19'][1] = html_print_input_text ('tcp_port', '', '', 5, 15, true); $table->data['edit19'][1] = html_print_input_text ('field_number', '', '', 5, 15, true);
$table->data['edit20'][0] = __('Plugin') . ui_print_help_icon ('plugin_macros', true); $table->data['edit20'][0] = __('Plugin') . ui_print_help_icon ('plugin_macros', true);
$table->data['edit20'][1] = html_print_select_from_sql ('SELECT id, name FROM tplugin ORDER BY name', $table->data['edit20'][1] = html_print_select_from_sql ('SELECT id, name FROM tplugin ORDER BY name',
@ -1381,7 +1381,8 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
'id_category', 'disabled_types_event', 'ip_target', "custom_ip_target", 'id_category', 'disabled_types_event', 'ip_target', "custom_ip_target",
'descripcion', 'min_ff_event_normal', 'min_ff_event_warning', 'descripcion', 'min_ff_event_normal', 'min_ff_event_warning',
'min_ff_event_critical', 'each_ff', 'module_ff_interval', 'min_ff_event_critical', 'each_ff', 'module_ff_interval',
'ff_timeout', 'max_timeout','tcp_port','max_retries','tcp_rcv','id_plugin'); 'ff_timeout', 'max_timeout','tcp_port','max_retries','tcp_rcv','id_plugin',
'wmi_query','key_string','field_number','tcp_send2','plugin_parameter_text');
$values = array (); $values = array ();
foreach ($fields as $field) { foreach ($fields as $field) {
@ -1433,19 +1434,13 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
else{ else{
$values['macros'] .= '}'; $values['macros'] .= '}';
} }
} }
else{ else{
$values['macros'] .= '}'; $values['macros'] .= '}';
} }
} }
break; break;
case 'module_interval': case 'module_interval':
if ($value != 0) { if ($value != 0) {
$values[$field] = $value; $values[$field] = $value;
@ -1470,6 +1465,32 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
} }
} }
break; break;
case 'wmi_query':
if ($value != '') {
$values['snmp_oid'] = $value;
}
break;
case 'key_string':
if ($value != '') {
$values['snmp_community'] = $value;
}
break;
case 'field_number':
if ($value != '') {
$values['tcp_port'] = $value;
}
break;
case 'tcp_send2':
if ($value != '') {
$values['tcp_send'] = $value;
}
break;
case 'plugin_parameter_text':
if ($value != '') {
$values['plugin_parameter'] = $value;
}
break;
default: default:
if ($value != '') { if ($value != '') {
$values[$field] = $value; $values[$field] = $value;

View File

@ -101,12 +101,12 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$sub["godmode/modules/manage_network_templates"]["text"] = __('Module templates'); $sub["godmode/modules/manage_network_templates"]["text"] = __('Module templates');
$sub["godmode/modules/manage_network_templates"]["id"] = 'Module templates'; $sub["godmode/modules/manage_network_templates"]["id"] = 'Module templates';
enterprise_hook ('inventory_submenu'); enterprise_hook ('inventory_submenu');
enterprise_hook ('autoconfiguration_menu');
} }
if (check_acl ($config['id_user'], 0, "AW")) { if (check_acl ($config['id_user'], 0, "AW")) {
enterprise_hook ('policies_menu'); enterprise_hook ('policies_menu');
enterprise_hook('agents_submenu'); enterprise_hook('agents_submenu');
} }
if (check_acl ($config['id_user'], 0, "AW")) { if (check_acl ($config['id_user'], 0, "AW")) {
$sub["gmassive"]["text"] = __('Bulk operations'); $sub["gmassive"]["text"] = __('Bulk operations');
$sub["gmassive"]["id"] = 'Bulk operations'; $sub["gmassive"]["id"] = 'Bulk operations';

View File

@ -22,6 +22,9 @@ $vconsoles_read = check_acl ($config['id_user'], 0, "VR");
$vconsoles_write = check_acl ($config['id_user'], 0, "VW"); $vconsoles_write = check_acl ($config['id_user'], 0, "VW");
$vconsoles_manage = check_acl ($config['id_user'], 0, "VM"); $vconsoles_manage = check_acl ($config['id_user'], 0, "VM");
$is_enterprise = enterprise_include_once('include/functions_policies.php');
$is_metaconsole = is_metaconsole();
if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) { if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
"Trying to access map builder"); "Trying to access map builder");
@ -29,19 +32,64 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
exit; exit;
} }
if(!$is_metaconsole){
$url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder';
$url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite';
$url_visual_console_template = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template';
$url_visual_console_template_wizard = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template_wizard';
}
else{
$url_visual_console = 'index.php?sec=screen&sec2=screens/screens&action=visualmap';
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
}
$pure = (int)get_parameter('pure', 0); $pure = (int)get_parameter('pure', 0);
$hack_metaconsole = ''; $hack_metaconsole = '';
if (defined('METACONSOLE')) if (defined('METACONSOLE'))
$hack_metaconsole = '../../'; $hack_metaconsole = '../../';
$buttons['visual_console_favorite'] = array('active' => false, $buttons['visual_console'] = array(
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/visual_console_favorite">' . 'active' => true,
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>'); 'text' => '<a href="'.$url_visual_console.'">' .
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console List'))) .'</a>'
);
if (!defined('METACONSOLE')) { $buttons['visual_console_favorite'] = array(
'active' => false,
'text' => '<a href="'.$url_visual_console_favorite.'">' .
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>'
);
if($is_enterprise){
$buttons['visual_console_template'] = array(
'active' => false,
'text' => '<a href="'.$url_visual_console_template.'">' .
html_print_image ("images/templates.png", true, array ("title" => __('Visual Console Template'))) .'</a>'
);
$buttons['visual_console_template_wizard'] = array(
'active' => false,
'text' => '<a href="'.$url_visual_console_template_wizard.'">' .
html_print_image ("images/wand.png", true, array ("title" => __('Visual Console Template Wizard'))) .'</a>'
);
}
if (!$is_metaconsole) {
ui_print_page_header( ui_print_page_header(
__('Reporting') .' &raquo; ' . __('Visual Console'), __('Reporting') .' &raquo; ' . __('Visual Console'),
"images/op_reporting.png", false, "map_builder", false, $buttons); "images/op_reporting.png",
false,
"map_builder",
false,
$buttons
);
}
else{
ui_meta_print_header(
__('Visual console') . " &raquo; " . $visualConsoleName, "",
$buttons);
} }
$id_layout = (int) get_parameter ('id_layout'); $id_layout = (int) get_parameter ('id_layout');

View File

@ -21,6 +21,9 @@ $vconsoles_read = check_acl ($config['id_user'], 0, "VR");
$vconsoles_write = check_acl ($config['id_user'], 0, "VW"); $vconsoles_write = check_acl ($config['id_user'], 0, "VW");
$vconsoles_manage = check_acl ($config['id_user'], 0, "VM"); $vconsoles_manage = check_acl ($config['id_user'], 0, "VM");
$is_enterprise = enterprise_include_once('include/functions_policies.php');
$is_metaconsole = is_metaconsole();
if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) { if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
db_pandora_audit("ACL Violation", db_pandora_audit("ACL Violation",
"Trying to access map builder"); "Trying to access map builder");
@ -28,15 +31,55 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
exit; exit;
} }
$buttons['map_builder'] = array('active' => false, if(!$is_metaconsole){
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder">' . $url_visual_console = 'index.php?sec=network&sec2=godmode/reporting/map_builder';
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console'))) .'</a>'); $url_visual_console_favorite = 'index.php?sec=network&sec2=godmode/reporting/visual_console_favorite';
$url_visual_console_template = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template';
$url_visual_console_template_wizard = 'index.php?sec=network&sec2=enterprise/godmode/reporting/visual_console_template_wizard';
}
else{
$url_visual_console = 'index.php?sec=screen&sec2=screens/screens&action=visualmap';
$url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite';
$url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template';
$url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard';
}
if (!defined('METACONSOLE')) { $buttons['visual_console'] = array(
'active' => false,
'text' => '<a href="'.$url_visual_console.'">' .
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console List'))) .'</a>'
);
$buttons['visual_console_favorite'] = array(
'active' => true,
'text' => '<a href="'.$url_visual_console_favorite.'">' .
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>'
);
if($is_enterprise){
$buttons['visual_console_template'] = array(
'active' => false,
'text' => '<a href="'.$url_visual_console_template.'">' .
html_print_image ("images/templates.png", true, array ("title" => __('Visual Console Template'))) .'</a>'
);
$buttons['visual_console_template_wizard'] = array(
'active' => false,
'text' => '<a href="'.$url_visual_console_template_wizard.'">' .
html_print_image ("images/wand.png", true, array ("title" => __('Visual Console Template Wizard'))) .'</a>'
);
}
if (!$is_metaconsole) {
ui_print_page_header( ui_print_page_header(
__('Reporting') .' &raquo; ' . __('Visual Favourite Console'), __('Reporting') .' &raquo; ' . __('Visual Favourite Console'),
"images/op_reporting.png", false, "map_builder", false, $buttons); "images/op_reporting.png", false, "map_builder", false, $buttons);
} }
else{
ui_meta_print_header(
__('Visual console') . " &raquo; " . $visualConsoleName, "",
$buttons);
}
$search = (string) get_parameter("search",""); $search = (string) get_parameter("search","");
$ag_group = (int) get_parameter("ag_group",0); $ag_group = (int) get_parameter("ag_group",0);
@ -48,7 +91,7 @@ if(!is_metaconsole()){
action='index.php?sec=network&amp;sec2=godmode/reporting/visual_console_favorite'>"; action='index.php?sec=network&amp;sec2=godmode/reporting/visual_console_favorite'>";
} else { } else {
echo "<form method='post' echo "<form method='post'
action='index.php?sec=screen&sec2=screens/screens&action=visualmap'>"; action='index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'>";
} }
echo "<ul class='form_flex'><li class='first_elements'>"; echo "<ul class='form_flex'><li class='first_elements'>";
echo "<ul><li>"; echo "<ul><li>";
@ -104,8 +147,13 @@ echo "<div id='is_favourite'>";
else{ else{
echo "<ul class='container'>"; echo "<ul class='container'>";
foreach( $favorite_array as $favorite_k => $favourite_v ){ foreach( $favorite_array as $favorite_k => $favourite_v ){
echo "<a href='index.php?sec=network&sec2=operation/visual_console/render_view&id=" . $favourite_v["id"] . if($is_metaconsole){
"' title='Visual console". $favourite_v["name"] ."' alt='". $favourite_v["name"] ."'><li>"; $url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='. $favourite_v["id"];
}
else{
$url = 'index.php?sec=network&sec2=operation/visual_console/render_view&id='. $favourite_v["id"];
}
echo "<a href='". $url ."' title='Visual console". $favourite_v["name"] ."' alt='". $favourite_v["name"] ."'><li>";
echo "<div class='icon_img'>"; echo "<div class='icon_img'>";
echo html_print_image ("images/groups_small/" . groups_get_icon($favourite_v["id_group"]).".png", echo html_print_image ("images/groups_small/" . groups_get_icon($favourite_v["id_group"]).".png",
true, true,

View File

@ -696,6 +696,18 @@ $options_soft_graphs[1] = __('Classic mode');
$table_chars->data[$row][1] = html_print_select($options_soft_graphs, 'type_mode_graph', $config["type_mode_graph"], '', '', 0, true, false, false); $table_chars->data[$row][1] = html_print_select($options_soft_graphs, 'type_mode_graph', $config["type_mode_graph"], '', '', 0, true, false, false);
$row++; $row++;
$table_chars->data[$row][0] = __('Zoom graphs:');
$options_zoom_graphs = array();
$options_zoom_graphs[1] = 'x1';
$options_zoom_graphs[2] = 'x2';
$options_zoom_graphs[3] = 'x3';
$options_zoom_graphs[4] = 'x4';
$options_zoom_graphs[5] = 'x5';
$table_chars->data[$row][1] = html_print_select($options_zoom_graphs, 'zoom_graph', $config["zoom_graph"], '', '', 0, true, false, false);
$row++;
$table_chars->data[$row][0] = __('Graph image height'); $table_chars->data[$row][0] = __('Graph image height');
$table_chars->data[$row][1] = html_print_input_text ('graph_image_height', $config['graph_image_height'], '', 20, 20, true); $table_chars->data[$row][1] = html_print_input_text ('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
$row++; $row++;

View File

@ -355,7 +355,15 @@ if ($get_module_detail) {
if($data_macro){ if($data_macro){
$data[] = $data_macro; $data[] = $data_macro;
} else { } else {
$data[] = $row[$attr[0]]; $datos = $row[$attr[0]];
$datos = preg_replace ('/</', '&lt;', $datos);
$datos = preg_replace ('/>/', '&gt;', $datos);
$datos = preg_replace ('/\n/i','<br>',$datos);
$datos = preg_replace ('/\s/i','&nbsp;',$datos);
$datos_format = "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
$datos_format .= $datos;
$datos_format .= "</div>";
$data[] = $datos_format;
} }
} }
} }

View File

@ -54,6 +54,7 @@ $no_login_msg = "";
// Clean unwanted output // Clean unwanted output
ob_clean(); ob_clean();
// READ THIS:
// Special call without checks to retrieve version and build of the Pandora FMS // Special call without checks to retrieve version and build of the Pandora FMS
// This info is avalable from the web console without login // This info is avalable from the web console without login
// Don't change the format, it is parsed by applications // Don't change the format, it is parsed by applications
@ -63,7 +64,7 @@ switch($info) {
$config["MR"] = 0; $config["MR"] = 0;
} }
echo get_product_name() . ' ' . $pandora_version . ' - ' . $build_version . " MR" . $config["MR"]; echo 'Pandora FMS ' . $pandora_version . ' - ' . $build_version . " MR" . $config["MR"];
exit; exit;
} }

View File

@ -1684,8 +1684,6 @@ class Tree {
// Info to be able to open the snapshot image new page // Info to be able to open the snapshot image new page
$module['snapshot'] = ui_get_snapshot_link(array( $module['snapshot'] = ui_get_snapshot_link(array(
'id_module' => $module['id'], 'id_module' => $module['id'],
'last_data' => $module['datos'],
'timestamp' => $module['timestamp'],
'interval' => $module['current_interval'], 'interval' => $module['current_interval'],
'module_name' => $module['name'] 'module_name' => $module['name']
), true); ), true);

View File

@ -22,8 +22,8 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC180723'; $build_version = 'PC180808';
$pandora_version = 'v7.0NG.724'; $pandora_version = 'v7.0NG.725';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get(); $script_tz = @date_default_timezone_get();

View File

@ -1363,6 +1363,18 @@ function is_metaconsole() {
return (bool) $config['metaconsole']; return (bool) $config['metaconsole'];
} }
/**
* @brief Check if there is management operations are allowed in current context
* (node // meta)
*
* @return bool
*/
function is_management_allowed() {
global $config;
return ( (is_metaconsole() && $config["centralized_management"])
|| (!is_metaconsole() && !$config["centralized_management"]));
}
/** /**
* @brief Check if there is centralized management in metaconsole environment. * @brief Check if there is centralized management in metaconsole environment.
* Usefull to display some policy features on metaconsole. * Usefull to display some policy features on metaconsole.

View File

@ -1739,6 +1739,7 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
// Get all non disabled modules of the agent // Get all non disabled modules of the agent
$all_modules = db_get_all_rows_filter('tagente_modulo', $all_modules = db_get_all_rows_filter('tagente_modulo',
$filter_modules, 'id_agente_modulo'); $filter_modules, 'id_agente_modulo');
if ($all_modules === false) $all_modules = array();
$result_modules = array(); $result_modules = array();
// Skip non init modules // Skip non init modules

View File

@ -99,35 +99,31 @@ function returnError($typeError, $returnType = 'string') {
break; break;
default: default:
returnData("string", returnData("string",
array('type' => 'string', 'data' => __($returnType))); array('type' => 'string', 'data' => __($typeError)));
break; break;
} }
} }
/** /**
*
* @param $returnType * @param $returnType
* @param $data * @param $data
* @param $separator * @param $separator
*
* @return * @return
*/ */
function returnData($returnType, $data, $separator = ';') { function returnData($returnType, $data, $separator = ';') {
switch ($returnType) { switch ($returnType) {
case 'string': case 'string':
if ($data['type'] == 'string') { if( is_array($data['data']) ){
echo $data['data']; echo convert_array_multi($data['data'], $separator);
} }
else{ else{
//TODO echo $data['data'];
} }
break; break;
case 'csv': case 'csv':
case 'csv_head': case 'csv_head':
switch ($data['type']) { if( is_array($data['data']) ){
case 'array': if (array_key_exists('list_index', $data)) {
if (array_key_exists('list_index', $data))
{
if ($returnType == 'csv_head') { if ($returnType == 'csv_head') {
foreach($data['list_index'] as $index) { foreach($data['list_index'] as $index) {
echo $index; echo $index;
@ -150,11 +146,8 @@ function returnData($returnType, $data, $separator = ';') {
} }
else { else {
if (!empty($data['data'])) { if (!empty($data['data'])) {
foreach ($data['data'] as $dataContent) { foreach ($data['data'] as $dataContent) {
$clean = array_map("array_apply_io_safe_output", $dataContent); $clean = array_map("array_apply_io_safe_output", $dataContent);
foreach ($clean as $k => $v) { foreach ($clean as $k => $v) {
$clean[$k] = str_replace("\r", "\n", $clean[$k]); $clean[$k] = str_replace("\r", "\n", $clean[$k]);
$clean[$k] = str_replace("\n", " ", $clean[$k]); $clean[$k] = str_replace("\n", " ", $clean[$k]);
@ -162,15 +155,13 @@ function returnData($returnType, $data, $separator = ';') {
$clean[$k] = str_replace(';',' ',$clean[$k]); $clean[$k] = str_replace(';',' ',$clean[$k]);
} }
$row = implode($separator, $clean); $row = implode($separator, $clean);
echo $row . "\n"; echo $row . "\n";
} }
} }
} }
break; }
case 'string': else{
echo $data['data']; echo $data['data'];
break;
} }
break; break;
case 'json': case 'json':
@ -5400,74 +5391,6 @@ function api_set_planned_downtimes_additem ($id, $thrash1, $other, $thrash3) {
} }
} }
/**
* Add agent to a policy. And return a message with the result of the operation.
*
* @param string $id Id of the target policy.
* @param $thrash1 Don't use.
* @param array $other it's array, $other as param is <id_agent> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example:
*
* example:
*
* api.php?op=set&op2=add_agent_policy&id=1&other=167&other_mode=url_encode_separator_|
*
* @param $thrash3 Don't use
*/
function api_set_add_agent_policy($id, $thrash1, $other, $thrash2) {
if (defined ('METACONSOLE')) {
return;
}
if ($id == "") {
returnError('error_add_agent_policy', __('Error adding agent to policy. Id_policy cannot be left blank.'));
return;
}
if ($other['data'][0] == "") {
returnError('error_add_agent_policy', __('Error adding agent to policy. Id_agent cannot be left blank.'));
return;
}
// Check if the agent exists and permissions
if (!util_api_check_agent_and_print_error((int) $other['data'][0], 'string', "AW")) {
return;
}
// Check the policy permissions and existence
if (enterprise_hook('policies_check_user_policy', array($id)) === false) {
$result_agent = db_get_value ('id_agente', 'tagente', 'id_agente', (int) $other['data'][0]);
if ($result_agent) {
returnError('error_add_agent_policy', __('Error adding agent to policy. Id policy doesn\'t exist.'));
return;
}
returnError('forbidden', 'string');
return;
}
// Check if the agent is already in the policy
$id_agent_policy = enterprise_hook('policies_get_agents', array($id, array('id_agent' => $other['data'][0]), 'id'));
if ($id_agent_policy === ENTERPRISE_NOT_HOOK) {
returnError('error_add_agent_policy', __('Error adding agent to policy.'));
return;
}
if ($id_agent_policy === false) {
$success = enterprise_hook('policies_create_agent', array($other['data'][0], $id));
}
else {
returnError('error_add_agent_policy', __('Error adding agent to policy. The agent is already in the policy.'));
return;
}
if ($success)
returnData('string', array('type' => 'string', 'data' => $success));
else
returnError('error_add_agent_policy', 'Error adding agent to policy.');
}
/** /**
* Add data module to policy. And return id from new module. * Add data module to policy. And return id from new module.
* *
@ -6429,153 +6352,6 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
array('type' => 'string', 'data' => __('SNMP policy module updated.'))); array('type' => 'string', 'data' => __('SNMP policy module updated.')));
} }
/**
* Apply policy. And return id from the applying operation.
*
* @param string $id Id of the target policy.
* @param $thrash1 Don't use.
* @param array $other Don't use
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example:
*
* api.php?op=set&op2=apply_policy&id=1
*
* @param $thrash3 Don't use
*/
function api_set_apply_policy($id, $thrash1, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
if ($id == "") {
returnError('error_apply_policy', __('Error applying policy. Id_policy cannot be left blank.'));
return;
}
# Check if this operation is duplicated
$duplicated = enterprise_hook('policies_get_policy_queue_status', array($id));
if ($duplicated === ENTERPRISE_NOT_HOOK) {
// We want to return a value
if ($other == "return") {
return -1;
}
else {
returnError('error_apply_policy', __('Error applying policy.'));
return;
}
}
if ($duplicated == STATUS_IN_QUEUE_APPLYING or $duplicated == STATUS_IN_QUEUE_IN) {
// We want to return a value
if ($other == "return") {
return -1;
}
else {
returnError('error_apply_policy',
__('Error applying policy. This policy is already pending to apply.'));
return;
}
}
$check_acl = enterprise_hook('policies_check_user_policy', array($id));
if ($check_acl !== true) {
// We want to return a value
if ($other == "return") {
return -1;
}
else {
returnError('error_apply_policy', __('Error applying policy.'));
return;
}
}
$id = enterprise_hook('add_policy_queue_operation', array($id, 0, 'apply'));
if ($id === ENTERPRISE_NOT_HOOK) {
// We want to return a value
if ($other == "return") {
return -1;
}
else {
returnError('error_apply_policy', __('Error applying policy.'));
return;
}
}
// We want to return a value
if ($other == "return") {
if ($id)
return $id;
else
return -1;
}
else {
if ($id)
returnData('string', array('type' => 'string', 'data' => $id));
else
returnError('error_apply_policy', 'Error applying policy.');
}
}
/**
* Apply all policy in database. And return the number of policies applied.
*
* @param string $id Don't use.
* @param $thrash1 Don't use.
* @param array $other Don't use
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example:
*
* api.php?op=set&op2=apply_all_policies
*
* @param $thrash3 Don't use
*/
function api_set_apply_all_policies($thrash1, $thrash2, $other, $thrash3) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
if (!check_acl($config['id_user'], 0, "AW")) {
returnError('forbidden', 'string');
return;
}
$policies = array();
# Get all policies
$policies = enterprise_hook('policies_get_policies', array(false, false, false));
if ($policies === ENTERPRISE_NOT_HOOK) {
returnError('error_apply_all_policy', __('Error applying all policies.'));
return;
}
if ($policies === false) $policies = array();
$num_policies = count($policies);
$count_results = 0;
foreach ($policies as $policy) {
$return_value = enterprise_hook('add_policy_queue_operation',
array($policy['id'], 0, 'apply'));
if ($return_value != -1) {
$count_results++;
}
}
if ($num_policies > $count_results) {
$errors = $num_policies - $count_results;
returnError('error_apply_policy', 'Error applying policy. ' . $errors . ' failed. ');
}
else {
returnData('string', array('type' => 'string', 'data' => $count_results));
}
}
/** /**
* Create a new group. And return the id_group of the new group. * Create a new group. And return the id_group of the new group.
* *

View File

@ -631,6 +631,9 @@ function config_update_config () {
if (!config_update_value ('type_mode_graph', (int) get_parameter('type_mode_graph', 0))) if (!config_update_value ('type_mode_graph', (int) get_parameter('type_mode_graph', 0)))
$error_update[] = __('Default soft graphs'); $error_update[] = __('Default soft graphs');
if (!config_update_value ('zoom_graph', (int) get_parameter('zoom_graph', 0)))
$error_update[] = __('Default zoom graphs');
if (!config_update_value ('graph_image_height', (int) get_parameter('graph_image_height', 0))) if (!config_update_value ('graph_image_height', (int) get_parameter('graph_image_height', 0)))
$error_update[] = __('Default height of the chart image'); $error_update[] = __('Default height of the chart image');

View File

@ -50,6 +50,8 @@ function events_get_all_fields() {
$columns['ack_utimestamp'] = __('ACK Timestamp'); $columns['ack_utimestamp'] = __('ACK Timestamp');
$columns['instructions'] = __('Instructions'); $columns['instructions'] = __('Instructions');
$columns['server_name'] = __('Server name'); $columns['server_name'] = __('Server name');
$columns['data'] = __('Data');
$columns['module_status'] = __('Module status');
return $columns; return $columns;
} }
@ -126,7 +128,7 @@ function events_get_events_no_grouped($sql_post, $offset = 0,
function events_get_events_grouped($sql_post, $offset = 0, function events_get_events_grouped($sql_post, $offset = 0,
$pagination = 1, $meta = false, $history = false, $total = false, $pagination = 1, $meta = false, $history = false, $total = false,
$history_db = false, $order = "DESC") { $history_db = false, $order = "down", $sort_field = "timestamp") {
global $config; global $config;
@ -139,6 +141,7 @@ function events_get_events_grouped($sql_post, $offset = 0,
$groupby_extra = ''; $groupby_extra = '';
} }
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
db_process_sql ('SET group_concat_max_len = 9999999'); db_process_sql ('SET group_concat_max_len = 9999999');
@ -158,11 +161,143 @@ function events_get_events_grouped($sql_post, $offset = 0,
(SELECT id_usuario FROM $table WHERE id_evento = MAX(te.id_evento)) id_usuario, (SELECT id_usuario FROM $table WHERE id_evento = MAX(te.id_evento)) id_usuario,
(SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente, (SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente,
(SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity, (SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity,
(SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp (SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp,
(SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = te.id_agentmodule) AS module_name
FROM $table te LEFT JOIN tagent_secondary_group tasg ON te.id_grupo = tasg.id_group FROM $table te LEFT JOIN tagent_secondary_group tasg ON te.id_grupo = tasg.id_group
WHERE 1=1 " . $sql_post . " WHERE 1=1 " . $sql_post . "
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra . " GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra . "
ORDER BY timestamp_rep " . $order . " LIMIT " . $offset . "," . $pagination; ORDER BY ";
if (!empty($sort_field)) {
switch ($sort_field) {
case 'event_id':
if ($order=='up')
$sql .= "id_evento" . " ASC";
if ($order=='down')
$sql .= "id_evento" . " DESC";
break;
case 'event_name':
if ($order=='up')
$sql .= "evento" . " ASC";
if ($order=='down')
$sql .= "evento" . " DESC";
break;
case 'event_id':
if ($order=='up')
$sql .= "id_evento" . " ASC";
if ($order=='down')
$sql .= "id_evento" . " DESC";
break;
case 'status':
if ($order=='up')
$sql .= "estado" . " ASC";
if ($order=='down')
$sql .= "estado" . " DESC";
break;
case 'agent_id':
if ($order=='up')
$sql .= "id_agente" . " ASC";
if ($order=='down')
$sql .= "id_agente" . " DESC";
break;
case 'timestamp':
if ($order=='up')
$sql .= "timestamp_rep" . " ASC";
if ($order=='down')
$sql .= "timestamp_rep" . " DESC";
break;
case 'user_id':
if ($order=='up')
$sql .= "id_usuario" . " ASC";
if ($order=='down')
$sql .= "id_usuario" . " DESC";
break;
case 'owner':
if ($order=='up')
$sql .= "owner_user" . " ASC";
if ($order=='down')
$sql .= "owner_user" . " DESC";
break;
case 'group_id':
if ($order=='up')
$sql .= "id_grupo" . " ASC";
if ($order=='down')
$sql .= "id_grupo" . " DESC";
break;
case 'module_name':
if ($order=='up')
$sql .= "module_name" . " ASC";
if ($order=='down')
$sql .= "module_name" . " DESC";
break;
case 'event_type':
if ($order=='up')
$sql .= "event_type" . " ASC";
if ($order=='down')
$sql .= "event_type" . " DESC";
break;
case 'alert_id':
if ($order=='up')
$sql .= "id_alert_am" . " ASC";
if ($order=='down')
$sql .= "id_alert_am" . " DESC";
break;
case 'criticity':
if ($order=='up')
$sql .= "criticity" . " ASC";
if ($order=='down')
$sql .= "criticity" . " DESC";
break;
case 'comment':
if ($order=='up')
$sql .= "user_comment" . " ASC";
if ($order=='down')
$sql .= "user_comment" . " DESC";
break;
case 'tags':
if ($order=='up')
$sql .= "tags" . " ASC";
if ($order=='down')
$sql .= "tags" . " DESC";
break;
case 'source':
if ($order=='up')
$sql .= "source" . " ASC";
if ($order=='down')
$sql .= "source" . " DESC";
break;
case 'extra_id':
if ($order=='up')
$sql .= "id_extra" . " ASC";
if ($order=='down')
$sql .= "id_extra" . " DESC";
break;
case 'ack_timestamp':
if ($order=='up')
$sql .= "ack_utimestamp" . " ASC";
if ($order=='down')
$sql .= "ack_utimestamp" . " DESC";
break;
case 'data':
if ($order=='up')
$sql .= "data" . " ASC";
if ($order=='down')
$sql .= "data" . " DESC";
break;
case 'module_status':
if ($order=='up')
$sql .= "module_status" . " ASC";
if ($order=='down')
$sql .= "module_status" . " DESC";
break;
default:
$sql .= "timestamp_rep" . " DESC";
}
}
$sql .= " LIMIT " . $offset . "," . $pagination;
} }
break; break;
case "postgresql": case "postgresql":
@ -721,15 +856,15 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
event_type, criticity, id_agentmodule, id_alert_am, event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions, critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, unknown_instructions, source, tags, custom_data,
server_id, id_extra) server_id, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()), VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
"%s", "%s", %d, "%s")', "%s", "%s", %d, "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user, $id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam, $event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions, $critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra); $server_id, $id_extra, $data, $module_status);
break; break;
case "postgresql": case "postgresql":
$sql = sprintf (' $sql = sprintf ('
@ -738,16 +873,16 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
event_type, criticity, id_agentmodule, id_alert_am, event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions, critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, unknown_instructions, source, tags, custom_data,
server_id, id_extra) server_id, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d, VALUES (%d, %d, "%s", NOW(), %d,
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s", ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s",
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s",
"%s", %d, "%s")', "%s", %d, "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user, $id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam, $event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions, $critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra); $server_id, $id_extra, $data, $module_status);
break; break;
case "oracle": case "oracle":
$sql = sprintf (' $sql = sprintf ('
@ -756,15 +891,15 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
event_type, criticity, id_agentmodule, id_alert_am, event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions, critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, unknown_instructions, source, tags, custom_data,
server_id, id_extra) server_id, id_extra, data, module_status)
VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP, VALUES (%d, %d, "%s", CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
"%s", "%s", %d, "%s")', "%s", "%s", %d, "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user, $id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam, $event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions, $critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra); $server_id, $id_extra, $data, $module_status);
break; break;
} }
} }
@ -776,13 +911,13 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario, timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am, event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions, critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, id_extra) unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()), VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s")', "%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user, $id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam, $event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions, $critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra); $unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break; break;
case "postgresql": case "postgresql":
$sql = sprintf (' $sql = sprintf ('
@ -790,14 +925,14 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario, timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am, event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions, critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, id_extra) unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d, VALUES (%d, %d, "%s", NOW(), %d,
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s", ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%s",
"%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s")', "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s", %d, %d)',
$id_agent, $id_group, $event, $status, $id_user, $id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam, $event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions, $critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra); $unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break; break;
case "oracle": case "oracle":
$sql = sprintf (" $sql = sprintf ("
@ -805,13 +940,13 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario, timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am, event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions, critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, id_extra) unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
VALUES (%d, %d, '%s', CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP, VALUES (%d, %d, '%s', CURRENT_TIMESTAMP, %d, UNIX_TIMESTAMP,
'%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')", '%s', '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)",
$id_agent, $id_group, $event, $status, $id_user, $id_agent, $id_group, $event, $status, $id_user,
$event_type, $priority, $id_agent_module, $id_aam, $event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions, $critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra); $unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break; break;
} }
} }
@ -3703,6 +3838,16 @@ function events_list_events_grouped_agents($sql) {
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('data', $show_fields)) {
$table->head[$i] = __('Data');
$table->align[$i] = 'left';
$i++;
}
if (in_array('module_status', $show_fields)) {
$table->head[$i] = __('Module status');
$table->align[$i] = 'left';
$i++;
}
if ($i != 0 && $allow_action) { if ($i != 0 && $allow_action) {
$table->head[$i] = __('Action'); $table->head[$i] = __('Action');
$table->align[$i] = 'left'; $table->align[$i] = 'left';
@ -4102,6 +4247,20 @@ function events_list_events_grouped_agents($sql) {
$table->cellclass[count($table->data)][$i] = $myclass; $table->cellclass[count($table->data)][$i] = $myclass;
$i++; $i++;
} }
if (in_array('data',$show_fields)) {
$data[$i] = $event["data"];
if($data[$i] %1 == 0)
$data[$i]= number_format($data[$i], 0);
else
$data[$i]= number_format($data[$i], 2);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('module_status',$show_fields)) {
$data[$i] = modules_get_modules_status ($event["module_status"]);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if ($i != 0 && $allow_action) { if ($i != 0 && $allow_action) {
//Actions //Actions

View File

@ -892,7 +892,7 @@ function grafico_modulo_sparse ($params) {
} }
if(!isset($params['zoom'])){ if(!isset($params['zoom'])){
$params['zoom'] = 1; $params['zoom'] = $config['zoom_graph'];
} }
if(!isset($params['type_mode_graph'])){ if(!isset($params['type_mode_graph'])){
@ -1501,7 +1501,6 @@ function graphic_combined_module (
//XXX arreglar estas //XXX arreglar estas
$long_index = ''; $long_index = '';
switch ($params_combined['stacked']) { switch ($params_combined['stacked']) {
default: default:
case CUSTOM_GRAPH_STACKED_LINE: case CUSTOM_GRAPH_STACKED_LINE:
@ -1734,6 +1733,8 @@ function graphic_combined_module (
break; break;
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD: case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
case CUSTOM_GRAPH_BULLET_CHART: case CUSTOM_GRAPH_BULLET_CHART:
$number_elements = count($module_list);
if($params_combined['stacked'] == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){ if($params_combined['stacked'] == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$acumulador = 0; $acumulador = 0;
foreach ($module_list as $module_item) { foreach ($module_list as $module_item) {
@ -1823,8 +1824,13 @@ function graphic_combined_module (
$graph_values = $temp; $graph_values = $temp;
if(!$params['vconsole']){
$width = 1024; $width = 1024;
$height = 50; $height = 50;
}
else{
$height = $height/$number_elements;
}
$color = color_graph_array(); $color = color_graph_array();
@ -1851,6 +1857,7 @@ function graphic_combined_module (
case CUSTOM_GRAPH_GAUGE: case CUSTOM_GRAPH_GAUGE:
$i = 0; $i = 0;
$number_elements = count($module_list);
foreach ($module_list as $module_item) { foreach ($module_list as $module_item) {
$automatic_custom_graph_meta = false; $automatic_custom_graph_meta = false;
if ($config['metaconsole']) { if ($config['metaconsole']) {
@ -1918,8 +1925,14 @@ function graphic_combined_module (
$color = color_graph_array(); $color = color_graph_array();
if(!$params['vconsole']){
$width = 200; $width = 200;
$height = 200; $height = 200;
}
else{
$width = $width/$number_elements;
$height = $height/$number_elements;
}
$output = stacked_gauge( $output = stacked_gauge(
$graph_values, $graph_values,
@ -1988,8 +2001,11 @@ function graphic_combined_module (
$graph_values = $temp; $graph_values = $temp;
if(!$params['vconsole']){
$width = 1024; $width = 1024;
$height = 500; $height = 500;
}
$flash_charts = true; $flash_charts = true;
if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){ if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){
@ -2102,8 +2118,11 @@ function graphic_combined_module (
$graph_values = $temp; $graph_values = $temp;
if(!$params['vconsole']){
$width = 1024; $width = 1024;
$height = 500; $height = 500;
}
$color = color_graph_array(); $color = color_graph_array();

View File

@ -709,8 +709,8 @@ function html_print_extended_select_for_post_process($name, $selected = '',
require_once($config['homedir'] . "/include/functions_post_process.php"); require_once($config['homedir'] . "/include/functions_post_process.php");
$fields = post_process_get_custom_values(); $fields = post_process_get_custom_values();
if($no_change != 0){ if($no_change != 0){
$fields[-1] = __('No change'); $fields[-1] = __('No change');
} }
@ -718,14 +718,13 @@ function html_print_extended_select_for_post_process($name, $selected = '',
$selected_float = (float)$selected; $selected_float = (float)$selected;
$found = false; $found = false;
if (array_key_exists($selected, $fields)) if (array_key_exists(number_format($selected, 14, '.', ','), $fields))
$found = true; $found = true;
if (!$found) { if (!$found) {
$fields[$selected] = floatval($selected); $fields[$selected] = floatval($selected);
} }
if ($unique_name === true) { if ($unique_name === true) {
$uniq_name = uniqid($name); $uniq_name = uniqid($name);
} }
@ -770,9 +769,6 @@ function html_print_extended_select_for_post_process($name, $selected = '',
$returnString = ob_get_clean(); $returnString = ob_get_clean();
if ($return) if ($return)
return $returnString; return $returnString;
else else

View File

@ -476,7 +476,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
global $config; global $config;
if (!$disableACL) { if (!$disableACL) {
if (empty ($id_agent) || ! users_access_to_agent ($id_agent, 'AW')) if (!users_is_admin() && (empty ($id_agent) || ! users_access_to_agent ($id_agent, 'AW')))
return false; return false;
} }
@ -537,10 +537,9 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
// Sync modules start in unknown status // Sync modules start in unknown status
$status = AGENT_MODULE_STATUS_NO_DATA; $status = AGENT_MODULE_STATUS_NO_DATA;
} }
switch ($config["dbtype"]) {
case "mysql": $result = db_process_sql_insert ('tagente_estado', array (
$result = db_process_sql_insert ('tagente_estado', 'id_agente_modulo' => $id_agent_module,
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0, 'datos' => 0,
'timestamp' => '01-01-1970 00:00:00', 'timestamp' => '01-01-1970 00:00:00',
'estado' => $status, 'estado' => $status,
@ -551,36 +550,6 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
'last_status' => $status, 'last_status' => $status,
'last_known_status' => $status 'last_known_status' => $status
)); ));
break;
case "postgresql":
$result = db_process_sql_insert ('tagente_estado',
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => null,
'estado' => $status,
'known_status' => $status,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_status' => $status,
'last_known_status' => $status
));
break;
case "oracle":
$result = db_process_sql_insert ('tagente_estado',
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => '#to_date(\'1970-01-01 00:00:00\', \'YYYY-MM-DD HH24:MI:SS\')',
'estado' => $status,
'known_status' => $status,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_status' => $status,
'last_known_status' => $status
));
break;
}
if ($result === false) { if ($result === false) {
db_process_sql_delete ('tagente_modulo', db_process_sql_delete ('tagente_modulo',
@ -758,34 +727,7 @@ function modules_format_delete_log4x($id)
* @return array An array with module information * @return array An array with module information
*/ */
function modules_get_agentmodule ($id_agentmodule) { function modules_get_agentmodule ($id_agentmodule) {
global $config;
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
break;
case "oracle":
$fields = db_get_all_rows_filter('USER_TAB_COLUMNS',
'TABLE_NAME = \'TAGENTE_MODULO\' AND COLUMN_NAME <> \'MAX_CRITICAL\' AND COLUMN_NAME <> \'MIN_CRITICAL\' AND COLUMN_NAME <> \'POST_PROCESS\' AND COLUMN_NAME <> \'MAX_WARNING\' AND COLUMN_NAME <> \'MIN_WARNING\'', 'COLUMN_NAME');
foreach ($fields as $field) {
$fields_[] = $field['column_name'];
}
$fields = implode(',', $fields_);
$result = db_process_sql("
SELECT TO_NUMBER(MAX_CRITICAL) as max_critical,
TO_NUMBER(MIN_CRITICAL) as min_critical,
TO_NUMBER(MAX_WARNING) as max_warning,
TO_NUMBER(MIN_WARNING) as min_warning,
TO_NUMBER(POST_PROCESS) as post_process,
" . $fields . "
FROM tagente_modulo
WHERE id_agente_modulo = " . $id_agentmodule);
return $result[0];
break;
}
} }
function modules_get_table_data($id_agent_module) { function modules_get_table_data($id_agent_module) {
@ -1999,8 +1941,6 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
// Get unknown agents by using the status code in modules // Get unknown agents by using the status code in modules
function modules_agents_unknown ($module_name) { function modules_agents_unknown ($module_name) {
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT( DISTINCT tagente.id_agente) return db_get_sql ("SELECT COUNT( DISTINCT tagente.id_agente)
FROM tagente_estado, tagente, tagente_modulo FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0 WHERE tagente.disabled = 0
@ -2022,8 +1962,6 @@ function modules_agents_ok ($module_name) {
//This query grouped all modules by agents and select the MAX value for status which has the value 0 //This query grouped all modules by agents and select the MAX value for status which has the value 0
//If MAX(estado) is 0 it means all modules has status 0 => OK //If MAX(estado) is 0 it means all modules has status 0 => OK
//Then we count the agents of the group selected to know how many agents are in OK status //Then we count the agents of the group selected to know how many agents are in OK status
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT(max_estado) return db_get_sql ("SELECT COUNT(max_estado)
FROM ( FROM (
SELECT MAX(tagente_estado.estado) as max_estado SELECT MAX(tagente_estado.estado) as max_estado
@ -2047,8 +1985,6 @@ function modules_agents_critical ($module_name) {
//If estado = 1 it means at leas 1 module is in critical status so the agent is critical //If estado = 1 it means at leas 1 module is in critical status so the agent is critical
//Then we count the agents of the group selected to know how many agents are in critical status //Then we count the agents of the group selected to know how many agents are in critical status
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT( DISTINCT tagente_estado.id_agente) return db_get_sql ("SELECT COUNT( DISTINCT tagente_estado.id_agente)
FROM tagente_estado, tagente, tagente_modulo FROM tagente_estado, tagente, tagente_modulo
WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0 WHERE tagente.disabled = 0 AND tagente_estado.utimestamp != 0
@ -2070,8 +2006,6 @@ function modules_agents_warning ($module_name) {
//If MIN(estado) is 2 it means at least one module is warning and there is no critical modules //If MIN(estado) is 2 it means at least one module is warning and there is no critical modules
//Then we count the agents of the group selected to know how many agents are in warning status //Then we count the agents of the group selected to know how many agents are in warning status
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT(min_estado) return db_get_sql ("SELECT COUNT(min_estado)
FROM (SELECT MAX(tagente_estado.estado) as min_estado FROM (SELECT MAX(tagente_estado.estado) as min_estado
FROM tagente_estado, tagente, tagente_modulo FROM tagente_estado, tagente, tagente_modulo
@ -2764,4 +2698,57 @@ function force_set_module_status ($status, $id_agent_module) {
array('id_agente_modulo' => $id_agent_module) array('id_agente_modulo' => $id_agent_module)
); );
} }
function modules_get_modules_status ($mod_status_id) {
$diferent_types = get_priorities ();
$mod_status_desc = '';
switch ($mod_status_id) {
case AGENT_MODULE_STATUS_NORMAL:
$mod_status_desc = __('NORMAL');
break;
case AGENT_MODULE_STATUS_CRITICAL_BAD:
$mod_status_desc = __('CRITICAL');
break;
case AGENT_MODULE_STATUS_WARNING:
$mod_status_desc = __('WARNING');
break;
case AGENT_MODULE_STATUS_UNKNOWN:
$mod_status_desc = __('UNKNOWN');
break;
case AGENT_MODULE_STATUS_NOT_INIT:
$mod_status_desc = __('NOT INIT');
break;
case AGENT_MODULE_STATUS_ALL:
$mod_status_desc = __('ALL');
break;
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
$mod_status_desc = __('CRITICAL');
break;
case AGENT_MODULE_STATUS_NO_DATA:
$mod_status_desc = __('NO DATA');
break;
case AGENT_MODULE_STATUS_NORMAL_ALERT:
$mod_status_desc = __('NORMAL');
break;
case AGENT_MODULE_STATUS_NOT_NORMAL:
$mod_status_desc = __('NOT NORMAL');
break;
case AGENT_MODULE_STATUS_WARNING_ALERT:
$mod_status_desc = __('WARNING');
break;
default:
if (isset($config['text_char_long'])) {
foreach ($diferent_types as $key => $type) {
if ($key == $mod_status_id) {
$mod_status_desc = ui_print_truncate_text($type,
$config['text_char_long'], false, true, false);
}
}
}
break;
}
return $mod_status_desc;
}
?> ?>

View File

@ -1275,6 +1275,8 @@ function tags_check_acl($id_user, $id_group, $access, $tags = array(), $flag_id_
if (in_array($tag, $acls[$group])) { if (in_array($tag, $acls[$group])) {
return true; return true;
} else if (empty($acls[$group])) {
return true;
} }
} }
} }

View File

@ -268,32 +268,16 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px')); $last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
$is_snapshot = is_snapshot_data ( $last_data["datos"] ); $is_snapshot = is_snapshot_data ( $last_data["datos"] );
if (($config['command_snapshot']) && ($is_snapshot)) { $is_large_image = is_text_to_black_string ($last_data["datos"]);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$link = ui_get_snapshot_link( array( $link = ui_get_snapshot_link( array(
'id_module' => $module['id_agente_modulo'], 'id_module' => $module['id_agente_modulo'],
'last_data' => $last_data['datos'],
'timestamp' => $last_data['timestamp'],
'interval' => $module['current_interval'], 'interval' => $module['current_interval'],
'module_name' => $module['module_name'] 'module_name' => $module['module_name'],
'id_node' => empty($server_id) ? 0 : $server_id
)); ));
$salida = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
if(!is_image_data($last_data["datos"])){
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/default_list.png', true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))) . '</a> &nbsp;&nbsp;';
} }
else {
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/photo.png', true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))) . '</a> &nbsp;&nbsp;';
}
}
$last_data_str .= $salida; $last_data_str .= $salida;
} }
else { else {

View File

@ -832,19 +832,36 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
$data = array (); $data = array ();
if (!defined('METACONSOLE')) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if(is_metaconsole()){
$node = metaconsole_get_connection_by_id($alert['server_data']['id']);
if (metaconsole_load_external_db($node) !== NOERR) {
// Restore the default connection.
metaconsole_restore_db();
$errors++;
break;
}
}
$policyInfo = policies_is_alert_in_policy2($alert['id'], false); $policyInfo = policies_is_alert_in_policy2($alert['id'], false);
if ($policyInfo === false) if ($policyInfo === false)
$data[$index['policy']] = ''; $data[$index['policy']] = '';
else { else {
$img = 'images/policies.png'; $img = 'images/policies.png';
if(!is_metaconsole()){
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id'] . '">' . $data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id'] . '">' .
html_print_image($img,true, array('title' => $policyInfo['name'])) . html_print_image($img,true, array('title' => $policyInfo['name'])) .
'</a>'; '</a>';
}else{
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=advanced/policymanager&amp;id=' . $policyInfo['id'] . '">' .
html_print_image($img,true, array('title' => $policyInfo['name'])) .
'</a>';
} }
} }
if(is_metaconsole()){
metaconsole_restore_db();
}
} }
// Standby // Standby
@ -882,7 +899,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
$id_agent = modules_get_agentmodule_agent ($alert["id_agent_module"]); $id_agent = modules_get_agentmodule_agent ($alert["id_agent_module"]);
} }
if (defined('METACONSOLE') && !can_user_access_node ()) { if (defined('METACONSOLE') || !can_user_access_node ()) {
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '[&hellip;]', 'font-size:7.5pt;'); $data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '[&hellip;]', 'font-size:7.5pt;');
} }
else { else {
@ -3774,36 +3791,27 @@ function ui_print_module_string_value($value, $id_agente_module,
$value = io_safe_input($value); $value = io_safe_input($value);
} }
$is_snapshot = is_snapshot_data ($module["datos"]);
$is_large_image = is_text_to_black_string ($module["datos"]);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$row[7] = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
}
$is_snapshot = is_snapshot_data($value); $is_snapshot = is_snapshot_data($value);
$is_large_image = is_text_to_black_string ($value); $is_large_image = is_text_to_black_string ($value);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) { if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$handle = "snapshot" . "_" . $id_agente_module; $link = ui_get_snapshot_link( array(
$url = 'include/procesos.php?agente=' . $id_agente_module; 'id_module' => $id_agente_module,
$win_handle = dechex(crc32($handle)); 'last_data' => $value,
'interval' => $current_interval,
$link = "winopeng_var('operation/agentes/snapshot_view.php?" . 'module_name' => $module_name,
"id=" . $id_agente_module . 'timestamp' => db_get_value('timestamp', 'tagente_estado', 'id_agente_modulo', $id_agente_module)
"&refr=" . $current_interval . ));
"&label=" . rawurlencode(urlencode(io_safe_output($module_name))) . "','" . $win_handle . "', 700,480)"; $salida = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
if ($is_snapshot) { } else {
$salida = '<a href="javascript:' . $link . '">' .
html_print_image("images/photo.png", true,
array("border" => '0',
"alt" => "",
"title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
else {
$salida = '<a href="javascript:' . $link . '">' .
html_print_image("images/default_list.png", true,
array("border" => '0',
"alt" => "",
"title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
}
else {
$sub_string = substr(io_safe_output($value), 0, 12); $sub_string = substr(io_safe_output($value), 0, 12);
if ($value == $sub_string) { if ($value == $sub_string) {
if ($value == 0 && !$sub_string) { if ($value == 0 && !$sub_string) {
@ -3836,12 +3844,17 @@ function ui_print_module_string_value($value, $id_agente_module,
$salida = $value; $salida = $value;
} }
else { else {
$value = preg_replace ('/</', '&lt;', $value);
$value = preg_replace ('/>/', '&gt;', $value);
$value = preg_replace ('/\n/i','<br>',$value);
$value = preg_replace ('/\s/i','&nbsp;',$value);
$title_dialog = $title_dialog =
modules_get_agentmodule_agent_alias($id_agente_module) . modules_get_agentmodule_agent_alias($id_agente_module) .
" / " . $module_name; " / " . $module_name;
$salida = "<div " . $salida = "<div " .
"id='hidden_value_module_" . $id_agente_module . "' "id='hidden_value_module_" . $id_agente_module . "'
style='display: none;' title='" . $title_dialog . "'>" . style='display: none; width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left' title='" . $title_dialog . "'>" .
$value . $value .
"</div>" . "</div>" .
"<span " . "<span " .
@ -3899,8 +3912,8 @@ function ui_get_snapshot_link($params, $only_params = false) {
'id_module' => 0, //id_agente_modulo 'id_module' => 0, //id_agente_modulo
'module_name' => '', 'module_name' => '',
'interval' => 300, 'interval' => 300,
'last_data' => '', 'timestamp' => 0,
'timestamp' => '0' 'id_node' => 0
); );
// Merge default params with passed params // Merge default params with passed params
@ -3911,10 +3924,10 @@ function ui_get_snapshot_link($params, $only_params = false) {
$url = "$page?" . $url = "$page?" .
"id=" . $params['id_module'] . "id=" . $params['id_module'] .
"&refr=" . $parms['interval'] . "&label=" . rawurlencode(urlencode(io_safe_output($params['module_name']))).
"&timestamp=" . $params['timestamp'] . "&id_node=" . $params['id_node'];
"&last_data=" . rawurlencode(urlencode(io_safe_output($params['last_data']))) . if ($params['timestamp'] != 0) $url .= "&timestamp=" . $parms['timestamp'];
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name']))); if ($params['timestamp'] != 0) $url .= "&refr=" . $parms['interval'];
// Second parameter of js winopeng_var // Second parameter of js winopeng_var
$win_handle = dechex(crc32('snapshot_' . $params['id_module'])); $win_handle = dechex(crc32('snapshot_' . $params['id_module']));
@ -3928,11 +3941,34 @@ function ui_get_snapshot_link($params, $only_params = false) {
return "winopeng_var('" . implode("', '", $link_parts) . "')"; return "winopeng_var('" . implode("', '", $link_parts) . "')";
} }
/**
* @brief Get the snapshot image with the link to open a snapshot into a new page
*
* @param string Built link
* @param bool Picture image or list image
*
* @return string HTML anchor link with image
*/
function ui_get_snapshot_image ($link, $is_image) {
$image_name = $is_image ? 'photo.png' : 'default_list.png';
$link = '<a href="javascript:' . $link . '">' .
html_print_image("images/$image_name", true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))
) .
'</a>';
return $link;
}
function ui_get_using_system_timezone_warning ($tag = "h3", $return = true) { function ui_get_using_system_timezone_warning ($tag = "h3", $return = true) {
global $config; global $config;
$user_offset = (-get_fixed_offset() / 60) / 60; $user_offset = (-get_fixed_offset() / 60) / 60;
if ($config["timezone"] != date_default_timezone_get()) {
$message = sprintf( $message = sprintf(
__("These controls are using the timezone of the system (%s) instead of yours (%s). The difference with your time zone in hours is %s."), __("These controls are using the timezone of the system (%s) instead of yours (%s). The difference with your time zone in hours is %s."),
$config["timezone"], $config["timezone"],
@ -3940,6 +3976,9 @@ function ui_get_using_system_timezone_warning ($tag = "h3", $return = true) {
$user_offset > 0 ? "+" . $user_offset : $user_offset $user_offset > 0 ? "+" . $user_offset : $user_offset
); );
return ui_print_info_message($message, '', $return, $tag); return ui_print_info_message($message, '', $return, $tag);
} else
return '';
} }
/** /**

View File

@ -1731,15 +1731,27 @@ function visual_map_print_item($mode = "read", $layoutData,
$result = array_merge($result, $result_server); $result = array_merge($result, $result_server);
} }
if ($connection) {
metaconsole_restore_db();
}
} }
} }
if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) { if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) {
$img_style_title = strip_tags($label); $img_style_title = strip_tags($label);
if ($layoutData['type'] == STATIC_GRAPH) { if ($layoutData['type'] == STATIC_GRAPH) {
if ($layoutData['id_agente_modulo'] != 0) { if ($layoutData['id_agente_modulo'] != 0) {
if ($layoutData['id_metaconsole'] != 0) {
//Metaconsole db connection
$connection = db_get_row_filter ('tmetaconsole_setup',
array('id' => $layoutData['id_metaconsole']));
if (metaconsole_load_external_db($connection) != NOERR) {
continue;
}
}
$unit_text = trim(io_safe_output( $unit_text = trim(io_safe_output(
modules_get_unit($layoutData['id_agente_modulo']))); modules_get_unit($layoutData['id_agente_modulo'])));
@ -1759,6 +1771,11 @@ function visual_map_print_item($mode = "read", $layoutData,
" <br>" . __("Last value: ") " <br>" . __("Last value: ")
. remove_right_zeros(number_format($value, $config['graph_precision'])).$unit_text; . remove_right_zeros(number_format($value, $config['graph_precision'])).$unit_text;
} }
if ($layoutData['id_metaconsole'] != 0) {
//Restore db connection
metaconsole_restore_db();
}
} }
if(get_parameter('action') == 'edit'){ if(get_parameter('action') == 'edit'){
@ -3172,14 +3189,18 @@ function visual_map_get_status_element($layoutData) {
$module_status = db_get_sql ('SELECT estado $module_status = db_get_sql ('SELECT estado
FROM tagente_estado FROM tagente_estado
WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']); WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
switch($module_status) { switch($module_status) {
case AGENT_STATUS_NORMAL: case AGENT_STATUS_NORMAL:
case AGENT_MODULE_STATUS_NORMAL_ALERT:
$layoutData['status_calculated'] = VISUAL_MAP_STATUS_NORMAL; $layoutData['status_calculated'] = VISUAL_MAP_STATUS_NORMAL;
break; break;
case AGENT_MODULE_STATUS_WARNING: case AGENT_MODULE_STATUS_WARNING:
case AGENT_MODULE_STATUS_WARNING_ALERT:
$layoutData['status_calculated'] = VISUAL_MAP_STATUS_WARNING; $layoutData['status_calculated'] = VISUAL_MAP_STATUS_WARNING;
break; break;
case AGENT_STATUS_CRITICAL: case AGENT_STATUS_CRITICAL:
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
$layoutData['status_calculated'] = VISUAL_MAP_STATUS_CRITICAL_BAD; $layoutData['status_calculated'] = VISUAL_MAP_STATUS_CRITICAL_BAD;
break; break;
case AGENT_MODULE_STATUS_NO_DATA: case AGENT_MODULE_STATUS_NO_DATA:
@ -4066,4 +4087,5 @@ function visual_map_macro($label,$module){
return $label; return $label;
} }
?> ?>

View File

@ -1769,6 +1769,10 @@ function pandoraFlotArea( graph_id, values, legend,
update_left_width_canvas(graph_id); update_left_width_canvas(graph_id);
}); });
var max_draw = [];
max_draw['max'] = plot.getAxes().yaxis.max;
max_draw['min'] = plot.getAxes().yaxis.min;
// Connection between plot and miniplot // Connection between plot and miniplot
$('#' + graph_id).bind('plotselected', function (event, ranges) { $('#' + graph_id).bind('plotselected', function (event, ranges) {
// do the zooming if exist menu to undo it // do the zooming if exist menu to undo it
@ -1786,12 +1790,25 @@ function pandoraFlotArea( graph_id, values, legend,
} }
} }
if(thresholded){
var y_recal = axis_thresholded(
threshold_data,
plot.getAxes().yaxis.min,
plot.getAxes().yaxis.max,
red_threshold, extremes,
red_up
);
}
else{
var y_recal = ranges.yaxis;
}
if (thresholded) { if (thresholded) {
data_base_treshold = add_threshold ( data_base_treshold = add_threshold (
data_base, data_base,
threshold_data, threshold_data,
ranges.yaxis.from, ranges.yaxis.from,
ranges.yaxis.to, y_recal.max,
red_threshold, red_threshold,
extremes, extremes,
red_up, red_up,
@ -1822,7 +1839,7 @@ function pandoraFlotArea( graph_id, values, legend,
}], }],
yaxis:{ yaxis:{
min: ranges.yaxis.from, min: ranges.yaxis.from,
max: ranges.yaxis.to, max: y_recal.max,
font: { font: {
size: font_size + 2, size: font_size + 2,
color: legend_color, color: legend_color,
@ -1882,6 +1899,9 @@ function pandoraFlotArea( graph_id, values, legend,
$('#menu_cancelzoom_' + graph_id).attr('src', homeurl + '/images/zoom_cross_grey.png'); $('#menu_cancelzoom_' + graph_id).attr('src', homeurl + '/images/zoom_cross_grey.png');
max_draw['max'] = ranges.yaxis.to;
max_draw['min'] = ranges.yaxis.from;
// don't fire event on the overview to prevent eternal loop // don't fire event on the overview to prevent eternal loop
overview.setSelection(ranges, true); overview.setSelection(ranges, true);
}); });
@ -2174,7 +2194,7 @@ function pandoraFlotArea( graph_id, values, legend,
data_base, data_base,
threshold_data, threshold_data,
plot.getAxes().yaxis.min, plot.getAxes().yaxis.min,
plot.getAxes().yaxis.max, y_recal.max,
red_threshold, red_threshold,
extremes, extremes,
red_up, red_up,
@ -2254,7 +2274,6 @@ function pandoraFlotArea( graph_id, values, legend,
$('#menu_threshold_' + graph_id).click(function() { $('#menu_threshold_' + graph_id).click(function() {
datas = new Array(); datas = new Array();
if (thresholded) { if (thresholded) {
$.each(data_base, function() { $.each(data_base, function() {
datas.push(this); datas.push(this);
@ -2265,7 +2284,8 @@ function pandoraFlotArea( graph_id, values, legend,
plot = $.plot($('#' + graph_id), data_base, plot = $.plot($('#' + graph_id), data_base,
$.extend(true, {}, options, { $.extend(true, {}, options, {
yaxis: { yaxis: {
max: max_draw min: max_draw['min'],
max: max_draw['max']
}, },
xaxis: { xaxis: {
min: plot.getAxes().xaxis.min, min: plot.getAxes().xaxis.min,
@ -2275,8 +2295,6 @@ function pandoraFlotArea( graph_id, values, legend,
thresholded = false; thresholded = false;
} }
else { else {
var max_draw = plot.getAxes().yaxis.datamax;
if(!thresholded){ if(!thresholded){
// Recalculate the y axis // Recalculate the y axis
var y_recal = axis_thresholded( var y_recal = axis_thresholded(
@ -2295,7 +2313,7 @@ function pandoraFlotArea( graph_id, values, legend,
data_base, data_base,
threshold_data, threshold_data,
plot.getAxes().yaxis.min, plot.getAxes().yaxis.min,
plot.getAxes().yaxis.max, y_recal.max,
red_threshold, red_threshold,
extremes, extremes,
red_up, red_up,
@ -2305,7 +2323,8 @@ function pandoraFlotArea( graph_id, values, legend,
plot = $.plot($('#' + graph_id), datas_treshold, plot = $.plot($('#' + graph_id), datas_treshold,
$.extend(true, {}, options, { $.extend(true, {}, options, {
yaxis: { yaxis: {
max: y_recal.max, min: max_draw['min'],
max: y_recal.max
}, },
xaxis: { xaxis: {
min: plot.getAxes().xaxis.min, min: plot.getAxes().xaxis.min,
@ -2330,6 +2349,7 @@ function pandoraFlotArea( graph_id, values, legend,
overview.clearSelection(); overview.clearSelection();
currentRanges = null; currentRanges = null;
thresholded = false; thresholded = false;
max_draw = [];
}); });
// Adjust the menu image on top of the plot // Adjust the menu image on top of the plot
@ -2342,8 +2362,6 @@ function pandoraFlotArea( graph_id, values, legend,
// Add bottom margin in the legend // Add bottom margin in the legend
// Estimated height of 24 (works fine with this data in all browsers) // Estimated height of 24 (works fine with this data in all browsers)
menu_height = 24; menu_height = 24;
var legend_margin_bottom = parseInt(
$('#legend_'+graph_id).css('margin-bottom').split('px')[0]);
$('#legend_'+graph_id).css('margin-bottom', '10px'); $('#legend_'+graph_id).css('margin-bottom', '10px');
parent_height = parseInt($('#menu_'+graph_id).parent().css('height').split('px')[0]); parent_height = parseInt($('#menu_'+graph_id).parent().css('height').split('px')[0]);
adjust_menu(graph_id, plot, parent_height, width, show_legend); adjust_menu(graph_id, plot, parent_height, width, show_legend);

View File

@ -301,4 +301,22 @@ function get_complementary_rgb ($hexcode) {
return $rgbhex; return $rgbhex;
} }
/**
* Returns convert array multidimensional to string whit gluer.
* @param array $array to convert
* @param string glue to implode
*/
function convert_array_multi($array, $glue) {
$result = '';
foreach ($array as $item) {
if (is_array($item)) {
$result .= convert_array_multi($item, $glue) . $glue;
} else {
$result .= $item . $glue;
}
}
$result = substr($result, 0, 0-strlen($glue));
return $result;
}
?> ?>

View File

@ -4617,10 +4617,6 @@ form ul.form_flex li ul li{
flex-direction: column; flex-direction: column;
} }
.events_bar {
margin:0 auto;
}
#snmp_data { #snmp_data {
background: #f9faf9; background: #f9faf9;
} }

View File

@ -447,21 +447,23 @@ if (! isset ($config['id_user'])) {
$_GET["sec"] = "general/logon_ok"; $_GET["sec"] = "general/logon_ok";
break; break;
case 'Dashboard': case 'Dashboard':
$_GET["sec"] = "dashboard"; $_GET["sec"] = "reporting";
$_GET["sec2"] = ENTERPRISE_DIR.'/dashboard/main_dashboard'; $_GET["sec2"] = ENTERPRISE_DIR.'/dashboard/main_dashboard';
$id_dashboard_select = $id_dashboard_select =
db_get_value('id', 'tdashboard', 'name', $home_url); db_get_value('id', 'tdashboard', 'name', $home_url);
$_GET['id_dashboard_select'] = $id_dashboard_select; $_GET['id_dashboard_select'] = $id_dashboard_select;
break; break;
case 'Visual console': case 'Visual console':
$_GET["sec"] = "visualc"; $_GET["sec"] = "network";
$_GET["sec2"] = "operation/visual_console/index"; $_GET["sec2"] = "operation/visual_console/index";
break; break;
case 'Other': case 'Other':
$home_url = io_safe_output($home_url); $home_url = io_safe_output($home_url);
parse_str ($home_url, $res); $url_array = parse_url($home_url);
$_GET["sec"] = $res["sec"]; parse_str ($url_array['query'], $res);
$_GET["sec2"] = $res["sec2"]; foreach ($res as $key => $param) {
$_GET[$key] = $param;
}
break; break;
} }
} }
@ -1034,65 +1036,79 @@ else {
$home_url = $user_info['data_section']; $home_url = $user_info['data_section'];
} }
if ($home_page != '') { if ($home_page != '') {
switch ($home_page) { switch ($home_page) {
case 'Event list': case 'Event list':
require ('operation/events/events.php'); $_GET['sec'] = 'eventos';
$_GET['sec2'] = 'operation/events/events';
break; break;
case 'Group view': case 'Group view':
require ('operation/agentes/group_view.php'); $_GET['sec'] = 'view';
$_GET['sec2'] = 'operation/agentes/group_view';
break; break;
case 'Alert detail': case 'Alert detail':
require ('operation/agentes/alerts_status.php'); $_GET['sec'] = 'view';
$_GET['sec2'] = 'operation/agentes/alerts_status';
break; break;
case 'Tactical view': case 'Tactical view':
require ('operation/agentes/tactical.php'); $_GET['sec'] = 'view';
$_GET['sec2'] = 'operation/agentes/tactical';
break; break;
case 'Default': case 'Default':
require ('general/logon_ok.php'); $_GET['sec2'] = 'general/logon_ok';
break; break;
case 'Dashboard': case 'Dashboard':
$id_dashboard = db_get_value('id', 'tdashboard', 'name', $home_url); $id_dashboard = db_get_value('id', 'tdashboard', 'name', $home_url);
$str = 'sec=visualc&sec2='.ENTERPRISE_DIR.'/dashboard/main_dashboard&id='.$id_dashboard; $str = 'sec=reporting&sec2='.ENTERPRISE_DIR.'/dashboard/main_dashboard&id='.$id_dashboard;
parse_str($str, $res); parse_str($str, $res);
foreach ($res as $key => $param) { foreach ($res as $key => $param) {
$_GET[$key] = $param; $_GET[$key] = $param;
} }
require(ENTERPRISE_DIR.'/dashboard/main_dashboard.php');
break; break;
case 'Visual console': case 'Visual console':
$id_visualc = db_get_value('id', 'tlayout', 'name', $home_url); $id_visualc = db_get_value('id', 'tlayout', 'name', $home_url);
if (($home_url == '') || ($id_visualc == false)) { if (($home_url == '') || ($id_visualc == false)) {
$str = 'sec=visualc&sec2=operation/visual_console/index&refr=60'; $str = 'sec=network&sec2=operation/visual_console/index&refr=60';
} }
else else
$str = 'sec=visualc&sec2=operation/visual_console/render_view&id='.$id_visualc .'&refr=60'; $str = 'sec=network&sec2=operation/visual_console/render_view&id='.$id_visualc .'&refr=60';
parse_str($str, $res); parse_str($str, $res);
foreach ($res as $key => $param) { foreach ($res as $key => $param) {
$_GET[$key] = $param; $_GET[$key] = $param;
} }
require($_GET["sec2"] . '.php');
break; break;
case 'Other': case 'Other':
$home_url = io_safe_output($home_url); $home_url = io_safe_output($home_url);
parse_str ($home_url, $res); $url_array = parse_url($home_url);
parse_str ($url_array['query'], $res);
foreach ($res as $key => $param) { foreach ($res as $key => $param) {
$_GET[$key] = $param; $_GET[$key] = $param;
} }
break;
}
if (isset($_GET['sec2'])) { if (isset($_GET['sec2'])) {
$file = $_GET['sec2'] . '.php'; $file = $_GET['sec2'] . '.php';
// Translate some secs
if (!file_exists ($file)) { $main_sec = get_sec($_GET['sec']);
$_GET['sec'] = $main_sec == false ? $_GET['sec'] : $main_sec;
if (
!file_exists ($file) ||
(
$_GET['sec2'] != 'general/logon_ok' &&
enterprise_hook ('enterprise_acl',
array ($config['id_user'], $_GET['sec'], $_GET['sec2'], true,
isset($_GET['sec3']) ? $_GET['sec3'] : '')
) == false
)
) {
unset($_GET['sec2']); unset($_GET['sec2']);
require('general/logon_ok.php'); require ("general/noaccess.php");
} }
else { else {
require($file); require($file);
} }
} } else {
break; require ("general/noaccess.php");
} }
} }
else { else {

View File

@ -70,8 +70,8 @@
<body> <body>
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.724'; $version = '7.0NG.725';
$build = '180723'; $build = '180808';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -655,10 +655,9 @@ class Ui {
echo " <link rel='stylesheet' href='include/style/main.css' />\n"; echo " <link rel='stylesheet' href='include/style/main.css' />\n";
echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.3.1.css' />\n"; echo " <link rel='stylesheet' href='include/style/jquery.mobile-1.3.1.css' />\n";
//echo " <link rel='stylesheet' href='http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.css' />\n";
echo " <script src='include/javascript/jquery.js'></script>\n"; echo " <script src='include/javascript/jquery.js'></script>\n";
echo " <script src='include/javascript/jquery.mobile-1.3.1.js'></script>\n"; echo " <script src='include/javascript/jquery.mobile-1.3.1.js'></script>\n";
//echo " <script src='http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.js'></script>\n"; echo " <script src='../include/javascript/pandora.js'></script>\n";
echo " </head>\n"; echo " </head>\n";
echo " <body>\n"; echo " <body>\n";

View File

@ -270,6 +270,7 @@ class Modules {
} }
private function getListModules($page = 0, $ajax = false) { private function getListModules($page = 0, $ajax = false) {
global $config;
$system = System::getInstance(); $system = System::getInstance();
$user = User::getInstance(); $user = User::getInstance();
@ -591,33 +592,16 @@ class Modules {
} }
} }
$is_snapshot = is_snapshot_data ($module["datos"]); $is_snapshot = is_snapshot_data ($module["datos"]);
$is_large_image = is_text_to_black_string ($module["datos"]);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$link = ui_get_snapshot_link( array(
'id_module' => $module['id_agente_modulo'],
'module_name' => $module['module_name']
));
$handle = "snapshot" . "_" . $module["id_agente_modulo"]; $row[7] = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
$url = 'include/procesos.php?agente=' . $module["id_agente_modulo"]; } else {
$link = "window.open('../operation/agentes/snapshot_view.php?" .
"id=" . $module["id_agente_modulo"] .
"&refr=" . $module["module_interval"]."','".$handle."','width=700, height=480')";
if ($is_snapshot) {
if (is_image_data($module["datos"])) {
$row[7] = $row[__('Data')] = '<a href="javascript:' . $link . '">' .
html_print_image("images/photo.png", true,
array("border" => '0',
"alt" => "",
"title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
else {
$row[7] = $row[__('Data')] = '<a href="javascript:' . $link . '">' .
html_print_image("images/default_list.png", true,
array("border" => '0',
"alt" => "",
"title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
}
else {
$row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">' . $row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">' .
'<span style="display: none;" class="show_collapside">' . '<span style="display: none;" class="show_collapside">' .
$row[__('Status')] . '&nbsp;&nbsp;</span>' . $row[__('Status')] . '&nbsp;&nbsp;</span>' .
@ -627,17 +611,6 @@ class Modules {
$this->id_agent . '">' . $output . '</a>' . '</span>'; $this->id_agent . '">' . $output . '</a>' . '</span>';
} }
/*
'<span style="white-space: nowrap;">' .
'<span style="display: none;" class="show_collapside">' .
$row[__('Status')] . '&nbsp;&nbsp;</span>' .
'<a data-ajax="false" class="ui-link" ' .
'href="index.php?page=module_graph&id=' .
$module['id_agente_modulo'] . '&id_agent=' .
$this->id_agent . '">' . $output . '</a>' . '</span>';*/
if (!$ajax) { if (!$ajax) {
unset($row[0]); unset($row[0]);
if ($this->columns['agent']) { if ($this->columns['agent']) {
@ -817,20 +790,6 @@ class Modules {
$string = '(' . implode(' - ', $filters_to_serialize) . ')'; $string = '(' . implode(' - ', $filters_to_serialize) . ')';
//~ $status = $this->list_status[$this->status];
//~
//~ $group = groups_get_name($this->group, true);
//~
//~ $module_group = db_get_value('name',
//~ 'tmodule_group', 'id_mg', $this->module_group);
//~ $module_group = io_safe_output($module_group);
//~
//~ $string = sprintf(
//~ __("(Status: %s - Group: %s - Module group: %s - Free Search: %s)"),
//~ $status, $group, $module_group, $this->free_search);
return $string; return $string;
} }
} }

View File

@ -449,10 +449,8 @@ $table->align = array ();
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if ($print_agent) { if ($print_agent) {
if (!is_metaconsole()) {
$table->head[0] = "<span title='" . __('Policy') . "'>" . $table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
__('P.') . "</span>";
}
$table->head[1] = "<span title='" . __('Standby') . "'>" . $table->head[1] = "<span title='" . __('Standby') . "'>" .
__('S.') . "</span>"; __('S.') . "</span>";
@ -496,9 +494,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
} }
} }
else { else {
if (!is_metaconsole()) {
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>"; $table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
}
$table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>"; $table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";

View File

@ -108,21 +108,18 @@ if (is_ajax ()) {
$value = $module_value; $value = $module_value;
} }
else{ else{
// If carriage returns present... then is a "Snapshot" data (full command output)
$is_snapshot = is_snapshot_data ( $module_value );
$module = modules_get_agentmodule($id_module); $module = modules_get_agentmodule($id_module);
if (($config['command_snapshot']) && ($is_snapshot)){ $is_snapshot = is_snapshot_data ($module_value);
$handle = "snapshot"."_".$module["id_agente_modulo"]; $is_large_image = is_text_to_black_string ($module_value);
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"]; if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$win_handle = dechex(crc32($handle)); $link = ui_get_snapshot_link( array(
'id_module' => $module["id_agente_modulo"],
$link ="winopeng_var('operation/agentes/snapshot_view.php?id=".$module["id_agente_modulo"]."&refr=".$module["current_interval"]."&label=".$module["nombre"]."','".$win_handle."', 700,480)"; 'interval' => $module["current_interval"],
'module_name' => $module["nombre"]
$value = '<a href="javascript:'.$link.'">' . html_print_image("images/default_list.png", true, array("border" => '0', "alt" => "", "title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;'; ));
} $value = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
else { } else {
$value = ui_print_module_string_value( $value = ui_print_module_string_value(
$module_value, $module["id_agente_modulo"], $module_value, $module["id_agente_modulo"],
$module["current_interval"], $module["module_name"]); $module["current_interval"], $module["module_name"]);

View File

@ -30,6 +30,7 @@ require_once ($config['homedir'] . '/include/functions_custom_graphs.php');
require_once ($config['homedir'] . '/include/functions_modules.php'); require_once ($config['homedir'] . '/include/functions_modules.php');
require_once ($config['homedir'] . '/include/functions_agents.php'); require_once ($config['homedir'] . '/include/functions_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php'); require_once ($config['homedir'] . '/include/functions_tags.php');
enterprise_include_once('include/functions_agents.php');
check_login(); check_login();
@ -108,28 +109,8 @@ $interface_traffic_modules = array(
<body bgcolor="#ffffff" style='background:#ffffff;'> <body bgcolor="#ffffff" style='background:#ffffff;'>
<?php <?php
// ACL // ACL
$permission = false; $all_groups = agents_get_all_groups_agent($agent_id);
$agent_group = (int) agents_get_agent_group($agent_id); if (!check_acl_one_of_groups ($config["id_user"], $all_groups, "AR")) {
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
// The traffic modules should belong to the agent id
$in_agent_id = (int) db_get_value("id_agente", "tagente_modulo", "id_agente_modulo", $params['traffic_module_in']);
$out_agent_id = (int) db_get_value("id_agente", "tagente_modulo", "id_agente_modulo", $params['traffic_module_out']);
$traffic_modules_belong_to_agent = $agent_id == $in_agent_id && $agent_id == $out_agent_id;
if (!empty($agent_group) && !empty($params['traffic_module_in'])
&& !empty($params['traffic_module_out']) && $traffic_modules_belong_to_agent) {
if ($strict_user) {
if (tags_check_acl_by_module($params['traffic_module_in'], $config['id_user'], 'RR') === true
&& tags_check_acl_by_module($params['traffic_module_out'], $config['id_user'], 'RR') === true)
$permission = true;
}
else {
$permission = check_acl($config['id_user'], $agent_group, "RR");
}
}
if (!$permission) {
require ($config['homedir'] . "/general/noaccess.php"); require ($config['homedir'] . "/general/noaccess.php");
exit; exit;
} }
@ -140,7 +121,7 @@ $interface_traffic_modules = array(
$height = (int) get_parameter("height", 245); $height = (int) get_parameter("height", 245);
$start_date = (string) get_parameter("start_date", date("Y-m-d")); $start_date = (string) get_parameter("start_date", date("Y-m-d"));
$start_time = get_parameter ("start_time", date("H:i:s")); $start_time = get_parameter ("start_time", date("H:i:s"));
$zoom = (int) get_parameter ("zoom", 1); $zoom = (int) get_parameter ("zoom", $config['zoom_graph']);
$baseline = get_parameter ("baseline", 0); $baseline = get_parameter ("baseline", 0);
$show_percentil = get_parameter ("show_percentil", 0); $show_percentil = get_parameter ("show_percentil", 0);
$fullscale = get_parameter("fullscale"); $fullscale = get_parameter("fullscale");

View File

@ -83,6 +83,10 @@ echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/
</head> </head>
<body bgcolor="#ffffff" style='background:#ffffff;'> <body bgcolor="#ffffff" style='background:#ffffff;'>
<?php <?php
if (!check_acl ($config["id_user"], 0, "AR")) {
require ($config['homedir'] . "/general/noaccess.php");
exit;
}
$config['extensions'] = extensions_get_extensions (false, '../../'); $config['extensions'] = extensions_get_extensions (false, '../../');
if (!extensions_is_enabled_extension("realtime_graphs.php")) { if (!extensions_is_enabled_extension("realtime_graphs.php")) {
ui_print_error_message(__('Realtime extension is not enabled.')); ui_print_error_message(__('Realtime extension is not enabled.'));

View File

@ -28,6 +28,7 @@ require_once ($config['homedir'] . '/include/functions_graph.php');
require_once ($config['homedir'] . '/include/functions_modules.php'); require_once ($config['homedir'] . '/include/functions_modules.php');
require_once ($config['homedir'] . '/include/functions_agents.php'); require_once ($config['homedir'] . '/include/functions_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php'); require_once ($config['homedir'] . '/include/functions_tags.php');
enterprise_include_once('include/functions_agents.php');
check_login (); check_login ();
@ -38,25 +39,40 @@ if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
} }
$id = get_parameter('id'); $id = get_parameter('id');
$label = get_parameter ("label"); $id_node = get_parameter("id_node", 0);
$last_data = get_parameter("last_data", '');
$last_timestamp = get_parameter("timestamp", ''); // Get the data
// FIXME: Support to old call snapshow_view calls. Remove it when all are migrated if ($id_node > 0) {
if (empty($last_data)) { $connection = metaconsole_get_connection_by_id($id_node);
$row = db_get_row_sql("SELECT * if (metaconsole_load_external_db($connection) != NOERR) {
FROM tagente_estado ui_print_error_message(__('Cannot connect with node to display the module data.'));
WHERE id_agente_modulo = $id"); exit;
$last_data = io_safe_output($row["datos"]); }
$last_timestamp = $row["timestamp"]; }
$row_module = modules_get_agentmodule($id);
$row_state = db_get_row('tagente_estado', 'id_agente_modulo', $id);
if ($id_node > 0) {
metaconsole_restore_db();
} }
// TODO - Put ACL here // Build the info
$label = get_parameter ("label", io_safe_output($row_module['module_name']));
$last_timestamp = get_parameter("timestamp", $row_state['timestamp']);
$last_data = io_safe_output($row_state["datos"]);
$refresh = (int) get_parameter ("refr", $row_state['current_interval']);
// ACL check
$all_groups = agents_get_all_groups_agent ($row_state['id_agente']);
if (!check_acl_one_of_groups($config['id_user'], $all_groups, "AR")) {
require ($config['homedir'] . "/general/noaccess.php");
exit;
}
?> ?>
<html> <html>
<head> <head>
<?php <?php
// Parsing the refresh before sending any header // Parsing the refresh before sending any header
$refresh = (int) get_parameter ("refr", -1);
if ($refresh > 0) { if ($refresh > 0) {
$query = ui_get_url_refresh (false); $query = ui_get_url_refresh (false);
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />'; echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
@ -68,30 +84,24 @@ if (empty($last_data)) {
</head> </head>
<body style='background:#000; color: #ccc;'> <body style='background:#000; color: #ccc;'>
<?php <?php
$row = db_get_row_sql("SELECT *
FROM tagente_estado
WHERE id_agente_modulo = $id");
echo "<h2 style='text-align:center;' id='title_snapshot_view'>"; echo "<h2 style='text-align:center;' id='title_snapshot_view'>";
echo __("Current data at"); echo __("Current data at %s", $last_timestamp);
echo " ";
echo $last_timestamp;
echo "</h2>"; echo "</h2>";
if (is_image_data($last_data)) { if (is_image_data($last_data)) {
echo '<center><img src="' . $last_data . '" alt="image" style="width:100%"/></center>'; echo '<center><img src="' . $last_data . '" alt="image" style="width:100%"/></center>';
} }
else { else {
$datos = preg_replace ('/</', '&lt;', $datos); $last_data = preg_replace ('/</', '&lt;', $last_data);
$datos = preg_replace ('/>/', '&gt;', $datos); $last_data = preg_replace ('/>/', '&gt;', $last_data);
$datos = preg_replace ('/\n/i','<br>',$datos); $last_data = preg_replace ('/\n/i','<br>',$last_data);
$datos = preg_replace ('/\s/i','&nbsp;',$datos); $last_data = preg_replace ('/\s/i','&nbsp;',$last_data);
echo "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>"; echo "<div id='result_div' style='width: 100%; height: 100%; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
echo $last_data; echo $last_data;
echo "</div>"; echo "</div>";
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function getScrollbarWidth() { function getScrollbarWidth() {
var div = $('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div></div>'); var div = $('<div style=""></div>');
$('body').append(div); $('body').append(div);
var w1 = $('div', div).innerWidth(); var w1 = $('div', div).innerWidth();
div.css('overflow-y', 'auto'); div.css('overflow-y', 'auto');

View File

@ -29,6 +29,7 @@ require_once ($config['homedir'] . '/include/functions_graph.php');
require_once ($config['homedir'] . '/include/functions_modules.php'); require_once ($config['homedir'] . '/include/functions_modules.php');
require_once ($config['homedir'] . '/include/functions_agents.php'); require_once ($config['homedir'] . '/include/functions_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php'); require_once ($config['homedir'] . '/include/functions_tags.php');
enterprise_include_once('include/functions_agents.php');
check_login (); check_login ();
@ -112,11 +113,8 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
} }
// ACL // ACL
$permission = false; $all_groups = agents_get_all_groups_agent($agent_id);
$agent_group = (int) agents_get_agent_group($agent_id); if (!check_acl_one_of_groups ($config["id_user"], $all_groups, "AR")) {
$permission = check_acl($config['id_user'], $agent_group, "AR");
if (!$permission) {
require ($config['homedir'] . "/general/noaccess.php"); require ($config['homedir'] . "/general/noaccess.php");
exit; exit;
} }
@ -131,7 +129,7 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$start_time = get_parameter ("start_time", date("H:i:s")); $start_time = get_parameter ("start_time", date("H:i:s"));
$draw_events = get_parameter ("draw_events", 0); $draw_events = get_parameter ("draw_events", 0);
$graph_type = get_parameter ("type", "sparse"); $graph_type = get_parameter ("type", "sparse");
$zoom = get_parameter ("zoom", 1); $zoom = get_parameter ("zoom", $config['zoom_graph']);
$baseline = get_parameter ("baseline", 0); $baseline = get_parameter ("baseline", 0);
$show_events_graph = get_parameter ("show_events_graph", 0); $show_events_graph = get_parameter ("show_events_graph", 0);
$show_percentil = get_parameter ("show_percentil", 0); $show_percentil = get_parameter ("show_percentil", 0);

View File

@ -732,8 +732,6 @@ switch ($sortField) {
break; break;
} }
switch ($config['dbtype']) {
case 'mysql':
$sql = 'SELECT $sql = 'SELECT
(SELECT GROUP_CONCAT(ttag.name SEPARATOR \',\') (SELECT GROUP_CONCAT(ttag.name SEPARATOR \',\')
FROM ttag FROM ttag
@ -778,100 +776,6 @@ switch ($config['dbtype']) {
GROUP BY tagente_modulo.id_agente_modulo GROUP BY tagente_modulo.id_agente_modulo
ORDER BY ' . $order['field'] . " " . $order['order'] . ' ORDER BY ' . $order['field'] . " " . $order['order'] . '
LIMIT '.$offset.",".$limit_sql; LIMIT '.$offset.",".$limit_sql;
break;
case 'postgresql':
if (strstr($config['dbversion'], "8.4") !== false) {
$string_agg = 'array_to_string(array_agg(ttag.name), \',\')';
}
else {
$string_agg = 'STRING_AGG(ttag.name, \',\')';
}
$sql = 'SELECT
(SELECT ' . $string_agg . '
FROM ttag
WHERE ttag.id_tag IN (
SELECT ttag_module.id_tag
FROM ttag_module
WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo))
AS tags,
tagente_modulo.id_agente_modulo,
tagente_modulo.id_modulo,
tagente.intervalo AS agent_interval,
tagente.alias AS agent_alias,
tagente.nombre AS agent_name,
tagente_modulo.nombre AS module_name,
tagente_modulo.history_data,
tagente_modulo.flag AS flag,
tagente.id_grupo AS id_group,
tagente.id_agente AS id_agent,
tagente_modulo.id_tipo_modulo AS module_type,
tagente_modulo.module_interval,
tagente_estado.datos,
tagente_estado.estado,
tagente_modulo.min_warning,
tagente_modulo.max_warning,
tagente_modulo.str_warning,
tagente_modulo.min_critical,
tagente_modulo.unit,
tagente_modulo.max_critical,
tagente_modulo.str_critical,
tagente_modulo.extended_info,
tagente_modulo.critical_inverse,
tagente_modulo.warning_inverse,
tagente_modulo.critical_instructions,
tagente_modulo.warning_instructions,
tagente_modulo.unknown_instructions,
tagente_estado.utimestamp AS utimestamp' .
$sql_from .
$sql_conditions_all .
' LIMIT ' . $limit_sql . ' OFFSET ' . $offset;
break;
case 'oracle':
$set = array();
$set['limit'] = $limit_sql;
$set['offset'] = $offset;
$sql = 'SELECT
(SELECT LISTAGG(ttag.name, \',\') WITHIN GROUP (ORDER BY ttag.name)
FROM ttag
WHERE ttag.id_tag IN (
SELECT ttag_module.id_tag
FROM ttag_module
WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo))
AS tags,
tagente_modulo.id_agente_modulo,
tagente_modulo.id_modulo,
tagente.intervalo AS agent_interval,
tagente.alias AS agent_alias,
tagente.nombre AS agent_name,
tagente_modulo.nombre AS module_name,
tagente_modulo.history_data,
tagente_modulo.flag AS flag,
tagente.id_grupo AS id_group,
tagente.id_agente AS id_agent,
tagente_modulo.id_tipo_modulo AS module_type,
tagente_modulo.module_interval,
tagente_estado.datos,
tagente_estado.estado,
tagente_modulo.min_warning,
tagente_modulo.max_warning,
tagente_modulo.str_warning,
tagente_modulo.unit,
tagente_modulo.min_critical,
tagente_modulo.max_critical,
tagente_modulo.str_critical,
tagente_modulo.extended_info,
tagente_modulo.critical_inverse,
tagente_modulo.warning_inverse,
tagente_modulo.critical_instructions,
tagente_modulo.warning_instructions,
tagente_modulo.unknown_instructions,
tagente_estado.utimestamp AS utimestamp' .
$sql_from .
$sql_conditions_all;
$sql = oracle_recode_query ($sql, $set);
break;
}
if (! defined ('METACONSOLE')) { if (! defined ('METACONSOLE')) {
$result = db_get_all_rows_sql ($sql); $result = db_get_all_rows_sql ($sql);
@ -1043,7 +947,18 @@ if (!empty($result)) {
$data = array (); $data = array ();
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if(is_metaconsole()){
$node = metaconsole_get_connection_by_id($row['server_id']);
if (metaconsole_load_external_db($node) !== NOERR) {
// Restore the default connection.
metaconsole_restore_db();
$errors++;
break;
}
}
$policyInfo = policies_info_module_policy($row['id_agente_modulo']); $policyInfo = policies_info_module_policy($row['id_agente_modulo']);
if ($policyInfo === false) if ($policyInfo === false)
$data[0] = ''; $data[0] = '';
else { else {
@ -1074,13 +989,23 @@ if (!empty($result)) {
$title = __('(Unlinked) ') . $policyInfo['name_policy']; $title = __('(Unlinked) ') . $policyInfo['name_policy'];
} }
} }
if(is_metaconsole()){
$data[0] = '<a href="?sec=gmodules&amp;sec2=advanced/policymanager&amp;id=' . $policyInfo['id_policy'] . '">' .
html_print_image($img,true, array('title' => $title)) .
'</a>';
}
else{
$data[0] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id_policy'] . '">' . $data[0] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id_policy'] . '">' .
html_print_image($img,true, array('title' => $title)) . html_print_image($img,true, array('title' => $title)) .
'</a>'; '</a>';
} }
} }
if(is_metaconsole()){
metaconsole_restore_db();
}
}
$agent_alias = !empty($row['agent_alias']) ? $row['agent_alias'] : $row['agent_name']; $agent_alias = !empty($row['agent_alias']) ? $row['agent_alias'] : $row['agent_name'];
// TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view // TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view
@ -1379,29 +1304,12 @@ if (!empty($result)) {
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) { if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$link = ui_get_snapshot_link( array( $link = ui_get_snapshot_link( array(
'id_module' => $row['id_agente_modulo'], 'id_module' => $row['id_agente_modulo'],
'last_data' => $row['datos'],
'timestamp' => $row['timestamp'],
'interval' => $row['current_interval'], 'interval' => $row['current_interval'],
'module_name' => $row['module_name'] 'module_name' => $row['module_name'],
'id_node' => $row['server_id']
)); ));
$salida = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
if($is_large_image){ } else {
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/default_list.png', true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))) . '</a> &nbsp;&nbsp;';
}
else {
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/photo.png', true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))) . '</a> &nbsp;&nbsp;';
}
}
else {
$sub_string = substr(io_safe_output($row['datos']), 0, 12); $sub_string = substr(io_safe_output($row['datos']), 0, 12);
if ($module_value == $sub_string) { if ($module_value == $sub_string) {
if ($module_value == 0 && !$sub_string) { if ($module_value == 0 && !$sub_string) {

View File

@ -17,6 +17,9 @@ global $config;
require_once ($config["homedir"] . "/include/functions_ui.php"); require_once ($config["homedir"] . "/include/functions_ui.php");
$sort_field = get_parameter("sort_field", "timestamp");
$sort = get_parameter("sort", "down");
$table = new stdClass(); $table = new stdClass();
if(!isset($table->width)) { if(!isset($table->width)) {
@ -130,7 +133,7 @@ else {
//headers //headers
$i = 0; $i = 0;
$table->head[$i] = __('ID'); $table->head[$i] = __('ID') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
@ -141,104 +144,104 @@ else {
$i++; $i++;
} }
if (in_array('estado', $show_fields)) { if (in_array('estado', $show_fields)) {
$table->head[$i] = __('Status'); $table->head[$i] = __('Status') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=status&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=status&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('id_evento', $show_fields)) { if (in_array('id_evento', $show_fields)) {
$table->head[$i] = __('Event ID'); $table->head[$i] = __('Event ID') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('evento', $show_fields)) { if (in_array('evento', $show_fields)) {
$table->head[$i] = __('Event Name'); $table->head[$i] = __('Event Name') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_name&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$table->style[$i] = 'min-width: 200px; max-width: 350px; word-break: break-all;'; $table->style[$i] = 'min-width: 200px; max-width: 350px; word-break: break-all;';
$i++; $i++;
} }
if (in_array('id_agente', $show_fields)) { if (in_array('id_agente', $show_fields)) {
$table->head[$i] = __('Agent name'); $table->head[$i] = __('Agent name') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=agent_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=agent_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$table->style[$i] = 'max-width: 350px; word-break: break-all;'; $table->style[$i] = 'max-width: 350px; word-break: break-all;';
$i++; $i++;
} }
if (in_array('timestamp', $show_fields)) { if (in_array('timestamp', $show_fields)) {
$table->head[$i] = __('Timestamp'); $table->head[$i] = __('Timestamp') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=timestamp&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=timestamp&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('id_usuario', $show_fields)) { if (in_array('id_usuario', $show_fields)) {
$table->head[$i] = __('User'); $table->head[$i] = __('User') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=user_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=user_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('owner_user', $show_fields)) { if (in_array('owner_user', $show_fields)) {
$table->head[$i] = __('Owner'); $table->head[$i] = __('Owner') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=owner&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=owner&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('id_grupo', $show_fields)) { if (in_array('id_grupo', $show_fields)) {
$table->head[$i] = __('Group'); $table->head[$i] = __('Group') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=group_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=group_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('event_type', $show_fields)) { if (in_array('event_type', $show_fields)) {
$table->head[$i] = __('Event type'); $table->head[$i] = __('Event Type') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_type&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_type&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$table->style[$i] = 'min-width: 85px;'; $table->style[$i] = 'min-width: 85px;';
$i++; $i++;
} }
if (in_array('id_agentmodule', $show_fields)) { if (in_array('id_agentmodule', $show_fields)) {
$table->head[$i] = __('Agent Module'); $table->head[$i] = __('Module Name') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=module_name&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=module_name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('id_alert_am', $show_fields)) { if (in_array('id_alert_am', $show_fields)) {
$table->head[$i] = __('Alert'); $table->head[$i] = __('Alert') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=alert_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=alert_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('criticity', $show_fields)) { if (in_array('criticity', $show_fields)) {
$table->head[$i] = __('Severity'); $table->head[$i] = __('Severity') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=criticity&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=criticity&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('user_comment', $show_fields)) { if (in_array('user_comment', $show_fields)) {
$table->head[$i] = __('Comment'); $table->head[$i] = __('Comment') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=comment&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=comment&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('tags', $show_fields)) { if (in_array('tags', $show_fields)) {
$table->head[$i] = __('Tags'); $table->head[$i] = __('Tags') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=tags&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=tags&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('source', $show_fields)) { if (in_array('source', $show_fields)) {
$table->head[$i] = __('Source'); $table->head[$i] = __('Source') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=source&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=source&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('id_extra', $show_fields)) { if (in_array('id_extra', $show_fields)) {
$table->head[$i] = __('Extra ID'); $table->head[$i] = __('Extra ID') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=extra_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=extra_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
} }
if (in_array('ack_utimestamp', $show_fields)) { if (in_array('ack_utimestamp', $show_fields)) {
$table->head[$i] = __('ACK Timestamp'); $table->head[$i] = __('ACK Timestamp') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=ack_timestamp&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=ack_utimestamp&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left'; $table->align[$i] = 'left';
$i++; $i++;
@ -249,6 +252,18 @@ else {
$i++; $i++;
} }
if (in_array('data', $show_fields)) {
$table->head[$i] = __('Data') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=data&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=data&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->align[$i] = 'left';
$i++;
}
if (in_array('module_status', $show_fields)) {
$table->head[$i] = __('Module Status') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=module_status&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=module_status&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';;
$table->align[$i] = 'left';
$i++;
}
if ($i != 0 && $allow_action) { if ($i != 0 && $allow_action) {
$table->head[$i] = __('Action'); $table->head[$i] = __('Action');
$table->align[$i] = 'left'; $table->align[$i] = 'left';
@ -663,6 +678,20 @@ else {
$table->cellclass[count($table->data)][$i] = $myclass; $table->cellclass[count($table->data)][$i] = $myclass;
$i++; $i++;
} }
if (in_array('data',$show_fields)) {
$data[$i] = $event["data"];
if($data[$i] %1 == 0)
$data[$i]= number_format($data[$i], 0);
else
$data[$i]= number_format($data[$i], 2);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('module_status',$show_fields)) {
$data[$i] = modules_get_modules_status ($event["module_status"]);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if ($i != 0 && $allow_action) { if ($i != 0 && $allow_action) {
//Actions //Actions
@ -743,7 +772,7 @@ else {
if (!empty ($table->data)) { if (!empty ($table->data)) {
if ($allow_pagination) { if ($allow_pagination) {
ui_pagination ($total_events, $url, $offset, $pagination); ui_pagination ($total_events, "index.php?sec=eventos&sec2=operation/events/events&sort_field=$sort_field&sort=$sort&disabled=$disabled", $offset, $pagination);
} }
if ($allow_action) { if ($allow_action) {

View File

@ -28,6 +28,10 @@ enterprise_include_once('include/functions_events.php');
check_login (); check_login ();
$sort_field = get_parameter("sort_field", "timestamp");
$sort_order = get_parameter("sort", "down");
$event_a = check_acl ($config['id_user'], 0, "ER"); $event_a = check_acl ($config['id_user'], 0, "ER");
$event_w = check_acl ($config['id_user'], 0, "EW"); $event_w = check_acl ($config['id_user'], 0, "EW");
$event_m = check_acl ($config['id_user'], 0, "EM"); $event_m = check_acl ($config['id_user'], 0, "EM");
@ -758,7 +762,8 @@ elseif ($group_rep == 1) {
$history, $history,
false, false,
false, false,
'DESC'); $sort_order,
$sort_field);
} }
elseif ($group_rep == 2) { elseif ($group_rep == 2) {
$filter_resume['duplicate'] = $group_rep; $filter_resume['duplicate'] = $group_rep;

View File

@ -2,8 +2,8 @@
# Pandora FMS Console # Pandora FMS Console
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.724 %define version 7.0NG.725
%define release 180723 %define release 180808
# 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

@ -2,8 +2,8 @@
# Pandora FMS Console # Pandora FMS Console
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.724 %define version 7.0NG.725
%define release 180723 %define release 180808
%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

@ -9,7 +9,7 @@
# This code is licensed under GPL 2.0 license. # This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.724" PI_VERSION="7.0NG.725"
FORCE=0 FORCE=0
DESTDIR="" DESTDIR=""
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`

View File

@ -641,6 +641,8 @@ CREATE TABLE IF NOT EXISTS `tevento` (
`owner_user` VARCHAR(100) NOT NULL DEFAULT '', `owner_user` VARCHAR(100) NOT NULL DEFAULT '',
`ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0', `ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0',
`custom_data` TEXT NOT NULL, `custom_data` TEXT NOT NULL,
`data` double(22,5) default NULL,
`module_status` int(4) NOT NULL default '0',
PRIMARY KEY (`id_evento`), PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`), KEY `idx_agente` (`id_agente`),
KEY `idx_agentmodule` (`id_agentmodule`), KEY `idx_agentmodule` (`id_agentmodule`),
@ -2878,6 +2880,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
`ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0', `ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0',
`server_id` int(10) NOT NULL, `server_id` int(10) NOT NULL,
`custom_data` TEXT NOT NULL DEFAULT '', `custom_data` TEXT NOT NULL DEFAULT '',
`data` double(22,5) default NULL,
`module_status` int(4) NOT NULL default '0',
PRIMARY KEY (`id_evento`), PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`), KEY `idx_agente` (`id_agente`),
KEY `idx_agentmodule` (`id_agentmodule`), KEY `idx_agentmodule` (`id_agentmodule`),
@ -2923,6 +2927,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
`ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0', `ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0',
`server_id` int(10) NOT NULL, `server_id` int(10) NOT NULL,
`custom_data` TEXT NOT NULL DEFAULT '', `custom_data` TEXT NOT NULL DEFAULT '',
`data` double(22,5) default NULL,
`module_status` int(4) NOT NULL default '0',
PRIMARY KEY (`id_evento`), PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`), KEY `idx_agente` (`id_agente`),
KEY `idx_agentmodule` (`id_agentmodule`), KEY `idx_agentmodule` (`id_agentmodule`),
@ -3198,3 +3204,97 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
ON DELETE CASCADE ON DELETE CASCADE
) engine=InnoDB DEFAULT CHARSET=utf8; ) engine=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tautoconfig`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tautoconfig` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`description` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tautoconfig_rules`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tautoconfig_rules` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_autoconfig` int(10) unsigned NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`operator` enum('AND','OR') DEFAULT 'OR',
`type` enum('alias','ip-range','group','os','custom-field','script','server-name') DEFAULT 'alias',
`value` text,
`custom` text,
PRIMARY KEY (`id`),
KEY `id_autoconfig` (`id_autoconfig`),
CONSTRAINT `tautoconfig_rules_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tautoconfig_actions`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_autoconfig` int(10) unsigned NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`action_type` enum('set-group', 'set-secondary-group', 'apply-policy', 'launch-script', 'launch-event', 'launch-alert-action', 'raw-config') DEFAULT 'launch-event',
`value` text,
`custom` text,
PRIMARY KEY (`id`),
KEY `id_autoconfig` (`id_autoconfig`),
CONSTRAINT `tautoconfig_action_ibfk_1` FOREIGN KEY (`id_autoconfig`) REFERENCES `tautoconfig` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tlayout_template`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
`background_color` varchar(50) NOT NULL default '#FFF',
`is_favourite` INTEGER UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tlayout_template_data`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`id_layout_template` INTEGER UNSIGNED NOT NULL,
`pos_x` INTEGER UNSIGNED NOT NULL default 0,
`pos_y` INTEGER UNSIGNED NOT NULL default 0,
`height` INTEGER UNSIGNED NOT NULL default 0,
`width` INTEGER UNSIGNED NOT NULL default 0,
`label` TEXT,
`image` varchar(200) DEFAULT "",
`type` tinyint(1) UNSIGNED NOT NULL default 0,
`period` INTEGER UNSIGNED NOT NULL default 3600,
`module_name` text NOT NULL,
`agent_name` varchar(600) BINARY NOT NULL default '',
`id_layout_linked` INTEGER unsigned NOT NULL default '0',
`parent_item` INTEGER UNSIGNED NOT NULL default 0,
`enable_link` tinyint(1) UNSIGNED NOT NULL default 1,
`id_metaconsole` int(10) NOT NULL default 0,
`id_group` INTEGER UNSIGNED NOT NULL default 0,
`id_custom_graph` INTEGER UNSIGNED NOT NULL default 0,
`border_width` INTEGER UNSIGNED NOT NULL default 0,
`type_graph` varchar(50) NOT NULL default 'area',
`label_position` varchar(50) NOT NULL default 'down',
`border_color` varchar(200) DEFAULT "",
`fill_color` varchar(200) DEFAULT "",
`show_statistics` tinyint(2) NOT NULL default '0',
`id_layout_linked_weight` int(10) NOT NULL default '0',
`element_group` int(10) NOT NULL default '0',
`show_on_top` tinyint(1) NOT NULL default '0',
`clock_animation` varchar(60) NOT NULL default "analogic_1",
`time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''), ('custom_report_front_header', ''),
('custom_report_front_footer', ''), ('custom_report_front_footer', ''),
('MR', 18), ('MR', 19),
('identification_reminder', 1), ('identification_reminder', 1),
('identification_reminder_timestamp', 0), ('identification_reminder_timestamp', 0),
('current_package_enterprise', '724'), ('current_package_enterprise', '726'),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'), ('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
('custom_docs_logo', 'default_docs.png'), ('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'), ('custom_support_logo', 'default_support.png'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.724-180723 Version: 7.0NG.725-180808
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.724-180723" pandora_version="7.0NG.725-180808"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -1,7 +1,7 @@
############################################################################# #############################################################################
# Pandora FMS Server Parameters # Pandora FMS Server Parameters
# Pandora FMS, the Flexible Monitoring System. # Pandora FMS, the Flexible Monitoring System.
# Version 7.0NG.724 # Version 7.0NG.725
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2017 Artica Soluciones Tecnologicas # (c) 2003-2017 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -44,8 +44,8 @@ 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.724"; my $pandora_version = "7.0NG.725";
my $pandora_build = "180723"; my $pandora_build = "180808";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -486,6 +486,8 @@ sub pandora_load_config {
$pa_config->{"provisioningserver_threads"} = 1; # 7.0 720 $pa_config->{"provisioningserver_threads"} = 1; # 7.0 720
$pa_config->{"provisioning_cache_interval"} = 300; # 7.0 720 $pa_config->{"provisioning_cache_interval"} = 300; # 7.0 720
$pa_config->{"autoconfigure_agents"} = 1; # 7.0 725
$pa_config->{'snmp_extlog'} = ""; # 7.0 726 $pa_config->{'snmp_extlog'} = ""; # 7.0 726
# Check for UID0 # Check for UID0
@ -1115,6 +1117,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^provisioning_cache_interval\s+([0-9]*)/i){ elsif ($parametro =~ m/^provisioning_cache_interval\s+([0-9]*)/i){
$pa_config->{'provisioning_cache_interval'}= clean_blank($1); $pa_config->{'provisioning_cache_interval'}= clean_blank($1);
} }
elsif ($parametro =~ m/^autoconfigure_agents\s+([0-1])/i){
$pa_config->{'autoconfigure_agents'}= clean_blank($1);
}
elsif ($parametro =~ m/^snmp_extlog\s(.*)/i) { elsif ($parametro =~ m/^snmp_extlog\s(.*)/i) {
$pa_config->{'snmp_extlog'} = clean_blank($1); $pa_config->{'snmp_extlog'} = clean_blank($1);
} }

View File

@ -3116,11 +3116,12 @@ Generate an event.
=cut =cut
########################################################################## ##########################################################################
sub pandora_event ($$$$$$$$$$;$$$$$$$$$) { sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$) {
my ($pa_config, $evento, $id_grupo, $id_agente, $severity, my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh, $id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh,
$source, $user_name, $comment, $id_extra, $tags, $source, $user_name, $comment, $id_extra, $tags,
$critical_instructions, $warning_instructions, $unknown_instructions, $custom_data) = @_; $critical_instructions, $warning_instructions, $unknown_instructions, $custom_data,
$module_data, $module_status) = @_;
my $event_table = is_metaconsole($pa_config) ? 'tmetaconsole_event' : 'tevento'; my $event_table = is_metaconsole($pa_config) ? 'tmetaconsole_event' : 'tevento';
my $agent = undef; my $agent = undef;
@ -3134,7 +3135,10 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
my $module = undef; my $module = undef;
if (defined($id_agentmodule) && $id_agentmodule != 0) { if (defined($id_agentmodule) && $id_agentmodule != 0) {
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ?', $id_agentmodule); $module = get_db_single_row ($dbh, 'SELECT *, tagente_estado.datos, tagente_estado.estado
FROM tagente_modulo, tagente_estado
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.id_agente_modulo = ?', $id_agentmodule);
if (defined ($module) && $module->{'quiet'} == 1) { if (defined ($module) && $module->{'quiet'} == 1) {
logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10); logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10);
return; return;
@ -3162,6 +3166,8 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
$warning_instructions = '' unless defined ($warning_instructions); $warning_instructions = '' unless defined ($warning_instructions);
$unknown_instructions = '' unless defined ($unknown_instructions); $unknown_instructions = '' unless defined ($unknown_instructions);
$custom_data = '' unless defined ($custom_data); $custom_data = '' unless defined ($custom_data);
$module_data = defined($module) ? $module->{'datos'} : '' unless defined ($module_data);
$module_status = defined($module) ? $module->{'estado'} : '' unless defined ($module_status);
# If the event is created with validated status, assign ack_utimestamp # If the event is created with validated status, assign ack_utimestamp
my $ack_utimestamp = $event_status == 1 ? time() : 0; my $ack_utimestamp = $event_status == 1 ? time() : 0;
@ -3183,8 +3189,8 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
# Create the event # Create the event
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10); logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);
db_do ($dbh, 'INSERT INTO ' . $event_table . ' (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp, custom_data) db_do ($dbh, 'INSERT INTO ' . $event_table . ' (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp, custom_data, data, module_status)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $comment, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions, $ack_utimestamp, $custom_data); VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $comment, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions, $ack_utimestamp, $custom_data, $module_data, $module_status);
# Do not write to the event file # Do not write to the event file
return if ($pa_config->{'event_file'} eq ''); return if ($pa_config->{'event_file'} eq '');
@ -4168,11 +4174,11 @@ sub generate_status_event ($$$$$$$$) {
# Generate the event # Generate the event
if ($status != 0){ if ($status != 0){
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'}, pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'monitoring_server', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}); $severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'monitoring_server', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}, undef, $data, $status);
} else { } else {
# Self validate this event if has "normal" status # Self validate this event if has "normal" status
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'}, pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 1, $dbh, 'monitoring_server', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}); $severity, 0, $module->{'id_agente_modulo'}, $event_type, 1, $dbh, 'monitoring_server', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'}, undef, $data, $status);
} }
} }

View File

@ -50,6 +50,7 @@ our @EXPORT = qw(
db_text db_text
db_update db_update
db_update_get_values db_update_get_values
set_update_agent
get_action_id get_action_id
get_addr_id get_addr_id
get_agent_addr_id get_agent_addr_id
@ -801,6 +802,35 @@ sub get_db_rows_limit ($$$;@) {
return @rows; return @rows;
} }
##########################################################################
## Updates agent fields using field => value
## Be careful, no filter is done.
##########################################################################
sub set_update_agent {
my ($dbh, $agent_id, $data) = @_;
return undef unless (defined($agent_id) && $agent_id > 0);
return undef unless (ref($data) eq "HASH");
# Build update query
my $query = 'UPDATE tagente SET ';
my @values;
foreach my $field (keys %{$data}) {
push @values, $data->{$field};
$query .= ' ' . $field . ' = ?,';
}
chop($query);
$query .= ' WHERE id_agente = ? ';
push @values, $agent_id;
return db_update($dbh, $query, @values);
}
########################################################################## ##########################################################################
## SQL delete with a LIMIT clause. ## SQL delete with a LIMIT clause.
########################################################################## ##########################################################################

View File

@ -414,6 +414,12 @@ sub process_xml_data ($$$$$) {
} }
} }
} }
if (defined($pa_config->{'autoconfigure_agents'}) && $pa_config->{'autoconfigure_agents'} == 1) {
# Update agent configuration once, before create agent - MetaConsole port to Node
enterprise_hook('autoconfigure_agent', [$pa_config, $agent_name, $agent_id, $data, $dbh]);
}
} }
# Get the data of the agent, if fail return # Get the data of the agent, if fail return

View File

@ -31,8 +31,8 @@ use base 'Exporter';
our @ISA = qw(Exporter); 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.724"; my $pandora_version = "7.0NG.725";
my $pandora_build = "180723"; my $pandora_build = "180808";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -461,9 +461,7 @@ sub print_agent {
# print_module # print_module
################################################################################ ################################################################################
sub print_module { sub print_module {
my $conf = shift; my ($conf, $data, $not_print_flag) = @_;
my $data = shift;
my $not_print_flag = shift;
if ((ref($data) ne "HASH") || (!defined $data->{name})) { if ((ref($data) ne "HASH") || (!defined $data->{name})) {
return undef; return undef;
@ -476,9 +474,21 @@ sub print_module {
} }
$data->{value} = '' if empty($data->{value}); $data->{value} = '' if empty($data->{value});
$data->{tags} = $data->{tags}?$data->{tags}:($conf->{MODULE_TAG_LIST}?$conf->{MODULE_TAG_LIST}:undef);
$data->{interval} = $data->{interval}?$data->{interval}:($conf->{MODULE_INTERVAL}?$conf->{MODULE_INTERVAL}:undef); $data->{tags} = ($data->{tags} ?
$data->{module_group} = $data->{module_group}?$data->{module_group}:($conf->{MODULE_GROUP}?$conf->{MODULE_GROUP}:undef); $data->{tags} : ($conf->{MODULE_TAG_LIST} ?
$conf->{MODULE_TAG_LIST} : ($conf->{module_tag_list} ?
$conf->{module_tag_list} : undef)));
$data->{interval} = ($data->{interval} ?
$data->{interval} : ($conf->{MODULE_INTERVAL} ?
$conf->{MODULE_INTERVAL} : ($conf->{module_interval} ?
$conf->{module_interval} : undef)));
$data->{module_group} = ($data->{module_group} ?
$data->{module_group} : ($conf->{MODULE_GROUP} ?
$conf->{MODULE_GROUP} : ( $conf->{module_group} ?
$conf->{module_group} : undef)));
# Global instructions (if defined) # Global instructions (if defined)
@ -990,6 +1000,18 @@ sub init {
return $conf; return $conf;
} }
################################################################################
# Update internal UA timeout
################################################################################
sub ua_set_timeout {
my ($config, $timeout) = @_;
return unless looks_like_number($timeout) and $timeout > 0;
my $sys = get_sys_environment($config);
return unless defined($sys->{'ua'});
$sys->{'ua'}->timeout($timeout);
}
################################################################################ ################################################################################
# initialize plugin (basic) # initialize plugin (basic)
################################################################################ ################################################################################

View File

@ -2,8 +2,8 @@
# Pandora FMS Server # Pandora FMS Server
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.724 %define version 7.0NG.725
%define release 180723 %define release 180808
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server # Pandora FMS Server
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.724 %define version 7.0NG.725
%define release 180723 %define release 180808
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -8,8 +8,8 @@
# This code is licensed under GPL 2.0 license. # This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.724" PI_VERSION="7.0NG.725"
PI_BUILD="180723" PI_BUILD="180808"
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.724 PS180723"; my $version = "7.0NG.725 PS180808";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;
@ -687,7 +687,7 @@ sub pandora_load_config_pdb ($) {
############################################################################### ###############################################################################
sub pandora_checkdb_integrity { sub pandora_checkdb_integrity {
my $dbh = shift; my ($conf, $dbh) = @_;
log_message ('INTEGRITY', "Cleaning up group stats."); log_message ('INTEGRITY', "Cleaning up group stats.");
@ -719,7 +719,7 @@ sub pandora_checkdb_integrity {
db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)'); db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)');
# Check enterprise tables # Check enterprise tables
enterprise_hook ('pandora_checkdb_integrity_enterprise', [$dbh]); enterprise_hook ('pandora_checkdb_integrity_enterprise', [$conf, $dbh]);
} }
############################################################################### ###############################################################################
@ -996,7 +996,7 @@ sub pandoradb_main ($$$) {
pandora_checkdb_consistency ($conf, $dbh); pandora_checkdb_consistency ($conf, $dbh);
# Maintain Referential integrity and other stuff # Maintain Referential integrity and other stuff
pandora_checkdb_integrity ($dbh); pandora_checkdb_integrity ($conf, $dbh);
# Move old data to the history DB # Move old data to the history DB
if (defined ($history_dbh)) { if (defined ($history_dbh)) {

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.724 PS180723"; my $version = "7.0NG.725 PS180808";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);