conflict solved

Former-commit-id: 1f523d736b97c48ecfb9b39598c529e601702775
This commit is contained in:
alejandro-campos 2019-01-08 11:59:50 +01:00
commit 752186cfba
219 changed files with 8346 additions and 36026 deletions
extras/chrome_extension
pandora_agents
pandora_console

@ -247,4 +247,11 @@ button h3 {
}
.sev-Maintenance {
background: #A8A8A8;
}
.sev-Minor {
background: #F099A2;
color: #333;
}
.sev-Major {
background: #C97A4A;
}

@ -3,7 +3,7 @@ var isFetching = null;
var storedEvents = new Array();
var notVisited = {};
$(window).load(function() {
$(window).on('load', function() {
initilise();
// Wait some ms to throw main function
var delay = setTimeout(main, 100);
@ -29,11 +29,13 @@ function main() {
if (isFetching) return;
isFetching = true;
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=json&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
req = new XMLHttpRequest();
req.onload = handleResponse;
req.onerror = handleError;
req.open("GET", feedUrl, true);
req.withCredentials = true
req.send(null);
}
@ -132,25 +134,23 @@ function fetchNewEvents(A,B){
function parseReplyEvents (reply) {
// Split the API response
var e_array = reply.split("\n");
var data = JSON.parse(reply)
var e_array = JSON.parse(reply).data;
// Form a properly object
var fetchedEvents=new Array();
for(var i=0;i<e_array.length;i++){
// Avoid to parse empty lines
if (e_array[i].length == 0) continue;
var event=e_array[i].split(";");
var event=e_array[i];
fetchedEvents.push({
'id' : event[0],
'agent_name' : event[1],
'agent' : event[2],
'date' : event[5],
'title' : event[6],
'module' : event[9],
'type' : event[14],
'source' : event[17],
'severity' : event[28],
'id' : event.id_evento,
'agent_name' : event.agent_name,
'agent' : event.id_agente,
'date' : event.timestamp,
'title' : event.evento,
'module' : event.id_agentmodule,
'type' : event.event_type,
'source' : event.source,
'severity' : event.criticity_name,
'visited' : false
});
}
@ -215,7 +215,7 @@ function getNotification(pEvent){
if(pEvent['module'] != 0) even += " in the module with Id "+ pEvent['module'];
even += ".";
var url = (pEvent['agent']=="")
var url = (pEvent['agent'] == 0)
? localStorage["ip_address"]+"/index.php?sec=eventos&sec2=operation/events/events"
: localStorage["ip_address"]+"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + pEvent['agent'];

@ -1,17 +1,14 @@
console.log("hola");
var url = window.location.href;
var re = /\?event=(\d+)/;
console.log("hola");
if(re.exec(url)) {
if(!isNaN(RegExp.$1)) {
var eventId = RegExp.$1;
document.write(chrome.extension.getBackgroundPage().getNotification(eventId));
}
}
console.log("hola");
window.onload = function () {
setTimeout(function() {
window.close();
}, 10000);
}
console.log("hola");

@ -91,12 +91,12 @@ function showEvents(){
var a = document.createElement('a');
var temp_style;
var agent_url = (allEvents[i]["agent_name"] == 0)
var agent_url = (allEvents[i]["agent"] == 0)
? localStorage["ip_address"]
+ "/index.php?sec=eventos&sec2=operation/events/events"
: localStorage["ip_address"]
+ "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="
+ allEvents[i]['agent_name'];
+ allEvents[i]['agent'];
a.setAttribute("href",agent_url);
a.target = "_blank";
a.className = 'a_2_mo';

@ -1,6 +1,6 @@
{
"name": "__MSG_name__",
"version": "2.0",
"version": "2.1",
"manifest_version": 2,
"description": "Pandora FMS Event viewer Chrome extension",
"homepage_url": "http://pandorafms.com",
@ -23,6 +23,7 @@
"tabs",
"notifications",
"http://*/*",
"https://*/*",
"background"
],
"default_locale": "en"

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

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

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

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

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

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

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.728
# Version 7.0NG.730
# 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

@ -58,8 +58,17 @@ use strict;
use File::Basename;
use Getopt::Std;
use IO::Select;
use IO::Compress::Zip qw(zip $ZipError);
use IO::Uncompress::Unzip qw(unzip $UnzipError);
my $zlib_available = 1;
eval {
eval "use IO::Compress::Zip qw(zip);1" or die($@);
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
};
if ($@) {
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
$zlib_available = 0;
}
use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,7 +333,9 @@ sub parse_options {
# Compress data
if (defined ($opts{'z'})) {
$t_zip = 1;
if ($zlib_available == 1) {
$t_zip = 1;
}
}
}
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file
$zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError");
print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n");
return;
}
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents
if (! zip($file => \$data)) {
send_data ("QUIT\n");
error ("Compression error: $ZipError");
error ("Compression error: $IO::Compress::Zip::ZipError");
return;
}
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response.");
}
print_log ("Server responded SEND OK");
print_log ("Server responded ZSEND OK");
send_data ($data);
# Wait for server response

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

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

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

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

@ -58,8 +58,17 @@ use strict;
use File::Basename;
use Getopt::Std;
use IO::Select;
use IO::Compress::Zip qw(zip $ZipError);
use IO::Uncompress::Unzip qw(unzip $UnzipError);
my $zlib_available = 1;
eval {
eval "use IO::Compress::Zip qw(zip);1" or die($@);
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
};
if ($@) {
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
$zlib_available = 0;
}
use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,7 +333,9 @@ sub parse_options {
# Compress data
if (defined ($opts{'z'})) {
$t_zip = 1;
if ($zlib_available == 1) {
$t_zip = 1;
}
}
}
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file
$zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError");
print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n");
return;
}
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents
if (! zip($file => \$data)) {
send_data ("QUIT\n");
error ("Compression error: $ZipError");
error ("Compression error: $IO::Compress::Zip::ZipError");
return;
}
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response.");
}
print_log ("Server responded SEND OK");
print_log ("Server responded ZSEND OK");
send_data ($data);
# Wait for server response

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

@ -58,8 +58,17 @@ use strict;
use File::Basename;
use Getopt::Std;
use IO::Select;
use IO::Compress::Zip qw(zip $ZipError);
use IO::Uncompress::Unzip qw(unzip $UnzipError);
my $zlib_available = 1;
eval {
eval "use IO::Compress::Zip qw(zip);1" or die($@);
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
};
if ($@) {
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
$zlib_available = 0;
}
use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,7 +333,9 @@ sub parse_options {
# Compress data
if (defined ($opts{'z'})) {
$t_zip = 1;
if ($zlib_available == 1) {
$t_zip = 1;
}
}
}
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file
$zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError");
print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n");
return;
}
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents
if (! zip($file => \$data)) {
send_data ("QUIT\n");
error ("Compression error: $ZipError");
error ("Compression error: $IO::Compress::Zip::ZipError");
return;
}
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response.");
}
print_log ("Server responded SEND OK");
print_log ("Server responded ZSEND OK");
send_data ($data);
# Wait for server response

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

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

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

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.728-181030
Version: 7.0NG.730-181221
Architecture: all
Priority: optional
Section: admin

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

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

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

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

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

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

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

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

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

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.728
%define release 181030
%define version 7.0NG.730
%define release 181221
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
@ -95,7 +95,8 @@ if [ ! -e /etc/pandora/plugins ]; then
fi
if [ ! -e /etc/pandora/collections ]; then
mkdir -p /etc/pandora/collections
mkdir -p /usr/share/pandora_agent/collections
ln -s /usr/share/pandora_agent/collections /etc/pandora
fi
mkdir -p /var/spool/pandora/data_out

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 7.0NG.728
%define release 181030
%define version 7.0NG.730
%define release 181221
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

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

@ -25,12 +25,33 @@
###############################################################################
use strict;
use warnings;
# Retrieve information from all filesystems
my $all_filesystems = 0;
# Regex flag
my $regex_mode = 0;
my $inode_mode = 0;
# Exclusion
my @exclude_fs = ();
my $cmd = undef;
sub in_array {
my ($array, $value) = @_;
if (!defined($value)) {
return 0;
}
my %params = map { $_ => 1 } @{$array};
if (exists($params{$value})) {
return 1;
}
return 0;
}
sub check_re($$){
my $item = shift;
@ -65,10 +86,24 @@ if ($#ARGV < 0) {
$all_filesystems = 1;
}
# Check if regex mode is enabled
if ($ARGV[0] eq "-r") {
$regex_mode = 1;
shift @ARGV;
while ($#ARGV >= 0) {
my $param = shift @ARGV;
if ($param eq '-r') {
$regex_mode = 1;
shift @ARGV;
}
elsif ($param eq '-i') {
$inode_mode = 1;
}
elsif ($param eq '-exclude_fs') {
my $_tmp = shift @ARGV;
chomp ($_tmp);
@exclude_fs = split /,/, $_tmp;
}
elsif ($param eq '-custom_cmd') {
$cmd = shift @ARGV;
chomp ($cmd);
}
}
# Parse command line parameters
@ -90,7 +125,15 @@ if ($onlyexclude) {
# Retrieve filesystem information
# -P use the POSIX output format for portability
my @df = `df -P`;
$cmd = 'df -PT' unless defined($cmd);
if ($inode_mode > 0) {
$cmd = 'df -PTi';
}
my @df = `$cmd`;
shift (@df);
# No filesystems? Something went wrong.
@ -102,9 +145,13 @@ my %out;
# Parse filesystem usage
foreach my $row (@df) {
my @columns = split (' ', $row);
exit 1 if ($#columns < 4);
if (check_in (\%filesystems,$columns[0]) || ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0]) )) {
$out{$columns[0]} = $columns[4] ;
exit 1 if ($#columns < 5);
next if (in_array(\@exclude_fs, $columns[1]) > 0);
if (check_in (\%filesystems,$columns[0])
|| ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0])) ){
$out{$columns[0]} = $columns[5] ;
}
}
@ -115,7 +162,7 @@ while (my ($filesystem, $use) = each (%out)) {
# Print module output
print "<module>\n";
print "<name><![CDATA[" . $filesystem . "]]></name>\n";
print "<name><![CDATA[" . ($inode_mode > 0 ? 'Inodes:' : '') . $filesystem . "]]></name>\n";
print "<type><![CDATA[generic_data]]></type>\n";
print "<data><![CDATA[" . $use . "]]></data>\n";
print "<description><![CDATA[% of usage in this volume]]></description>\n";

@ -58,8 +58,17 @@ use strict;
use File::Basename;
use Getopt::Std;
use IO::Select;
use IO::Compress::Zip qw(zip $ZipError);
use IO::Uncompress::Unzip qw(unzip $UnzipError);
my $zlib_available = 1;
eval {
eval "use IO::Compress::Zip qw(zip);1" or die($@);
eval "use IO::Uncompress::Unzip qw(unzip);1" or die($@);
};
if ($@) {
print_log ("Zip transfer not available, required libraries not found (IO::Compress::Zip, IO::Uncompress::Unzip).");
$zlib_available = 0;
}
use Socket (qw(SOCK_STREAM AF_INET AF_INET6));
my $SOCKET_MODULE =
eval { require IO::Socket::INET6 } ? 'IO::Socket::INET6'
@ -324,7 +333,9 @@ sub parse_options {
# Compress data
if (defined ($opts{'z'})) {
$t_zip = 1;
if ($zlib_available == 1) {
$t_zip = 1;
}
}
}
@ -622,7 +633,7 @@ sub zrecv_file {
# Receive file
$zdata = recv_data_block ($size);
if (!unzip(\$zdata => \$data)) {
print_log ("Uncompress error: $UnzipError");
print_log ("Uncompress error: $IO::Uncompress::Unzip::UnzipError");
send_data ("ZRECV ERR\n");
return;
}
@ -705,7 +716,7 @@ sub zsend_file {
# Read the file and compress its contents
if (! zip($file => \$data)) {
send_data ("QUIT\n");
error ("Compression error: $ZipError");
error ("Compression error: $IO::Compress::Zip::ZipError");
return;
}
@ -725,7 +736,7 @@ sub zsend_file {
error ("Server responded $response.");
}
print_log ("Server responded SEND OK");
print_log ("Server responded ZSEND OK");
send_data ($data);
# Wait for server response

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2017 Artica Soluciones Tecnologicas
# Version 7.0NG.728
# Version 7.0NG.730
# 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

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

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.728(Build 181030)")
#define PANDORA_VERSION ("7.0NG.730(Build 181221)")
string pandora_path;
string pandora_dir;

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

@ -1,10 +1,10 @@
package: pandorafms-console
Version: 7.0NG.728-181030
Version: 7.0NG.730-181221
Architecture: all
Priority: optional
Section: admin
Installed-Size: 42112
Maintainer: Artica ST <deptec@artica.es>
Homepage: http://pandorafms.org/
Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc
Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc, php7.2-zip | php-zip
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.

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

@ -18,9 +18,8 @@ if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"
exit;
}
// Real start
session_start();
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ('include/config.php');
require_once ('include/functions.php');
require_once ('include/functions_db.php');
@ -82,7 +81,6 @@ if (isset($config['metaconsole'])) {
if ($config['metaconsole'])
define ('METACONSOLE', true);
}
session_write_close ();
if (file_exists ($page)) {
require_once ($page);

@ -30,7 +30,7 @@
},
yaxis: {
tickFormatter: function (value, axis) {
return shortNumber(value);
return shortNumber(roundToTwo(value)) ;
}
},
series: {
@ -178,6 +178,9 @@
return number + " " + shorts[pos];
}
function roundToTwo(num) {
return +(Math.round(num + "e+2") + "e-2");
}
$('#graph').change(function() {
$('form#realgraph').submit();

@ -16,14 +16,14 @@
if (isset($_GET['get_ptr'])) {
if ($_GET['get_ptr'] == 1) {
session_start ();
session_write_close ();
$ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir);
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ($ownDir.'../include/config.php');
// Login check
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;

@ -1,7 +1,22 @@
START TRANSACTION;
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(600) NOT NULL,
`id_group` int(10) unsigned default '0',
`id_custom_field` varchar(600) default '',
`id_custom_fields_data` varchar(600) default '',
`id_status` varchar(600) default '',
`module_search` varchar(600) default '',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
COMMIT;

@ -0,0 +1,11 @@
START TRANSACTION;
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0;
COMMIT;

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
COMMIT;

@ -54,7 +54,7 @@ $rows = db_get_all_rows_in_table('tupdate_settings');
$settings = new StdClass;
foreach ($rows as $row) {
$settings->$row['key'] = $row['value'];
$settings->{$row['key']} = $row['value'];
}
echo '<script type="text/javascript">';

@ -544,6 +544,7 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
`user_comment` text NOT NULL,
`id_tag` integer(10) unsigned NOT NULL default '0',
`name` text default '',
`group_recursion` INT(1) unsigned default 0,
PRIMARY KEY (`id_event_rule`),
KEY `idx_id_event_alert` (`id_event_alert`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -1159,8 +1160,8 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "
-- Table `talert_commands`
-- ---------------------------------------------------------------------
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket';
UPDATE `talert_commands` SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.', `fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1;
ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
@ -1180,13 +1181,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', 22);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 23);
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', '729');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '730');
-- ---------------------------------------------------------------------
-- Table `tconfig_os`
@ -1231,6 +1232,7 @@ ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '
alter table tusuario add autorefresh_white_list text not null default '';
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tagente_modulo`
@ -1803,6 +1805,7 @@ INSERT INTO tlog_graph_models VALUES (1, 'Apache&#x20;log&#x20;model',
-- -----------------------------------------------------
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
@ -1811,3 +1814,23 @@ ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL def
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields_filter`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(600) NOT NULL,
`id_group` int(10) unsigned default '0',
`id_custom_field` varchar(600) default '',
`id_custom_fields_data` varchar(600) default '',
`id_status` varchar(600) default '',
`module_search` varchar(600) default '',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';

@ -32,9 +32,7 @@ if (!$config["MR"]) {
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
if(enterprise_installed()){
enterprise_include_once("../include/functions_update_manager.php");
}
include_once ($config["homedir"]."/include/functions_update_manager.php");
$current_package = update_manager_get_current_package();
@ -48,7 +46,7 @@ else{
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config["MR"]));
echo '</a><br />';
echo '<a class="white footer">'. __('Page generated at') . ' '. date('F j, Y h:i a'); //Always use timestamp here
echo '<a class="white footer">'. __('Page generated at') . ' '. date($config["date_format"]);
echo '</a><br /><span style="color:#eff">&reg; '.get_copyright_notice().'</span>';
if (isset ($config['debug'])) {

@ -484,8 +484,8 @@ if($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig' |
}
ui_require_css_file ('dialog');
ui_require_css_file ('jquery-ui-1.10.0.custom');
ui_require_jquery_file('jquery-ui-1.10.0.custom');
ui_require_css_file ('jquery-ui.min');
ui_require_jquery_file('jquery-ui.min');
?>
<?php

@ -335,11 +335,8 @@ $(document).ready( function() {
handsIn = 0;
handsIn2 = 0;
//Daniel maya 02/06/2016 Display menu with click --INI
if(!click_display){
//Daniel barbero 10/08/2016 Display menu with click --INI
if (autohidden_menu) {
//Daniel barbero 10/08/2016 Display menu with click --END
$('.menu_icon').mouseenter(function() {
table_hover = $(this);
handsIn = 1;
@ -359,37 +356,10 @@ $(document).ready( function() {
}
}, 2500);
});
//Daniel barbero 10/08/2016 Display menu with click --INI
} else {
$('.menu_icon').mouseenter(function() {
table_hover = $(this);
handsIn = 1;
openTime = new Date().getTime();
$("ul#sub"+table_hover[0].id).show();
if( typeof(table_noHover) != 'undefined')
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
$("ul#sub"+table_noHover[0].id).hide();
}).mouseleave(function() {
table_noHover = $(this);
handsIn = 0;
$("ul#sub"+table_hover[0].id).hide();
/*
setTimeout(function() {
opened = new Date().getTime() - openTime;
if(opened > 3000 && handsIn == 0) {
openTime = 4000;
$("ul#sub"+table_hover[0].id).hide();
}
}, 2500);
*/
});
}
//Daniel barbero 10/08/2016 Display menu with click --END
}else{
$(document).ready(function() {
//Daniel barbero 10/08/2016 Display menu with click --INI
if (autohidden_menu) {
//Daniel barbero 10/08/2016 Display menu with click --END
$('.menu_icon').on("click", function() {
if( typeof(table_hover) != 'undefined'){
$("ul#sub"+table_hover[0].id).hide();
@ -409,7 +379,6 @@ $(document).ready( function() {
}
}, 5500);
});
//Daniel barbero 10/08/2016 Display menu with click --INI
} else {
$('.menu_icon').on("click", function() {
if( typeof(table_hover) != 'undefined'){
@ -421,10 +390,8 @@ $(document).ready( function() {
$("ul#sub"+table_hover[0].id).show();
});
}
//Daniel barbero 10/08/2016 Display menu with click --END
});
}
//Daniel maya 02/06/2016 Display menu with click --END
- $('.has_submenu').mouseenter(function() {
table_hover2 = $(this);

@ -14,8 +14,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../include/config.php");
require_once ("../include/functions.php");
require_once ("../include/functions_html.php");
?>
@ -33,11 +35,6 @@ require_once ("../include/functions_html.php");
$id = get_parameter ('id');
$id_user = get_parameter ('id_user');
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
}
$user_language = get_user_language ($id_user);
if (file_exists ('../include/languages/'.$user_language.'.mo')) {

@ -0,0 +1,67 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package General
*/
global $config;
if ($config['language'] == 'es') {
$url_help = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Instalaci%C3%B3n_y_actualizaci%C3%B3n_PHP_7';
}
else{
$url_help = 'https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:_PHP_7';
}
// Prints help dialog information
echo '<div id="login_help_dialog" title="PHP UPDATE REQUIRED" style="display: none;">';
echo '<div style="width:70%; font-size: 10pt; margin: 20px; float:left">';
echo "<p><b style='font-size: 10pt;'>" . __('For a correct operation of PandoraFMS, PHP must be updated to version 7.0 or higher.') . "</b></p>";
echo "<p style='font-size: 10pt;'><b>" . __('Otherwise, functionalities will be lost.') . "</b></p>";
echo "<ul>";
echo "<li style='padding:5px;'>" . __('Report download in PDF format') . "</li>";
echo "<li style='padding:5px;'>" . __('Emails Sending') . "</li>";
echo "<li style='padding:5px;'>" . __('Metaconsole Collections') . "</li>";
echo "<li style='padding:5px;'>" . '...' . "</li>";
echo "</ul>";
echo '<p><a target="blank" href="' . $url_help . '"><b>'.__('Access Help').'</b></a></p>';
echo '</div>';
echo "<div style='margin-top: 80px;'>";
echo html_print_image('images/icono_warning_mr.png', true, array("alt" => __('Warning php version'), "border" => 0));
echo "</div>";
echo '</div>';
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("#login_help_dialog").dialog({
resizable: true,
draggable: true,
modal: true,
height: 320,
width: 550,
overlay: {
opacity: 0.5,
background: "black"
}
});
});
/* ]]> */
</script>

@ -228,11 +228,11 @@ foreach ($result as $row) {
$rowPair = !$rowPair;
$data = array();
$data[0] = $row["id_usuario"];
$data[0] = io_safe_output($row["id_usuario"]);
$data[1] = ui_print_session_action_icon($row["accion"], true) . $row["accion"];
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
. ui_print_timestamp($row["utimestamp"], true);
$data[3] = $row["ip_origen"];
$data[3] = io_safe_output($row["ip_origen"]);
$data[4] = io_safe_output($row["descripcion"]);
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {

@ -484,7 +484,7 @@ $table->data[4][1] = __('Disabled') . ' ' .
$table->data[4][1] .= __('Enabled') . ' ' .
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
if (enterprise_installed()) {
$table->data[4][2] = __('Url address');
$table->data[4][2] = __('Url address') . ui_print_help_tip(__('URL address must be complete, for example: https://pandorafms.com/'), true);
$table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true);
}else{

@ -261,7 +261,7 @@ if ($snmpwalk) {
}
if ($create_modules) {
$modules = get_parameter("module", array());
$modules = io_safe_output(get_parameter("module", array()));
$devices = array();
$processes = array();

@ -924,9 +924,8 @@ if ($update_agent) { // if modified some agent paramenter
enterprise_hook ('update_agent', array ($id_agente));
ui_print_success_message (__('Successfully updated'));
$unsafe_alias = io_safe_output($alias);
db_pandora_audit("Agent management",
"Updated agent $unsafe_alias", false, false, $info);
"Updated agent $alias", false, false, $info);
}
}
@ -1427,7 +1426,7 @@ if ($update_module) {
$edit_module = true;
db_pandora_audit("Agent management",
"Fail to try update module '".io_safe_output($name)."' for agent " . io_safe_output($agent["alias"]));
"Fail to try update module '$name' for agent " . $agent["alias"]);
}
else {
if ($prediction_module == 3) {
@ -1445,7 +1444,7 @@ if ($update_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Updated module '".io_safe_output($name)."' for agent ". io_safe_output($agent["alias"]), false, false, io_json_mb_encode($values));
"Updated module '$name' for agent ".$agent["alias"], false, false, io_json_mb_encode($values));
}
}
@ -1586,7 +1585,7 @@ if ($create_module) {
$edit_module = true;
$moduletype = $id_module;
db_pandora_audit("Agent management",
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]));
"Fail to try added module '$name' for agent ".$agent["alias"]);
}
else {
if ($prediction_module == 3) {
@ -1604,7 +1603,7 @@ if ($create_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]), false, true, io_json_mb_encode($values));
"Added module '$name' for agent ".$agent["alias"], false, true, io_json_mb_encode($values));
}
}
@ -1727,7 +1726,7 @@ if ($delete_module) { // DELETE agent module !
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Deleted module '".io_safe_output($module_data["nombre"])."' for agent ".io_safe_output($agent["alias"]));
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
}
@ -1760,11 +1759,11 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
if ($result) {
db_pandora_audit("Agent management",
"Duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]) . " with the new id for clon " . $result);
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"] . " with the new id for clon " . $result);
}
else {
db_pandora_audit("Agent management",
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]));
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"]);
}
}
@ -1943,7 +1942,7 @@ switch ($tab) {
var aget_id_os = '<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter("id_agent_module"))); ?>';
if('<?php echo modules_get_agentmodule_name(get_parameter("id_agent_module")); ?>' != $('#text-name').val() &&
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter("id_agent_module"))); ?>' != $('#text-name').val() &&
'<?php echo agents_get_os(modules_get_agentmodule_agent(get_parameter("id_agent_module"))); ?>' == 19){
event.preventDefault();
@ -1977,7 +1976,7 @@ switch ($tab) {
var module_type_snmp = '<?php echo modules_get_agentmodule_type(get_parameter("id_agent_module")); ?>';
if('<?php echo modules_get_agentmodule_name(get_parameter("id_agent_module")); ?>' != $('#text-name').val() && (
if('<?php echo html_entity_decode(modules_get_agentmodule_name(get_parameter("id_agent_module"))); ?>' != $('#text-name').val() && (
module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){
event.preventDefault();

@ -481,15 +481,14 @@ if ($agents !== false) {
if($agent["id_os"] == 100){
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.$agent['nombre'].'</a>';
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.$agent['alias'].'</a>';
}else{
echo "<a alt =".$agent["nombre"]." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=" . $agent["id_agente"] . "'>" .
'<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
"</a>";
}
}
echo "</strong>";
$in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime

@ -573,7 +573,7 @@ ui_require_javascript_file ('pandora_modules');
?>
<script language="javascript">
/* <![CDATA[ */
var no_name_lang = "<?php echo __('No module name provided') ?>";
var no_name_lang = "<?php echo __ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module name provided') ) ); ?>";
var no_target_lang = "<?php echo __('No target IP provided') ?>";
var no_oid_lang = "<?php echo __('No SNMP OID provided') ?>";
var no_prediction_module_lang = "<?php echo __('No module to predict') ?>";

@ -13,9 +13,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
session_start ();
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ("../../include/config.php");
require_once ("../../include/functions.php");
require_once ("../../include/functions_db.php");
require_once ("../../include/functions_users.php");

@ -57,7 +57,7 @@ else {
$sec = 'galertas';
}
if ((!$copy_action) && (!$delete_action) && (!$update_action)) {
if ((!$copy_action) && (!$delete_action)) {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
@ -141,135 +141,8 @@ if ($copy_action) {
__('Could not be copied'));
}
if ($create_action) {
$name = (string) get_parameter ('name');
$id_alert_command = (int) get_parameter ('id_command');
$fields_descriptions = array();
$fields_values = array();
$info_fields = '';
$values = array();
for($i=1;$i<=$config['max_macro_fields'];$i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field'.$i.': ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
$info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
}
$values['id_group'] = (string) get_parameter ('group');
$values['action_threshold'] = (int) get_parameter ('action_threshold');
$name_check = db_get_value ('name', 'talert_actions', 'name', $name);
if ($name_check) {
$result = '';
}
else {
$result = alerts_create_alert_action ($name, $id_alert_command,
$values);
$info = '{"Name":"'.$name.'", "ID alert Command":"'.$id_alert_command.'", "Field information":"'.$info_fields.'", "Group":"'.$values['id_group'].'",
"Action threshold":"'.$values['action_threshold'].'"}';
}
if ($result) {
db_pandora_audit("Command management", "Create alert action #" . $result, false, false, $info);
}
else {
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
}
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($name == "") {
$messageAction = __('No name specified');
}
if ($id_alert_command == "") {
$messageAction = __('No command specified');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
$messageAction);
}
if ($update_action) {
$id = (string) get_parameter ('id');
$al_action = alerts_get_alert_action ($id);
if ($al_action !== false) {
if ($al_action['id_group'] == 0) {
if (! check_acl ($config['id_user'], 0, "PM")) {
db_pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
exit;
}
else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
}
else {
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/gm_alerts.png", false, "alerts_config", true);
}
}
}
}
else {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
}
else {
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/gm_alerts.png", false, "alerts_config", true);
}
}
$name = (string) get_parameter ('name');
$id_alert_command = (int) get_parameter ('id_command');
$group = get_parameter ('group');
$action_threshold = (int) get_parameter ('action_threshold');
$info_fields = '';
$values = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field1: ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
$info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
}
$values['name'] = $name;
$values['id_alert_command'] = $id_alert_command;
$values['id_group'] = $group;
$values['action_threshold'] = $action_threshold;
if (!$name) {
$result = '';
}
else {
$result = alerts_update_alert_action ($id, $values);
}
if ($result) {
db_pandora_audit("Command management", "Update alert action #" . $id, false, false, json_encode($values));
}
else {
db_pandora_audit("Command management", "Fail try to update alert action #" . $id, false, false, json_encode($values));
}
ui_print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
if ($update_action || $create_action) {
alerts_ui_update_or_create_actions($update_action);
}
if ($delete_action) {
@ -342,6 +215,7 @@ if ($delete_action) {
__('Could not be deleted'));
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->data = array ();
@ -363,9 +237,13 @@ $table->align[3] = 'left';
$filter = array();
if (!is_user_admin($config['id_user']))
$filter['id_group'] = array_keys(users_get_groups(false, "LM"));
$filter['talert_actions.id_group'] = array_keys(users_get_groups(false, "LM"));
$actions = db_get_all_rows_filter ('talert_actions', $filter);
$actions = db_get_all_rows_filter (
'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
$filter,
'talert_actions.* , talert_commands.id_group AS command_group'
);
if ($actions === false)
$actions = array ();
@ -380,11 +258,19 @@ foreach ($actions as $action) {
$iterator++;
$data = array ();
$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;';
if (!alerts_validate_command_to_action($action["id_group"], $action["command_group"])) {
$data[1].= html_print_image(
"images/error.png",
true,
// FIXME: Translation.
array("title" => __("The action and the command associated with it do not have the same group. Please contact an administrator to fix it.")
));
}
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;">' .
@ -393,7 +279,7 @@ foreach ($actions as $action) {
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/cross.png", true) . '</a>';
}
array_push ($table->data, $data);
}
if (isset($data)) {

@ -38,6 +38,7 @@ $pure = (int)get_parameter('pure', 0);
$update_command = (bool) get_parameter ('update_command');
$create_command = (bool) get_parameter ('create_command');
$delete_command = (bool) get_parameter ('delete_command');
$copy_command = (bool) get_parameter ('copy_command');
if (is_ajax ()) {
$get_alert_command = (bool) get_parameter ('get_alert_command');
@ -57,37 +58,13 @@ if (is_ajax ()) {
if (isset($command['description'])) {
$command['description'] = io_safe_input(str_replace("\r\n","<br>", io_safe_output($command['description'])));
}
// Get the html rows of the fields form
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
// Descriptions are stored in json
$fields_descriptions = empty($command['fields_descriptions']) ?
'' : json_decode(io_safe_output($command['fields_descriptions']), true);
// Fields values are stored in json
$fields_values = empty($command['fields_values']) ?
'' : io_safe_output(json_decode($command['fields_values'], true));
break;
case "oracle":
// Descriptions are stored in json
$description_field = str_replace("\\\"","\"",$command['fields_descriptions']);
$description_field = str_replace("\\","",$description_field);
$fields_descriptions = empty($command['fields_descriptions']) ?
'' : json_decode(io_safe_output($description_field), true);
// Fields values are stored in json
$values_fields = str_replace("\\\"","\"",$command['fields_values']);
$values_fields = str_replace("\\","",$values_fields);
$fields_values = empty($command['fields_values']) ?
'' : io_safe_output(json_decode($values_fields, true));
break;
}
// Descriptions are stored in json
$fields_descriptions = empty($command['fields_descriptions']) ?
'' : json_decode(io_safe_output($command['fields_descriptions']), true);
// Fields values are stored in json
$fields_values = empty($command['fields_values']) ?
'' : io_safe_output(json_decode($command['fields_values'], true));
$fields_rows = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@ -266,13 +243,11 @@ if (defined('METACONSOLE'))
else
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert commands'), "images/gm_alerts.png", false, "alerts_config", true);
if ($create_command) {
$name = (string) get_parameter ('name');
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array();
$fields_values = array();
@ -287,7 +262,8 @@ if ($create_command) {
$values['fields_values'] = io_json_mb_encode($fields_values);
$values['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
$values['description'] = $description;
$values['id_group'] = $id_group;
$name_check = db_get_value ('name', 'talert_commands', 'name', $name);
if (!$name_check) {
@ -349,8 +325,27 @@ if ($delete_command) {
ui_print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}
if ($copy_command) {
$id = (int) get_parameter ('id');
// Get the info from the source command
$command_to_copy = db_get_row('talert_commands', 'id', $id);
if ($command_to_copy === false) {
ui_print_error_message(__("Command with id $id does not found."));
} else {
// Prepare to insert the copy with same values
unset ($command_to_copy['id']);
$command_to_copy['name'].= __(' (copy)');
$result = db_process_sql_insert('talert_commands', $command_to_copy);
// Print the result
ui_print_result_message ($result,
__('Successfully copied'),
__('Could not be copied')
);
}
}
$table->width = '100%';
@ -358,45 +353,54 @@ $table->class = 'databox data';
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('ID');
$table->head[2] = __('Description');
$table->head[3] = __('Delete');
$table->head['name'] = __('Name');
$table->head['id'] = __('ID');
$table->head['group'] = __('Group');
$table->head['description'] = __('Description');
$table->head['action'] = __('Actions');
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->style['name'] = 'font-weight: bold';
$table->size = array ();
$table->size[3] = '40px';
$table->size['action'] = '40px';
$table->align = array ();
$table->align[3] = 'left';
$table->align['action'] = 'left';
$commands = db_get_all_rows_in_table ('talert_commands');
if ($commands === false)
$commands = array ();
$commands = db_get_all_rows_filter(
'talert_commands',
array('id_group' => array_keys(users_get_groups(false, "LM")))
);
if ($commands === false) $commands = array ();
foreach ($commands as $command) {
$data = array ();
$data[0] = '<span style="font-size: 7.5pt">';
$data['name'] = '<span style="font-size: 7.5pt">';
if (! $command['internal'])
$data[0] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'.
$data['name'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&id='.$command['id'].'&pure='.$pure.'">'.
$command['name'].'</a>';
else
$data[0] .= $command['name'];
$data[0] .= '</span>';
$data[1] = $command['id'];
$data[2] = str_replace("\r\n","<br>",
$data['name'] .= $command['name'];
$data['name'] .= '</span>';
$data['id'] = $command['id'];
$data['group'] = ui_print_group_icon ($command["id_group"], true);
$data['description'] = str_replace("\r\n","<br>",
io_safe_output($command['description']));
$data[3] = '';
$data['action'] = '';
if (! $command['internal']) {
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
$data['action'] = '<span style="display: inline-flex">';
$data['action'].= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&amp;copy_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/copy.png", true) . '</a>';
$data['action'].= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&delete_command=1&id='.$command['id'].'&pure='.$pure.'"
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/cross.png", true) . '</a>';
$data['action'].= '</span>';
}
array_push ($table->data, $data);
}
if (isset($data)) {
if (count($table->data) > 0) {
html_print_table ($table);
}
else {

@ -122,7 +122,6 @@ $table->colspan[0][1] = 2;
$table->data[1][0] = __('Group');
$groups = users_get_groups ();
$own_info = get_user_info ($config['id_user']);
// Only display group "All" if user is administrator or has "PM" privileges
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
@ -133,9 +132,17 @@ $table->data[1][1] = html_print_select_groups(false, "LW", $display_all_group, '
$table->colspan[1][1] = 2;
$table->data[2][0] = __('Command');
$table->data[2][1] = html_print_select_from_sql ('SELECT id, name
FROM talert_commands',
'id_command', $id_command, '', __('None'), 0, true);
$commands_sql = db_get_all_rows_filter(
'talert_commands',
array('id_group' => array_keys(users_get_groups(false, "LW"))),
array('id', 'name'),
'AND',
false,
true
);
$table->data[2][1] = html_print_select_from_sql ($commands_sql, 'id_command', $id_command,
'', __('None'), 0, true
);
$table->data[2][1] .= ' ';
if (check_acl ($config['id_user'], 0, "PM")) {
$table->data[2][1] .= html_print_image ('images/add.png', true);
@ -282,6 +289,19 @@ $(document).ready (function () {
var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>');
// Change the selected group
$("#group option").each(function(index, value) {
var current_group = $(value).val();
if (data.id_group != 0 && current_group != 0 && current_group != data.id_group) {
$(value).hide();
} else {
$(value).show();
}
});
if (data.id_group != 0 && $("#group").val() != data.id_group) {
$("#group").val(0);
}
for (i = 1; i <= max_fields; i++) {
var old_value = '';
var old_recovery_value = '';

@ -54,6 +54,7 @@ if ($update_command) {
$name = (string) get_parameter ('name');
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
$id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array();
$fields_values = array();
@ -71,7 +72,8 @@ if ($update_command) {
$values['name'] = $name;
$values['command'] = $command;
$values['description'] = $description;
$values['id_group'] = $id_group;
//Check it the new name is used in the other command.
$id_check = db_get_value ('id', 'talert_commands', 'name', $name);
if (($id_check != $id) && (!empty($id_check))) {
@ -100,12 +102,13 @@ $command = '';
$description = '';
$fields_descriptions = '';
$fields_values = '';
$id_group = 0;
if ($id) {
$alert = alerts_get_alert_command ($id);
$name = $alert['name'];
$command = $alert['command'];
$description = $alert['description'];
$id_group = $alert['id_group'];
$fields_descriptions = $alert['fields_descriptions'];
$fields_values = $alert['fields_values'];
}
@ -123,13 +126,7 @@ $table->width = '100%';
$table->class = 'databox filters';
if (defined('METACONSOLE')) {
if ($id) {
$table->head[0] = __('Update Command');
}
else {
$table->head[0] = __('Create Command');
}
$table->head[0] = ($id) ? __('Update Command') : __('Create Command');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
@ -142,18 +139,25 @@ $table->size = array ();
$table->size[0] = '20%';
$table->data = array ();
$table->colspan[0][1] = 3;
$table->data[0][0] = __('Name');
$table->data[0][2] = html_print_input_text ('name', $name, '', 35, 255, true);
$table->colspan['name'][1] = 3;
$table->data['name'][0] = __('Name');
$table->data['name'][2] = html_print_input_text ('name', $name, '', 35, 255, true);
$table->colspan[1][1] = 3;
$table->data[1][0] = __('Command');
$table->data[1][0] .= ui_print_help_icon ('alert_macros', true);
$table->data[1][1] = html_print_textarea ('command', 8, 30, $command, '', true);
$table->colspan['command'][1] = 3;
$table->data['command'][0] = __('Command');
$table->data['command'][0] .= ui_print_help_icon ('alert_macros', true);
$table->data['command'][1] = html_print_textarea ('command', 8, 30, $command, '', true);
$table->colspan['group'][1] = 3;
$table->data['group'][0] = __('Group');
$table->data['group'][1] = html_print_select_groups(false, "LM",
true, 'id_group', $id_group, false,
'', 0, true);
$table->colspan['description'][1] = 3;
$table->data['description'][0] = __('Description');
$table->data['description'][1] = html_print_textarea ('description', 10, 30, $description, '', true);
$table->colspan[2][1] = 3;
$table->data[2][0] = __('Description');
$table->data[2][1] = html_print_textarea ('description', 10, 30, $description, '', true);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {

@ -12,19 +12,17 @@
$ownDir = dirname(__FILE__) . '/';
$ownDir = str_replace("\\", "/", $ownDir);
require_once($ownDir . "../include/config.php");
require_once($config["homedir"] . "/include/functions.php");
require_once($config["homedir"] . "/include/functions_db.php");
require_once($config["homedir"] . "/include/auth/mysql.php");
// Don't start a session before this import.
// The session is configured and started inside the config process.
require_once ($ownDir . "../include/config.php");
require_once ($config["homedir"] . "/include/functions.php");
require_once ($config["homedir"] . "/include/functions_db.php");
require_once ($config["homedir"] . "/include/auth/mysql.php");
global $config;
if (! isset($_SESSION["id_usuario"])) {
session_start();
session_write_close();
}
// Login check
if (!isset($_SESSION["id_usuario"])) {
$config['id_user'] = null;

@ -229,15 +229,31 @@ $(document).ready (function () {
});
$("#left").click (function () {
var current_fields_size = ($('#fields_selected option').length);
var selected_fields = [];
var selected_fields_total = '';
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>) {
id_field = $(value).attr('value');
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
$("#fields_selected").find("option[value='" + id_field + "']").remove();
$("#fields_available").find("option[value='0']").remove();
}
field_name = $(value).html();
selected_fields.push(field_name);
selected_fields_total = selected_fields.length;
});
if(selected_fields_total === current_fields_size){
display_confirm_dialog(
"<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
"<?php echo __('Confirm'); ?>",
"<?php echo __('Cancel'); ?>",
function () {
move_left();
$("#fields_available").find("option[value='timestamp']").remove();
$("select[name='fields_selected[]']").append($("<option></option>").val('timestamp').html('<i>' + 'Timestamp' + '</i>'));
}
);
}
else{
move_left();
}
});
$("#submit-upd_button").click(function () {
@ -247,4 +263,16 @@ $(document).ready (function () {
});
});
});
function move_left(){
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
field_name = $(value).html();
if (field_name != <?php echo "'".__('None')."'"; ?>) {
id_field = $(value).attr('value');
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
$("#fields_selected").find("option[value='" + id_field + "']").remove();
$("#fields_available").find("option[value='0']").remove();
}
});
}
</script>

@ -16,6 +16,8 @@
global $config;
include_once($config['homedir'] . "/include/functions_event_responses.php");
check_login ();
if (! check_acl($config['id_user'], 0, "PM")) {
@ -25,14 +27,7 @@ if (! check_acl($config['id_user'], 0, "PM")) {
return;
}
if (!is_user_admin($config['id_user'])) {
$id_groups = array_keys(users_get_groups(false, "PM"));
$event_responses = db_get_all_rows_filter('tevent_response',
array('id_group' => $id_groups));
}
else {
$event_responses = db_get_all_rows_in_table('tevent_response');
}
$event_responses = event_responses_get_responses();
if(empty($event_responses)) {
ui_print_info_message ( array('no_close'=>true, 'message'=> __('No responses found') ) );

@ -16,6 +16,8 @@
global $config;
include_once($config['homedir'] . "/include/functions_event_responses.php");
check_login ();
if (! check_acl($config['id_user'], 0, "PM")) {
@ -40,24 +42,9 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params');
if (enterprise_installed()) {
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec');
}
else {
$values['server_to_exec'] = 0;
}
}
else {
$values['server_to_exec'] = 0;
}
if($values['new_window'] == 1) {
$values['modal_width'] = 0;
$values['modal_height'] = 0;
}
$result = db_process_sql_insert('tevent_response', $values);
$values['server_to_exec'] = get_parameter('server_to_exec');
$result = event_responses_create_response($values);
if($result) {
ui_print_success_message(__('Response added succesfully'));
@ -78,26 +65,10 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params');
if (enterprise_installed()) {
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec');
}
else {
$values['server_to_exec'] = 0;
}
}
else {
$values['server_to_exec'] = 0;
}
if($values['new_window'] == 1) {
$values['modal_width'] = 0;
$values['modal_height'] = 0;
}
$values['server_to_exec'] = get_parameter('server_to_exec');
$response_id = get_parameter('id_response',0);
$result = db_process_sql_update('tevent_response', $values, array('id' => $response_id));
$result = event_responses_update_response($response_id, $values);
if($result) {
ui_print_success_message(__('Response updated succesfully'));

@ -48,7 +48,7 @@ if ($create_profiles) {
// If the profile doesnt exist, we create it
if ($profile_data === false) {
db_pandora_audit("User management",
"Added profile for user ".io_safe_output($user));
"Added profile for user ".io_safe_input($user));
$return = profile_create_user_profile ($user, $profile, $group);
if ($return !== false) {
$n_added ++;

@ -175,6 +175,7 @@ if ($update) {
}
}
$table = new stdClass();
$table->id = 'delete_table';
$table->class = 'databox filters';
$table->width = '100%';
@ -235,7 +236,7 @@ switch ($config["dbtype"]) {
if ($module_types === false)
$module_types = array ();
$types = '';
$types = array();
foreach ($module_types as $type) {
$types[$type['id_tipo']] = $type['description'];
}
@ -248,22 +249,18 @@ $snmp_versions['3'] = 'v. 3';
$table->width = '100%';
$table->data = array ();
$table->data['selection_mode'][0] = __('Selection mode');
$table->data['selection_mode'][1] = '<span style="width:110px;display:inline-block;">'.__('Select modules first ') . '</span>' .
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>';
$table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-block;">'.__('Select agents first ') . '</span>' .
html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
$table->rowclass['form_modules_1'] = 'select_modules_row';
$table->data['form_modules_1'][0] = __('Module type');
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
$table->data['form_modules_1'][0] .= '</span>';
$types[0] = __('All');
$table->colspan['form_modules_1'][1] = 2;
$table->data['form_modules_1'][1] = html_print_select ($types,

@ -32,6 +32,7 @@ enterprise_include ('godmode/massive/massive_operations.php');
$tab = (string) get_parameter ('tab', 'massive_agents');
$option = (string) get_parameter ('option', '');
$options_alerts = array(
'add_alerts' => __('Bulk alert add'),
'delete_alerts' => __('Bulk alert delete'),
@ -224,6 +225,11 @@ if ((get_cfg_var("max_execution_time") != 0)
echo '</div>';
}
if ($tab == 'massive_policies' && is_central_policies_on_node()){
ui_print_warning_message(__('This node is configured with centralized mode. All policies information is read only. Go to metaconsole to manage it.'));
return;
}
// Catch all submit operations in this view to display Wait banner
$submit_action = get_parameter('go');
$submit_update = get_parameter('updbutton');

@ -49,7 +49,7 @@ You can of course remove the warnings, that's why we include the source and do n
ui_print_page_header (__('Module management') . ' &raquo; ' .
__('Network component management'), "", false,
"network_component", true,"",true,"modulemodal");
"network_component", true,"",false,"modulemodal");
$sec = 'gmodules';
}

@ -60,8 +60,6 @@ if ($edit_graph) {
$stacked = $graphInTgraph['stacked'];
$period = $graphInTgraph['period'];
$id_group = $graphInTgraph['id_group'];
$width = $graphInTgraph['width'];
$height = $graphInTgraph['height'];
$check = false;
$percentil = $graphInTgraph['percentil'];
$summatory_series = $graphInTgraph['summatory_series'];
@ -78,8 +76,6 @@ else {
$id_agent = 0;
$id_module = 0;
$id_group = 0;
$width = 550;
$height = 210;
$period = SECONDS_1DAY;
$factor = 1;
$stacked = 4;
@ -136,15 +132,6 @@ if ($stacked == CUSTOM_GRAPH_GAUGE)
$hidden = ' style="display:none;" ';
else
$hidden = '';
echo "<tr>";
echo "<td class='datos stacked' $hidden>";
echo "<b>".__('Width')."</b></td>";
echo "<td class='datos'>";
echo "<input type='text' name='width' value='$width' $hidden size=6></td>";
echo "<td class='datos2'>";
echo "<b>".__('Height')."</b></td>";
echo "<td class='datos2'>";
echo "<input type='text' name='height' value='$height' size=6></td></tr>";
echo "<tr>";
echo "<td class='datos'>";

@ -81,8 +81,6 @@ if ($add_graph) {
$description = get_parameter_post ("description");
$module_number = get_parameter_post ("module_number");
$idGroup = get_parameter_post ('graph_id_group');
$width = get_parameter_post ("width");
$height = get_parameter_post ("height");
$stacked = get_parameter ("stacked", 0);
$period = get_parameter_post ("period");
$threshold = get_parameter('threshold');
@ -102,8 +100,6 @@ if ($add_graph) {
'name' => $name,
'description' => $description,
'period' => $period,
'width' => $width,
'height' => $height,
'private' => 0,
'id_group' => $idGroup,
'stacked' => $stacked,
@ -134,8 +130,6 @@ if ($update_graph) {
$name = get_parameter('name');
$id_group = get_parameter('graph_id_group');
$description = get_parameter('description');
$width = get_parameter('width');
$height = get_parameter('height');
$period = get_parameter('period');
$stacked = get_parameter('stacked');
$percentil = get_parameter('percentil');

@ -1082,13 +1082,15 @@ You can of course remove the warnings, that's why we include the source and do n
WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0';
}
$all_agent_log = db_get_all_rows_sql($sql_log_report);
foreach ($all_agent_log as $key => $value) {
$agents2[$value['id_agente']] = $value['alias'];
if(isset($all_agent_log) && is_array($all_agent_log)){
foreach ($all_agent_log as $key => $value) {
$agents2[$value['id_agente']] = $value['alias'];
}
}
if ((empty($agents2)) || $agents2 == -1) $agents = array();
$agents_select = array();
if (is_array($id_agents) || is_object($id_agents)){
foreach ($id_agents as $id) {
@ -1574,7 +1576,8 @@ You can of course remove the warnings, that's why we include the source and do n
<tr id="row_historical_db_check" style="" class="datos">
<td style="font-weight:bold;">
<?php echo __('Query History Database'); ?>
<?php echo __('Query History Database')
. ui_print_help_tip(__('With the token enabled the query will affect the Historical Database, which may mean a small drop in performance.'), true); ?>
</td>
<td style="">
<?php
@ -1615,16 +1618,6 @@ You can of course remove the warnings, that's why we include the source and do n
?>
</td>
</tr>
<tr id="row_hide_notinit_agents" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Hide not init agents');?></td>
<td>
<?php
html_print_checkbox('hide_notinit_agents', 1,
$hide_notinit_agents, false, false);
?>
</td>
</tr>
<tr id="row_priority_mode" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Priority mode');?></td>

@ -1869,7 +1869,7 @@ switch ($action) {
break;
}
metaconsole_restore_db_force();
metaconsole_restore_db();
$temp_sort[$report_item['id_rc']] = $element_name;

@ -195,10 +195,10 @@ html_print_submit_button ($textButtonSubmit, 'update_layout', false,
echo '</div>';
echo "</form>";
ui_require_css_file ("color-picker");
ui_require_jquery_file ("colorpicker");
?>
<script src="include/javascript/jquery.colorpicker.js"></script>
<script type="text/javascript">
$(document).ready (function () {

@ -50,10 +50,10 @@ function toggle_advance_options_palette(close) {
function visual_map_main() {
img_handler_start = "images/dot_red.png";
img_handler_end = "images/dot_green.png";
get_image_url(img_handler_start).success(function (data) {
get_image_url(img_handler_start).done(function (data) {
img_handler_start = data;
});
get_image_url(img_handler_end).success(function (data) {
get_image_url(img_handler_end).done(function (data) {
img_handler_end = data;
});
@ -65,9 +65,7 @@ function visual_map_main() {
eventsItems();
//Fixed to wait the load of images.
$(window).load(function() {
$(window).on('load', function() {
$('#module').change(function(){
var txt = $("#module").val();
if(selectedItem == 'simple_value' || creationItem == 'simple_value'){
@ -147,14 +145,15 @@ function visual_map_main() {
}
});
bindColorRangeEvents();
draw_lines(lines, 'background', true);
draw_user_lines("", 0, 0, 0 , 0, 0, true);
//~ center_labels();
}
);
});
obj_js_user_lines = new jsGraphics("background");
@ -223,12 +222,11 @@ function update_button_palette_callback() {
// TODO VALIDATE DATA
switch (selectedItem) {
case 'background':
if(values['width'] < 1024 || values['height'] < 768){
alert('Min allowed size is 1024x768');
return false;
alert('Min allowed size is 1024x768');
return false;
}
if(values['width'] == 0 && values['height'] == 0) {
values['width'] =
$("#hidden-background_original_width").val();
@ -238,7 +236,6 @@ function update_button_palette_callback() {
$("#background").css('width', values['width']);
$("#background").css('height', values['height']);
//$("#background").css('background', 'url(images/console/background/' + values['background'] + ')');
var image = values['background'];
$("#background_img").attr('src', "images/spinner.gif");
set_image("background", null, image);
@ -246,7 +243,6 @@ function update_button_palette_callback() {
idElement = 0;
break;
case 'box_item':
if($('input[name=width_box]').val() == ''){
alert('Undefined width');
return false;
@ -255,11 +251,11 @@ function update_button_palette_callback() {
alert('Undefined height');
return false;
}
$("#" + idItem + " div").css('background-color', values['fill_color']);
$("#" + idItem + " div").css('border-color', values['border_color']);
$("#" + idItem + " div").css('border-width', values['border_width'] + "px");
if(values['height_box']==0 || values['width_box']==0){
$("#" + idItem + " div").css('width', "300px");
$("#" + idItem + " div").css('height', "180px");
@ -274,54 +270,43 @@ function update_button_palette_callback() {
alert('Undefined image');
return false;
}
$("#text_" + idItem).html(values['label']);
if(values['show_statistics'] == 1){
if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;');
}
else if(values['label_position'] == 'right'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;');
}
else{
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png");
}
$('#'+idItem).append($image);
}
if ((values['width'] == 0) || (values['height'] == 0)) {
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 520);
$("#image_" + idItem).attr('height', 80);
$("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', 520);
$("#image_" + idItem).attr('height', 80);
$("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
}
else {
$("#image_" + idItem).removeAttr('width');
@ -331,49 +316,36 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
}
}
}
else{
if ((values['width'] == 0) || (values['height'] == 0)) {
if(values['image'] != '' && values['image'] != 'none'){
if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;');
}
else if(values['label_position'] == 'right'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;');
}
else{
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png");
}
$('#'+idItem).append($image);
}
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
@ -385,15 +357,11 @@ function update_button_palette_callback() {
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
}
else{
$("#image_" + idItem).removeAttr('width');
@ -404,7 +372,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', '70px');
$("#image_" + idItem).remove();
}
}
else {
$("#image_" + idItem).removeAttr('width');
@ -414,14 +381,9 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px');
}
}
break;
case 'static_graph':
if($('input[name=width]').val() == ''){
alert('Undefined width');
return false;
@ -436,10 +398,8 @@ function update_button_palette_callback() {
}
$("#text_" + idItem).html(values['label']);
if(values['show_statistics'] == 1){
if ((values['width'] == 0) || (values['height'] == 0)) {
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
@ -448,7 +408,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
}
else {
$("#image_" + idItem).removeAttr('width');
@ -458,50 +417,35 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
}
}
}
else{
if ((values['width'] == 0) || (values['height'] == 0)) {
if(values['image'] != '' && values['image'] != 'none'){
if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;');
}
else if(values['label_position'] == 'right'){
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;');
}
else{
var $image = $('<img></img>')
.attr('id', 'image_' + idItem)
.attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png");
}
$('#'+idItem).append($image);
}
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
@ -513,15 +457,11 @@ function update_button_palette_callback() {
else{
$("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
}
}
else{
$("#image_" + idItem).removeAttr('width');
@ -532,7 +472,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', '70px');
$("#image_" + idItem).remove();
}
}
else {
$("#image_" + idItem).removeAttr('width');
@ -542,9 +481,7 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px');
}
}
break;
case 'percentile_bar':
case 'percentile_item':
@ -552,13 +489,15 @@ function update_button_palette_callback() {
alert('Undefined width');
return false;
}
if($('input[name=height_percentile]').val() == ''){
alert('Undefined height');
return false;
}
$("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif");
if (values['type_percentile'] == 'bubble') {
setPercentileBubble(idItem, values);
}
@ -571,7 +510,7 @@ function update_button_palette_callback() {
else {
setPercentileBar(idItem, values);
}
break;
case 'module_graph':
if($('#dir_items').html() == 'horizontal'){
@ -804,6 +743,12 @@ function readFields() {
values['label'] = $("input[name=label]").val();
var text = tinymce.get('text-label').getContent();
values['label'] = text;
if ($("input[name=percentile_label]").val().length > 0) {
values['percentile_label_color'] = $("input[name=percentile_label_color]").val();
values['label'] = "<span style='color:"+values['percentile_label_color']+";'>" + $("input[name=percentile_label]").val() + "</span>";
}
values['line-height'] = $("#text-label_ifr").contents().find("p").css('line-height');
values['type_graph'] = $("select[name=type_graph]").val();
values['image'] = $("select[name=image]").val();
@ -843,7 +788,6 @@ function readFields() {
values['event_max_time_row'] = $("select[name=event_max_time_row]").val();
values['type_percentile'] = $("select[name=type_percentile]").val();
values['percentile_color'] = $("input[name=percentile_color]").val();
values['percentile_label_color'] = $("input[name=percentile_label_color]").val();
values['percentile_label'] = $("input[name=percentile_label]").val();
values['value_show'] = $("select[name=value_show]").val();
@ -871,6 +815,25 @@ function readFields() {
values['clock_animation'] = $("select[name=clock_animation]").val();
values['show_last_value'] = $("select[name=last_value]").val();
// Color Cloud values
if (selectedItem == "color_cloud" || creationItem == "color_cloud") {
var diameter = $("input[name=diameter]").val();
values["diameter"] = values["width"] = values["height"] = diameter;
var defaultColor = $("input[name=default_color]").val();
values["default_color"] = defaultColor;
// Ranges
$('input[name="color_range_from_values[]"]').each(function (index, element) {
values["color_range_from_values[" + index + "]"] = $(element).val();
});
$('input[name="color_range_to_values[]"]').each(function (index, element) {
values["color_range_to_values[" + index + "]"] = $(element).val();
});
$('input[name="color_range_color_values[]"]').each(function (index, element) {
values["color_range_colors[" + index + "]"] = $(element).val();
});
}
if (is_metaconsole()) {
values['metaconsole'] = 1;
values['id_agent'] = $("#hidden-agent").val();
@ -1237,6 +1200,7 @@ function toggle_item_palette() {
activeToolboxButton('line_item', true);
activeToolboxButton('auto_sla_graph', true);
activeToolboxButton('donut_graph', true);
activeToolboxButton('color_cloud', true);
if (typeof(enterprise_activeToolboxButton) == 'function') {
enterprise_activeToolboxButton(true);
@ -1267,6 +1231,7 @@ function toggle_item_palette() {
activeToolboxButton('group_item', false);
activeToolboxButton('box_item', false);
activeToolboxButton('line_item', false);
activeToolboxButton('color_cloud', false);
activeToolboxButton('copy_item', false);
activeToolboxButton('edit_item', false);
@ -1673,6 +1638,26 @@ function loadFieldsFromDB(item) {
.css('background-color', val);
}
// Color Cloud values
if (key === "diameter") $("input[name='diameter']").val(val);
if (key === "dynamic_data") {
if (val == null) val = {};
var defaultColor = val["default_color"] || "#FFFFFF";
$('input[name="default_color"]').val(defaultColor);
var colorRanges = val["color_ranges"] || [];
var $colorRangeCreationTable = $("table.color-range-creation");
if ($colorRangeCreationTable.length > 0) {
colorRanges.forEach(function (range) {
$colorRangeTable = getColorRangeTable(
$colorRangeCreationTable,
range
);
$colorRangeTable.insertBefore($colorRangeCreationTable);
});
}
}
});
$('#count_items').html(1);
@ -1954,6 +1939,14 @@ function hiddenFields(item) {
$("#line_case").css('display', 'none');
$("#line_case." + item).css('display', '');
// Color cloud rows
$("#color_cloud_diameter_row").hide();
$("#color_cloud_diameter_row." + item).show();
$("#color_cloud_def_color_row").hide();
$("#color_cloud_def_color_row." + item).show();
$("#color_cloud_color_ranges_row").hide();
$("#color_cloud_color_ranges_row." + item).show();
$("input[name='radio_choice']").trigger('change');
if (typeof(enterprise_hiddenFields) == 'function') {
@ -1978,14 +1971,14 @@ function cleanFields(item) {
$("select[name=period]").val('');
$("input[name=width]").val(0);
$("input[name=height]").val(0);
$("select[name=parent]").val('');
$("select[name=parent]").val(0);
$("select[name=linked_map_status_calculation_type]").val('default').change();
$("select[name=map_linked]").val('').change();
$("select[name=map_linked]").val(0).change();
$("input[name=linked_map_node_id]").val(0);
$("input[name=map_linked_weight]").val('');
$("input[name=linked_map_status_service_critical]").val('');
$("input[name=linked_map_status_service_warning]").val('');
$("select[name=element_group]").val('');
$("select[name=element_group]").val(0);
$("input[name=width_module_graph]").val(300);
$("input[name=height_module_graph]").val(180);
$("input[name='width_box']").val(300);
@ -2007,6 +2000,13 @@ function cleanFields(item) {
$("select[name='timezone']").val('Europe/Madrid');
$("select[name='clock_animation']").val('analogic_1');
// Color cloud fields
$("input[name='diameter']").val(100);
$("input[name='default_color']").val("#FFFFFF");
// Clean dynamic fields
$("table.color-range-creation input[type=text]").val("");
$("table.color-range-creation input[type=color]").val("#FFFFFF");
$("table.color-range:not(table.color-range-creation)").remove();
$("#preview").empty();
@ -2482,7 +2482,6 @@ function setPercentileCircular (id_data, values) {
width_percentile = values['width_percentile'];
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data});
@ -2517,7 +2516,7 @@ function setPercentileCircular (id_data, values) {
else {
value_text = module_value + " " + unit_text;
}
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/circular-progress-bar.png');
if($('#text-width_percentile').val() == 0){
$("#" + id_data + " img").css('width', '130px');
@ -2527,12 +2526,12 @@ function setPercentileCircular (id_data, values) {
$("#" + id_data + " img").css('width', $('#text-width_percentile').val()+'px');
$("#" + id_data + " img").css('height', $('#text-width_percentile').val()+'px');
}
if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){
$('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2);
$('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2);
}
else{
$('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2);
$('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2);
}
}
});
@ -2619,7 +2618,7 @@ function setEventsBar(id_data, values) {
parameter.push ({name: "id_agent", value: values['id_agent']});
parameter.push ({name: "id_agent_module", value: values['module']});
if (is_metaconsole()) {
parameter.push ({name: "id_metaconsole", value: id_metaconsole});
parameter.push ({name: "id_metaconsole", value: values['server_id']});
}
parameter.push ({name: "period", value: values['event_max_time_row']});
parameter.push ({name: "id_visual_console", value: id_visual_console});
@ -2776,6 +2775,43 @@ function setPercentileBubble(id_data, values) {
});
}
function setColorCloud (visualConsoleId, dataId, $container) {
$container = $container || $("#" + dataId + ".item.color_cloud");
if ($container.length === 0) return;
var $spinner = $container.children("img");
var $svg = $container.children("svg");
if ($svg.length === 0) {
$svg = $("<svg />");
$container.append($svg);
}
if ($spinner.length > 0) $svg.hide();
jQuery
.post(
get_url_ajax(),
{
"page": "include/ajax/visual_console_builder.ajax",
"action": "get_color_cloud",
"id_visual_console": visualConsoleId,
"id_element": dataId
},
null,
"html"
)
.done(function (data) {
var $newSvg = $(data);
// Check if $newSvg contains a svg
if ($newSvg.is("svg")) $svg.replaceWith($newSvg);
})
.always(function () {
if ($spinner.length > 0) $spinner.remove();
$svg.show();
});
}
function get_image_url(img_src) {
var img_url= null;
var parameter = Array();
@ -2824,9 +2860,6 @@ function set_color_line_status(lines, id_data, values) {
}
function createItem(type, values, id_data) {
var sizeStyle = '';
var imageSize = '';
@ -2834,7 +2867,6 @@ function createItem(type, values, id_data) {
metaconsole = $("input[name='metaconsole']").val();
switch (type) {
case 'box_item':
@ -3645,6 +3677,15 @@ function createItem(type, values, id_data) {
var image = values['image'] + ".png";
set_image("image", id_data, image);
break;
case 'color_cloud':
var diameter = values["diameter"] || values["width"] || 100;
item = $('<div id="' + id_data + '" class="item color_cloud" style="text-align: left; position: absolute; width: ' + diameter + 'px; height: ' + diameter + 'px; top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img id="image_' + id_data + '" class="image" src="images/spinner.gif" width="' + diameter + '" height="' + diameter + '" />' +
'</div>'
);
setColorCloud(id_visual_console, id_data, item);
break;
default:
//Maybe create in any Enterprise item.
if (typeof(enterprise_createItem) == 'function') {
@ -3733,9 +3774,10 @@ function insertDB(type, values) {
success: function (data) {
if (data['correct']) {
id = data['id_data'];
if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){
values['naturalWidth'] = $('#preview > img')[0].naturalWidth;
values['naturalHeight'] = $('#preview > img')[0].naturalHeight;
var image_to_show = $('#preview > img')[0];
if((type === 'group_item') || (type === 'icon') || (type === 'static_graph' && typeof(image_to_show) !== 'undefined')){
values['naturalWidth'] = image_to_show.naturalWidth;
values['naturalHeight'] = image_to_show.naturalHeight;
}
createItem(type, values, id);
addItemSelectParents(id, data['text']);
@ -3838,14 +3880,12 @@ function updateDB_visual(type, idElement , values, event, top, left) {
case 'clock':
case 'auto_sla_graph':
case 'donut_graph':
if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['mov_top']) != 'undefined')) {
if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
$("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px');
}
else if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
else{
$("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px');
}
@ -3882,6 +3922,16 @@ function updateDB_visual(type, idElement , values, event, top, left) {
}
}
break;
case 'color_cloud':
var diameter = values["diameter"];
var $container = $("#" + idElement + ".item.color_cloud");
if ($container.children("img").length === 0) {
$container.append(
'<img id="image_' + idElement + '" class="image" src="images/spinner.gif" width="' + diameter + '" height="' + diameter + '" />'
);
}
setColorCloud(id_visual_console, idElement, $container);
break;
case 'background':
if(values['width'] == '0' || values['height'] == '0'){
@ -3955,7 +4005,6 @@ function updateDB(type, idElement , values, event) {
parameter.push({name: key, value: val});
});
switch (type) {
// -- line_item --
case 'handler_start':
@ -4338,6 +4387,15 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('color_cloud')) {
creationItem = null;
selectedItem = 'color_cloud';
idItem = $(divParent).attr('id');
activeToolboxButton('copy_item', true);
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('handler_start')) {
idItem = $(divParent).attr('id')
.replace("handler_start_", "");
@ -4525,6 +4583,9 @@ function eventsItems(drag) {
if ($(event.target).hasClass('clock')) {
selectedItem = 'clock';
}
if ($(event.target).hasClass('color_cloud')) {
selectedItem = 'color_cloud';
}
if ($(event.target).hasClass('handler_start')) {
selectedItem = 'handler_start';
}
@ -4863,6 +4924,10 @@ function click_button_toolbox(id) {
toolbuttonActive = creationItem = 'line_item';
toggle_item_palette();
break;
case 'color_cloud':
toolbuttonActive = creationItem = 'color_cloud';
toggle_item_palette();
break;
case 'copy_item':
click_copy_item_callback();
break;
@ -4897,6 +4962,7 @@ function click_button_toolbox(id) {
activeToolboxButton('group_item', false);
activeToolboxButton('auto_sla_graph', false);
activeToolboxButton('donut_graph', false);
activeToolboxButton('color_cloud', false);
activeToolboxButton('copy_item', false);
activeToolboxButton('edit_item', false);
activeToolboxButton('delete_item', false);
@ -4930,6 +4996,7 @@ function click_button_toolbox(id) {
activeToolboxButton('group_item', true);
activeToolboxButton('auto_sla_graph', true);
activeToolboxButton('donut_graph', true);
activeToolboxButton('color_cloud', true);
}
break;
case 'save_visualmap':
@ -5009,6 +5076,9 @@ function showPreviewStaticGraph(staticGraph) {
$spinner.prop("src", "../../images/spinner.gif");
}
// If no image configured do not show anything
if (staticGraph === null) return;
$("#preview")
.empty()
.css('text-align', 'right')
@ -5276,3 +5346,99 @@ function onLinkedMapStatusCalculationTypeChange (event) {
var value = event.target.value || "default";
linkedMapStatusCalculationTypeChanged($linkedMapStatusCalcRow, value);
}
function validateColorRange (values) {
return (
(values["from_value"].length > 0 || values["to_value"].length > 0) &&
values["color"].length > 0 &&
!Number.isNaN(Number.parseFloat(values["from_value"])) &&
!Number.isNaN(Number.parseFloat(values["to_value"]))
)
}
function getColorRangeTable ($colorRangeCreationTable, values) {
var $colorRangeTable = $colorRangeCreationTable.clone();
$colorRangeTable.attr("id", "").removeClass("color-range-creation");
// ref inputs
var $fromValueInput = $colorRangeTable.find('input[name="from_value_new"]');
var $toValueInput = $colorRangeTable.find('input[name="to_value_new"]');
var $colorInput = $colorRangeTable.find('input[name="color_new"]');
// Override input values
if (values != null) {
if (values["from_value"] != null) {
$fromValueInput.val(values["from_value"]);
}
if (values["to_value"] != null) {
$toValueInput.val(values["to_value"]);
}
if (values["color"] != null) {
$colorInput.val(values["color"]);
}
}
// Change the name of the new inputs (and clear the id attr)
$fromValueInput.attr("name", "color_range_from_values[]").attr("id", "");
$toValueInput.attr("name", "color_range_to_values[]").attr("id", "");
$colorInput.attr("name", "color_range_color_values[]").attr("id", "");
// Change the add button
$colorRangeAddBtn = $colorRangeTable.find("a.color-range-add");
if ($colorRangeAddBtn.length > 0) {
$colorRangeAddBtn
.removeClass("color-range-add")
.addClass("color-range-delete")
.click(function (e) {
e.preventDefault();
e.stopPropagation();
$colorRangeTable.remove();
});
// Change img
$colorRangeAddImg = $colorRangeAddBtn.children("img");
if ($colorRangeAddImg.length > 0) {
var src = $("#hidden-metaconsole").val() == 1
? "../../images/delete.png"
: "images/delete.png";
$colorRangeAddImg.prop("src", src);
}
}
return $colorRangeTable;
}
function handleColorRangeCreation (event) {
event.preventDefault();
event.stopPropagation();
var $creationBtn = $(event.target);
var $colorRangeCreationTable = $creationBtn.parents("table.color-range-creation");
// ref inputs
var $fromValueInput = $colorRangeCreationTable.find('input[name="from_value_new"]');
var $toValueInput = $colorRangeCreationTable.find('input[name="to_value_new"]');
var $colorInput = $colorRangeCreationTable.find('input[name="color_new"]');
// TODO: Show info about validation
var values = {
"from_value": $fromValueInput.val(),
"to_value": $toValueInput.val(),
"color": $colorInput.val()
}
if (!validateColorRange(values)) return;
var $newColorRangeTable = getColorRangeTable($colorRangeCreationTable);
// Clear creation inputs
$fromValueInput.val("");
$toValueInput.val("");
$colorInput.val("#FFFFFF");
// Add the new table
$newColorRangeTable.insertBefore($colorRangeCreationTable);
}
function bindColorRangeEvents () {
$("a.color-range-add").click(handleColorRangeCreation);
}

@ -152,11 +152,9 @@ echo "<div id='delete_in_progress_dialog' style='display: none; text-align: cent
//CSS
ui_require_css_file ('color-picker');
ui_require_css_file ('jquery-ui-1.8.17.custom');
ui_require_css_file ('jquery-ui.min');
//Javascript
//ui_require_jquery_file('jquery-ui-1.8.17.custom.min');
ui_require_jquery_file('colorpicker');
ui_require_javascript_file('wz_jsgraphics');
ui_require_javascript_file('pandora_visual_console');

@ -202,6 +202,11 @@ foreach ($layoutDatas as $layoutData) {
html_print_image('images/line_item.png', true,
array('title' => __('Line')));
break;
case COLOR_CLOUD:
$table->data[$i + 1]['icon'] =
html_print_image('images/color_cloud_item.png', true,
array('title' => __('Color cloud')));
break;
default:
if (enterprise_installed()) {
$table->data[$i + 1]['icon'] =
@ -259,6 +264,11 @@ foreach ($layoutDatas as $layoutData) {
// hasn't the width and height.
$table->data[$i + 1][2] = '';
break;
case COLOR_CLOUD:
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) .
' x ' .
html_print_input_text('height_' . $idLayoutData, $layoutData['width'], '', 2, 5, true);
break;
default:
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) .
' x ' .
@ -284,6 +294,7 @@ foreach ($layoutDatas as $layoutData) {
switch ($layoutData['type']) {
case BOX_ITEM:
case LINE_ITEM:
case COLOR_CLOUD:
$table->data[$i + 1][4] = "";
break;
default:
@ -485,6 +496,7 @@ foreach ($layoutDatas as $layoutData) {
case LINE_ITEM:
case BOX_ITEM:
case AUTO_SLA_GRAPH:
case COLOR_CLOUD:
$table->data[$i + 2][4] = "";
break;
default:

@ -865,7 +865,7 @@ $row++;
$table_other->data[$row][0] = __('Show only the group name');
$table_other->data[$row][0] .= ui_print_help_tip(
__('Show the group name instead the group icon.'), true);
html_print_checkbox('show_group_name', 1,
$table_other->data[$row][1] = html_print_checkbox('show_group_name', 1,
$config['show_group_name'], true);
$row++;
@ -1208,21 +1208,21 @@ $(".logo_preview").click (function(e) {
switch (e.target.id) {
case 'button-custom_logo_preview':
icon_name = $("select#custom_logo option:selected").val();
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
options.grayed = true;
break;
case 'button-custom_logo_white_bg_preview':
icon_name = $("select#custom_logo_white_bg option:selected").val();
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
break;
case 'button-custom_logo_login_preview':
icon_name = $("select#custom_logo_login option:selected").val();
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo_login/" + icon_name;
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo_login/" + icon_name;
options.grayed = true;
break;
case 'button-custom_splash_login_preview':
icon_name = $("select#custom_splash_login option:selected").val();
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_splash_login/" + icon_name;
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_splash_login/" + icon_name;
options.title = "<?php echo __('Splash Preview'); ?>";
break;
case 'button-custom_docs_logo_preview':

@ -26,6 +26,12 @@ if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_us
return;
}
$php_version = phpversion();
$php_version_array = explode('.', $php_version);
if($php_version_array[0] < 7){
include_once("general/php7_message.php");
}
$tab = get_parameter('tab', 'online');
$buttons = array(

@ -24,6 +24,7 @@ include_once($config['homedir'] . "/include/functions_profile.php");
include_once($config['homedir'] . '/include/functions_users.php');
include_once ($config['homedir'] . '/include/functions_groups.php');
include_once ($config['homedir'] . '/include/functions_visual_map.php');
include_once($config['homedir'] . '/include/functions_custom_fields.php');
enterprise_include_once('include/functions_profile.php');
$meta = false;
@ -169,6 +170,7 @@ if ($create_user) {
$values['language'] = get_parameter ('language', 'default');
$values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
$dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', '');
@ -240,7 +242,7 @@ if ($create_user) {
}
db_pandora_audit("User management",
"Created user ".io_safe_output($id), false, false, $info);
"Created user ".io_safe_input($id), false, false, $info);
ui_print_result_message ($result,
__('Successfully created'),
@ -281,6 +283,7 @@ if ($update_user) {
$values['language'] = (string) get_parameter ('language');
$values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
$dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', '');
@ -389,7 +392,7 @@ if ($update_user) {
}
db_pandora_audit("User management", "Updated user ".io_safe_output($id),
db_pandora_audit("User management", "Updated user ".io_safe_input($id),
false, false, $info);
ui_print_result_message ($res1,
@ -447,7 +450,7 @@ if ($add_profile) {
$tags = implode(',', $tags);
db_pandora_audit("User management",
"Added profile for user ".io_safe_output($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
"Added profile for user ".io_safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
ui_print_result_message ($return,
__('Profile added successfully'),
@ -463,7 +466,7 @@ if ($delete_profile) {
$perfil = db_get_row('tperfil', 'id_perfil', $id_perfil);
db_pandora_audit("User management",
"Deleted profile for user ".io_safe_output($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']);
"Deleted profile for user ".io_safe_input($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']);
$return = profile_delete_user_profile ($id2, $id_up);
ui_print_result_message ($return,
@ -570,7 +573,16 @@ if (!$meta) {
}
}
$table->data[11][0] = __('Interactive charts').' '.ui_print_help_tip(__('Whether to use Javascript or static PNG graphs'), true) ;
if($meta){
$array_filters = get_filters_custom_fields_view(0, true);
$table->data[11][0] = __('Search custom field view').' '.ui_print_help_tip(__('Load by default the selected view in custom field view'), true);
$table->data[11][1] =html_print_select(
$array_filters, 'default_custom_view',
$user_info['default_custom_view'], '', __('None'), 0,
true, false, true, '', false
);
}
$values = array(-1 => __('Use global conf'), 1 => __('Yes'), 0 => __('No'));
$table->data[12][0] = __('Home screen').
@ -721,11 +733,14 @@ $(document).ready (function () {
if($('#radiobtn0002').prop('checked')) {
$('#user_configuration_table-metaconsole_agents_manager').show();
$('#user_configuration_table-metaconsole_access_node').show();
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
$('#user_configuration_table-metaconsole_assigned_server').show();
}
}
else {
$('#user_configuration_table-metaconsole_agents_manager').hide();
$('#user_configuration_table-metaconsole_assigned_server').show();
$('#user_configuration_table-metaconsole_access_node').hide();
$('#user_configuration_table-metaconsole_assigned_server').hide();
}
});

@ -66,40 +66,19 @@ $id_profile = (int) get_parameter ('id');
// Profile deletion
if ($delete_profile) {
$count_users_admin_in_profile = db_get_value_sql("
SELECT COUNT(*)
FROM tusuario
WHERE is_admin = 1 AND id_user IN (
SELECT id_usuario
FROM tusuario_perfil
WHERE id_perfil = " . $id_profile . ")");
if ($count_users_admin_in_profile >= 1) {
ui_print_error_message(
__('Unsucessful delete profile. Because the profile is used by some admin users.'));
// Delete profile
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
$ret = profile_delete_profile_and_clean_users ($id_profile);
if ($ret === false) {
ui_print_error_message(__('There was a problem deleting the profile'));
}
else {
// Delete profile
$profile = db_get_row('tperfil', 'id_perfil', $id_profile);
$sql = sprintf ('DELETE FROM tperfil WHERE id_perfil = %d', $id_profile);
$ret = db_process_sql ($sql);
if ($ret === false) {
ui_print_error_message(__('There was a problem deleting the profile'));
}
else {
db_pandora_audit("Profile management",
"Delete profile ". $profile['name']);
ui_print_success_message(__('Successfully deleted'));
}
//Delete profile from user data
$sql = sprintf ('DELETE FROM tusuario_perfil WHERE id_perfil = %d', $id_profile);
db_process_sql ($sql);
$id_profile = 0;
db_pandora_audit("Profile management",
"Delete profile ". $profile['name']);
ui_print_success_message(__('Successfully deleted'));
}
$id_profile = 0;
}
// Store the variables when create or update

Binary file not shown.

After

(image error) Size: 314 B

Binary file not shown.

After

(image error) Size: 505 B

Binary file not shown.

After

(image error) Size: 502 B

@ -0,0 +1,727 @@
<?php
if(check_login()){
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
include_once($config['homedir'] . "/include/functions_agents.php");
include_once($config['homedir'] . "/include/functions_modules.php");
include_once($config['homedir'] . "/include/functions_ui.php");
include_once($config['homedir'] . '/include/functions_custom_fields.php');
enterprise_include_once ('include/functions_metaconsole.php');
$get_custom_fields_data = (bool) get_parameter('get_custom_fields_data', 0);
$build_table_custom_fields = (bool)get_parameter('build_table_custom_fields', 0);
$build_table_child_custom_fields = (bool)get_parameter('build_table_child_custom_fields', 0);
$build_table_save_filter = (bool)get_parameter('build_table_save_filter', 0);
$append_tab_filter = (bool)get_parameter('append_tab_filter', 0);
$create_filter_cf = (bool)get_parameter('create_filter_cf', 0);
$update_filter_cf = (bool)get_parameter('update_filter_cf', 0);
$delete_filter_cf = (bool)get_parameter('delete_filter_cf', 0);
$change_name_filter = (bool)get_parameter('change_name_filter', 0);
if ($get_custom_fields_data){
$name_custom_fields = get_parameter("name_custom_fields", 0);
$array_custom_fields_data = get_custom_fields_data($name_custom_fields);
echo json_encode($array_custom_fields_data);
return;
}
if($build_table_custom_fields){
$order = get_parameter("order", '');
$length = get_parameter("length", 20);
$start = get_parameter("start", 0);
$draw = get_parameter("draw", 0);
$search = get_parameter("search", '');
$indexed_descriptions = json_decode(io_safe_output(get_parameter("indexed_descriptions", '')), true);
//order query
$order_column = $order[0]['column'];
$type_order = $order[0]['dir'];
switch ($order_column) {
default:
case '1':
$order_by = "ORDER BY temp.name_custom_fields " . $type_order;
break;
case '4':
$order_by = "ORDER BY tma.server_name " . $type_order;
break;
case '2':
$order_by = "ORDER BY tma.alias " . $type_order;
break;
case '3':
$order_by = "ORDER BY tma.direccion " . $type_order;
break;
}
//table temporary for save array in table by order and search custom_field data
$table_temporary = "CREATE TEMPORARY TABLE temp_custom_fields (
id_server int(10),
id_agent int(10),
name_custom_fields varchar(2048),
`status` int(2),
KEY `data_index_temp_1` (`id_server`, `id_agent`)
)";
db_process_sql($table_temporary);
//insert values array in table temporary
$values_insert = array();
foreach ($indexed_descriptions as $key => $value) {
$values_insert[] = "(".$value['id_server'].", ".$value['id_agente'].", '".$value['description']."', ".$value['status'].")";
}
$values_insert_implode = implode(",", $values_insert);
$query_insert ="INSERT INTO temp_custom_fields VALUES ". $values_insert_implode;
db_process_sql($query_insert);
//search table for alias, custom field data, server_name, direction
$search_query = "";
if($search['value'] != ''){
$search_query = ' AND (tma.alias LIKE "%' . $search['value']. '%"';
$search_query .= ' OR tma.server_name LIKE "%' . $search['value']. '%"';
$search_query .= ' OR tma.direccion LIKE "%' . $search['value']. '%"';
$search_query .= ' OR temp.name_custom_fields LIKE "%' . $search['value']. '%" ) ';
}
//query all fields result
$query = sprintf("SELECT
tma.id_agente,
tma.id_tagente,
tma.id_tmetaconsole_setup,
tma.alias,
tma.direccion,
tma.server_name,
temp.name_custom_fields,
temp.status
FROM tmetaconsole_agent tma
INNER JOIN temp_custom_fields temp
ON temp.id_agent = tma.id_tagente
AND temp.id_server = tma.id_tmetaconsole_setup
WHERE tma.disabled = 0
%s
%s
LIMIT %d OFFSET %d
",
$search_query,
$order_by,
$length,
$start
);
$result = db_get_all_rows_sql($query);
//query count
$query_count = sprintf("SELECT
COUNT(tma.id_agente) AS `count`
FROM tmetaconsole_agent tma
INNER JOIN temp_custom_fields temp
ON temp.id_agent = tma.id_tagente
AND temp.id_server = tma.id_tmetaconsole_setup
WHERE tma.disabled = 0
%s
",
$search_query
);
$count = db_get_sql($query_count);
//for link nodes.
$array_nodes = metaconsole_get_connections();
if(isset($array_nodes) && is_array($array_nodes)){
$hash_array_nodes = array();
foreach ($array_nodes as $key => $server) {
$pwd = $server['auth_token'];
$auth_serialized = json_decode($pwd,true);
if (is_array($auth_serialized)) {
$pwd = $auth_serialized['auth_token'];
$api_password = $auth_serialized['api_password'];
$console_user = $auth_serialized['console_user'];
$console_password = $auth_serialized['console_password'];
}
$user = $config['id_user'];
$user_rot13 = str_rot13($config['id_user']);
$hashdata = $user.$pwd;
$hashdata = md5($hashdata);
$url_hash = '&amp;' .
'loginhash=auto&amp;' .
'loginhash_data=' . $hashdata . '&amp;' .
'loginhash_user=' . $user_rot13;
$hash_array_nodes[$server['id']]['hashurl'] = $url_hash;
$hash_array_nodes[$server['id']]['server_url'] = $server['server_url'];
}
}
//prepare rows for table dinamic
$data = array();
foreach ($result as $values) {
$image_status = agents_get_image_status($values['status']);
//link nodes
$agent_link = '<a href="'.
$hash_array_nodes[$values['id_tmetaconsole_setup']]['server_url'] . '/' .
'index.php?' .
'sec=estado&amp;' .
'sec2=operation/agentes/ver_agente&amp;' .
'id_agente='. $values['id_tagente'] .
$hash_array_nodes[$values['id_tmetaconsole_setup']]['hashurl'] . '">'
;
$agent_alias = ui_print_truncate_text($values['alias'],
'agent_small', false, true, false, '[&hellip;]',
'font-size:7.5pt;'
);
if (can_user_access_node ()) {
$agent = $agent_link . '<b>' . $agent_alias . '</b></a>';
}
else {
$agent = $agent_alias;
}
$data[] = array(
"ref" => $referencia,
"data_custom_field" => $values['name_custom_fields'],
"server" => $values['server_name'],
"agent" => $agent,
"IP" => $values['direccion'],
"status" => "<div id='reload_status_agent_" . $values['id_tmetaconsole_setup'] . "_" . $values['id_tagente'] ."'>" . $image_status . "</div>",
"id_agent" => $values['id_tagente'],
"id_server" => $values['id_tmetaconsole_setup']
);
}
$result = array(
"draw" => $draw,
"recordsTotal" => count($data),
"recordsFiltered" => $count,
"data" => $data
);
echo json_encode($result);
return;
}
if($build_table_child_custom_fields){
$id_agent = get_parameter("id_agent", 0);
$id_server = get_parameter("id_server", 0);
$module_search = str_replace('amp;', '',get_parameter("module_search", ''));
$module_status = get_parameter("module_status", 0);
if(!$id_server || !$id_agent){
return false;
}
if($module_search != ''){
$name_where = " AND tam.nombre LIKE '%" . $module_search . "%'";
}
//filter by status module
$and_module_status = "";
if(is_array($module_status)){
if(!in_array(-1, $module_status)){
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $module_status)){
if(count($module_status) > 0){
$and_module_status = " AND ( ";
foreach ($module_status as $key => $value) {
$and_module_status .= ($key != 0)
? " OR ("
: " (";
switch ($value) {
default:
case AGENT_STATUS_NORMAL:
$and_module_status .= " tae.estado = 0 OR tae.estado = 300 ) ";
break;
case AGENT_STATUS_CRITICAL:
$and_module_status .= " tae.estado = 1 OR tae.estado = 100 ) ";
break;
case AGENT_STATUS_WARNING:
$and_module_status .= " tae.estado = 2 OR tae.estado = 200 ) ";
break;
case AGENT_STATUS_UNKNOWN:
$and_module_status .= " tae.estado = 3 ) ";
break;
case AGENT_STATUS_NOT_INIT:
$and_module_status .= " tae.estado = 4 OR tae.estado = 5 ) ";
break;
}
}
$and_module_status .= " ) ";
}
}
else{
//not normal
$and_module_status = "AND tae.estado <> 0 AND tae.estado <> 300 ";
}
}
}
if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id ($id_server);
metaconsole_connect($server);
}
$query = sprintf("SELECT tam.nombre,
tam.min_warning, tam.max_warning,
tam.min_critical, tam.max_critical,
tam.str_warning, tam.str_critical,
tam.id_tipo_modulo,
tae.estado, tae.current_interval,
tae.utimestamp, tae.datos
FROM tagente_modulo tam
INNER JOIN tagente_estado tae
ON tam.id_agente_modulo = tae.id_agente_modulo
WHERE tam.id_agente = %d
%s %s",
$id_agent,
$name_where,
$and_module_status
);
$modules = db_get_all_rows_sql ($query);
$table_modules = new stdClass();
$table_modules->width = "100%";
$table_modules->class="databox data";
$table_modules->head = array();
$table_modules->head[0] = __('Module name');
$table_modules->head[1] = __('Data');
$table_modules->head[2] = __('Treshold');
$table_modules->head[3] = __('Current interval');
$table_modules->head[4] = __('Timestamp');
$table_modules->head[5] = __('Status');
$table_modules->data = array();
if(isset($modules) && is_array($modules)){
foreach ($modules as $key => $value) {
$table_modules->data[$key][0] = $value['nombre'];
if($value["id_tipo_modulo"] != 3 &&
$value["id_tipo_modulo"] != 10 &&
$value["id_tipo_modulo"] != 17 &&
$value["id_tipo_modulo"] != 23 &&
$value["id_tipo_modulo"] != 33 ){
$table_modules->data[$key][1] = remove_right_zeros(number_format($value["datos"], $config['graph_precision']));
}
else{
$table_modules->data[$key][1] = $value["datos"];
}
$table_modules->data[$key][2] = ui_print_module_warn_value (
$value["max_warning"],
$value["min_warning"],
$value["str_warning"],
$value["max_critical"],
$value["min_critical"],
$value["str_critical"]
);
$table_modules->data[$key][3] = $value['current_interval'];
$table_modules->data[$key][4] = ui_print_timestamp($value['utimestamp'], true);
switch ($value['estado']) {
case 0:
case 300:
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_normal.png',
true,
array(
'title' => __('Modules normal')
)
);
break;
case 1:
case 100:
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_critical.png',
true,
array(
'title' => __('Modules critical')
)
);
break;
case 2:
case 200:
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_warning.png',
true,
array(
'title' => __('Modules warning')
)
);
break;
case 3:
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_maintenance.png',
true,
array(
'title' => __('Modules unknown')
)
);
break;
case 4:
case 5:
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_informational.png',
true,
array(
'title' => __('Modules no init')
)
);
break;
default:
$table_modules->data[$key][5] = html_print_image(
'images/status_sets/default/severity_normal.png',
true,
array(
'title' => __('Modules normal')
)
);
break;
}
}
}
//status agents from tagente
$sql_info_agents = "SELECT * fROM tagente WHERE id_agente =" . $id_agent;
$info_agents = db_get_row_sql($sql_info_agents);
$status_agent = agents_get_status_from_counts($info_agents);
if (is_metaconsole()) {
metaconsole_restore_db();
}
$data['modules_table'] = html_print_table($table_modules, true);
$data['img_status_agent'] = agents_get_image_status($status_agent);
echo json_encode($data);
return;
}
if($build_table_save_filter){
$type_form = get_parameter("type_form", '');
if($type_form == 'save'){
$tabs = '<div id="tabs" style="height:95%;">';
$tabs .= "<ul class='tab_save_filter'>";
$tabs .= "<li>";
$tabs .= "<a href='#extended_create_filter' id='link_create'>";
$tabs .= html_print_image('images/lightning_go.png',true);
$tabs .= "<span>". __('New Filter') . "</span>";
$tabs .= "</a>";
$tabs .= "</li>";
$tabs .= "<li>";
$tabs .= "<a href='#extended_update_filter' id='link_update'>";
$tabs .= html_print_image('images/zoom.png',true);
$tabs .= "<span>".__('Existing Filter')."</span>";
$tabs .= "</a>";
$tabs .= "</li>";
$tabs .= "</ul>";
$tabs .= '<div id="extended_create_filter">';
$tabs .= '</div>';
$tabs .= '<div id="extended_update_filter">';
$tabs .= '</div>';
$tabs .= "</div>";
echo $tabs;
}
else{
$table = new StdClass;
$table->id = 'save_filter_form';
$table->width = '100%';
$table->class = 'databox';
$array_filters = get_filters_custom_fields_view(0, true);
$table->data[0][0] = __('Filter name');
$table->data[0][1] = html_print_select(
$array_filters, 'id_name',
'', '', '', '',
true, false, true, '', false
);
$table->data[0][3] = html_print_submit_button (__('Load filter'), 'load_filter', false, 'class="sub upd"', true);
echo "<form action='' method='post'>";
html_print_table($table);
echo "</form>";
}
return;
}
if($append_tab_filter){
$filters = json_decode(io_safe_output(get_parameter("filters", '')), true);
$table = new StdClass;
$table->id = 'save_filter_form';
$table->width = '100%';
$table->class = 'databox';
$table->rowspan = array();
if($filters['id'] == 'extended_create_filter'){
echo "<div id='msg_error_create'></div>";
$table->data[0][0] = __('Filter name');
$table->data[0][1] = html_print_input_text('id_name', '', '', 15, 255, true);
$table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups(
$config['id_user'], 'AR', true, 'group_search_cr',
0, '', '', '0', true, false,
false, '', false, 'width:180px;', false, false,
'id_grupo', false
);
$table->rowspan[0][2] = 2;
$table->data[0][2] = html_print_submit_button (__('Create filter'), 'create_filter', false, 'class="sub upd"', true);
}
else{
echo "<div id='msg_error_update'></div>";
echo "<div id='msg_error_delete'></div>";
$array_filters = get_filters_custom_fields_view(0, true);
$table->data[0][0] = __('Filter name');
$table->data[0][1] = html_print_select(
$array_filters, 'id_name', '',
'filter_name_change_group(this.value)',
__('None'), -1, true, false, true,
'', false
);
$table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups(
$config['id_user'], 'AR', true, 'group_search_up',
$group, '', '', '0', true, false,
false, '', false, 'width:180px;', false, false,
'id_grupo', false
);
$table->data[0][2] = html_print_submit_button (__('Delete filter'), 'delete_filter', false, 'class="sub upd"', true);
$table->data[1][2] = html_print_submit_button (__('Update filter'), 'update_filter', false, 'class="sub upd"', true);
}
html_print_table($table);
return;
}
if($create_filter_cf){
//initialize result
$result_array = array();
$result_array['error'] = 0;
$result_array['msg'] = '';
//initialize vars
$filters = json_decode(io_safe_output(get_parameter("filters", '')), true);
$name_filter = get_parameter("name_filter", '');
$group_search = get_parameter("group_search", 0);
//check that the name is not empty
if($name_filter == ''){
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__('The name must not be empty'),
'', true
);
echo json_encode($result_array);
return;
}
$name_exists = get_filters_custom_fields_view(0, false, $name_filter);
if($name_exists){
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__('Filter name already exists in the bbdd'),
'', true
);
echo json_encode($result_array);
return;
}
//check custom field is not empty
if($filters['id_custom_fields'] == ''){
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__('Please, select a custom field'),
'', true
);
echo json_encode($result_array);
return;
}
//insert
$values = array();
$values['name'] = $name_filter;
$values['group_search'] = $group_search;
$values['id_group'] = $filters['group'];
$values['id_custom_field'] = $filters['id_custom_fields'];
$values['id_custom_fields_data'] = json_encode($filters['id_custom_fields_data']);
$values['id_status'] = json_encode($filters['id_status']);
$values['module_search'] = $filters['module_search'];
$values['module_status'] = json_encode($filters['module_status']);
$values['recursion'] = $filters['recursion'];
$insert = db_process_sql_insert('tagent_custom_fields_filter', $values);
//check error insert
if($insert) {
$result_array['error'] = 0;
$result_array['msg'] = ui_print_success_message(
__("Success create filter."),
'', true
);
} else {
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__("Error create filter."),
'', true
);
}
echo json_encode($result_array);
return;
}
if($update_filter_cf){
//initialize result
$result_array = array();
$result_array['error'] = 0;
$result_array['msg'] = '';
//initialize vars
$filters = json_decode(io_safe_output(get_parameter("filters", '')), true);
$id_filter = get_parameter("id_filter", '');
$group_search = get_parameter("group_search", 0);
//check selected filter
if($id_filter == -1){
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__('please, select a filter'),
'', true
);
echo json_encode($result_array);
return;
}
//array condition update
$condition = array();
$condition['id'] = $id_filter;
//check selected custom fields
if($filters['id_custom_fields'] == ''){
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__('please, select a custom field'),
'', true
);
echo json_encode($result_array);
return;
}
//array values update
$values = array();
$values['id_group'] = $filters['group'];
$values['group_search'] = $group_search;
$values['id_custom_field'] = $filters['id_custom_fields'];
$values['id_custom_fields_data'] = json_encode($filters['id_custom_fields_data']);
$values['id_status'] = json_encode($filters['id_status']);
$values['module_search'] = $filters['module_search'];
$values['module_status'] = json_encode($filters['module_status']);
$values['recursion'] = $filters['recursion'];
//update
$update = db_process_sql_update('tagent_custom_fields_filter', $values, $condition);
//check error insert
if($update) {
$result_array['error'] = 0;
$result_array['msg'] = ui_print_success_message(
__("Success update filter."),
'', true
);
} else {
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__("Error update filter."),
'', true
);
}
echo json_encode($result_array);
return;
}
if($delete_filter_cf){
//Initialize result
$result_array = array();
$result_array['error'] = 0;
$result_array['msg'] = '';
//Initialize vars
$filters = json_decode(io_safe_output(get_parameter("filters", '')), true);
$id_filter = get_parameter("id_filter", '');
//Check selected filter
if($id_filter == -1){
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__('please, select a filter'),
'', true
);
echo json_encode($result_array);
return;
}
//Array condition update
$condition = array();
$condition['id'] = $id_filter;
//Delete
$delete = db_process_sql_delete('tagent_custom_fields_filter', $condition);
//Check error insert
if($delete) {
$result_array['error'] = 0;
$result_array['msg'] = ui_print_success_message(
__("Success delete filter."),
'', true
);
} else {
$result_array['error'] = 1;
$result_array['msg'] = ui_print_error_message(
__("Error delete filter."),
'', true
);
}
echo json_encode($result_array);
return;
}
if($change_name_filter){
$id_filter = get_parameter("id_filter", 0);
if(isset($id_filter)){
$res = get_group_filter_custom_field_view($id_filter);
echo json_encode($res);
return;
}
return json_encode(false);
}
}

@ -415,7 +415,7 @@ if ($get_extended_event) {
$custom_data = events_page_custom_data($event);
if ($meta) {
metaconsole_restore_db_force();
metaconsole_restore_db();
}
$general = events_page_general($event);

@ -18,7 +18,6 @@ if(check_login()){
global $config;
include_once($config['homedir'] . "/include/functions_agents.php");
include_once($config['homedir'] . "/include/functions_modules.php");
include_once($config['homedir'] . "/include/functions_ui.php");
@ -36,7 +35,6 @@ $get_type = (bool) get_parameter('get_type', 0);
$list_modules = (bool) get_parameter('list_modules', 0);
$get_agent_modules_json_by_name = (bool) get_parameter('get_agent_modules_json_by_name', 0);
if ($get_agent_modules_json_by_name) {
$agent_name = get_parameter('agent_name');
@ -474,16 +472,17 @@ if ($list_modules) {
$sort = get_parameter('sort', 'none');
$selected = 'border: 1px solid black;';
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
switch ($sortField) {
case 'type':
switch ($sort) {
case 'up':
$selectTypeUp = $selected;
$order = array('field' => 'tagente_modulo.id_modulo', 'order' => 'ASC');
$order[] = array('field' => 'tagente_modulo.id_modulo', 'order' => 'ASC');
break;
case 'down':
$selectTypeDown = $selected;
$order = array('field' => 'tagente_modulo.id_modulo', 'order' => 'DESC');
$order[] = array('field' => 'tagente_modulo.id_modulo', 'order' => 'DESC');
break;
}
break;
@ -491,11 +490,11 @@ if ($list_modules) {
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break;
case 'down':
$selectNameDown = $selected;
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC');
break;
}
break;
@ -503,11 +502,11 @@ if ($list_modules) {
switch ($sort) {
case 'up':
$selectStatusUp = $selected;
$order = array('field' => 'tagente_estado.estado=0 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=1 DESC', 'order' => '');
$order[] = array('field' => 'tagente_estado.estado=0 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=1 DESC', 'order' => '');
break;
case 'down':
$selectStatusDown = $selected;
$order = array('field' => 'tagente_estado.estado=1 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=0 DESC', 'order' => '');
$order[] = array('field' => 'tagente_estado.estado=1 DESC,tagente_estado.estado=2 DESC,tagente_estado.estado=3 DESC,tagente_estado.estado=0 DESC', 'order' => '');
break;
}
break;
@ -515,11 +514,11 @@ if ($list_modules) {
switch ($sort) {
case 'up':
$selectLastContactUp = $selected;
$order = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'ASC');
break;
case 'down':
$selectLastContactDown = $selected;
$order = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
$order[] = array('field' => 'tagente_estado.utimestamp', 'order' => 'DESC');
break;
}
break;
@ -535,15 +534,7 @@ if ($list_modules) {
$selectLastContactUp = '';
$selectLastContactDown = '';
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break;
}
switch ($config["dbtype"]) {
case "oracle":
if (isset($order['field']) && $order['field'] == 'tagente_modulo.nombre') {
$order['field'] = 'dbms_lob.substr(tagente_modulo.nombre,4000,1)';
}
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
break;
}
@ -598,9 +589,21 @@ if ($list_modules) {
}
//Count monitors/modules
$order_sql = $order['field'] . " " . $order['order'];
$sql = "SELECT COUNT(*)
FROM tagente_modulo
// Build the order sql
$first = true;
foreach ($order as $ord) {
if ($first) {
$first = false;
}
else {
$order_sql .= ',';
}
$order_sql .= $ord['field'].' '.$ord['order'];
}
$sql_condition = "FROM tagente_modulo
$tags_join
INNER JOIN tagente_estado
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
@ -609,13 +612,15 @@ if ($list_modules) {
WHERE tagente_modulo.id_agente = $id_agente
AND nombre LIKE '$status_text_monitor_sql'
AND delete_pending = 0
AND disabled = 0
AND $status_filter_sql
AND $status_module_group_filter
$tags_sql
AND tagente_estado.estado != $monitor_filter
GROUP BY tagente_modulo.id_agente_modulo
";
$count_modules = db_get_all_rows_sql($sql);
$count_modules = db_get_all_rows_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)' . $sql_condition);
if (isset($count_modules[0]))
$count_modules = reset($count_modules[0]);
else
@ -623,22 +628,9 @@ if ($list_modules) {
//Get monitors/modules
// Get all module from agent
$sql = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*
FROM tagente_modulo
$tags_join
INNER JOIN tagente_estado
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo.id_module_group = tmodule_group.id_mg
WHERE tagente_modulo.id_agente = $id_agente
AND nombre LIKE '$status_text_monitor_sql'
AND delete_pending = 0
AND $status_filter_sql
$tags_sql
AND tagente_estado.estado != $monitor_filter
GROUP BY tagente_modulo.id_agente_modulo
ORDER BY tmodule_group.name, $order_sql
";
$sql_modules_info = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*
$sql_condition
GROUP BY tagente_modulo.id_agente_modulo ORDER BY $order_sql";
if ($monitors_change_filter) {
$limit = " LIMIT " . $config['block_size'] . " OFFSET 0";
@ -651,10 +643,10 @@ if ($list_modules) {
$paginate_module = $config['paginate_module'];
if ($paginate_module) {
$modules = db_get_all_rows_sql ($sql . $limit);
$modules = db_get_all_rows_sql ($sql_modules_info . $limit);
}
else {
$modules = db_get_all_rows_sql ($sql);
$modules = db_get_all_rows_sql ($sql_modules_info);
}
if (empty ($modules)) {
$modules = array ();
@ -1104,6 +1096,7 @@ if ($get_type) {
echo $graph_type;
return;
}
}
?>

@ -15,9 +15,7 @@
// Login check
global $config;
check_login ();
check_login();
$get_image_path_status = get_parameter('get_image_path_status', 0);
if ($get_image_path_status){
@ -25,13 +23,12 @@ if ($get_image_path_status){
$only_src = get_parameter("only_src", 0);
$result = array();
$result['bad'] = html_print_image($img_src . '_bad.png', true, '', $only_src);
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
$result['warning'] = html_print_image($img_src . '_warning.png', true, '', $only_src);
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
$result['normal'] = html_print_image($img_src . '.png', true, '', $only_src);
echo json_encode($result);
return;
}
@ -166,6 +163,12 @@ $timezone = get_parameter('timezone', 'Europe/Madrid');
$show_last_value = get_parameter('show_last_value', null);
$diameter = (int) get_parameter("diameter", $width);
$default_color = get_parameter("default_color", "#FFFFFF");
$color_range_from_values = get_parameter("color_range_from_values", array());
$color_range_to_values = get_parameter("color_range_to_values", array());
$color_range_colors = get_parameter("color_range_colors", array());
switch ($action) {
case 'get_font':
$return = array();
@ -328,8 +331,19 @@ switch ($action) {
case 'get_layout_data':
if(is_metaconsole()){
$server_data = metaconsole_get_connection_by_id($server_id);
// Establishes connection
if (metaconsole_load_external_db($server_data) !== NOERR) continue;
}
$layoutData = db_get_row_filter('tlayout_data',
array('id' => $id_element));
if(is_metaconsole()){
metaconsole_restore_db();
}
$layoutData['height'] = $layoutData['height'];
$layoutData['width'] = $layoutData['width'];
echo json_encode($layoutData);
@ -528,7 +542,10 @@ switch ($action) {
echo json_encode($return);
break;
case 'get_color_cloud':
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
echo visual_map_get_color_cloud_element($layoutData);
break;
case 'update':
case 'move':
@ -726,6 +743,14 @@ switch ($action) {
if ($id_custom_graph !== null) {
$values['id_custom_graph'] = $id_custom_graph;
}
if(is_metaconsole()){
if($values['id_custom_graph'] != 0){
$explode_id = explode("|", $values['id_custom_graph']);
$values['id_custom_graph'] = $explode_id[0];
$values['id_metaconsole'] = $explode_id[1];
}
}
break;
case 'bars_graph':
if ($width_percentile !== null) {
@ -817,6 +842,36 @@ switch ($action) {
$values['fill_color'] = $fill_color;
}
break;
case "color_cloud":
$values['width'] = $diameter;
$values['height'] = $diameter;
// Fill Color Cloud values
$extra = array(
"default_color" => $default_color,
"color_ranges" => array()
);
$num_ranges = count($color_range_colors);
for ($i = 0; $i < $num_ranges; $i++) {
if (
!isset($color_range_from_values[$i]) ||
!isset($color_range_to_values[$i]) ||
!isset($color_range_colors[$i])
) {
return;
}
$extra["color_ranges"][] = array(
"from_value" => (float) $color_range_from_values[$i],
"to_value" => (float) $color_range_to_values[$i],
"color" => $color_range_colors[$i] // already html encoded
);
}
// Yes, we are using the label to store the extra info.
// Sorry not sorry.
$values["label"] = json_encode($extra);
break;
default:
if (enterprise_installed()) {
if ($image !== null) {
@ -878,6 +933,12 @@ switch ($action) {
unset($values['width']);
unset($values['height']);
break;
case 'color_cloud':
unset($values['width']);
unset($values['height']);
unset($values['diameter']);
unset($values['label']);
break;
// -- line_item --
case 'handler_start':
case 'handler_end':
@ -934,6 +995,7 @@ switch ($action) {
case 'clock':
case 'auto_sla_graph':
case 'donut_graph':
case 'color_cloud':
$elementFields = db_get_row_filter('tlayout_data',
array('id' => $id_element));
@ -1074,6 +1136,16 @@ switch ($action) {
$elementFields['fill_color'] = $elementFields['fill_color'];
break;
case 'color_cloud':
$elementFields["diameter"] = $elementFields["width"];
$elementFields["dynamic_data"] = null;
try {
// Yes, it's using the label field to store the extra data
$elementFields["dynamic_data"] = json_decode($elementFields["label"], true);
} catch (Exception $ex) {}
$elementFields["label"] = "";
break;
// -- line_item --
case 'handler_start':
case 'handler_end':
@ -1208,9 +1280,11 @@ switch ($action) {
$values['type'] = MODULE_GRAPH;
if(is_metaconsole()){
$explode_id = explode("|", $values['id_custom_graph']);
$values['id_custom_graph'] = $explode_id[0];
$values['id_metaconsole'] = $explode_id[1];
if($values['id_custom_graph'] != 0){
$explode_id = explode("|", $values['id_custom_graph']);
$values['id_custom_graph'] = $explode_id[0];
$values['id_metaconsole'] = $explode_id[1];
}
}
if ($values['id_custom_graph'] > 0 ) {
@ -1327,6 +1401,37 @@ switch ($action) {
$values['width'] = $width;
$values['height'] = $height;
break;
case 'color_cloud':
$values['type'] = COLOR_CLOUD;
$values['width'] = $diameter;
$values['height'] = $diameter;
$extra = array(
"default_color" => $default_color,
"color_ranges" => array()
);
$num_ranges = count($color_range_colors);
for ($i = 0; $i < $num_ranges; $i++) {
if (
!isset($color_range_from_values[$i]) ||
!isset($color_range_to_values[$i]) ||
!isset($color_range_colors[$i])
) {
return;
}
$extra["color_ranges"][] = array(
"from_value" => (int) $color_range_from_values[$i],
"to_value" => (int) $color_range_to_values[$i],
"color" => $color_range_colors[$i] // already html encoded
);
}
// Yes, we are using the label to store the extra info.
// Sorry not sorry.
$values["label"] = json_encode($extra);
break;
default:
if (enterprise_installed()) {
enterprise_ajax_insert_fill_values_insert($type, $values);
@ -1371,7 +1476,6 @@ switch ($action) {
$text = visual_map_create_internal_name_item($label, $type, $image, $agent, $id_module, $idData);
$values['label'] = io_safe_output($values['label']);
$values['left'] = $values['pos_x'];
$values['top'] = $values['pos_y'];
$values['parent'] = $values['parent_item'];
@ -1403,9 +1507,22 @@ switch ($action) {
$return['values']['type_percentile'] = 'percentile';
break;
case COLOR_CLOUD:
$return["values"]["diameter"] = $values["width"];
try {
// Yes, it's using the label field to store the extra data
$return["values"]["dynamic_data"] = json_decode($values["label"], true);
} catch (Exception $ex) {
$return["values"]["dynamic_data"] = array();
}
$values["label"] = "";
break;
}
}
// Don't move this piece of code
$return["values"]["label"] = io_safe_output($values['label']);
echo json_encode($return);
break;

@ -72,18 +72,14 @@ switch($info) {
if (isInACL($ipOrigin)) {
if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
$user_in_db = process_user_login($user, $password, true);
if ($user_in_db !== false) {
$config['id_user'] = $user_in_db;
$correctLogin = true;
//XXXX
session_start();
if (session_status() === PHP_SESSION_NONE) session_start();
$_SESSION["id_usuario"] = $user;
session_write_close();
file_put_contents(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id(), $user);
}
else {
$no_login_msg = "Incorrect user credentials";
@ -186,11 +182,6 @@ if ($correctLogin) {
returnError('no_exist_operation', $returnType);
}
}
//XXXXX
if (file_exists(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id())) {
unlink(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id());
}
}
else {
// TODO: Implement a new switch in config to enable / disable

@ -1,160 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* @package Include/auth
*/
if (!isset ($config)) {
die ('
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pandora FMS - The Flexible Monitoring System - Console error</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=utf8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Artica ST">
<meta name="copyright" content="(c) Artica ST">
<meta name="robots" content="index, follow">
<link rel="icon" href="../../images/pandora.ico" type="image/ico">
<link rel="stylesheet" href="../styles/pandora.css" type="text/css">
</head>
<body>
<div id="main" style="float:left; margin-left: 100px">
<div align="center">
<div id="login_f">
<h1 id="log_f" class="error">You cannot access this file</h1>
<div>
<img src="../../images/pandora_logo.png" border="0"></a>
</div>
<div class="msg">
<span class="error"><b>ERROR:</b>
You can\'t access this file directly!</span>
</div>
</div>
</div>
</body>
</html>
');
}
$config["user_can_update_password"] = false;
$config["admin_can_add_user"] = false;
$config["admin_can_delete_user"] = false;
$config["admin_can_disable_user"] = false;
global $dev_cache; //This variable needs to be globalized because this file is called from within a function and thus local
//DON'T USE THIS IF YOU DON'T KNOW WHAT YOU'RE DOING
die ("This is a very dangerous authentication scheme. Only use for programming in case you should uncomment this line");
/**
* process_user_login accepts $login and $pass and handles it according to current authentication scheme
*
* @param string $login
* @param string $pass
*
* @return mixed False in case of error or invalid credentials, the username in case it's correct.
*/
function process_user_login ($login, $pass) {
return false; //Error
return $login; //Good
}
/**
* Checks if a user is administrator.
*
* @param string User id.
*
* @return bool True is the user is admin
*/
function is_user_admin ($user) {
return true; //User is admin
return false; //User isn't
}
/**
* Check is a user exists in the system
*
* @param string User id.
*
* @return bool True if the user exists.
*/
function is_user ($id_user) {
return true;
return false;
}
/**
* Gets the users real name
*
* @param string User id.
*
* @return string The users full name
*/
function get_user_fullname ($id_user) {
return "admin";
return "";
return false;
}
/**
* Gets the users email
*
* @param string User id.
*
* @return string The users email address
*/
function get_user_email ($id_user) {
return "test@example.com";
return "";
return false;
}
/**
* Get a list of all users in an array [username] => real name
*
* @param string Field to order by (id_usuario, nombre_real or fecha_registro)
*
* @return array An array of users
*/
function get_users ($order = "nombre_real") {
return array ("admin" => "Admini Strator");
}
/**
* Sets the last login for a user
*
* @param string User id
*/
function process_user_contact ($id_user) {
//void
}
/**
* Deletes the user
*
* @param string User id
*/
function delete_user ($id_user) {
return true;
return false;
}
//Reference the global use authorization error to last ldap error.
$config["auth_error"] = &$dev_cache["auth_error"];
?>

@ -13,17 +13,8 @@
// GNU General Public License for more details.
// Global & session manageme
session_id($_REQUEST["session_id"]);
if (file_exists(session_save_path() . "/pansess_" . session_id()) ) {
$user = file_get_contents(session_save_path() . "/pansess_" . session_id());
}
session_start();
if (isset($user)) {
$_SESSION["id_usuario"] = $user;
}
session_write_close();
require_once ('config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');
@ -74,11 +65,11 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="styles/jquery-ui-1.10.0.custom.css" type="text/css" />
<link rel="stylesheet" href="styles/jquery-ui.min.css" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-1.9.0.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.jquery-ui-1.10.0.custom.js'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js'></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.min.js"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.time.js"></script>
@ -95,9 +86,8 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script>
</head>
<body bgcolor="#ffffff" style='background:#ffffff;'>
<?php
$params['only_image'] = false;
<?php
$params['only_image'] = false;
$params['width'] = (int) $_REQUEST['viewport_width'];
$params['menu'] = false;
@ -132,7 +122,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['height'],
$params['water_mark_url'],
$params['font'],
$params['font_size'],
$config['font_size'],
$params['legend_position'],
$params['colors'],
$params['hide_labels']
@ -151,7 +141,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['water_mark_url'],
$params['homedir'],
$params['font'],
$params['font_size'],
$config['font_size'],
$params['from_ux'],
$params['from_wux'],
$params['backgroundColor'],
@ -165,7 +155,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['height'],
$params['water_mark_url'],
$params['font'],
$params['font_size'],
$config['font_size'],
$params['backgroundColor'],
$params['tick_color'],
$params['val_min'],
@ -185,7 +175,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
'',
$params['water_mark'],
$params['font'],
$params['font_size'],
$config['font_size'],
$params['unit'],
$params['ttl'],
$params['homeurl'],
@ -211,7 +201,9 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
$params['id_agent'],
$params['full_legend_daterray'],
$params['not_interactive'],
1
$params['ttl'],
$params['widgets'],
$params['show']
);
break;
default:
@ -221,7 +213,19 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
echo '</div>';
$config['font_size'] = $aux_font_size;
?>
</body>
?>
<script type="text/javascript">
$('document').ready(function () {
setTimeout(function () {
try {
var status = window.callPhantom({ status: "loaded" });
} catch (error) {
console.log("CALLBACK ERROR", error.message)
}
}, 100);
});
</script>
</body>
</html>

@ -22,8 +22,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC181030';
$pandora_version = 'v7.0NG.728';
$build_version = 'PC181221';
$pandora_version = 'v7.0NG.730';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();
@ -171,19 +171,21 @@ require_once ($ownDir. 'functions_config.php');
date_default_timezone_set("Europe/Madrid");
//////////////////////////////////////
//// PLEASE DO NOT CHANGE ORDER //////
//////////////////////////////////////
require_once ($config["homedir"].'/include/load_session.php');
if (session_status() === PHP_SESSION_NONE) session_start();
config_process_config();
config_prepare_session();
require_once ($config["homedir"].'/include/load_session.php');
if(session_id() == '') {
$resultado = session_start();
}
// Set a the system timezone default
// Set a the system timezone default
if ((!isset($config["timezone"])) OR ($config["timezone"] == "")) {
$config["timezone"] = "Europe/Berlin";
}
////////////////////////////////////////
date_default_timezone_set($config["timezone"]);

@ -204,6 +204,7 @@ define('CIRCULAR_INTERIOR_PROGRESS_BAR', 16);
define('DONUT_GRAPH', 17);
define('BARS_GRAPH', 18);
define('CLOCK', 19);
define('COLOR_CLOUD', 20);
//Some styles
define('MIN_WIDTH', 300);
define('MIN_HEIGHT', 120);

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