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
# Version 7.0NG.724, AIX version
# Version 7.0NG.725, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

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

View File

@ -1,5 +1,5 @@
# 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,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (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
# 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
# Base config file for Pandora agents
# Version 7.0NG.724, AIX version
# Version 7.0NG.725, AIX version
# General Parameters
# ==================

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.724-180723
Version: 7.0NG.725-180808
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# 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,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

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

View File

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

View File

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

View File

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

View File

@ -41,8 +41,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.724';
use constant AGENT_BUILD => '180723';
use constant AGENT_VERSION => '7.0NG.725';
use constant AGENT_BUILD => '180808';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (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
# under the terms of the GNU General Public Licence as published by the Free Software

View File

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

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.724(Build 180723)")
#define PANDORA_VERSION ("7.0NG.725(Build 180808)")
string pandora_path;
string pandora_dir;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.724-180723
Version: 7.0NG.725-180808
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.724-180723"
pandora_version="7.0NG.725-180808"
package_pear=0
package_pandora=1

View File

@ -125,7 +125,7 @@ function pandora_realtime_graphs () {
if ($graph != 'snmp_module') {
$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;
if ($graph == 'snmp_interface' || $graph == 'snmp_module') {
@ -154,7 +154,7 @@ function pandora_realtime_graphs () {
$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'] .= '&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->data[] = $data;
@ -176,7 +176,7 @@ function pandora_realtime_graphs () {
echo '</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');
echo '<script type="text/javascript" src="'.ui_get_full_url("extensions/realtime_graphs/realtime_graphs.js").'"></script>';

View File

@ -1,192 +1,186 @@
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 = {
legend: { container: $("#chartLegend") },
xaxis: {
tickFormatter: function (timestamp, axis) {
var date = new Date(timestamp * 1000);
var server_timezone_offset = get_php_value('timezone_offset');
var local_timezone_offset = date.getTimezoneOffset()*60*-1;
if (server_timezone_offset != local_timezone_offset) {
// If timezone of server and client is different, adjust the time to the server
date = new Date((timestamp + (server_timezone_offset - local_timezone_offset)) * 1000);
var plot;
var plotOptions = {
legend: { container: $("#chartLegend") },
xaxis: {
tickFormatter: function (timestamp, axis) {
var date = new Date(timestamp * 1000);
var server_timezone_offset = get_php_value('timezone_offset');
var local_timezone_offset = date.getTimezoneOffset()*60*-1;
if (server_timezone_offset != local_timezone_offset) {
// If timezone of server and client is different, adjust the time to the server
date = new Date((timestamp + (server_timezone_offset - local_timezone_offset)) * 1000);
}
var hours = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
var minutes = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
var seconds = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
var formattedTime = hours + ':' + minutes + ':' + seconds;
return formattedTime;
}
},
series: {
lines: {
lineWidth: 2,
fill: true
}
},
colors: ['#6db431']
};
function updatePlot (data) {
plot = $.plot($('.graph'), data, plotOptions);
}
function requestData () {
var rel_path = $("#hidden-rel_path").val();
currentXHR = $.ajax({
url: rel_path + "extensions/realtime_graphs/ajax.php",
type: "POST",
dataType: "json",
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) {
var timestamp = serie.data[0][0];
var data = plot.getData();
if (data.length === 0) {
for (i = 0; i < numberOfPoints; i++) {
var step = i * (refresh / 1000);
serie.data.unshift([timestamp - step, 0]);
}
var hours = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
var minutes = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes());
var seconds = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
var formattedTime = hours + ':' + minutes + ':' + seconds;
return formattedTime;
serie = [serie];
updatePlot(serie);
return;
}
data[0].label = serie.label;
if (data[0].data.length >= numberOfPoints) {
data[0].data.shift();
}
if (incremental) {
var currentVal = serie.data[0][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;
// Incremental is always positive
if (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]);
updatePlot(data);
}
});
}
function startDataPooling () {
intervalRef = window.setInterval(requestData, refresh);
}
function resetDataPooling () {
if (currentXHR !== null) currentXHR.abort();
// Stop and start the interval
window.clearInterval(intervalRef);
startDataPooling();
}
function clearGraph () {
var data = plot.getData();
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
function snmpBrowserWindow () {
// Keep elements in the form and the SNMP browser synced
$('#text-target_ip').val($('#text-ip_target').val());
$('#text-community').val($('#text-snmp_community').val());
$('#snmp_browser_version').val($('#snmp_version').val());
$('#snmp3_browser_auth_user').val($('#snmp3_auth_user').val());
$('#snmp3_browser_security_level').val($('#snmp3_security_level').val());
$('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val());
$('#snmp3_browser_auth_pass').val($('#snmp3_auth_pass').val());
$('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val());
$('#snmp3_browser_privacy_pass').val($('#snmp3_privacy_pass').val());
$("#snmp_browser_container").show().dialog ({
title: '',
resizable: true,
draggable: true,
modal: true,
overlay: {
opacity: 0.5,
background: "black"
},
series: {
lines: {
lineWidth: 2,
fill: true
}
},
colors: ['#6db431']
}
width: 920,
height: 500
});
}
var data = [];
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();
$.ajax({
url: rel_path + "extensions/realtime_graphs/ajax.php",
type: "POST",
dataType: "json",
data: postvars,
success: function(serie) {
var timestamp = serie.data[0][0];
data = plot.getData();
if (data.length == 0) {
for(i = 0; i < max_data_plot; i ++) {
step = i * (refresh/1000);
serie.data.unshift([timestamp-step, 0]);
}
serie = [serie];
plot = $.plot("#" + id, serie, options);
return;
}
data[0].label = serie.label;
if (data[0].data.length >= max_data_plot) {
data[0].data.shift();
}
if (incremental) {
var last_item = parseInt(data[0].data.length)-1;
var last_value = data[0].data[last_item][1];
var current_value = serie.data[0][1];
serie.data[0][1] = current_value - last_inc;
last_inc = current_value;
// Incremental is always positive
if (serie.data[0][1] < 0) {
serie.data[0][1] = 0;
}
}
data[0].data.push(serie.data[0]);
$.plot("#" + id, data, options);
}
$('#graph').change(function() {
$('form#realgraph').submit();
});
to = window.setTimeout(refresh_graph, refresh);
}
$('#graph').change(function() {
$('form#realgraph').submit();
});
$('#refresh').change(function() {
var refresh = parseInt($('#refresh').val());
// Stop and start the Timeout
clearTimeout(to);
to = window.setTimeout(refresh_graph, refresh);
});
// Show the SNMP browser window
function snmpBrowserWindow () {
// Keep elements in the form and the SNMP browser synced
$('#text-target_ip').val($('#text-ip_target').val());
$('#text-community').val($('#text-snmp_community').val());
$('#snmp_browser_version').val($('#snmp_version').val());
$('#snmp3_browser_auth_user').val($('#snmp3_auth_user').val());
$('#snmp3_browser_security_level').val($('#snmp3_security_level').val());
$('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val());
$('#snmp3_browser_auth_pass').val($('#snmp3_auth_pass').val());
$('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val());
$('#snmp3_browser_privacy_pass').val($('#snmp3_privacy_pass').val());
$("#snmp_browser_container").show().dialog ({
title: '',
resizable: true,
draggable: true,
modal: true,
overlay: {
opacity: 0.5,
background: "black"
},
width: 920,
height: 500
$('#refresh').change(function () {
refresh = parseInt($('#refresh').val());
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());
$('#checkbox-incremental').change(function() {
incremental = $('#checkbox-incremental').is(':checked');
clearGraph();
});
updatePlot([]);
requestData();
startDataPooling();
// Expose this functions
window.realtimeGraphs = {
clearGraph: clearGraph,
setOID: setOID,
snmpBrowserWindow: snmpBrowserWindow
}
// Close the SNMP browser
$('.ui-dialog-titlebar-close').trigger('click');
}
$('#checkbox-incremental').change(function() {
incremental = $('#checkbox-incremental').is(':checked');
clearGraph();
});
function firstNotZero(data) {
var notZero = 0;
for(i = 0; i < data[0].data.length; i ++) {
if (data[0].data[i][1] != 0) {
return data[0].data[i][1];
}
}
}
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';
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 UNIQUE(`id_policy`, `id_agent`, `id_node`);
COMMIT;
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;

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 ('small_operation_step_datos_purge', '1000');
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_support_logo', 'default_support.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';
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`
@ -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 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';
-- ---------------------------------------------------------------------
-- 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.'">'.
$action['name'].'</a>';
$data[1] = ui_print_group_icon ($action["id_group"], true) .'&nbsp;';
$hack_id_group_all = $action["id_group"];
if ($hack_id_group_all == 0) {
//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")) {
if (check_acl($config['id_user'], $action["id_group"], "LM")) {
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">' .
html_print_image("images/copy.png", true) . '</a>';

View File

@ -65,13 +65,13 @@ if ($fields_selected[0]!='') {
foreach ($fields_selected as $field_selected) {
switch ($field_selected) {
case 'id_evento':
$result = __('Event id');
$result = __('Event Id');
break;
case 'evento':
$result = __('Event name');
$result = __('Event Name');
break;
case 'id_agente':
$result = __('Agent name');
$result = __('Agent Name');
break;
case 'id_usuario':
$result = __('User');
@ -86,10 +86,10 @@ if ($fields_selected[0]!='') {
$result = __('Timestamp');
break;
case 'event_type':
$result = __('Event type');
$result = __('Event Type');
break;
case 'id_agentmodule':
$result = __('Agent module');
$result = __('Module Name');
break;
case 'id_alert_am':
$result = __('Alert');
@ -107,7 +107,7 @@ if ($fields_selected[0]!='') {
$result = __('Source');
break;
case 'id_extra':
$result = __('Extra id');
$result = __('Extra Id');
break;
case 'owner_user':
$result = __('Owner');
@ -119,8 +119,15 @@ if ($fields_selected[0]!='') {
$result = __('Instructions');
break;
case 'server_name':
$result = __('Server name');
$result = __('Server Name');
break;
case 'data':
$result = __('Data');
break;
case 'module_status':
$result = __('Module Status');
break;
}
$result_selected[$field_selected] = $result;
}
@ -149,25 +156,27 @@ $table->data = array();
$fields_available = array();
$fields_available['id_evento'] = __('Event id');
$fields_available['evento'] = __('Event name');
$fields_available['id_agente'] = __('Agent name');
$fields_available['id_evento'] = __('Event Id');
$fields_available['evento'] = __('Event Name');
$fields_available['id_agente'] = __('Agent Name');
$fields_available['id_usuario'] = __('User');
$fields_available['id_grupo'] = __('Group');
$fields_available['estado'] = __('Status');
$fields_available['timestamp'] = __('Timestamp');
$fields_available['event_type'] = __('Event type');
$fields_available['id_agentmodule'] = __('Agent module');
$fields_available['event_type'] = __('Event Type');
$fields_available['id_agentmodule'] = __('Module Name');
$fields_available['id_alert_am'] = __('Alert');
$fields_available['criticity'] = __('Severity');
$fields_available['user_comment'] = __('Comment');
$fields_available['tags'] = __('Tags');
$fields_available['source'] = __('Source');
$fields_available['id_extra'] = __('Extra id');
$fields_available['id_extra'] = __('Extra Id');
$fields_available['owner_user'] = __('Owner');
$fields_available['ack_utimestamp'] = __('ACK Timestamp');
$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
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);
$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'][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'][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'][3] = html_print_textarea ('tcp_rcv', 2, 65, '', '', 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'][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'][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'][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",
'descripcion', 'min_ff_event_normal', 'min_ff_event_warning',
'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 ();
foreach ($fields as $field) {
@ -1391,61 +1392,55 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
case 'id_plugin':
if ($value != 0) {
$value_field_1 = get_parameter ('_field1_', '');
$value_field_1_desc = get_parameter ('desc_field1_', '');
$value_field_2 = get_parameter ('_field2_', '');
$value_field_2_desc = get_parameter ('desc_field2_', '');
$value_field_3 = get_parameter ('_field3_', '');
$value_field_3_desc = get_parameter ('desc_field3_', '');
$value_field_4 = get_parameter ('_field4_', '');
$value_field_4_desc = get_parameter ('desc_field4_', '');
$value_field_5 = get_parameter ('_field5_', '');
$value_field_5_desc = get_parameter ('desc_field5_', '');
$values['macros'] = '{"1":{"macro":"_field1_","desc":"'.io_safe_input($value_field_1_desc).'","help":"'.io_safe_input($value_field_1_desc).'","value":"'.$value_field_1.'"}';
if($value_field_2_desc != ''){
$values['macros'] .= ',"2":{"macro":"_field2_","desc":"'.io_safe_input($value_field_2_desc).'","help":"'.io_safe_input($value_field_2_desc).'","value":"'.$value_field_2.'"}';
if($value_field_3_desc != ''){
$values['macros'] .= ',"3":{"macro":"_field3_","desc":"'.io_safe_input($value_field_3_desc).'","help":"'.io_safe_input($value_field_3_desc).'","value":"'.$value_field_3.'"}';
$value_field_1 = get_parameter ('_field1_', '');
$value_field_1_desc = get_parameter ('desc_field1_', '');
if($value_field_4_desc != ''){
$values['macros'] .= ',"4":{"macro":"_field4_","desc":"'.io_safe_input($value_field_4_desc).'","help":"'.io_safe_input($value_field_4_desc).'","value":"'.$value_field_4.'"}';
if($value_field_5_desc != ''){
$values['macros'] .= ',"5":{"macro":"_field5_","desc":"'.io_safe_input($value_field_5_desc).'","help":"'.io_safe_input($value_field_5_desc).'","value":"'.$value_field_5.'"}';
}
else{
$values['macros'] .= '}';
}
$value_field_2 = get_parameter ('_field2_', '');
$value_field_2_desc = get_parameter ('desc_field2_', '');
$value_field_3 = get_parameter ('_field3_', '');
$value_field_3_desc = get_parameter ('desc_field3_', '');
$value_field_4 = get_parameter ('_field4_', '');
$value_field_4_desc = get_parameter ('desc_field4_', '');
$value_field_5 = get_parameter ('_field5_', '');
$value_field_5_desc = get_parameter ('desc_field5_', '');
$values['macros'] = '{"1":{"macro":"_field1_","desc":"'.io_safe_input($value_field_1_desc).'","help":"'.io_safe_input($value_field_1_desc).'","value":"'.$value_field_1.'"}';
if($value_field_2_desc != ''){
$values['macros'] .= ',"2":{"macro":"_field2_","desc":"'.io_safe_input($value_field_2_desc).'","help":"'.io_safe_input($value_field_2_desc).'","value":"'.$value_field_2.'"}';
if($value_field_3_desc != ''){
$values['macros'] .= ',"3":{"macro":"_field3_","desc":"'.io_safe_input($value_field_3_desc).'","help":"'.io_safe_input($value_field_3_desc).'","value":"'.$value_field_3.'"}';
if($value_field_4_desc != ''){
$values['macros'] .= ',"4":{"macro":"_field4_","desc":"'.io_safe_input($value_field_4_desc).'","help":"'.io_safe_input($value_field_4_desc).'","value":"'.$value_field_4.'"}';
if($value_field_5_desc != ''){
$values['macros'] .= ',"5":{"macro":"_field5_","desc":"'.io_safe_input($value_field_5_desc).'","help":"'.io_safe_input($value_field_5_desc).'","value":"'.$value_field_5.'"}';
}
else{
$values['macros'] .= '}';
}
}
else{
$values['macros'] .= '}';
}
}
else{
$values['macros'] .= '}';
}
}
else{
$values['macros'] .= '}';
}
}
else{
$values['macros'] .= '}';
}
}
else{
$values['macros'] .= '}';
}
}
break;
case 'module_interval':
if ($value != 0) {
$values[$field] = $value;
@ -1470,6 +1465,32 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
}
}
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:
if ($value != '') {
$values[$field] = $value;
@ -1477,7 +1498,7 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
break;
}
}
// Specific snmp reused fields
if (get_parameter ('tcp_send', '') == 3) {
$plugin_user_snmp = get_parameter ('plugin_user_snmp', '');

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"]["id"] = 'Module templates';
enterprise_hook ('inventory_submenu');
enterprise_hook ('autoconfiguration_menu');
}
if (check_acl ($config['id_user'], 0, "AW")) {
enterprise_hook ('policies_menu');
enterprise_hook('agents_submenu');
}
if (check_acl ($config['id_user'], 0, "AW")) {
$sub["gmassive"]["text"] = __('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_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) {
db_pandora_audit("ACL Violation",
"Trying to access map builder");
@ -29,19 +32,64 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
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);
$hack_metaconsole = '';
if (defined('METACONSOLE'))
$hack_metaconsole = '../../';
$buttons['visual_console_favorite'] = array('active' => false,
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/visual_console_favorite">' .
html_print_image ("images/list.png", true, array ("title" => __('Visual Favourite Console'))) .'</a>');
$buttons['visual_console'] = array(
'active' => true,
'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(
__('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');
@ -62,7 +110,7 @@ if ($delete_layout || $copy_layout) {
require ("general/noaccess.php");
exit;
}
$group_id = db_get_value("id_group", "tlayout", "id", $id_layout);
if ($group_id === false) {
db_pandora_audit("ACL Violation",

View File

@ -17,10 +17,13 @@ global $config;
require_once ($config['homedir'] . '/include/functions_visual_map.php');
// ACL for the general permission
$vconsoles_read = check_acl ($config['id_user'], 0, "VR");
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
$vconsoles_read = check_acl ($config['id_user'], 0, "VR");
$vconsoles_write = check_acl ($config['id_user'], 0, "VW");
$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) {
db_pandora_audit("ACL Violation",
"Trying to access map builder");
@ -28,15 +31,55 @@ if (!$vconsoles_read && !$vconsoles_write && !$vconsoles_manage) {
exit;
}
$buttons['map_builder'] = array('active' => false,
'text' => '<a href="index.php?sec=network&sec2=godmode/reporting/map_builder">' .
html_print_image ("images/visual_console.png", true, array ("title" => __('Visual Console'))) .'</a>');
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';
}
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(
__('Reporting') .' &raquo; ' . __('Visual Favourite Console'),
"images/op_reporting.png", false, "map_builder", false, $buttons);
}
else{
ui_meta_print_header(
__('Visual console') . " &raquo; " . $visualConsoleName, "",
$buttons);
}
$search = (string) get_parameter("search","");
$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'>";
} else {
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><li>";
@ -61,14 +104,14 @@ if(!is_metaconsole()){
$return_all_group = false;
else
$return_all_group = true;
html_print_select_groups(false, "AR", $return_all_group, "ag_group",
$ag_group, 'this.form.submit();', '', 0, false,
html_print_select_groups(false, "AR", $return_all_group, "ag_group",
$ag_group, 'this.form.submit();', '', 0, false,
false, true, '', false
);
echo "</li></ul></li><li class='second_elements'><ul><li>";
echo __('Group Recursion');
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
echo "</li><li>";
echo "</li><li>";
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
echo "</li></ul></li></ul>";
echo "</form>";
@ -103,12 +146,17 @@ echo "<div id='is_favourite'>";
}
else{
echo "<ul class='container'>";
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"] .
"' title='Visual console". $favourite_v["name"] ."' alt='". $favourite_v["name"] ."'><li>";
foreach( $favorite_array as $favorite_k => $favourite_v ){
if($is_metaconsole){
$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 html_print_image ("images/groups_small/" . groups_get_icon($favourite_v["id_group"]).".png",
true,
echo html_print_image ("images/groups_small/" . groups_get_icon($favourite_v["id_group"]).".png",
true,
array ("style" => '')
);
echo "</div>";

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);
$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][1] = html_print_input_text ('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
$row++;

View File

@ -355,7 +355,15 @@ if ($get_module_detail) {
if($data_macro){
$data[] = $data_macro;
} 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
ob_clean();
// READ THIS:
// Special call without checks to retrieve version and build of the Pandora FMS
// This info is avalable from the web console without login
// Don't change the format, it is parsed by applications
@ -63,7 +64,7 @@ switch($info) {
$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;
}

View File

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

View File

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

View File

@ -1363,6 +1363,18 @@ function is_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.
* Usefull to display some policy features on metaconsole.

View File

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

View File

@ -99,78 +99,69 @@ function returnError($typeError, $returnType = 'string') {
break;
default:
returnData("string",
array('type' => 'string', 'data' => __($returnType)));
array('type' => 'string', 'data' => __($typeError)));
break;
}
}
/**
*
* @param $returnType
* @param $data
* @param $separator
*
* @return
*/
function returnData($returnType, $data, $separator = ';') {
switch ($returnType) {
case 'string':
if ($data['type'] == 'string') {
echo $data['data'];
if( is_array($data['data']) ){
echo convert_array_multi($data['data'], $separator);
}
else {
//TODO
else{
echo $data['data'];
}
break;
case 'csv':
case 'csv_head':
switch ($data['type']) {
case 'array':
if (array_key_exists('list_index', $data))
{
if ($returnType == 'csv_head') {
foreach($data['list_index'] as $index) {
echo $index;
if (end($data['list_index']) == $index)
echo "\n";
else
echo $separator;
}
}
foreach($data['data'] as $dataContent) {
foreach($data['list_index'] as $index) {
if (array_key_exists($index, $dataContent))
echo str_replace("\n", " ", $dataContent[$index]);
if (end($data['list_index']) == $index)
echo "\n";
else
echo $separator;
}
if( is_array($data['data']) ){
if (array_key_exists('list_index', $data)) {
if ($returnType == 'csv_head') {
foreach($data['list_index'] as $index) {
echo $index;
if (end($data['list_index']) == $index)
echo "\n";
else
echo $separator;
}
}
else {
if (!empty($data['data'])) {
foreach ($data['data'] as $dataContent) {
$clean = array_map("array_apply_io_safe_output", $dataContent);
foreach ($clean as $k => $v) {
$clean[$k] = str_replace("\r", "\n", $clean[$k]);
$clean[$k] = str_replace("\n", " ", $clean[$k]);
$clean[$k] = strip_tags($clean[$k]);
$clean[$k] = str_replace(';',' ',$clean[$k]);
}
$row = implode($separator, $clean);
echo $row . "\n";
}
foreach($data['data'] as $dataContent) {
foreach($data['list_index'] as $index) {
if (array_key_exists($index, $dataContent))
echo str_replace("\n", " ", $dataContent[$index]);
if (end($data['list_index']) == $index)
echo "\n";
else
echo $separator;
}
}
break;
case 'string':
echo $data['data'];
break;
}
else {
if (!empty($data['data'])) {
foreach ($data['data'] as $dataContent) {
$clean = array_map("array_apply_io_safe_output", $dataContent);
foreach ($clean as $k => $v) {
$clean[$k] = str_replace("\r", "\n", $clean[$k]);
$clean[$k] = str_replace("\n", " ", $clean[$k]);
$clean[$k] = strip_tags($clean[$k]);
$clean[$k] = str_replace(';',' ',$clean[$k]);
}
$row = implode($separator, $clean);
echo $row . "\n";
}
}
}
}
else{
echo $data['data'];
}
break;
case 'json':
@ -180,13 +171,13 @@ function returnData($returnType, $data, $separator = ';') {
if ($separator == ";") {
$separator = null;
}
if(empty($separator)){
echo json_encode ($data);
} else {
echo json_encode ($data, $separator);
}
break;
}
}
@ -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.
*
@ -6429,153 +6352,6 @@ function api_set_update_snmp_module_policy($id, $thrash1, $other, $thrash3) {
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.
*

View File

@ -631,6 +631,9 @@ function config_update_config () {
if (!config_update_value ('type_mode_graph', (int) get_parameter('type_mode_graph', 0)))
$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)))
$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['instructions'] = __('Instructions');
$columns['server_name'] = __('Server name');
$columns['data'] = __('Data');
$columns['module_status'] = __('Module status');
return $columns;
}
@ -126,10 +128,10 @@ function events_get_events_no_grouped($sql_post, $offset = 0,
function events_get_events_grouped($sql_post, $offset = 0,
$pagination = 1, $meta = false, $history = false, $total = false,
$history_db = false, $order = "DESC") {
global $config;
$history_db = false, $order = "down", $sort_field = "timestamp") {
global $config;
$table = events_get_events_table($meta, $history);
if ($meta) {
@ -139,6 +141,7 @@ function events_get_events_grouped($sql_post, $offset = 0,
$groupby_extra = '';
}
switch ($config["dbtype"]) {
case "mysql":
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_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 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
WHERE 1=1 " . $sql_post . "
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;
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,
critical_instructions, warning_instructions,
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()),
"%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,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra);
$server_id, $id_extra, $data, $module_status);
break;
case "postgresql":
$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,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data,
server_id, id_extra)
server_id, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d,
ceil(date_part(\'epoch\', CURRENT_TIMESTAMP)), "%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,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra);
$server_id, $id_extra, $data, $module_status);
break;
case "oracle":
$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,
critical_instructions, warning_instructions,
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,
"%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,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data,
$server_id, $id_extra);
$server_id, $id_extra, $data, $module_status);
break;
}
}
@ -776,13 +911,13 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
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()),
"%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,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break;
case "postgresql":
$sql = sprintf ('
@ -790,14 +925,14 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
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,
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,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break;
case "oracle":
$sql = sprintf ("
@ -805,13 +940,13 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
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,
'%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,
$event_type, $priority, $id_agent_module, $id_aam,
$critical_instructions, $warning_instructions,
$unknown_instructions, $source, $tags, $custom_data, $id_extra);
$unknown_instructions, $source, $tags, $custom_data, $id_extra, $data, $module_status);
break;
}
}
@ -3703,6 +3838,16 @@ function events_list_events_grouped_agents($sql) {
$table->align[$i] = 'left';
$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) {
$table->head[$i] = __('Action');
$table->align[$i] = 'left';
@ -4102,6 +4247,20 @@ function events_list_events_grouped_agents($sql) {
$table->cellclass[count($table->data)][$i] = $myclass;
$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) {
//Actions

View File

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

View File

@ -704,37 +704,36 @@ function html_print_extended_select_for_post_process($name, $selected = '',
$script = '', $nothing = '', $nothing_value = '0', $size = false,
$return = false, $select_style = false, $unique_name = true,
$disabled = false, $no_change = 0) {
global $config;
require_once($config['homedir'] . "/include/functions_post_process.php");
$fields = post_process_get_custom_values();
if($no_change != 0){
$fields[-1] = __('No change');
}
$selected_float = (float)$selected;
$found = false;
if (array_key_exists($selected, $fields))
if (array_key_exists(number_format($selected, 14, '.', ','), $fields))
$found = true;
if (!$found) {
$fields[$selected] = floatval($selected);
}
if ($unique_name === true) {
$uniq_name = uniqid($name);
}
else {
$uniq_name = $name;
}
ob_start();
echo '<div id="' . $uniq_name . '_default" style="width:100%;display:inline;">';
html_print_select ($fields, $uniq_name . '_select', $selected,
"" . $script, $nothing, $nothing_value, false, false, false,
@ -747,10 +746,10 @@ function html_print_extended_select_for_post_process($name, $selected = '',
'style' => 'width: 18px;')) .
'</a>';
echo '</div>';
echo '<div id="' . $uniq_name . '_manual" style="width:100%;display:inline;">';
html_print_input_text ($uniq_name . '_text', $selected, '', 20);
html_print_input_hidden($name, $selected, false, $uniq_name);
echo ' <a href="javascript:">' .
html_print_image('images/default_list.png', true,
@ -759,20 +758,17 @@ function html_print_extended_select_for_post_process($name, $selected = '',
'title' => __('List'),
'style' => 'width: 18px;')) . '</a>';
echo '</div>';
echo "<script type='text/javascript'>
$(document).ready (function () {
post_process_select_init('$uniq_name');
post_process_select_events('$uniq_name');
});
</script>";
$returnString = ob_get_clean();
if ($return)
return $returnString;
else

View File

@ -476,7 +476,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
global $config;
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;
}
@ -537,51 +537,20 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
// Sync modules start in unknown status
$status = AGENT_MODULE_STATUS_NO_DATA;
}
switch ($config["dbtype"]) {
case "mysql":
$result = db_process_sql_insert ('tagente_estado',
array ('id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => '01-01-1970 00:00:00',
'estado' => $status,
'known_status' => $status,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_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;
}
$result = db_process_sql_insert ('tagente_estado', array (
'id_agente_modulo' => $id_agent_module,
'datos' => 0,
'timestamp' => '01-01-1970 00:00:00',
'estado' => $status,
'known_status' => $status,
'id_agente' => (int) $id_agent,
'utimestamp' => 0,
'status_changes' => 0,
'last_status' => $status,
'last_known_status' => $status
));
if ($result === false) {
db_process_sql_delete ('tagente_modulo',
array ('id_agente_modulo' => $id_agent_module));
@ -758,34 +727,7 @@ function modules_format_delete_log4x($id)
* @return array An array with module information
*/
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);
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;
}
return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
}
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
function modules_agents_unknown ($module_name) {
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT( DISTINCT tagente.id_agente)
FROM tagente_estado, tagente, tagente_modulo
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
//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
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT(max_estado)
FROM (
SELECT MAX(tagente_estado.estado) as max_estado
@ -2046,9 +1984,7 @@ function modules_agents_critical ($module_name) {
//The status values are: 0 OK; 1 Critical; 2 Warning; 3 Unkown
//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
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT( DISTINCT tagente_estado.id_agente)
FROM tagente_estado, tagente, tagente_modulo
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
//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)
FROM (SELECT MAX(tagente_estado.estado) as min_estado
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)
);
}
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])) {
return true;
} else if (empty($acls[$group])) {
return true;
}
}
}

View File

@ -266,35 +266,19 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head =
$last_data_str .= "&nbsp;";
$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"] );
if (($config['command_snapshot']) && ($is_snapshot)) {
$link = ui_get_snapshot_link( array(
'id_module' => $module['id_agente_modulo'],
'last_data' => $last_data['datos'],
'timestamp' => $last_data['timestamp'],
'interval' => $module['current_interval'],
'module_name' => $module['module_name']
));
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;
$is_snapshot = is_snapshot_data ( $last_data["datos"] );
$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(
'id_module' => $module['id_agente_modulo'],
'interval' => $module['current_interval'],
'module_name' => $module['module_name'],
'id_node' => empty($server_id) ? 0 : $server_id
));
$salida = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
}
$last_data_str .= $salida;
}
else {
$last_data_str = '<i>' . __('No data') . '</i>';

View File

@ -831,22 +831,39 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
$description = io_safe_output($template['name']);
$data = array ();
if (!defined('METACONSOLE')) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
if ($policyInfo === false)
$data[$index['policy']] = '';
else {
$img = 'images/policies.png';
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);
if ($policyInfo === false)
$data[$index['policy']] = '';
else {
$img = 'images/policies.png';
if(!is_metaconsole()){
$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'])) .
'</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
$data[$index['standby']] = '';
if (isset ($alert["standby"]) && $alert["standby"] == 1) {
@ -881,8 +898,8 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
$agent_name = false;
$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;');
}
else {
@ -893,7 +910,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agente['nombre']. '">'.$agente["alias"].'</span></a>';
}
}
$data[$index['module_name']] =
ui_print_truncate_text (isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name ($alert["id_agent_module"]), 'module_small', false, true, true, '[&hellip;]', 'font-size: 7.2pt');
}
@ -3774,36 +3791,27 @@ function ui_print_module_string_value($value, $id_agente_module,
$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_large_image = is_text_to_black_string ($value);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$handle = "snapshot" . "_" . $id_agente_module;
$url = 'include/procesos.php?agente=' . $id_agente_module;
$win_handle = dechex(crc32($handle));
$link = "winopeng_var('operation/agentes/snapshot_view.php?" .
"id=" . $id_agente_module .
"&refr=" . $current_interval .
"&label=" . rawurlencode(urlencode(io_safe_output($module_name))) . "','" . $win_handle . "', 700,480)";
if ($is_snapshot) {
$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 {
$link = ui_get_snapshot_link( array(
'id_module' => $id_agente_module,
'last_data' => $value,
'interval' => $current_interval,
'module_name' => $module_name,
'timestamp' => db_get_value('timestamp', 'tagente_estado', 'id_agente_modulo', $id_agente_module)
));
$salida = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
} else {
$sub_string = substr(io_safe_output($value), 0, 12);
if ($value == $sub_string) {
if ($value == 0 && !$sub_string) {
@ -3836,12 +3844,17 @@ function ui_print_module_string_value($value, $id_agente_module,
$salida = $value;
}
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 =
modules_get_agentmodule_agent_alias($id_agente_module) .
" / " . $module_name;
$salida = "<div " .
"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 .
"</div>" .
"<span " .
@ -3899,8 +3912,8 @@ function ui_get_snapshot_link($params, $only_params = false) {
'id_module' => 0, //id_agente_modulo
'module_name' => '',
'interval' => 300,
'last_data' => '',
'timestamp' => '0'
'timestamp' => 0,
'id_node' => 0
);
// Merge default params with passed params
@ -3911,10 +3924,10 @@ function ui_get_snapshot_link($params, $only_params = false) {
$url = "$page?" .
"id=" . $params['id_module'] .
"&refr=" . $parms['interval'] .
"&timestamp=" . $params['timestamp'] .
"&last_data=" . rawurlencode(urlencode(io_safe_output($params['last_data']))) .
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name'])));
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name']))).
"&id_node=" . $params['id_node'];
if ($params['timestamp'] != 0) $url .= "&timestamp=" . $parms['timestamp'];
if ($params['timestamp'] != 0) $url .= "&refr=" . $parms['interval'];
// Second parameter of js winopeng_var
$win_handle = dechex(crc32('snapshot_' . $params['id_module']));
@ -3928,18 +3941,44 @@ function ui_get_snapshot_link($params, $only_params = false) {
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) {
global $config;
$user_offset = (-get_fixed_offset() / 60) / 60;
$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."),
$config["timezone"],
date_default_timezone_get(),
$user_offset > 0 ? "+" . $user_offset : $user_offset
);
return ui_print_info_message($message, '', $return, $tag);
if ($config["timezone"] != date_default_timezone_get()) {
$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."),
$config["timezone"],
date_default_timezone_get(),
$user_offset > 0 ? "+" . $user_offset : $user_offset
);
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);
}
if ($connection) {
metaconsole_restore_db();
}
}
}
if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) {
$img_style_title = strip_tags($label);
if ($layoutData['type'] == STATIC_GRAPH) {
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(
modules_get_unit($layoutData['id_agente_modulo'])));
@ -1759,6 +1771,11 @@ function visual_map_print_item($mode = "read", $layoutData,
" <br>" . __("Last value: ")
. 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'){
@ -3172,14 +3189,18 @@ function visual_map_get_status_element($layoutData) {
$module_status = db_get_sql ('SELECT estado
FROM tagente_estado
WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
switch($module_status) {
case AGENT_STATUS_NORMAL:
case AGENT_MODULE_STATUS_NORMAL_ALERT:
$layoutData['status_calculated'] = VISUAL_MAP_STATUS_NORMAL;
break;
case AGENT_MODULE_STATUS_WARNING:
case AGENT_MODULE_STATUS_WARNING_ALERT:
$layoutData['status_calculated'] = VISUAL_MAP_STATUS_WARNING;
break;
case AGENT_STATUS_CRITICAL:
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
$layoutData['status_calculated'] = VISUAL_MAP_STATUS_CRITICAL_BAD;
break;
case AGENT_MODULE_STATUS_NO_DATA:
@ -4066,4 +4087,5 @@ function visual_map_macro($label,$module){
return $label;
}
?>

View File

@ -1769,6 +1769,10 @@ function pandoraFlotArea( graph_id, values, legend,
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
$('#' + graph_id).bind('plotselected', function (event, ranges) {
// 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) {
data_base_treshold = add_threshold (
data_base,
threshold_data,
ranges.yaxis.from,
ranges.yaxis.to,
y_recal.max,
red_threshold,
extremes,
red_up,
@ -1822,7 +1839,7 @@ function pandoraFlotArea( graph_id, values, legend,
}],
yaxis:{
min: ranges.yaxis.from,
max: ranges.yaxis.to,
max: y_recal.max,
font: {
size: font_size + 2,
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');
max_draw['max'] = ranges.yaxis.to;
max_draw['min'] = ranges.yaxis.from;
// don't fire event on the overview to prevent eternal loop
overview.setSelection(ranges, true);
});
@ -2174,7 +2194,7 @@ function pandoraFlotArea( graph_id, values, legend,
data_base,
threshold_data,
plot.getAxes().yaxis.min,
plot.getAxes().yaxis.max,
y_recal.max,
red_threshold,
extremes,
red_up,
@ -2254,7 +2274,6 @@ function pandoraFlotArea( graph_id, values, legend,
$('#menu_threshold_' + graph_id).click(function() {
datas = new Array();
if (thresholded) {
$.each(data_base, function() {
datas.push(this);
@ -2265,7 +2284,8 @@ function pandoraFlotArea( graph_id, values, legend,
plot = $.plot($('#' + graph_id), data_base,
$.extend(true, {}, options, {
yaxis: {
max: max_draw
min: max_draw['min'],
max: max_draw['max']
},
xaxis: {
min: plot.getAxes().xaxis.min,
@ -2275,8 +2295,6 @@ function pandoraFlotArea( graph_id, values, legend,
thresholded = false;
}
else {
var max_draw = plot.getAxes().yaxis.datamax;
if(!thresholded){
// Recalculate the y axis
var y_recal = axis_thresholded(
@ -2295,7 +2313,7 @@ function pandoraFlotArea( graph_id, values, legend,
data_base,
threshold_data,
plot.getAxes().yaxis.min,
plot.getAxes().yaxis.max,
y_recal.max,
red_threshold,
extremes,
red_up,
@ -2305,7 +2323,8 @@ function pandoraFlotArea( graph_id, values, legend,
plot = $.plot($('#' + graph_id), datas_treshold,
$.extend(true, {}, options, {
yaxis: {
max: y_recal.max,
min: max_draw['min'],
max: y_recal.max
},
xaxis: {
min: plot.getAxes().xaxis.min,
@ -2330,6 +2349,7 @@ function pandoraFlotArea( graph_id, values, legend,
overview.clearSelection();
currentRanges = null;
thresholded = false;
max_draw = [];
});
// 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
// Estimated height of 24 (works fine with this data in all browsers)
menu_height = 24;
var legend_margin_bottom = parseInt(
$('#legend_'+graph_id).css('margin-bottom').split('px')[0]);
$('#legend_'+graph_id).css('margin-bottom', '10px');
parent_height = parseInt($('#menu_'+graph_id).parent().css('height').split('px')[0]);
adjust_menu(graph_id, plot, parent_height, width, show_legend);

View File

@ -301,4 +301,22 @@ function get_complementary_rgb ($hexcode) {
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;
}
.events_bar {
margin:0 auto;
}
#snmp_data {
background: #f9faf9;
}

View File

@ -447,21 +447,23 @@ if (! isset ($config['id_user'])) {
$_GET["sec"] = "general/logon_ok";
break;
case 'Dashboard':
$_GET["sec"] = "dashboard";
$_GET["sec"] = "reporting";
$_GET["sec2"] = ENTERPRISE_DIR.'/dashboard/main_dashboard';
$id_dashboard_select =
db_get_value('id', 'tdashboard', 'name', $home_url);
$_GET['id_dashboard_select'] = $id_dashboard_select;
break;
case 'Visual console':
$_GET["sec"] = "visualc";
$_GET["sec"] = "network";
$_GET["sec2"] = "operation/visual_console/index";
break;
case 'Other':
$home_url = io_safe_output($home_url);
parse_str ($home_url, $res);
$_GET["sec"] = $res["sec"];
$_GET["sec2"] = $res["sec2"];
$url_array = parse_url($home_url);
parse_str ($url_array['query'], $res);
foreach ($res as $key => $param) {
$_GET[$key] = $param;
}
break;
}
}
@ -1033,67 +1035,81 @@ else {
$home_page = io_safe_output($user_info['section']);
$home_url = $user_info['data_section'];
}
if ($home_page != '') {
switch ($home_page) {
case 'Event list':
require ('operation/events/events.php');
$_GET['sec'] = 'eventos';
$_GET['sec2'] = 'operation/events/events';
break;
case 'Group view':
require ('operation/agentes/group_view.php');
$_GET['sec'] = 'view';
$_GET['sec2'] = 'operation/agentes/group_view';
break;
case 'Alert detail':
require ('operation/agentes/alerts_status.php');
$_GET['sec'] = 'view';
$_GET['sec2'] = 'operation/agentes/alerts_status';
break;
case 'Tactical view':
require ('operation/agentes/tactical.php');
$_GET['sec'] = 'view';
$_GET['sec2'] = 'operation/agentes/tactical';
break;
case 'Default':
require ('general/logon_ok.php');
$_GET['sec2'] = 'general/logon_ok';
break;
case 'Dashboard':
$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);
foreach ($res as $key => $param) {
$_GET[$key] = $param;
}
require(ENTERPRISE_DIR.'/dashboard/main_dashboard.php');
break;
case 'Visual console':
$id_visualc = db_get_value('id', 'tlayout', 'name', $home_url);
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
$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);
foreach ($res as $key => $param) {
$_GET[$key] = $param;
}
require($_GET["sec2"] . '.php');
break;
case 'Other':
$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) {
$_GET[$key] = $param;
}
if (isset($_GET['sec2'])) {
$file = $_GET['sec2'] . '.php';
if (!file_exists ($file)) {
unset($_GET['sec2']);
require('general/logon_ok.php');
}
else {
require($file);
}
}
break;
}
if (isset($_GET['sec2'])) {
$file = $_GET['sec2'] . '.php';
// Translate some secs
$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']);
require ("general/noaccess.php");
}
else {
require($file);
}
} else {
require ("general/noaccess.php");
}
}
else {
require("general/logon_ok.php");

View File

@ -70,8 +70,8 @@
<body>
<div style='height: 10px'>
<?php
$version = '7.0NG.724';
$build = '180723';
$version = '7.0NG.725';
$build = '180808';
$banner = "v$version Build $build";
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/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.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 " <body>\n";

View File

@ -270,6 +270,7 @@ class Modules {
}
private function getListModules($page = 0, $ajax = false) {
global $config;
$system = System::getInstance();
$user = User::getInstance();
@ -590,34 +591,17 @@ class Modules {
$output = $sub_string;
}
}
$is_snapshot = is_snapshot_data($module["datos"]);
$handle = "snapshot" . "_" . $module["id_agente_modulo"];
$url = 'include/procesos.php?agente=' . $module["id_agente_modulo"];
$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 {
$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']
));
$row[7] = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
} else {
$row[7] = $row[__('Data')] = '<span style="white-space: nowrap;">' .
'<span style="display: none;" class="show_collapside">' .
$row[__('Status')] . '&nbsp;&nbsp;</span>' .
@ -626,18 +610,7 @@ class Modules {
$module['id_agente_modulo'] . '&id_agent=' .
$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) {
unset($row[0]);
if ($this->columns['agent']) {
@ -814,23 +787,9 @@ class Modules {
$filters_to_serialize[] = sprintf(__("Tag: %s"),
$tag_name);
}
$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;
}
}

View File

@ -449,11 +449,9 @@ $table->align = array ();
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if ($print_agent) {
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>";
@ -496,10 +494,8 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
}
}
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>";
if (!is_metaconsole()) {

View File

@ -108,21 +108,18 @@ if (is_ajax ()) {
$value = $module_value;
}
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);
if (($config['command_snapshot']) && ($is_snapshot)){
$handle = "snapshot"."_".$module["id_agente_modulo"];
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
$win_handle = dechex(crc32($handle));
$link ="winopeng_var('operation/agentes/snapshot_view.php?id=".$module["id_agente_modulo"]."&refr=".$module["current_interval"]."&label=".$module["nombre"]."','".$win_handle."', 700,480)";
$value = '<a href="javascript:'.$link.'">' . html_print_image("images/default_list.png", true, array("border" => '0', "alt" => "", "title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
else {
$is_snapshot = is_snapshot_data ($module_value);
$is_large_image = is_text_to_black_string ($module_value);
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$link = ui_get_snapshot_link( array(
'id_module' => $module["id_agente_modulo"],
'interval' => $module["current_interval"],
'module_name' => $module["nombre"]
));
$value = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
} else {
$value = ui_print_module_string_value(
$module_value, $module["id_agente_modulo"],
$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_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php');
enterprise_include_once('include/functions_agents.php');
check_login();
@ -108,28 +109,8 @@ $interface_traffic_modules = array(
<body bgcolor="#ffffff" style='background:#ffffff;'>
<?php
// ACL
$permission = false;
$agent_group = (int) agents_get_agent_group($agent_id);
$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) {
$all_groups = agents_get_all_groups_agent($agent_id);
if (!check_acl_one_of_groups ($config["id_user"], $all_groups, "AR")) {
require ($config['homedir'] . "/general/noaccess.php");
exit;
}
@ -140,7 +121,7 @@ $interface_traffic_modules = array(
$height = (int) get_parameter("height", 245);
$start_date = (string) get_parameter("start_date", date("Y-m-d"));
$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);
$show_percentil = get_parameter ("show_percentil", 0);
$fullscale = get_parameter("fullscale");

View File

@ -83,6 +83,10 @@ echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/
</head>
<body bgcolor="#ffffff" style='background:#ffffff;'>
<?php
if (!check_acl ($config["id_user"], 0, "AR")) {
require ($config['homedir'] . "/general/noaccess.php");
exit;
}
$config['extensions'] = extensions_get_extensions (false, '../../');
if (!extensions_is_enabled_extension("realtime_graphs.php")) {
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_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php');
enterprise_include_once('include/functions_agents.php');
check_login ();
@ -38,25 +39,40 @@ if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
}
$id = get_parameter('id');
$label = get_parameter ("label");
$last_data = get_parameter("last_data", '');
$last_timestamp = get_parameter("timestamp", '');
// FIXME: Support to old call snapshow_view calls. Remove it when all are migrated
if (empty($last_data)) {
$row = db_get_row_sql("SELECT *
FROM tagente_estado
WHERE id_agente_modulo = $id");
$last_data = io_safe_output($row["datos"]);
$last_timestamp = $row["timestamp"];
$id_node = get_parameter("id_node", 0);
// Get the data
if ($id_node > 0) {
$connection = metaconsole_get_connection_by_id($id_node);
if (metaconsole_load_external_db($connection) != NOERR) {
ui_print_error_message(__('Cannot connect with node to display the module data.'));
exit;
}
}
$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>
<head>
<?php
// Parsing the refresh before sending any header
$refresh = (int) get_parameter ("refr", -1);
if ($refresh > 0) {
$query = ui_get_url_refresh (false);
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
@ -68,30 +84,24 @@ if (empty($last_data)) {
</head>
<body style='background:#000; color: #ccc;'>
<?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 __("Current data at");
echo " ";
echo $last_timestamp;
echo __("Current data at %s", $last_timestamp);
echo "</h2>";
if (is_image_data($last_data)) {
echo '<center><img src="' . $last_data . '" alt="image" style="width:100%"/></center>';
}
else {
$datos = preg_replace ('/</', '&lt;', $datos);
$datos = preg_replace ('/>/', '&gt;', $datos);
$datos = preg_replace ('/\n/i','<br>',$datos);
$datos = preg_replace ('/\s/i','&nbsp;',$datos);
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'>";
$last_data = preg_replace ('/</', '&lt;', $last_data);
$last_data = preg_replace ('/>/', '&gt;', $last_data);
$last_data = preg_replace ('/\n/i','<br>',$last_data);
$last_data = preg_replace ('/\s/i','&nbsp;',$last_data);
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 "</div>";
?>
<script type="text/javascript">
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);
var w1 = $('div', div).innerWidth();
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_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php');
enterprise_include_once('include/functions_agents.php');
check_login ();
@ -112,11 +113,8 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
}
// ACL
$permission = false;
$agent_group = (int) agents_get_agent_group($agent_id);
$permission = check_acl($config['id_user'], $agent_group, "AR");
if (!$permission) {
$all_groups = agents_get_all_groups_agent($agent_id);
if (!check_acl_one_of_groups ($config["id_user"], $all_groups, "AR")) {
require ($config['homedir'] . "/general/noaccess.php");
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"));
$draw_events = get_parameter ("draw_events", 0);
$graph_type = get_parameter ("type", "sparse");
$zoom = get_parameter ("zoom", 1);
$zoom = get_parameter ("zoom", $config['zoom_graph']);
$baseline = get_parameter ("baseline", 0);
$show_events_graph = get_parameter ("show_events_graph", 0);
$show_percentil = get_parameter ("show_percentil", 0);

View File

@ -732,146 +732,50 @@ switch ($sortField) {
break;
}
switch ($config['dbtype']) {
case 'mysql':
$sql = 'SELECT
(SELECT GROUP_CONCAT(ttag.name SEPARATOR \',\')
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_modulo.tcp_send,
tagente_modulo.ip_target,
tagente_modulo.snmp_community,
tagente_modulo.snmp_oid,
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 . '
GROUP BY tagente_modulo.id_agente_modulo
ORDER BY ' . $order['field'] . " " . $order['order'] . '
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;
}
$sql = 'SELECT
(SELECT GROUP_CONCAT(ttag.name SEPARATOR \',\')
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_modulo.tcp_send,
tagente_modulo.ip_target,
tagente_modulo.snmp_community,
tagente_modulo.snmp_oid,
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 . '
GROUP BY tagente_modulo.id_agente_modulo
ORDER BY ' . $order['field'] . " " . $order['order'] . '
LIMIT '.$offset.",".$limit_sql;
if (! defined ('METACONSOLE')) {
$result = db_get_all_rows_sql ($sql);
@ -977,17 +881,17 @@ if (!empty($result)) {
$table->head[2] = __('Data Type');
$table->head[2] .= ' <a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectTypeUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=type&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectTypeDown, 'alt' => 'down')) . '</a>';
$table->align[2] = 'left';
$table->head[3] = __('Module name');
$table->head[3] .= ' <a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
$table->head[4] = __('Server type');
$table->head[4] = __('Server type');
$table->head[4] .= ' <a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
$table->head[5] = __('Interval');
$table->head[5] .= ' <a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectIntervalUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=interval&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectIntervalDown, 'alt' => 'down')) . '</a>';
@ -1024,36 +928,47 @@ if (!empty($result)) {
//Avoid unset, null and false value
if (empty($row['server_name']))
$row['server_name'] = "";
$is_web_content_string = (bool)db_get_value_filter('id_agente_modulo',
'tagente_modulo',
array('id_agente_modulo' => $row['id_agente_modulo'],
'id_tipo_modulo' => $id_type_web_content_string));
//Fixed the goliat sends the strings from web
//without HTML entities
if ($is_web_content_string) {
$row['datos'] = io_safe_input($row['datos']);
}
//Fixed the data from Selenium Plugin
if ($row['datos'] != strip_tags($row['datos'])) {
$row['datos'] = io_safe_input($row['datos']);
}
$data = array ();
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']);
if ($policyInfo === false)
$data[0] = '';
else {
$linked = policies_is_module_linked($row['id_agente_modulo']);
$adopt = false;
if (policies_is_module_adopt($row['id_agente_modulo'])) {
$adopt = true;
}
if ($linked) {
if ($adopt) {
$img = 'images/policies_brick.png';
@ -1074,15 +989,25 @@ if (!empty($result)) {
$title = __('(Unlinked) ') . $policyInfo['name_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)) .
'</a>';
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'] . '">' .
html_print_image($img,true, array('title' => $title)) .
'</a>';
}
}
if(is_metaconsole()){
metaconsole_restore_db();
}
}
$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
if (defined('METACONSOLE')) {
$agent_link = '<a href="'.
@ -1379,29 +1304,12 @@ if (!empty($result)) {
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$link = ui_get_snapshot_link( array(
'id_module' => $row['id_agente_modulo'],
'last_data' => $row['datos'],
'timestamp' => $row['timestamp'],
'interval' => $row['current_interval'],
'module_name' => $row['module_name']
'module_name' => $row['module_name'],
'id_node' => $row['server_id']
));
if($is_large_image){
$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 {
$salida = ui_get_snapshot_image($link, $is_snapshot) . '&nbsp;&nbsp;';
} else {
$sub_string = substr(io_safe_output($row['datos']), 0, 12);
if ($module_value == $sub_string) {
if ($module_value == 0 && !$sub_string) {

View File

@ -17,6 +17,9 @@ global $config;
require_once ($config["homedir"] . "/include/functions_ui.php");
$sort_field = get_parameter("sort_field", "timestamp");
$sort = get_parameter("sort", "down");
$table = new stdClass();
if(!isset($table->width)) {
@ -130,7 +133,7 @@ else {
//headers
$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';
@ -141,104 +144,104 @@ else {
$i++;
}
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';
$i++;
}
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';
$i++;
}
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->style[$i] = 'min-width: 200px; max-width: 350px; word-break: break-all;';
$i++;
}
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->style[$i] = 'max-width: 350px; word-break: break-all;';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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->style[$i] = 'min-width: 85px;';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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';
$i++;
}
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';
$i++;
@ -249,6 +252,18 @@ else {
$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) {
$table->head[$i] = __('Action');
$table->align[$i] = 'left';
@ -663,6 +678,20 @@ else {
$table->cellclass[count($table->data)][$i] = $myclass;
$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) {
//Actions
@ -741,9 +770,9 @@ else {
echo '<div id="events_list">';
if (!empty ($table->data)) {
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) {

View File

@ -28,6 +28,10 @@ enterprise_include_once('include/functions_events.php');
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_w = check_acl ($config['id_user'], 0, "EW");
$event_m = check_acl ($config['id_user'], 0, "EM");
@ -758,7 +762,8 @@ elseif ($group_rep == 1) {
$history,
false,
false,
'DESC');
$sort_order,
$sort_field);
}
elseif ($group_rep == 2) {
$filter_resume['duplicate'] = $group_rep;

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.724
%define release 180723
%define version 7.0NG.725
%define release 180808
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 7.0NG.724
%define release 180723
%define version 7.0NG.725
%define release 180808
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -9,7 +9,7 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.724"
PI_VERSION="7.0NG.725"
FORCE=0
DESTDIR=""
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 '',
`ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0',
`custom_data` TEXT NOT NULL,
`data` double(22,5) default NULL,
`module_status` int(4) NOT NULL default '0',
PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`),
KEY `idx_agentmodule` (`id_agentmodule`),
@ -2878,6 +2880,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
`ack_utimestamp` BIGINT(20) NOT NULL DEFAULT '0',
`server_id` int(10) NOT NULL,
`custom_data` TEXT NOT NULL DEFAULT '',
`data` double(22,5) default NULL,
`module_status` int(4) NOT NULL default '0',
PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`),
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',
`server_id` int(10) NOT NULL,
`custom_data` TEXT NOT NULL DEFAULT '',
`data` double(22,5) default NULL,
`module_status` int(4) NOT NULL default '0',
PRIMARY KEY (`id_evento`),
KEY `idx_agente` (`id_agente`),
KEY `idx_agentmodule` (`id_agentmodule`),
@ -3198,3 +3204,97 @@ create table IF NOT EXISTS `tmetaconsole_agent_secondary_group`(
ON DELETE CASCADE
) 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_header', ''),
('custom_report_front_footer', ''),
('MR', 18),
('MR', 19),
('identification_reminder', 1),
('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"}'),
('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.724-180723
Version: 7.0NG.725-180808
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

@ -44,8 +44,8 @@ our @EXPORT = qw(
);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.724";
my $pandora_build = "180723";
my $pandora_version = "7.0NG.725";
my $pandora_build = "180808";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -485,7 +485,9 @@ sub pandora_load_config {
$pa_config->{"provisioningserver"} = 1; # 7.0 720
$pa_config->{"provisioningserver_threads"} = 1; # 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
# Check for UID0
@ -1115,6 +1117,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^provisioning_cache_interval\s+([0-9]*)/i){
$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) {
$pa_config->{'snmp_extlog'} = clean_blank($1);
}

View File

@ -3116,11 +3116,12 @@ Generate an event.
=cut
##########################################################################
sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
sub pandora_event ($$$$$$$$$$;$$$$$$$$$$$) {
my ($pa_config, $evento, $id_grupo, $id_agente, $severity,
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh,
$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 $agent = undef;
@ -3134,7 +3135,10 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
my $module = undef;
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) {
logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10);
return;
@ -3162,6 +3166,8 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
$warning_instructions = '' unless defined ($warning_instructions);
$unknown_instructions = '' unless defined ($unknown_instructions);
$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
my $ack_utimestamp = $event_status == 1 ? time() : 0;
@ -3183,8 +3189,8 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
# Create the event
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)
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);
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, $module_data, $module_status);
# Do not write to the event file
return if ($pa_config->{'event_file'} eq '');
@ -4168,11 +4174,11 @@ sub generate_status_event ($$$$$$$$) {
# Generate the event
if ($status != 0){
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 {
# Self validate this event if has "normal" status
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_update
db_update_get_values
set_update_agent
get_action_id
get_addr_id
get_agent_addr_id
@ -801,6 +802,35 @@ sub get_db_rows_limit ($$$;@) {
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.
##########################################################################

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

View File

@ -31,8 +31,8 @@ use base 'Exporter';
our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.724";
my $pandora_build = "180723";
my $pandora_version = "7.0NG.725";
my $pandora_build = "180808";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -461,9 +461,7 @@ sub print_agent {
# print_module
################################################################################
sub print_module {
my $conf = shift;
my $data = shift;
my $not_print_flag = shift;
my ($conf, $data, $not_print_flag) = @_;
if ((ref($data) ne "HASH") || (!defined $data->{name})) {
return undef;
@ -476,9 +474,21 @@ sub print_module {
}
$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->{module_group} = $data->{module_group}?$data->{module_group}:($conf->{MODULE_GROUP}?$conf->{MODULE_GROUP}:undef);
$data->{tags} = ($data->{tags} ?
$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)
@ -990,6 +1000,18 @@ sub init {
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)
################################################################################

View File

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

View File

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

View File

@ -8,8 +8,8 @@
# This code is licensed under GPL 2.0 license.
# **********************************************************************
PI_VERSION="7.0NG.724"
PI_BUILD="180723"
PI_VERSION="7.0NG.725"
PI_BUILD="180808"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.724 PS180723";
my $version = "7.0NG.725 PS180808";
# Pandora server configuration
my %conf;
@ -687,7 +687,7 @@ sub pandora_load_config_pdb ($) {
###############################################################################
sub pandora_checkdb_integrity {
my $dbh = shift;
my ($conf, $dbh) = @_;
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)');
# 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);
# Maintain Referential integrity and other stuff
pandora_checkdb_integrity ($dbh);
pandora_checkdb_integrity ($conf, $dbh);
# Move old data to the history DB
if (defined ($history_dbh)) {

View File

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