mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Fixed conflicts
Former-commit-id: 1be548acda51690c59d03e7270810ad03bb16822
This commit is contained in:
commit
cf2b9c5798
@ -247,4 +247,11 @@ button h3 {
|
||||
}
|
||||
.sev-Maintenance {
|
||||
background: #A8A8A8;
|
||||
}
|
||||
.sev-Minor {
|
||||
background: #F099A2;
|
||||
color: #333;
|
||||
}
|
||||
.sev-Major {
|
||||
background: #C97A4A;
|
||||
}
|
@ -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"
|
||||
|
@ -16,7 +16,7 @@ else
|
||||
fi
|
||||
VERSION=$2
|
||||
if [ $# == 2 ]; then
|
||||
BUILD=`date +%g%m%d`
|
||||
BUILD=`date +%y%m%d`
|
||||
else
|
||||
BUILD=$3
|
||||
fi
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.729, 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.729, 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.729, 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.729, 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.729, 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.729, 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.729
|
||||
# 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.729, 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.729
|
||||
# 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.729, HPUX Version
|
||||
# Version 7.0NG.730, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.729
|
||||
# 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.729
|
||||
# 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.729
|
||||
# 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.729, Solaris version
|
||||
# Version 7.0NG.730, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.729, 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.729-181127
|
||||
Version: 7.0NG.730-190128
|
||||
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.729-181127"
|
||||
pandora_version="7.0NG.730-190128"
|
||||
|
||||
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.729, 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.729, 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.729, 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.729, 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.729, 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.729, 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.729, 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.729';
|
||||
use constant AGENT_BUILD => '181127';
|
||||
use constant AGENT_VERSION => '7.0NG.730';
|
||||
use constant AGENT_BUILD => '190128';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
@ -516,11 +516,18 @@ sub parse_conf_modules($) {
|
||||
log_message ('setup', "Invalid regular expression in intensive condition: $line");
|
||||
}
|
||||
}
|
||||
} elsif ($line =~ /^\s*module_crontab\s+(((\*|(\d+(-\d+){0,1}))\s*){5}).*$/) {
|
||||
} elsif ($line =~ /^\s*module_crontab\s+(.*)$/) {
|
||||
my $cron_text = $1;
|
||||
chomp ($cron_text);
|
||||
$cron_text =~ s/\s+$//;
|
||||
# Get module name if is already read.
|
||||
my $module_name_message = "";
|
||||
$module_name_message = " (module $module->{'name'})" if defined($module->{'name'});
|
||||
if (cron_check_syntax($cron_text)) {
|
||||
$module->{'cron'} = $cron_text;
|
||||
log_message('debug', "Cron '$module->{'cron'}' configured $module_name_message.");
|
||||
} else {
|
||||
log_message('setup', "Incorrect cron syntax '$cron_text'. This module$module_name_message will be executed always.");
|
||||
}
|
||||
} elsif ($line =~ /^\s*module_end\s*$/) {
|
||||
|
||||
@ -2397,6 +2404,7 @@ sub check_module_cron {
|
||||
$interval
|
||||
);
|
||||
|
||||
my $is_first = ($module->{'cron_utimestamp'} == 0) ? 1 : 0;
|
||||
$module->{'cron_utimestamp'} = $now + $time_to_next_execution;
|
||||
$module->{'cron_interval'} = $time_to_next_execution;
|
||||
|
||||
@ -2405,7 +2413,7 @@ sub check_module_cron {
|
||||
}
|
||||
|
||||
# On first execution checking if cron is valid is required
|
||||
return 1 unless ($module->{'cron_utimestamp'} == 0);
|
||||
return 1 unless ($is_first);
|
||||
|
||||
# Check if current timestamp is a valid cron date
|
||||
my $next_execution = cron_next_execution_date(
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.729
|
||||
%define release 181127
|
||||
%define version 7.0NG.730
|
||||
%define release 190128
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.729
|
||||
%define release 181127
|
||||
%define version 7.0NG.730
|
||||
%define release 190128
|
||||
|
||||
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.729"
|
||||
PI_BUILD="181127"
|
||||
PI_VERSION="7.0NG.730"
|
||||
PI_BUILD="190128"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -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.729
|
||||
# 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.729}
|
||||
{Pandora FMS Windows Agent v7.0NG.730}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{181127}
|
||||
{190128}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.729(Build 181127)")
|
||||
#define PANDORA_VERSION ("7.0NG.730(Build 190128)")
|
||||
|
||||
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.729(Build 181127))"
|
||||
VALUE "ProductVersion", "(7.0NG.730(Build 190128))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,10 +1,10 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.729-181127
|
||||
Version: 7.0NG.730-190128
|
||||
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.729-181127"
|
||||
pandora_version="7.0NG.730-190128"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -14,6 +14,15 @@
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Enable profiler for testing
|
||||
if (!defined("__PAN_XHPROF__")) define ("__PAN_XHPROF__", 0);
|
||||
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
if (function_exists('tideways_xhprof_enable')) {
|
||||
tideways_xhprof_enable();
|
||||
}
|
||||
}
|
||||
|
||||
if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"))) {
|
||||
exit;
|
||||
}
|
||||
@ -88,4 +97,8 @@ if (file_exists ($page)) {
|
||||
else {
|
||||
echo '<br /><b class="error">Sorry! I can\'t find the page '.$page.'!</b>';
|
||||
}
|
||||
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
pandora_xhprof_display_result("ajax", "console");
|
||||
}
|
||||
?>
|
||||
|
@ -61,17 +61,27 @@ function mainModuleGroups() {
|
||||
$info = groupview_plain_groups($info);
|
||||
$counter = count($info);
|
||||
$offset = get_parameter('offset', 0);
|
||||
$groups_view = $is_not_paginated
|
||||
? $info
|
||||
: array_slice($info, $offset, $config['block_size']);
|
||||
$agents_counters = array_reduce($groups_view, function($carry, $item){
|
||||
$carry[$item['id']] = $item;
|
||||
return $carry;
|
||||
}, array());
|
||||
$agent_group_search = get_parameter('agent_group_search', '');
|
||||
$module_group_search = get_parameter('module_group_search', '');
|
||||
|
||||
$ids_array = array_keys($agents_counters);
|
||||
$info = array_filter($info, function($v, $k) use ($agent_group_search) {
|
||||
return preg_match("/$agent_group_search/i", $v['name']);
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
|
||||
$ids_group = implode(',', $ids_array);
|
||||
if (!empty($info)) {
|
||||
$groups_view = $is_not_paginated
|
||||
? $info
|
||||
: array_slice($info, $offset, $config['block_size']);
|
||||
$agents_counters = array_reduce($groups_view, function($carry, $item){
|
||||
$carry[$item['id']] = $item;
|
||||
return $carry;
|
||||
}, array());
|
||||
|
||||
$ids_array = array_keys($agents_counters);
|
||||
|
||||
$ids_group = implode(',', $ids_array);
|
||||
} else
|
||||
$ids_group = -1;
|
||||
|
||||
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
|
||||
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
|
||||
@ -90,6 +100,12 @@ function mainModuleGroups() {
|
||||
$array_module_group[$value['id_mg']] = $value['name'];
|
||||
}
|
||||
$array_module_group[0] = 'Nothing';
|
||||
|
||||
|
||||
$array_module_group = array_filter($array_module_group, function($v, $k) use ($module_group_search) {
|
||||
return preg_match("/$module_group_search/i", $v);
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
|
||||
foreach ($agents_counters as $key => $value) {
|
||||
$array_for_defect[$key]['gm'] = $array_module_group;
|
||||
$array_for_defect[$key]['data']['name'] = $value['name'];
|
||||
@ -167,7 +183,26 @@ $sql =
|
||||
|
||||
ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, '');
|
||||
|
||||
if(count($array_for_defect) > 0){
|
||||
echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'>
|
||||
<tr>";
|
||||
echo "<form method='post'
|
||||
action='index.php?sec=view&sec2=extensions/module_groups'>";
|
||||
|
||||
echo "<td>";
|
||||
echo __('Search by agent group') . ' ';
|
||||
html_print_input_text ("agent_group_search", $agent_group_search);
|
||||
|
||||
echo "</td><td>";
|
||||
echo __('Search by module group') . ' ';
|
||||
html_print_input_text ("module_group_search", $module_group_search);
|
||||
|
||||
echo "</td><td>";
|
||||
echo "<input name='srcbutton' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
echo "</form>";
|
||||
echo "<td>";
|
||||
echo "</tr></table>";
|
||||
|
||||
if(true){
|
||||
$table = new StdClass();
|
||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
|
||||
$table->width = '100%';
|
||||
|
@ -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();
|
||||
|
11
pandora_console/extras/mr/23.sql
Normal file
11
pandora_console/extras/mr/23.sql
Normal file
@ -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;
|
5
pandora_console/extras/mr/24.sql
Normal file
5
pandora_console/extras/mr/24.sql
Normal file
@ -0,0 +1,5 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
|
||||
|
||||
COMMIT;
|
@ -48,8 +48,6 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
|
||||
`dynamic_interval` int(4) unsigned default '0',
|
||||
`dynamic_max` int(4) default '0',
|
||||
`dynamic_min` int(4) default '0',
|
||||
`dynamic_next` bigint(20) NOT NULL default '0',
|
||||
`dynamic_two_tailed` tinyint(1) unsigned default '0',
|
||||
`prediction_sample_window` int(10) default 0,
|
||||
`prediction_samples` int(4) default 0,
|
||||
`prediction_threshold` int(4) default 0,
|
||||
@ -58,6 +56,9 @@ CREATE TABLE IF NOT EXISTS `tlocal_component` (
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE `tlocal_component` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tpolicy_modules`
|
||||
-- -----------------------------------------------------
|
||||
@ -125,8 +126,6 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
|
||||
`dynamic_interval` int(4) unsigned default '0',
|
||||
`dynamic_max` int(4) default '0',
|
||||
`dynamic_min` int(4) default '0',
|
||||
`dynamic_next` bigint(20) NOT NULL default '0',
|
||||
`dynamic_two_tailed` tinyint(1) unsigned default '0',
|
||||
`prediction_sample_window` int(10) default 0,
|
||||
`prediction_samples` int(4) default 0,
|
||||
`prediction_threshold` int(4) default 0,
|
||||
@ -135,6 +134,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules` (
|
||||
UNIQUE (`id_policy`, `name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tpolicies`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -181,6 +183,9 @@ CREATE TABLE IF NOT EXISTS `tpolicy_agents` (
|
||||
UNIQUE (`id_policy`, `id_agent`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tpolicy_agents` ADD COLUMN `id_node` int(10) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `tpolicy_agents` ADD UNIQUE(`id_policy`, `id_agent`, `id_node`);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tpolicy_groups`
|
||||
-- -----------------------------------------------------
|
||||
@ -292,6 +297,8 @@ CREATE TABLE IF NOT EXISTS `tagent_module_inventory` (
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tagent_module_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tpolicy_modules_inventory`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -310,6 +317,8 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_inventory` (
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tagente_datos_inventory`
|
||||
-- -----------------------------------------------------
|
||||
@ -341,18 +350,13 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` (
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
|
||||
`id` int(10) NOT NULL auto_increment primary key,
|
||||
`server_name` text,
|
||||
`server_url` text,
|
||||
`dbuser` text,
|
||||
`dbpass` text,
|
||||
`dbhost` text,
|
||||
`dbport` text,
|
||||
`dbname` text,
|
||||
`meta_dbuser` text,
|
||||
`meta_dbpass` text,
|
||||
`meta_dbhost` text,
|
||||
`meta_dbport` text,
|
||||
`meta_dbname` text,
|
||||
`server_name` text default '',
|
||||
`server_url` text default '',
|
||||
`dbuser` text default '',
|
||||
`dbpass` text default '',
|
||||
`dbhost` text default '',
|
||||
`dbport` text default '',
|
||||
`dbname` text default '',
|
||||
`auth_token` text default '',
|
||||
`id_group` int(10) unsigned NOT NULL default 0,
|
||||
`api_password` text NOT NULL,
|
||||
@ -362,6 +366,12 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
|
||||
COMMENT = 'Table to store metaconsole sources'
|
||||
DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbpass` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbhost` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbport` text;
|
||||
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbname` text;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tprofile_view`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -400,7 +410,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
|
||||
`id_template_alert_warning` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_critical` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_unknown` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0
|
||||
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to define services to monitor'
|
||||
@ -548,6 +558,8 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
|
||||
KEY `idx_id_event_alert` (`id_event_alert`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tevent_rule` ADD COLUMN `group_recursion` INT(1) unsigned default 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tevent_alert`
|
||||
-- -----------------------------------------------------
|
||||
@ -744,14 +756,15 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
||||
`module_names` TEXT,
|
||||
`module_free_text` TEXT,
|
||||
`each_agent` tinyint(1) default 1,
|
||||
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||
`lapse` int(11) UNSIGNED NOT NULL default '300',
|
||||
`visual_format` tinyint(1) UNSIGNED NOT NULL default '0',
|
||||
`hide_no_data` tinyint(1) default 0,
|
||||
PRIMARY KEY(`id_rc`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE treport_content_template ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE treport_content_template ADD COLUMN `lapse_calc` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content_template ADD COLUMN `lapse` int(11) default '300';
|
||||
ALTER TABLE treport_content_template ADD COLUMN `visual_format` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content_template ADD COLUMN `hide_no_data` tinyint(1) default '0';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
|
||||
-- -----------------------------------------------------
|
||||
@ -860,6 +873,9 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event` (
|
||||
-- Criticity: 5 - Minor
|
||||
-- Criticity: 6 - Major
|
||||
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `data` double(22,5) default NULL;
|
||||
ALTER TABLE `tmetaconsole_event` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmetaconsole_event_history`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -905,6 +921,8 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_event_history` (
|
||||
-- Criticity: 5 - Minor
|
||||
-- Criticity: 6 - Major
|
||||
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `data` double(22,5) default NULL;
|
||||
ALTER TABLE `tmetaconsole_event_history` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `textension_translate_string`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -957,12 +975,10 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||
`agent_version` varchar(100) default '',
|
||||
`ultimo_contacto_remoto` datetime default '1970-01-01 00:00:00',
|
||||
`disabled` tinyint(2) NOT NULL default '0',
|
||||
`remote` tinyint(1) NOT NULL default '0',
|
||||
`id_parent` int(10) unsigned default '0',
|
||||
`custom_id` varchar(255) default '',
|
||||
`server_name` varchar(100) default '',
|
||||
`cascade_protection` tinyint(2) NOT NULL default '0',
|
||||
`cascade_protection_module` int(10) unsigned default '0',
|
||||
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'number of hours of diference with the server timezone' ,
|
||||
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
|
||||
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
|
||||
@ -977,8 +993,6 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||
`fired_count` bigint(20) NOT NULL default '0',
|
||||
`update_module_count` tinyint(1) NOT NULL default '0',
|
||||
`update_alert_count` tinyint(1) NOT NULL default '0',
|
||||
`transactional_agent` tinyint(1) NOT NULL default '0',
|
||||
`alias` varchar(600) BINARY NOT NULL default '',
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
@ -987,6 +1001,11 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
||||
FOREIGN KEY (`id_tmetaconsole_setup`) REFERENCES tmetaconsole_setup(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `ttransaction`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1180,13 +1199,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`
|
||||
@ -1305,6 +1324,10 @@ ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL defau
|
||||
ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time";
|
||||
ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid";
|
||||
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default';
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0;
|
||||
ALTER TABLE `tlayout_data` ADD COLUMN `linked_layout_node_id` INT(10) NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagent_custom_fields`
|
||||
@ -1358,26 +1381,15 @@ ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tmodule_relationship ADD COLUMN `id_server` varchar(100) NOT NULL DEFAULT '';
|
||||
|
||||
-- Table `tlocal_component`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tlocal_component ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tlocal_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tpolicy_module`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `ip_target`varchar(100) default '';
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tpolicy_modules ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE `tpolicy_modules` ADD COLUMN `cps` int NOT NULL DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmetaconsole_agent`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
@ -1542,6 +1554,8 @@ ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL defaul
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tsnmp_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
|
||||
|
||||
SELECT max(unified_filters_id) INTO @max FROM tsnmp_filter;
|
||||
UPDATE tsnmp_filter tsf,(SELECT @max:= @max) m SET tsf.unified_filters_id = @max:= @max + 1 where tsf.unified_filters_id=0;
|
||||
|
||||
@ -1732,7 +1746,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlayout_template` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`name` varchar(600) NOT NULL,
|
||||
`id_group` INTEGER UNSIGNED NOT NULL,
|
||||
`background` varchar(200) NOT NULL,
|
||||
`height` INTEGER UNSIGNED NOT NULL default 0,
|
||||
@ -1778,11 +1792,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
||||
`clock_animation` varchar(60) NOT NULL default "analogic_1",
|
||||
`time_format` varchar(60) NOT NULL default "time",
|
||||
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
|
||||
`show_last_value` tinyint(1) UNSIGNED NULL default '0',
|
||||
`linked_layout_status_type` ENUM ('default', 'weight', 'service') DEFAULT 'default',
|
||||
`linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_node_id` INT(10) NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tlayout_template_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlog_graph_models`
|
||||
-- ---------------------------------------------------------------------
|
||||
@ -1804,6 +1822,7 @@ INSERT INTO tlog_graph_models VALUES (1, 'Apache log 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 '';
|
||||
@ -1824,5 +1843,28 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
|
||||
`id_custom_fields_data` varchar(600) default '',
|
||||
`id_status` varchar(600) default '',
|
||||
`module_search` varchar(600) default '',
|
||||
`module_status` varchar(600) default '',
|
||||
`recursion` int(1) unsigned default '0',
|
||||
`group_search` int(10) unsigned default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tevento`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgis_map_layer_groups`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
|
||||
`layer_id` INT NOT NULL,
|
||||
`group_id` MEDIUMINT(4) UNSIGNED NOT NULL,
|
||||
`agent_id` INT(10) UNSIGNED NOT NULL COMMENT 'Used to link the position to the group',
|
||||
PRIMARY KEY (`layer_id`, `group_id`),
|
||||
FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
@ -46,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">® '.get_copyright_notice().'</span>';
|
||||
|
||||
if (isset ($config['debug'])) {
|
||||
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,18 +573,27 @@ ui_require_javascript_file ('pandora_modules');
|
||||
?>
|
||||
<script language="javascript">
|
||||
/* <![CDATA[ */
|
||||
var no_name_lang = "<?php echo __('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') ?>";
|
||||
var no_plugin_lang = "<?php echo __('No plug-in provided') ?>";
|
||||
var no_execute_test_from = "<?php echo __('No server 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 ui_print_info_message ( array('no_close'=>true, 'message'=> __('No target IP provided') ) ); ?>
|
||||
`;
|
||||
var no_oid_lang =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No SNMP OID provided') ) ); ?>
|
||||
`;
|
||||
var no_prediction_module_lang =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No module to predict') ) ); ?>
|
||||
`;
|
||||
var no_plugin_lang =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No plug-in provided') ) ); ?>
|
||||
`;
|
||||
var no_execute_test_from =`
|
||||
<?php echo ui_print_info_message ( array('no_close'=>true, 'message'=> __('No server provided') ) ); ?>
|
||||
`;
|
||||
|
||||
$(document).ready (function () {
|
||||
configure_modules_form ();
|
||||
|
||||
|
||||
|
||||
|
||||
$("#module_form").submit(function() {
|
||||
if (typeof(check_remote_conf) != 'undefined') {
|
||||
|
@ -249,29 +249,33 @@ else {
|
||||
$idModuleType = '';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT id_tipo, descripcion
|
||||
//Removed web analysis and log4x from select
|
||||
$sql = sprintf (
|
||||
'SELECT id_tipo, descripcion, nombre
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
WHERE categoria IN (%s) AND id_tipo NOT IN (24, 25)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
|
||||
$table_simple->data[2][1] = html_print_select_from_sql ($sql, 'id_module_type',
|
||||
$idModuleType, '', '', '', true, false, false, $disabledBecauseInPolicy, false, false, 100);
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$sql = sprintf ('SELECT id_tipo, nombre
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
implode (',', $categories));
|
||||
implode (',', $categories)
|
||||
);
|
||||
|
||||
$type_names = db_get_all_rows_sql($sql);
|
||||
|
||||
$type_names_hash = array();
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
$type_description_hash = array();
|
||||
if (isset($type_names) && is_array($type_names)) {
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
$type_description_hash[$tn['id_tipo']] = $tn['descripcion'];
|
||||
}
|
||||
}
|
||||
|
||||
$table_simple->data[2][1] = html_print_select (
|
||||
$type_description_hash, 'id_module_type', $idModuleType,
|
||||
$disabledBecauseInPolicy, '', 0, true,
|
||||
false, true, '', false, false, false, 100
|
||||
);
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true);
|
||||
}
|
||||
|
||||
@ -439,7 +443,7 @@ $table_advanced->data[2][1] .= html_print_input_hidden ('moduletype', $moduletyp
|
||||
$table_advanced->data[2][3] = __('Post process').' ' . ui_print_help_icon ('postprocess', true);
|
||||
$table_advanced->data[2][4] =
|
||||
html_print_extended_select_for_post_process('post_process',
|
||||
$post_process, '', '', '0', false, true, false, true,
|
||||
$post_process, '', '', '0', false, true, false, false,
|
||||
$disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[2][4] = 3;
|
||||
|
||||
|
@ -65,6 +65,8 @@ if (! $id_agente) {
|
||||
$params['selectbox_id'] = 'id_agent_module';
|
||||
$params['javascript_is_function_select'] = true;
|
||||
$params['metaconsole_enabled'] = false;
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$table->data['agent'][1] = ui_print_agent_autocomplete_input($params);
|
||||
}
|
||||
|
||||
@ -137,20 +139,18 @@ if (check_acl ($config['id_user'], 0, "LM")) {
|
||||
$table->data[3][1] .= ' ' . __('seconds') . ui_print_help_icon ('action_threshold', true);
|
||||
|
||||
|
||||
if (!isset($step) || $step!=5) {
|
||||
if (!isset($step)) {
|
||||
echo '<form class="add_alert_form" method="post">';
|
||||
html_print_table ($table);
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
if (!isset($step) || $step!=5) {
|
||||
if (!isset($step)) {
|
||||
if($id_cluster){
|
||||
echo "<input onclick='window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");' type=button style='float:right;margin-left:20px;' name='store' class='sub upd' value='".__('Finish and view cluster')."'>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
html_print_submit_button (__('Add alert'), 'add', false, 'class="sub wand"');
|
||||
html_print_input_hidden ('create_alert', 1);
|
||||
echo '</div></form>';
|
||||
@ -223,7 +223,7 @@ $(document).ready (function () {
|
||||
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
|
||||
}
|
||||
else {
|
||||
$("#value", $value).append (parseInt(data));
|
||||
$("#value", $value).append (data);
|
||||
}
|
||||
$loading.hide ();
|
||||
$value.show ();
|
||||
|
@ -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 ++;
|
||||
|
@ -285,7 +285,7 @@ else {
|
||||
$filter = false;
|
||||
}
|
||||
$names = agents_get_modules (array_keys ($agents),
|
||||
'DISTINCT(tagente_modulo.nombre)', $filter, false);
|
||||
'tagente_modulo.nombre', $filter, false);
|
||||
foreach ($names as $name) {
|
||||
$modules[$name['nombre']] = $name['nombre'];
|
||||
}
|
||||
|
@ -51,31 +51,27 @@ if ($update) {
|
||||
$agents_ = array();
|
||||
|
||||
$force = get_parameter('force_type', false);
|
||||
|
||||
|
||||
if ($agents_select == false) {
|
||||
$agents_select = array();
|
||||
}
|
||||
|
||||
foreach ($agents_select as $agent_name) {
|
||||
$agents_[] = agents_get_agent_id($agent_name);
|
||||
}
|
||||
|
||||
$agents_ = $agents_select;
|
||||
$modules_ = $module_name;
|
||||
|
||||
}
|
||||
else if ($selection_mode == 'agents') {
|
||||
$force = get_parameter('force_group', false);
|
||||
|
||||
|
||||
$agents_ = $agents_id;
|
||||
$modules_ = $modules_select;
|
||||
}
|
||||
|
||||
|
||||
$success = 0;
|
||||
$count = 0;
|
||||
|
||||
|
||||
if ($agents_ == false)
|
||||
$agents_ = array();
|
||||
|
||||
|
||||
// If the option to select all of one group or module type is checked
|
||||
if ($force) {
|
||||
if ($force == 'type') {
|
||||
|
@ -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') . ' » ' .
|
||||
__('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
|
||||
|
@ -119,7 +119,9 @@ if ($schedule_report != '') {
|
||||
$time = date(TIME_FORMAT);
|
||||
$parameters[0] = get_parameter('id_schedule_report');
|
||||
//$parameters[1] = db_get_value('schedule_email', 'treport', 'id_report', $id_report);
|
||||
$parameters[1] = get_parameter('schedule_email');
|
||||
$parameters[1] = get_parameter('schedule_email_address');
|
||||
$parameters[2] = get_parameter('schedule_subject', '');
|
||||
$parameters[3] = get_parameter('schedule_email', '');
|
||||
$parameters['first_execution'] = strtotime ($date.' '.$time);
|
||||
|
||||
$values = array(
|
||||
|
@ -145,7 +145,9 @@ function visual_map_main() {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
bindColorRangeEvents();
|
||||
|
||||
draw_lines(lines, 'background', true);
|
||||
|
||||
draw_user_lines("", 0, 0, 0 , 0, 0, true);
|
||||
@ -220,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();
|
||||
@ -235,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);
|
||||
@ -243,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;
|
||||
@ -252,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");
|
||||
@ -271,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');
|
||||
@ -328,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');
|
||||
@ -382,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');
|
||||
@ -401,7 +372,6 @@ function update_button_palette_callback() {
|
||||
$("#image_" + idItem).css('height', '70px');
|
||||
$("#image_" + idItem).remove();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
@ -411,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;
|
||||
@ -433,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');
|
||||
@ -445,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');
|
||||
@ -455,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');
|
||||
@ -510,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');
|
||||
@ -529,7 +472,6 @@ function update_button_palette_callback() {
|
||||
$("#image_" + idItem).css('height', '70px');
|
||||
$("#image_" + idItem).remove();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$("#image_" + idItem).removeAttr('width');
|
||||
@ -539,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':
|
||||
@ -549,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);
|
||||
}
|
||||
@ -568,7 +510,7 @@ function update_button_palette_callback() {
|
||||
else {
|
||||
setPercentileBar(idItem, values);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'module_graph':
|
||||
if($('#dir_items').html() == 'horizontal'){
|
||||
@ -801,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();
|
||||
@ -840,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();
|
||||
|
||||
@ -868,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();
|
||||
@ -1234,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);
|
||||
@ -1264,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);
|
||||
@ -1670,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);
|
||||
@ -1951,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') {
|
||||
@ -2004,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();
|
||||
|
||||
@ -2479,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});
|
||||
@ -2514,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');
|
||||
@ -2524,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);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -2773,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();
|
||||
@ -2821,9 +2860,6 @@ function set_color_line_status(lines, id_data, values) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function createItem(type, values, id_data) {
|
||||
var sizeStyle = '';
|
||||
var imageSize = '';
|
||||
@ -2831,7 +2867,6 @@ function createItem(type, values, id_data) {
|
||||
|
||||
metaconsole = $("input[name='metaconsole']").val();
|
||||
|
||||
|
||||
switch (type) {
|
||||
case 'box_item':
|
||||
|
||||
@ -3642,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') {
|
||||
@ -3730,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']);
|
||||
@ -3835,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');
|
||||
}
|
||||
@ -3879,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'){
|
||||
@ -3952,7 +4005,6 @@ function updateDB(type, idElement , values, event) {
|
||||
parameter.push({name: key, value: val});
|
||||
});
|
||||
|
||||
|
||||
switch (type) {
|
||||
// -- line_item --
|
||||
case 'handler_start':
|
||||
@ -4335,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_", "");
|
||||
@ -4522,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';
|
||||
}
|
||||
@ -4860,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;
|
||||
@ -4894,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);
|
||||
@ -4927,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':
|
||||
@ -5006,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')
|
||||
@ -5273,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);
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -242,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'),
|
||||
@ -392,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,
|
||||
@ -450,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'),
|
||||
@ -466,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,
|
||||
|
@ -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
|
||||
|
BIN
pandora_console/images/color_cloud_item.disabled.png
Normal file
BIN
pandora_console/images/color_cloud_item.disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 505 B |
BIN
pandora_console/images/color_cloud_item.png
Normal file
BIN
pandora_console/images/color_cloud_item.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 502 B |
BIN
pandora_console/images/success.png
Normal file
BIN
pandora_console/images/success.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -32,6 +32,7 @@ $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);
|
||||
@ -40,7 +41,6 @@ if ($get_custom_fields_data){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if($build_table_custom_fields){
|
||||
$order = get_parameter("order", '');
|
||||
$length = get_parameter("length", 20);
|
||||
@ -73,6 +73,7 @@ if($build_table_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);
|
||||
@ -80,7 +81,7 @@ if($build_table_custom_fields){
|
||||
//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']."')";
|
||||
$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;
|
||||
@ -104,25 +105,7 @@ if($build_table_custom_fields){
|
||||
tma.direccion,
|
||||
tma.server_name,
|
||||
temp.name_custom_fields,
|
||||
(CASE
|
||||
WHEN tma.critical_count > 0
|
||||
THEN 1
|
||||
WHEN tma.critical_count = 0
|
||||
AND tma.warning_count > 0
|
||||
THEN 2
|
||||
WHEN tma.critical_count = 0
|
||||
AND tma.warning_count = 0
|
||||
AND tma.unknown_count > 0
|
||||
THEN 3
|
||||
WHEN tma.critical_count = 0
|
||||
AND tma.warning_count = 0
|
||||
AND tma.unknown_count = 0
|
||||
AND tma.notinit_count <> tma.total_count
|
||||
THEN 0
|
||||
WHEN tma.total_count = tma.notinit_count
|
||||
THEN 5
|
||||
ELSE 0
|
||||
END) AS `status`
|
||||
temp.status
|
||||
FROM tmetaconsole_agent tma
|
||||
INNER JOIN temp_custom_fields temp
|
||||
ON temp.id_agent = tma.id_tagente
|
||||
@ -237,6 +220,7 @@ 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;
|
||||
@ -246,6 +230,46 @@ if($build_table_child_custom_fields){
|
||||
$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);
|
||||
@ -262,9 +286,10 @@ if($build_table_child_custom_fields){
|
||||
INNER JOIN tagente_estado tae
|
||||
ON tam.id_agente_modulo = tae.id_agente_modulo
|
||||
WHERE tam.id_agente = %d
|
||||
%s",
|
||||
%s %s",
|
||||
$id_agent,
|
||||
$name_where
|
||||
$name_where,
|
||||
$and_module_status
|
||||
);
|
||||
|
||||
$modules = db_get_all_rows_sql ($query);
|
||||
@ -282,7 +307,7 @@ if($build_table_child_custom_fields){
|
||||
$table_modules->head[5] = __('Status');
|
||||
|
||||
$table_modules->data = array();
|
||||
$status_agent = -1;
|
||||
|
||||
if(isset($modules) && is_array($modules)){
|
||||
foreach ($modules as $key => $value) {
|
||||
$table_modules->data[$key][0] = $value['nombre'];
|
||||
@ -311,9 +336,6 @@ if($build_table_child_custom_fields){
|
||||
switch ($value['estado']) {
|
||||
case 0:
|
||||
case 300:
|
||||
if($status_agent != 1 && $status_agent != 2 && $status_agent != 3){
|
||||
$status_agent = 0;
|
||||
}
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_normal.png',
|
||||
true,
|
||||
@ -324,7 +346,6 @@ if($build_table_child_custom_fields){
|
||||
break;
|
||||
case 1:
|
||||
case 100:
|
||||
$status_agent = 1;
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_critical.png',
|
||||
true,
|
||||
@ -335,10 +356,6 @@ if($build_table_child_custom_fields){
|
||||
break;
|
||||
case 2:
|
||||
case 200:
|
||||
if($status_agent != 1){
|
||||
$status_agent = 2;
|
||||
}
|
||||
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_warning.png',
|
||||
true,
|
||||
@ -348,10 +365,6 @@ if($build_table_child_custom_fields){
|
||||
);
|
||||
break;
|
||||
case 3:
|
||||
if($status_agent != 1 && $status_agent != 2){
|
||||
$status_agent = 3;
|
||||
}
|
||||
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_maintenance.png',
|
||||
true,
|
||||
@ -362,9 +375,6 @@ if($build_table_child_custom_fields){
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
if($status_agent == -1 || $status_agent == 4){
|
||||
$status_agent = 5;
|
||||
}
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_informational.png',
|
||||
true,
|
||||
@ -374,10 +384,6 @@ if($build_table_child_custom_fields){
|
||||
);
|
||||
break;
|
||||
default:
|
||||
if($status_agent != 1 && $status_agent != 2 && $status_agent != 3){
|
||||
$status_agent = 0;
|
||||
}
|
||||
|
||||
$table_modules->data[$key][5] = html_print_image(
|
||||
'images/status_sets/default/severity_normal.png',
|
||||
true,
|
||||
@ -390,6 +396,11 @@ if($build_table_child_custom_fields){
|
||||
}
|
||||
}
|
||||
|
||||
//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();
|
||||
}
|
||||
@ -433,17 +444,19 @@ if($build_table_save_filter){
|
||||
$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'>";
|
||||
|
||||
echo "<form action='' method='post'>";
|
||||
html_print_table($table);
|
||||
echo "</form>";
|
||||
}
|
||||
@ -457,11 +470,22 @@ if($append_tab_filter){
|
||||
$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{
|
||||
@ -470,12 +494,22 @@ if($append_tab_filter){
|
||||
$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',
|
||||
'', '', __('None'), -1,
|
||||
true, false, true, '', false
|
||||
$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[0][3] = html_print_submit_button (__('Update filter'), 'update_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);
|
||||
@ -491,6 +525,7 @@ if($create_filter_cf){
|
||||
//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 == ''){
|
||||
@ -529,11 +564,14 @@ if($create_filter_cf){
|
||||
//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);
|
||||
|
||||
@ -565,6 +603,7 @@ if($update_filter_cf){
|
||||
//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){
|
||||
@ -595,10 +634,13 @@ if($update_filter_cf){
|
||||
//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);
|
||||
@ -669,7 +711,17 @@ if($delete_filter_cf){
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -193,25 +193,49 @@ if ($dialogue_event_response) {
|
||||
$event_id = get_parameter ('event_id');
|
||||
$response_id = get_parameter ('response_id');
|
||||
$command = get_parameter ('target');
|
||||
|
||||
$massive = get_parameter ('massive');
|
||||
$end = get_parameter ('end');
|
||||
$show_execute_again_btn = get_parameter ('show_execute_again_btn');
|
||||
$out_iterator = get_parameter ('out_iterator');
|
||||
$event_response = db_get_row('tevent_response','id',$response_id);
|
||||
|
||||
$event = db_get_row('tevento','id_evento',$event_id);
|
||||
|
||||
$prompt = "<br>> ";
|
||||
|
||||
switch($event_response['type']) {
|
||||
case 'command':
|
||||
echo "<div style='text-align:left'>";
|
||||
echo $prompt.sprintf(__('Executing command: %s',$command));
|
||||
echo "</div><br>";
|
||||
|
||||
|
||||
echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true)."</div>";
|
||||
echo "<br><div id='response_out' style='text-align:left'></div>";
|
||||
|
||||
echo "<br><div id='re_exec_command' style='display:none;'>";
|
||||
html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
|
||||
echo "</div>";
|
||||
if ($massive) {
|
||||
echo "<div style='text-align:left'>";
|
||||
echo $prompt.sprintf("(Event #$event_id) ".__('Executing command: %s',$command));
|
||||
echo "</div><br>";
|
||||
|
||||
echo "<div id='response_loading_command_".$out_iterator."' style='display:none'>".html_print_image('images/spinner.gif', true)."</div>";
|
||||
echo "<br><div id='response_out_".$out_iterator."' style='text-align:left'></div>";
|
||||
|
||||
if ($end) {
|
||||
|
||||
echo "<br><div id='re_exec_command_".$out_iterator."' style='display:none;'>";
|
||||
html_print_button(__('Execute again'),'btn_str',false,'execute_event_response(false);', "class='sub next'");
|
||||
echo "<span id='execute_again_loading' style='display:none'>".html_print_image('images/spinner.gif', true)."</span>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
echo "<div style='text-align:left'>";
|
||||
echo $prompt.sprintf(__('Executing command: %s',$command));
|
||||
echo "</div><br>";
|
||||
|
||||
echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true)."</div>";
|
||||
echo "<br><div id='response_out' style='text-align:left'></div>";
|
||||
|
||||
echo "<br><div id='re_exec_command' style='display:none;'>";
|
||||
html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
break;
|
||||
case 'url':
|
||||
$command = str_replace("localhost",$_SERVER['SERVER_NAME'],$command);
|
||||
|
@ -472,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;
|
||||
@ -489,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;
|
||||
@ -501,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;
|
||||
@ -513,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;
|
||||
@ -533,7 +534,7 @@ if ($list_modules) {
|
||||
$selectLastContactUp = '';
|
||||
$selectLastContactDown = '';
|
||||
|
||||
$order = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||
break;
|
||||
}
|
||||
|
||||
@ -588,7 +589,20 @@ if ($list_modules) {
|
||||
}
|
||||
|
||||
//Count monitors/modules
|
||||
$order_sql = $order['field'] . " " . $order['order'];
|
||||
|
||||
// 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
|
||||
|
@ -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();
|
||||
@ -539,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':
|
||||
@ -836,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) {
|
||||
@ -897,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':
|
||||
@ -953,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));
|
||||
|
||||
@ -1093,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':
|
||||
@ -1348,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);
|
||||
@ -1392,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'];
|
||||
@ -1424,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;
|
||||
|
@ -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"];
|
||||
?>
|
@ -269,32 +269,8 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
||||
else {
|
||||
delete_user_pass_ldap ($login);
|
||||
}
|
||||
|
||||
$permissions = array();
|
||||
if($config['ldap_advanced_config']){
|
||||
$i = 0;
|
||||
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if(preg_match('/' . $attr[1] . '/', $s_attr)){
|
||||
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
|
||||
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
|
||||
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$permissions[0]["profile"] = $config['default_remote_profile'];
|
||||
$permissions[0]["groups"][] = $config['default_remote_group'];
|
||||
$permissions[0]["tags"] = $config['default_assign_tags'];
|
||||
}
|
||||
|
||||
$permissions = fill_permissions_ldap($sr);
|
||||
if(empty($permissions)) {
|
||||
$config["auth_error"] = __("User not found in database or incorrect password");
|
||||
return false;
|
||||
@ -388,33 +364,7 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
||||
}
|
||||
}
|
||||
|
||||
$permissions = array();
|
||||
if($config['ldap_advanced_config']){
|
||||
$i = 0;
|
||||
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if(preg_match('/' . $attr[1] . '/', $s_attr)){
|
||||
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
|
||||
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
|
||||
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$permissions[0]["profile"] = $config['default_remote_profile'];
|
||||
$permissions[0]["groups"][] = $config['default_remote_group'];
|
||||
$permissions[0]["tags"] = $config['default_assign_tags'];
|
||||
}
|
||||
|
||||
$permissions = fill_permissions_ldap($sr);
|
||||
if(empty($permissions)) {
|
||||
$config["auth_error"] = __("User not found in database or incorrect password");
|
||||
return false;
|
||||
@ -904,10 +854,11 @@ function create_user_and_permisions_ldap ($id_user, $password, $user_info,
|
||||
$id_profile = $permission["profile"];
|
||||
$id_groups = $permission["groups"];
|
||||
$tags = $permission["tags"];
|
||||
$no_hierarchy = (bool)$permission["no_hierarchy"] ? 1 : 0;
|
||||
|
||||
foreach ($id_groups as $id_group) {
|
||||
$profile = profile_create_user_profile(
|
||||
$id_user, $id_profile, $id_group, false, $tags);
|
||||
$id_user, $id_profile, $id_group, false, $tags, $no_hierarchy);
|
||||
}
|
||||
|
||||
if ( defined("METACONSOLE") && $syncronize ) {
|
||||
@ -934,7 +885,7 @@ function create_user_and_permisions_ldap ($id_user, $password, $user_info,
|
||||
db_process_sql_insert ("tusuario", $values);
|
||||
foreach ($id_groups as $id_group) {
|
||||
$profile = profile_create_user_profile ($id_user,
|
||||
$id_profile, $id_group, false, $tags);
|
||||
$id_profile, $id_group, false, $tags, $no_hierarchy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1141,6 +1092,46 @@ function check_permission_ldap ($id_user, $password, $user_info,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill permissions array with setup values
|
||||
*
|
||||
* @param string sr return value from LDAP connection
|
||||
*
|
||||
* @return array with all permission on LDAP authentication
|
||||
*/
|
||||
function fill_permissions_ldap ($sr) {
|
||||
global $config;
|
||||
|
||||
$permissions = array();
|
||||
if(!$config['ldap_advanced_config']){
|
||||
$permissions[0]["profile"] = $config['default_remote_profile'];
|
||||
$permissions[0]["groups"][] = $config['default_remote_group'];
|
||||
$permissions[0]["tags"] = $config['default_assign_tags'];
|
||||
$permissions[0]["no_hierarchy"] = $config['default_no_hierarchy'];
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
// Decode permissions in advanced mode
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if(preg_match('/' . $attr[1] . '/', $s_attr)){
|
||||
$permissions[] = array(
|
||||
"profile" => $ldap_adv_perm['profile'],
|
||||
"groups" => $ldap_adv_perm['group'],
|
||||
"tags" => implode(",",$ldap_adv_perm['tags']),
|
||||
"no_hierarchy" => (bool)$ldap_adv_perm['no_hierarchy'] ? 1 : 0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update local user pass from ldap user
|
||||
*
|
||||
|
@ -63,7 +63,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<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.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/pandora_minimal.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>
|
||||
@ -86,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;
|
||||
|
||||
@ -202,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:
|
||||
@ -212,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 = 'PC181127';
|
||||
$pandora_version = 'v7.0NG.729';
|
||||
$build_version = 'PC190128';
|
||||
$pandora_version = 'v7.0NG.730';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
@ -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);
|
||||
|
@ -1215,30 +1215,29 @@ function mysql_get_fields($table) {
|
||||
/**
|
||||
* Process a file with an oracle schema sentences.
|
||||
* Based on the function which installs the pandoradb.sql schema.
|
||||
*
|
||||
*
|
||||
* @param string $path File path.
|
||||
* @param bool $handle_error Whether to handle the mysqli_query/mysql_query errors or throw an exception.
|
||||
*
|
||||
*
|
||||
* @return bool Return the final status of the operation.
|
||||
*/
|
||||
function mysql_db_process_file ($path, $handle_error = true) {
|
||||
global $config;
|
||||
|
||||
|
||||
if (file_exists($path)) {
|
||||
$file_content = file($path);
|
||||
$query = "";
|
||||
|
||||
|
||||
// Begin the transaction
|
||||
mysql_db_process_sql_begin();
|
||||
|
||||
|
||||
foreach ($file_content as $sql_line) {
|
||||
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
|
||||
|
||||
$query .= $sql_line;
|
||||
|
||||
|
||||
if (preg_match("/;[\040]*\$/", $sql_line)) {
|
||||
if ($config["mysqli"]) {
|
||||
$query_result = mysqli_query($config['dbconnection'], $query);
|
||||
$query_result = mysqli_query($config['dbconnection'], $query);
|
||||
}
|
||||
else {
|
||||
$query_result = mysql_query($query);
|
||||
@ -1246,9 +1245,14 @@ function mysql_db_process_file ($path, $handle_error = true) {
|
||||
if (!$result = $query_result) {
|
||||
// Error. Rollback the transaction
|
||||
mysql_db_process_sql_rollback();
|
||||
|
||||
$error_message = mysql_error();
|
||||
|
||||
|
||||
if($config["mysqli"]){
|
||||
$error_message = mysqli_error($config['dbconnection']);
|
||||
}
|
||||
else{
|
||||
$error_message = mysql_error();
|
||||
}
|
||||
|
||||
// Handle the error
|
||||
if ($handle_error) {
|
||||
$backtrace = debug_backtrace();
|
||||
@ -1258,7 +1262,7 @@ function mysql_db_process_file ($path, $handle_error = true) {
|
||||
set_error_handler('db_sql_error_handler');
|
||||
trigger_error($error);
|
||||
restore_error_handler();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
// Throw an exception with the error message
|
||||
@ -1270,10 +1274,9 @@ function mysql_db_process_file ($path, $handle_error = true) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No errors. Commit the transaction
|
||||
mysql_db_process_sql_commit();
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -3285,11 +3285,19 @@ function series_type_graph_array($data, $show_elements_graph){
|
||||
function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = false, $module_list = false){
|
||||
global $config;
|
||||
|
||||
if(is_metaconsole()){
|
||||
$hack_metaconsole = "../..";
|
||||
}
|
||||
else{
|
||||
$hack_metaconsole = "";
|
||||
}
|
||||
|
||||
$file_js = $config["homedir"] . "/include/web2image.js";
|
||||
$url = $config["homeurl"] . "include/chart_generator.php";
|
||||
$url = ui_get_full_url(false) . $hack_metaconsole . "/include/chart_generator.php";
|
||||
|
||||
$img_file = "img_". uniqid() .".png";
|
||||
$img_path = $config["homedir"] . "/attachment/" . $img_file;
|
||||
$img_url = $config["homeurl"] . "attachment/" . $img_file;
|
||||
$img_url = ui_get_full_url(false) . $hack_metaconsole . "/attachment/" . $img_file;
|
||||
|
||||
$width_img = 500;
|
||||
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 280;
|
||||
@ -3320,12 +3328,16 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
||||
. ' "' . $session_id . '"'
|
||||
. ' "' . $params['return_img_base_64'] . '"';
|
||||
|
||||
$result = exec($cmd);
|
||||
$result = null;
|
||||
$retcode = null;
|
||||
exec($cmd, $result, $retcode);
|
||||
|
||||
$img_content = join("\n", $result);
|
||||
|
||||
if($params['return_img_base_64']){
|
||||
// To be used in alerts
|
||||
$width_img = 500;
|
||||
return $result;
|
||||
return $img_content;
|
||||
}
|
||||
else{
|
||||
// to be used in PDF files
|
||||
@ -3387,6 +3399,121 @@ function validate_csrf_code() {
|
||||
}
|
||||
|
||||
function generate_hash_to_api(){
|
||||
hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key'));
|
||||
return (string)hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the profiller and display de result
|
||||
*
|
||||
* @param string Key to identify the profiler run.
|
||||
* @param string Way to display the result
|
||||
* "link" (default): Click into word "Performance" to display the profilling info.
|
||||
* "console": Display with a message in pandora_console.log.
|
||||
*/
|
||||
function pandora_xhprof_display_result($key = "", $method = "link") {
|
||||
// Check if function exists
|
||||
if (!function_exists('tideways_xhprof_disable')) {
|
||||
error_log("Cannot find tideways_xhprof_disable function");
|
||||
return;
|
||||
}
|
||||
|
||||
$run_id = uniqid();
|
||||
$data = tideways_xhprof_disable();
|
||||
$source = "pandora_$key";
|
||||
file_put_contents(
|
||||
sys_get_temp_dir() . "/" . $run_id . ".$source.xhprof",
|
||||
serialize($data)
|
||||
);
|
||||
$new_url = "http://{$_SERVER['HTTP_HOST']}/profiler/index.php?run={$run_id}&source={$source}";
|
||||
switch($method) {
|
||||
case "console":
|
||||
error_log("'{$new_url}'");
|
||||
case "link":
|
||||
default:
|
||||
echo "<a href='{$new_url}' target='_new'>Performance</a>\n";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* From a network with a mask remove the smallest ip and the highest
|
||||
*
|
||||
* @param string address to identify the network.
|
||||
* @param string mask to identify the mask network
|
||||
* @return array or false with smallest ip and highest ip
|
||||
*/
|
||||
function range_ips_for_network($address, $mask) {
|
||||
if(!isset($address) || !isset($mask)){
|
||||
return false;
|
||||
}
|
||||
|
||||
//convert ip addresses to long form
|
||||
$address_long = ip2long($address);
|
||||
$mask_long = ip2long($mask);
|
||||
|
||||
//caculate first usable address
|
||||
$ip_host_first = ((~$mask_long) & $address_long);
|
||||
$ip_first = ($address_long ^ $ip_host_first) + 1;
|
||||
|
||||
//caculate last usable address
|
||||
$ip_broadcast_invert = ~$mask_long;
|
||||
$ip_last = ($address_long | $ip_broadcast_invert) - 1;
|
||||
|
||||
$range = array(
|
||||
'first' => long2ip($ip_first),
|
||||
'last' => long2ip($ip_last)
|
||||
);
|
||||
|
||||
return $range;
|
||||
}
|
||||
|
||||
/**
|
||||
* from two ips find out if there is such an ip
|
||||
*
|
||||
* @param string ip ip wont validate
|
||||
* @param string ip_lower
|
||||
* @param string ip_upper
|
||||
* @return bool true or false if the ip is between the two ips
|
||||
*/
|
||||
function is_in_network ($ip, $ip_lower, $ip_upper) {
|
||||
if(!isset($ip) || !isset($ip_lower) || !isset($ip_upper)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$ip = (float)sprintf("%u",ip2long($ip));
|
||||
$ip_lower = (float)sprintf("%u",ip2long($ip_lower));
|
||||
$ip_upper = (float)sprintf("%u",ip2long($ip_upper));
|
||||
|
||||
if ($ip >= $ip_lower && $ip <= $ip_upper){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function ip_belongs_to_network($ip, $network, $mask) {
|
||||
if ($ip == $network) {
|
||||
return true;
|
||||
}
|
||||
$ranges = range_ips_for_network($network, $mask);
|
||||
return is_in_network($ip, $ranges['first'], $ranges['last']);
|
||||
}
|
||||
/**
|
||||
* convert the mask to cird format
|
||||
*
|
||||
* @param string mask
|
||||
* @return string true or false if the ip is between the two ips
|
||||
*/
|
||||
function mask2cidr($mask){
|
||||
if(!isset($mask))
|
||||
return 0;
|
||||
|
||||
$long = ip2long($mask);
|
||||
$base = ip2long('255.255.255.255');
|
||||
return 32-log(($long ^ $base)+1,2);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -361,11 +361,13 @@ function agents_get_agents ($filter = false, $fields = false,
|
||||
break;
|
||||
case AGENT_STATUS_NOT_NORMAL:
|
||||
$status_sql = "(
|
||||
critical_count > 0
|
||||
OR warning_count > 0
|
||||
OR unknown_count > 0
|
||||
OR total_count = 0
|
||||
normal_count <> total_count
|
||||
OR total_count = notinit_count)";
|
||||
//The AGENT_STATUS_NOT_NORMAL filter must show all agents that are not in normal status
|
||||
/*"(
|
||||
normal_count <> total_count
|
||||
AND
|
||||
(normal_count + notinit_count) <> total_count)";*/
|
||||
break;
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
$status_sql = "(
|
||||
@ -825,7 +827,8 @@ function agents_get_group_agents (
|
||||
|
||||
$filter = array();
|
||||
|
||||
if (!$noACL) {
|
||||
// check available groups for target user only if asking for 'All' group
|
||||
if (!$noACL && $id_group == 0) {
|
||||
$id_group = $id_group == 0
|
||||
? array_keys(users_get_groups(false, "AR", false))
|
||||
: groups_safe_acl($config["id_user"], $id_group, "AR");
|
||||
@ -846,7 +849,8 @@ function agents_get_group_agents (
|
||||
$id_group = groups_get_id_recursive($id_group, true);
|
||||
}
|
||||
|
||||
if (!$noACL) {
|
||||
// check available groups for target user only if asking for 'All' group
|
||||
if (!$noACL && $id_group == 0) {
|
||||
$id_group = array_keys(
|
||||
users_get_groups(false, "AR", true, false, (array)$id_group));
|
||||
}
|
||||
@ -1229,8 +1233,8 @@ function agents_get_modules ($id_agent = null, $details = false,
|
||||
ON tagente.id_agente = tasg.id_agent
|
||||
WHERE tagente_modulo.delete_pending = 0
|
||||
AND %s
|
||||
GROUP BY tagente_modulo.id_agente_modulo
|
||||
ORDER BY tagente_modulo.nombre',
|
||||
GROUP BY 1
|
||||
ORDER BY 1',
|
||||
($details != 'tagente_modulo.*' && $indexed) ? 'tagente_modulo.id_agente_modulo,' : '',
|
||||
io_safe_output(implode (",", (array) $details)),
|
||||
$sql_tags_join,
|
||||
|
@ -1845,9 +1845,9 @@ function get_group_alerts($id_group, $filter = '', $options = false,
|
||||
}
|
||||
}
|
||||
|
||||
$selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name, t3.alias AS agent_name, t4.name AS template_name';
|
||||
$selectText = 'DISTINCT talert_template_modules.*, t2.nombre AS agent_module_name, t3.alias AS agent_name, t4.name AS template_name';
|
||||
if ($count !== false) {
|
||||
$selectText = 'COUNT(talert_template_modules.id) AS count';
|
||||
$selectText = 'COUNT(DISTINCT talert_template_modules.id) AS count';
|
||||
}
|
||||
|
||||
$sql = sprintf ("SELECT %s
|
||||
@ -1871,7 +1871,7 @@ function get_group_alerts($id_group, $filter = '', $options = false,
|
||||
return $alerts[0]['count'];
|
||||
}
|
||||
else {
|
||||
return $alerts;
|
||||
return $alerts;
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -249,6 +249,10 @@ function config_update_config () {
|
||||
$error_update[] = __('Activate Log Collector');
|
||||
if (!config_update_value ('enable_update_manager', get_parameter('enable_update_manager')))
|
||||
$error_update[] = __('Enable Update Manager');
|
||||
if (!config_update_value ('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold')))
|
||||
$error_update[] = __('Ipam Ocuppied Manager Critical');
|
||||
if (!config_update_value ('ipam_ocuppied_warning_treshold', get_parameter('ipam_ocuppied_warning_treshold')))
|
||||
$error_update[] = __('Ipam Ocuppied Manager Warning');
|
||||
|
||||
$inventory_changes_blacklist = get_parameter('inventory_changes_blacklist', array());
|
||||
if (!config_update_value ('inventory_changes_blacklist', implode(',',$inventory_changes_blacklist)))
|
||||
@ -312,6 +316,8 @@ function config_update_config () {
|
||||
$error_update[] = __('Autocreate profile group');
|
||||
if (!config_update_value ('default_assign_tags', implode(",",get_parameter ('default_assign_tags'))))
|
||||
$error_update[] = __('Autocreate profile tags');
|
||||
if (!config_update_value ('default_no_hierarchy', (int)get_parameter ('default_no_hierarchy')))
|
||||
$error_update[] = __('Automatically assigned no hierarchy');
|
||||
if (!config_update_value ('autocreate_blacklist', get_parameter ('autocreate_blacklist')))
|
||||
$error_update[] = __('Autocreate blacklist');
|
||||
|
||||
@ -1083,6 +1089,14 @@ function config_process_config () {
|
||||
config_update_value ('enable_update_manager', 1);
|
||||
}
|
||||
|
||||
if (!isset ($config["ipam_ocuppied_critical_treshold"])) {
|
||||
config_update_value ('ipam_ocuppied_critical_treshold', 90);
|
||||
}
|
||||
|
||||
if (!isset ($config["ipam_ocuppied_warning_treshold"])) {
|
||||
config_update_value ('ipam_ocuppied_warning_treshold', 80);
|
||||
}
|
||||
|
||||
if (!isset ($config["reset_pass_option"])) {
|
||||
config_update_value ('reset_pass_option', 0);
|
||||
}
|
||||
@ -1452,7 +1466,10 @@ function config_process_config () {
|
||||
if (!isset ($config['default_assign_tags'])) {
|
||||
config_update_value ( 'default_assign_tags', '');
|
||||
}
|
||||
|
||||
if (!isset ($config['default_no_hierarchy'])) {
|
||||
config_update_value ('default_no_hierarchy', 0);
|
||||
}
|
||||
|
||||
if (!isset ($config['ldap_server'])) {
|
||||
config_update_value ( 'ldap_server', 'localhost');
|
||||
}
|
||||
@ -2027,6 +2044,14 @@ function config_process_config () {
|
||||
if (!isset($config["metaconsole_deploy_collection"])) {
|
||||
config_update_value('metaconsole_deploy_collection', 0);
|
||||
}
|
||||
|
||||
if (!isset($config["metaconsole_deploy_inventory_plugin"])) {
|
||||
config_update_value('metaconsole_deploy_inventory_plugin', 0);
|
||||
}
|
||||
|
||||
if (!isset($config["metaconsole_deploy_plugin_server"])) {
|
||||
config_update_value('metaconsole_deploy_plugin_server', 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally, check if any value was overwritten in a form */
|
||||
|
@ -191,8 +191,15 @@ function get_custom_fields_data ($custom_field_name) {
|
||||
}
|
||||
|
||||
function agent_counters_custom_fields($filters){
|
||||
//filter by status
|
||||
//filter by status agent
|
||||
$and_status = "";
|
||||
|
||||
$agent_state_normal = 0;
|
||||
$agent_state_critical = 0;
|
||||
$agent_state_warning = 0;
|
||||
$agent_state_unknown = 0;
|
||||
$agent_state_notinit = 0;
|
||||
$agent_state_total = 0;
|
||||
if(is_array($filters['id_status'])){
|
||||
if(!in_array(-1, $filters['id_status'])){
|
||||
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $filters['id_status'])){
|
||||
@ -200,34 +207,34 @@ function agent_counters_custom_fields($filters){
|
||||
$and_status = " AND ( ";
|
||||
foreach ($filters['id_status'] as $key => $value) {
|
||||
$and_status .= ($key != 0)
|
||||
? " OR ("
|
||||
: " (";
|
||||
? " OR "
|
||||
: " ";
|
||||
switch ($value) {
|
||||
default:
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$and_status .= " ta.critical_count = 0
|
||||
AND ta.warning_count = 0
|
||||
AND ta.unknown_count = 0
|
||||
AND ta.total_count <> ta.notinit_count ) ";
|
||||
$agent_state_normal = agents_get_status_clause(AGENT_STATUS_NORMAL);
|
||||
$and_status .= agents_get_status_clause(AGENT_STATUS_NORMAL);
|
||||
break;
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
$and_status .= " ta.critical_count > 0 ) ";
|
||||
$and_status .= agents_get_status_clause(AGENT_STATUS_CRITICAL);
|
||||
$agent_state_critical = agents_get_status_clause(AGENT_STATUS_CRITICAL);
|
||||
break;
|
||||
case AGENT_STATUS_WARNING:
|
||||
$and_status .= " ta.critical_count = 0
|
||||
AND ta.warning_count > 0 ) ";
|
||||
$and_status .= agents_get_status_clause(AGENT_STATUS_WARNING);
|
||||
$agent_state_warning = agents_get_status_clause(AGENT_STATUS_WARNING);
|
||||
break;
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
$and_status .= " ta.critical_count = 0
|
||||
AND ta.warning_count = 0
|
||||
AND ta.unknown_count > 0 ) ";
|
||||
$and_status .= agents_get_status_clause(AGENT_STATUS_UNKNOWN);
|
||||
$agent_state_unknown = agents_get_status_clause(AGENT_STATUS_UNKNOWN);
|
||||
break;
|
||||
case AGENT_STATUS_NOT_INIT:
|
||||
$and_status .= " ta.total_count = ta.notinit_count ) ";
|
||||
$and_status .= agents_get_status_clause(AGENT_STATUS_NOT_INIT);
|
||||
$agent_state_notinit = agents_get_status_clause(AGENT_STATUS_NOT_INIT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$and_status .= " ) ";
|
||||
$agent_state_total = agents_get_status_clause(AGENT_STATUS_ALL);
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -237,21 +244,125 @@ function agent_counters_custom_fields($filters){
|
||||
OR ( ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0 )
|
||||
OR ( ta.total_count = ta.notinit_count )
|
||||
) ";
|
||||
|
||||
$agent_state_critical = agents_get_status_clause(AGENT_STATUS_CRITICAL);
|
||||
$agent_state_warning = agents_get_status_clause(AGENT_STATUS_WARNING);
|
||||
$agent_state_unknown = agents_get_status_clause(AGENT_STATUS_UNKNOWN);
|
||||
$agent_state_notinit = agents_get_status_clause(AGENT_STATUS_NOT_INIT);
|
||||
$agent_state_total = agents_get_status_clause(AGENT_STATUS_ALL);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$agent_state_normal = agents_get_status_clause(AGENT_STATUS_NORMAL);
|
||||
$agent_state_critical = agents_get_status_clause(AGENT_STATUS_CRITICAL);
|
||||
$agent_state_warning = agents_get_status_clause(AGENT_STATUS_WARNING);
|
||||
$agent_state_unknown = agents_get_status_clause(AGENT_STATUS_UNKNOWN);
|
||||
$agent_state_notinit = agents_get_status_clause(AGENT_STATUS_NOT_INIT);
|
||||
$agent_state_total = agents_get_status_clause(AGENT_STATUS_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
//filter by status module
|
||||
$empty_agents_count = "UNION ALL
|
||||
SELECT ta.id_agente,
|
||||
0 AS c_m_total,
|
||||
0 AS mm_normal,
|
||||
0 AS mm_critical,
|
||||
0 AS mm_warning,
|
||||
0 AS mm_unknown,
|
||||
0 AS mm_not_init,
|
||||
0 AS mm_total
|
||||
FROM tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND ta.total_count = 0
|
||||
$groups_and";
|
||||
|
||||
$and_module_status = "";
|
||||
if(is_array($filters['module_status'])){
|
||||
if(!in_array(-1, $filters['module_status'])){
|
||||
$empty_agents_count = "";
|
||||
if(!in_array(AGENT_MODULE_STATUS_NOT_NORMAL, $filters['module_status'])){
|
||||
if(count($filters['module_status']) > 0){
|
||||
$and_module_status = " AND ( ";
|
||||
foreach ($filters['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 ";
|
||||
$empty_agents_count = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//filters module
|
||||
if($filters['module_search']){
|
||||
$and_module_search = 'AND tam.nombre LIKE "%' . $filters['module_search'] . '%"';
|
||||
$empty_agents_count = "";
|
||||
}
|
||||
|
||||
//filter group and check ACL groups
|
||||
$groups_and = "";
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
if(!$filters['group']){
|
||||
$id_groups = explode(", ", array_keys(users_get_groups()));
|
||||
if($filters['group']){
|
||||
$user_groups = array_keys(users_get_groups());
|
||||
$id_groups = implode(", ", $user_groups);
|
||||
$groups_and = " AND (ta.id_grupo IN ($id_groups) OR tasg.id_group IN($id_groups))";
|
||||
}
|
||||
}
|
||||
|
||||
if($filters['group']){
|
||||
$groups_and = " AND (ta.id_grupo =". $filters['group']." OR tasg.id_group =". $filters['group'].")";
|
||||
//recursion check acl
|
||||
if($filters['recursion']){
|
||||
$recursion_groups = groups_get_id_recursive($filters['group'], true);
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
if(isset($user_groups) && is_array($user_groups)){
|
||||
$groups_intersect = array_intersect($user_groups, $recursion_groups);
|
||||
if(isset($groups_intersect) && is_array($groups_intersect)){
|
||||
$groups_intersect = implode(", ", $groups_intersect);
|
||||
$groups_and = " AND (ta.id_grupo IN ($groups_intersect) OR tasg.id_group IN($groups_intersect))";
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$recursion_groups = implode(", ", $recursion_groups);
|
||||
$groups_and = " AND (ta.id_grupo IN ($recursion_groups) OR tasg.id_group IN($recursion_groups))";
|
||||
}
|
||||
}
|
||||
else{
|
||||
$groups_and = " AND (ta.id_grupo =". $filters['group']." OR tasg.id_group =". $filters['group'].")";
|
||||
}
|
||||
}
|
||||
|
||||
//filter custom data
|
||||
@ -264,17 +375,6 @@ function agent_counters_custom_fields($filters){
|
||||
//filter custom name
|
||||
$custom_field_name = $filters['id_custom_fields'];
|
||||
|
||||
//filters module
|
||||
$module_filter = "";
|
||||
if($filters['module_search']){
|
||||
$module_filter = ' AND (
|
||||
SELECT count(*) AS n
|
||||
FROM tagente_modulo
|
||||
WHERE nombre LIKE "%' . $filters['module_search'] . '%"
|
||||
AND id_agente=ta.id_agente
|
||||
) > 0 ';
|
||||
}
|
||||
|
||||
if(is_metaconsole()){
|
||||
$metaconsole_connections = metaconsole_get_connection_names();
|
||||
// For all nodes
|
||||
@ -287,42 +387,63 @@ function agent_counters_custom_fields($filters){
|
||||
// Establishes connection
|
||||
if (metaconsole_load_external_db ($server_data) !== NOERR) continue;
|
||||
|
||||
$query = sprintf("SELECT
|
||||
tcd.description as name_data,
|
||||
SUM(ta.normal_count) AS m_normal,
|
||||
SUM(ta.critical_count) AS m_critical,
|
||||
SUM(ta.warning_count) AS m_warning,
|
||||
SUM(ta.unknown_count) AS m_unknown,
|
||||
SUM(ta.notinit_count) AS m_not_init,
|
||||
SUM(ta.fired_count) AS m_alerts,
|
||||
SUM(ta.total_count) AS m_total,
|
||||
SUM(IF(ta.critical_count > 0, 1, 0)) AS a_critical,
|
||||
SUM(IF(ta.critical_count = 0 AND ta.warning_count > 0, 1, 0)) AS a_warning,
|
||||
SUM(IF(ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0, 1, 0)) AS a_unknown,
|
||||
SUM(IF(ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count = 0 AND ta.notinit_count <> ta.total_count, 1, 0)) AS a_normal,
|
||||
SUM(IF(ta.total_count = ta.notinit_count, 1, 0)) AS a_not_init,
|
||||
COUNT(ta.id_agente) AS a_agents,
|
||||
GROUP_CONCAT(DISTINCT(ta.id_agente) SEPARATOR ',') as ids
|
||||
FROM tagente ta
|
||||
INNER JOIN tagent_custom_data tcd
|
||||
ON tcd.id_agent = ta.id_agente
|
||||
$query = sprintf(
|
||||
"SELECT tcd.description AS name_data,
|
||||
SUM(IF($agent_state_total, 1, 0)) AS a_agents,
|
||||
SUM(IF($agent_state_critical, 1, 0)) AS a_critical,
|
||||
SUM(IF($agent_state_warning, 1, 0)) AS a_warning,
|
||||
SUM(IF($agent_state_unknown, 1, 0)) AS a_unknown,
|
||||
SUM(IF($agent_state_normal, 1, 0)) AS a_normal,
|
||||
SUM(IF($agent_state_notinit, 1, 0)) AS a_not_init,
|
||||
SUM(tagent_counters.mm_normal) AS m_normal,
|
||||
SUM(tagent_counters.mm_critical) AS m_critical,
|
||||
SUM(tagent_counters.mm_warning) AS m_warning,
|
||||
SUM(tagent_counters.mm_unknown) AS m_unknown,
|
||||
SUM(tagent_counters.mm_not_init) AS m_not_init,
|
||||
SUM(tagent_counters.mm_total) AS m_total
|
||||
FROM tagent_custom_data tcd
|
||||
INNER JOIN tagent_custom_fields tcf
|
||||
ON tcd.id_field = tcf.id_field
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND tcf.name = '%s'
|
||||
INNER JOIN (
|
||||
SELECT ta.id_agente,
|
||||
ta.total_count AS c_m_total,
|
||||
SUM( IF(tae.estado = 0, 1, 0) ) AS mm_normal,
|
||||
SUM( IF(tae.estado = 1, 1, 0) ) AS mm_critical,
|
||||
SUM( IF(tae.estado = 2, 1, 0) ) AS mm_warning,
|
||||
SUM( IF(tae.estado = 3, 1, 0) ) AS mm_unknown,
|
||||
SUM( IF(tae.estado = 4 OR tae.estado = 5, 1, 0) ) AS mm_not_init,
|
||||
COUNT(tam.id_agente_modulo) AS mm_total
|
||||
FROM tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagente_estado tae
|
||||
ON tam.id_agente = tae.id_agente
|
||||
AND tam.id_agente_modulo = tae.id_agente_modulo
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
GROUP by ta.id_agente
|
||||
%s
|
||||
) AS tagent_counters
|
||||
ON tcd.id_agent = tagent_counters.id_agente
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tagent_counters.id_agente
|
||||
WHERE tcf.name = '%s'
|
||||
AND tcd.description <> ''
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
GROUP BY tcd.description",
|
||||
$custom_field_name,
|
||||
$custom_data_and,
|
||||
$groups_and,
|
||||
$and_status,
|
||||
$module_filter
|
||||
$and_module_search,
|
||||
$and_module_status,
|
||||
$empty_agents_count,
|
||||
$custom_field_name,
|
||||
$custom_data_and
|
||||
);
|
||||
|
||||
$result_meta[$server_data['id']] = db_get_all_rows_sql($query);
|
||||
@ -330,10 +451,34 @@ function agent_counters_custom_fields($filters){
|
||||
$query_data = sprintf("SELECT
|
||||
tcd.description,
|
||||
ta.id_agente,
|
||||
%d AS id_server
|
||||
%d AS id_server,
|
||||
(CASE
|
||||
WHEN ta.critical_count > 0
|
||||
THEN 1
|
||||
WHEN ta.critical_count = 0
|
||||
AND ta.warning_count > 0
|
||||
THEN 2
|
||||
WHEN ta.critical_count = 0
|
||||
AND ta.warning_count = 0
|
||||
AND ta.unknown_count > 0
|
||||
THEN 3
|
||||
WHEN ta.critical_count = 0
|
||||
AND ta.warning_count = 0
|
||||
AND ta.unknown_count = 0
|
||||
AND ta.notinit_count <> ta.total_count
|
||||
THEN 0
|
||||
WHEN ta.total_count = ta.notinit_count
|
||||
THEN 5
|
||||
ELSE 0
|
||||
END) AS `status`
|
||||
FROM tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagente_estado tae
|
||||
ON tam.id_agente = tae.id_agente
|
||||
AND tam.id_agente_modulo = tae.id_agente_modulo
|
||||
INNER JOIN tagent_custom_data tcd
|
||||
ON tcd.id_agent = ta.id_agente
|
||||
INNER JOIN tagent_custom_fields tcf
|
||||
@ -341,22 +486,28 @@ function agent_counters_custom_fields($filters){
|
||||
WHERE ta.disabled = 0
|
||||
AND tcf.name = '%s'
|
||||
AND tcd.description <> ''
|
||||
AND tam.disabled = 0
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
GROUP BY ta.id_agente
|
||||
",
|
||||
$server_data['id'],
|
||||
$custom_field_name,
|
||||
$custom_data_and,
|
||||
$groups_and,
|
||||
$and_status,
|
||||
$module_filter
|
||||
$and_module_search,
|
||||
$and_module_status
|
||||
);
|
||||
|
||||
$node_result = db_get_all_rows_sql($query_data);
|
||||
|
||||
if (empty($node_result)) $node_result = array();
|
||||
|
||||
|
||||
$data = array_merge($data, $node_result);
|
||||
// Restore connection to root node
|
||||
metaconsole_restore_db();
|
||||
@ -383,38 +534,39 @@ function agent_counters_custom_fields($filters){
|
||||
't_a_not_init' => 0,
|
||||
't_a_agents' => 0
|
||||
);
|
||||
|
||||
foreach ($result_meta as $k => $nodo) {
|
||||
foreach ($nodo as $key => $value) {
|
||||
//Sum counters total
|
||||
$final_result['counters_total']['t_m_normal'] += $value['m_normal'];
|
||||
$final_result['counters_total']['t_m_critical'] += $value['m_critical'];
|
||||
$final_result['counters_total']['t_m_warning'] += $value['m_warning'];
|
||||
$final_result['counters_total']['t_m_unknown'] += $value['m_unknown'];
|
||||
$final_result['counters_total']['t_m_not_init'] += $value['m_not_init'];
|
||||
$final_result['counters_total']['t_m_alerts'] += $value['m_alerts'];
|
||||
$final_result['counters_total']['t_m_total'] += $value['m_total'];
|
||||
$final_result['counters_total']['t_a_critical'] += $value['a_critical'];
|
||||
$final_result['counters_total']['t_a_warning'] += $value['a_warning'];
|
||||
$final_result['counters_total']['t_a_unknown'] += $value['a_unknown'];
|
||||
$final_result['counters_total']['t_a_normal'] += $value['a_normal'];
|
||||
$final_result['counters_total']['t_a_not_init'] += $value['a_not_init'];
|
||||
$final_result['counters_total']['t_a_agents'] += $value['a_agents'];
|
||||
if(isset($nodo) && is_array($nodo)){
|
||||
foreach ($nodo as $key => $value) {
|
||||
//Sum counters total
|
||||
$final_result['counters_total']['t_m_normal'] += $value['m_normal'];
|
||||
$final_result['counters_total']['t_m_critical'] += $value['m_critical'];
|
||||
$final_result['counters_total']['t_m_warning'] += $value['m_warning'];
|
||||
$final_result['counters_total']['t_m_unknown'] += $value['m_unknown'];
|
||||
$final_result['counters_total']['t_m_not_init'] += $value['m_not_init'];
|
||||
$final_result['counters_total']['t_m_alerts'] += $value['m_alerts'];
|
||||
$final_result['counters_total']['t_m_total'] += $value['m_total'];
|
||||
$final_result['counters_total']['t_a_critical'] += $value['a_critical'];
|
||||
$final_result['counters_total']['t_a_warning'] += $value['a_warning'];
|
||||
$final_result['counters_total']['t_a_unknown'] += $value['a_unknown'];
|
||||
$final_result['counters_total']['t_a_normal'] += $value['a_normal'];
|
||||
$final_result['counters_total']['t_a_not_init'] += $value['a_not_init'];
|
||||
$final_result['counters_total']['t_a_agents'] += $value['a_agents'];
|
||||
|
||||
//Sum counters for data
|
||||
$array_data[$value['name_data']]['m_normal'] += $value['m_normal'];
|
||||
$array_data[$value['name_data']]['m_critical'] += $value['m_critical'];
|
||||
$array_data[$value['name_data']]['m_warning'] += $value['m_warning'];
|
||||
$array_data[$value['name_data']]['m_unknown'] += $value['m_unknown'];
|
||||
$array_data[$value['name_data']]['m_not_init'] += $value['m_not_init'];
|
||||
$array_data[$value['name_data']]['m_alerts'] += $value['m_alerts'];
|
||||
$array_data[$value['name_data']]['m_total'] += $value['m_total'];
|
||||
$array_data[$value['name_data']]['a_critical'] += $value['a_critical'];
|
||||
$array_data[$value['name_data']]['a_warning'] += $value['a_warning'];
|
||||
$array_data[$value['name_data']]['a_unknown'] += $value['a_unknown'];
|
||||
$array_data[$value['name_data']]['a_normal'] += $value['a_normal'];
|
||||
$array_data[$value['name_data']]['a_not_init'] += $value['a_not_init'];
|
||||
$array_data[$value['name_data']]['a_agents'] += $value['a_agents'];
|
||||
//Sum counters for data
|
||||
$array_data[$value['name_data']]['m_normal'] += $value['m_normal'];
|
||||
$array_data[$value['name_data']]['m_critical'] += $value['m_critical'];
|
||||
$array_data[$value['name_data']]['m_warning'] += $value['m_warning'];
|
||||
$array_data[$value['name_data']]['m_unknown'] += $value['m_unknown'];
|
||||
$array_data[$value['name_data']]['m_not_init'] += $value['m_not_init'];
|
||||
$array_data[$value['name_data']]['m_alerts'] += $value['m_alerts'];
|
||||
$array_data[$value['name_data']]['m_total'] += $value['m_total'];
|
||||
$array_data[$value['name_data']]['a_critical'] += $value['a_critical'];
|
||||
$array_data[$value['name_data']]['a_warning'] += $value['a_warning'];
|
||||
$array_data[$value['name_data']]['a_unknown'] += $value['a_unknown'];
|
||||
$array_data[$value['name_data']]['a_normal'] += $value['a_normal'];
|
||||
$array_data[$value['name_data']]['a_not_init'] += $value['a_not_init'];
|
||||
$array_data[$value['name_data']]['a_agents'] += $value['a_agents'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,8 +584,16 @@ function agent_counters_custom_fields($filters){
|
||||
}
|
||||
|
||||
function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""){
|
||||
//filter group and check ACL groups
|
||||
$groups_and = "";
|
||||
if (!users_can_manage_group_all()) {
|
||||
$user_groups = array_keys(users_get_groups(false, "AR", false));
|
||||
$id_groups = implode(", ", $user_groups);
|
||||
$groups_and = " AND (group_search IN ($id_groups)) ";
|
||||
}
|
||||
|
||||
if($for_select){
|
||||
$query = "SELECT id, `name` FROM tagent_custom_fields_filter";
|
||||
$query = "SELECT id, `name` FROM tagent_custom_fields_filter WHERE 1=1" . $groups_and;
|
||||
$rs = db_get_all_rows_sql($query);
|
||||
if(isset($rs) && is_array($rs)){
|
||||
foreach ($rs as $key => $value) {
|
||||
@ -445,7 +605,7 @@ function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""
|
||||
}
|
||||
}
|
||||
else{
|
||||
$query = "SELECT * FROM tagent_custom_fields_filter WHERE 1=1";
|
||||
$query = "SELECT * FROM tagent_custom_fields_filter WHERE 1=1" . $groups_and;
|
||||
|
||||
if($id){
|
||||
$query .= " AND id = " . $id;
|
||||
@ -459,4 +619,13 @@ function get_filters_custom_fields_view($id = 0, $for_select = false, $name = ""
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_group_filter_custom_field_view ($id){
|
||||
if(isset($id)){
|
||||
$res = db_get_row_filter('tagent_custom_fields_filter',array('id' => $id));
|
||||
return $res;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
80
pandora_console/include/functions_event_responses.php
Normal file
80
pandora_console/include/functions_event_responses.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 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
|
||||
* @subpackage Event Responses
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get all event responses with all values that user can access
|
||||
*
|
||||
* @return array With all table values
|
||||
*/
|
||||
function event_responses_get_responses() {
|
||||
global $config;
|
||||
$filter = array();
|
||||
|
||||
// Apply a filter if user cannot see all groups
|
||||
if (!users_can_manage_group_all()) {
|
||||
$id_groups = array_keys(users_get_groups(false, "PM"));
|
||||
$filter = array('id_group' => $id_groups);
|
||||
}
|
||||
return db_get_all_rows_filter('tevent_response', $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the responses data to store in database
|
||||
*
|
||||
* @param array (by reference) Array with values to validate and modify
|
||||
*/
|
||||
function event_responses_validate_data (&$values) {
|
||||
if ($values['type'] != "command" || !enterprise_installed()) {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
if ($values['new_window'] == 1) {
|
||||
$values['modal_width'] = 0;
|
||||
$values['modal_height'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an event response
|
||||
*
|
||||
* @param array With all event response data
|
||||
*
|
||||
* @return True if successful insertion
|
||||
*/
|
||||
function event_responses_create_response($values) {
|
||||
event_responses_validate_data($values);
|
||||
return db_process_sql_insert('tevent_response', $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an event response
|
||||
*
|
||||
* @param array With all event response data
|
||||
*
|
||||
* @return True if successful insertion
|
||||
*/
|
||||
function event_responses_update_response($response_id, $values) {
|
||||
event_responses_validate_data($values);
|
||||
return db_process_sql_update(
|
||||
'tevent_response', $values, array('id' => $response_id)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
@ -853,10 +853,12 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
||||
$filter = '1 = 1';
|
||||
}
|
||||
|
||||
$secondary_join = "LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent";
|
||||
|
||||
$sql = sprintf ("SELECT DISTINCT tevento.*
|
||||
FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
|
||||
FROM tevento %s
|
||||
WHERE %s %s
|
||||
ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
|
||||
ORDER BY utimestamp DESC LIMIT %d", $secondary_join, $agent_condition, $filter, $limit);
|
||||
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
|
||||
@ -2708,7 +2710,7 @@ function events_clean_tags ($tags) {
|
||||
*/
|
||||
function events_get_count_events_by_agent ($id_group, $period, $date,
|
||||
$filter_event_severity = false, $filter_event_type = false,
|
||||
$filter_event_status = false, $filter_event_filter_search = false) {
|
||||
$filter_event_status = false, $filter_event_filter_search = false, $dbmeta = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
@ -2800,16 +2802,22 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
|
||||
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
|
||||
}
|
||||
|
||||
$tagente = 'tagente';
|
||||
$tevento = 'tevento';
|
||||
if($dbmeta){
|
||||
$tagente = 'tmetaconsole_agent';
|
||||
$tevento = 'tmetaconsole_event';
|
||||
}
|
||||
$sql = sprintf ('SELECT id_agente,
|
||||
(SELECT t2.alias
|
||||
FROM tagente t2
|
||||
FROM %s t2
|
||||
WHERE t2.id_agente = t3.id_agente) AS agent_name,
|
||||
COUNT(*) AS count
|
||||
FROM tevento t3
|
||||
FROM %s t3
|
||||
WHERE utimestamp > %d AND utimestamp <= %d
|
||||
AND id_grupo IN (%s) %s
|
||||
GROUP BY id_agente',
|
||||
$datelimit, $date, implode (",", $id_group), $sql_where);
|
||||
$tagente, $tevento, $datelimit, $date, implode (",", $id_group), $sql_where);
|
||||
|
||||
$rows = db_get_all_rows_sql ($sql);
|
||||
|
||||
@ -2841,7 +2849,7 @@ function events_get_count_events_by_agent ($id_group, $period, $date,
|
||||
*/
|
||||
function events_get_count_events_validated_by_user ($filter, $period, $date,
|
||||
$filter_event_severity = false, $filter_event_type = false,
|
||||
$filter_event_status = false, $filter_event_filter_search = false) {
|
||||
$filter_event_status = false, $filter_event_filter_search = false, $dbmeta = false) {
|
||||
global $config;
|
||||
//group
|
||||
$sql_filter = ' AND 1=1 ';
|
||||
@ -2947,16 +2955,20 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
|
||||
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
|
||||
}
|
||||
|
||||
$tevento = 'tevento';
|
||||
if($dbmeta)
|
||||
$tevento = 'tmetaconsole_event';
|
||||
|
||||
$sql = sprintf ('SELECT id_usuario,
|
||||
(SELECT t2.fullname
|
||||
FROM tusuario t2
|
||||
WHERE t2.id_user = t3.id_usuario) AS user_name,
|
||||
COUNT(*) AS count
|
||||
FROM tevento t3
|
||||
FROM %s t3
|
||||
WHERE utimestamp > %d AND utimestamp <= %d
|
||||
%s %s
|
||||
GROUP BY id_usuario',
|
||||
$datelimit, $date, $sql_filter, $sql_where);
|
||||
$tevento, $datelimit, $date, $sql_filter, $sql_where);
|
||||
$rows = db_get_all_rows_sql ($sql);
|
||||
|
||||
if ($rows == false)
|
||||
@ -2986,7 +2998,7 @@ function events_get_count_events_validated_by_user ($filter, $period, $date,
|
||||
*/
|
||||
function events_get_count_events_by_criticity ($filter, $period, $date,
|
||||
$filter_event_severity = false, $filter_event_type = false,
|
||||
$filter_event_status = false, $filter_event_filter_search = false) {
|
||||
$filter_event_status = false, $filter_event_filter_search = false, $dbmeta = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
@ -3092,13 +3104,16 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
|
||||
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
|
||||
}
|
||||
|
||||
$tevento = 'tevento';
|
||||
if ($dbmeta)
|
||||
$tevento = 'tmetaconsole_event';
|
||||
$sql = sprintf ('SELECT criticity,
|
||||
COUNT(*) AS count
|
||||
FROM tevento
|
||||
FROM %s
|
||||
WHERE utimestamp > %d AND utimestamp <= %d
|
||||
%s %s
|
||||
GROUP BY criticity',
|
||||
$datelimit, $date, $sql_filter, $sql_where);
|
||||
$tevento, $datelimit, $date, $sql_filter, $sql_where);
|
||||
|
||||
$rows = db_get_all_rows_sql ($sql);
|
||||
|
||||
@ -3126,7 +3141,7 @@ function events_get_count_events_by_criticity ($filter, $period, $date,
|
||||
*/
|
||||
function events_get_count_events_validated ($filter, $period = null, $date = null,
|
||||
$filter_event_severity = false, $filter_event_type = false,
|
||||
$filter_event_status = false, $filter_event_filter_search = false) {
|
||||
$filter_event_status = false, $filter_event_filter_search = false, $dbmeta = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
@ -3250,7 +3265,10 @@ function events_get_count_events_validated ($filter, $period = null, $date = nul
|
||||
' OR id_evento LIKE "%' . io_safe_input($filter_event_filter_search) . '%")';
|
||||
}
|
||||
|
||||
$sql = sprintf ("SELECT estado, COUNT(*) AS count FROM tevento WHERE %s %s GROUP BY estado", $sql_filter, $sql_where);
|
||||
$tevento = 'tevento';
|
||||
if ($dbmeta)
|
||||
$tevento = 'tmetaconsole_event';
|
||||
$sql = sprintf ("SELECT estado, COUNT(*) AS count FROM %s WHERE %s %s GROUP BY estado", $tevento, $sql_filter, $sql_where);
|
||||
|
||||
$rows = db_get_all_rows_sql ($sql);
|
||||
|
||||
|
@ -238,7 +238,7 @@ function grafico_modulo_sparse_data(
|
||||
}
|
||||
}
|
||||
|
||||
if($array_data === false){
|
||||
if ($array_data === false || (!$params['graph_combined'] && !isset($array_data['sum1']['data'][0][1]))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -912,7 +912,9 @@ function grafico_modulo_sparse ($params) {
|
||||
else{
|
||||
$return = graph_nodata_image(
|
||||
$params['width'],
|
||||
$params['height']
|
||||
$params['height'],
|
||||
'area',
|
||||
__('No data to display within the selected interval')
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1047,6 +1049,10 @@ function graphic_combined_module (
|
||||
$params_combined['id_graph'] = 0;
|
||||
}
|
||||
|
||||
if(!isset($params_combined['type_report'])){
|
||||
$params_combined['type_report'] = '';
|
||||
}
|
||||
|
||||
if(!isset($params['percentil'])){
|
||||
$params_combined['percentil'] = null;
|
||||
}
|
||||
@ -1205,8 +1211,8 @@ function graphic_combined_module (
|
||||
);
|
||||
|
||||
$series = db_get_all_rows_sql(
|
||||
'SELECT summatory_series,average_series,modules_series
|
||||
FROM tgraph
|
||||
'SELECT summatory_series,average_series, modules_series
|
||||
FROM tgraph
|
||||
WHERE id_graph = '.
|
||||
$params_combined['id_graph']
|
||||
);
|
||||
@ -1299,7 +1305,6 @@ function graphic_combined_module (
|
||||
);
|
||||
}
|
||||
|
||||
//XXX arreglar estas
|
||||
$long_index = '';
|
||||
switch ($params_combined['stacked']) {
|
||||
default:
|
||||
@ -1322,7 +1327,16 @@ function graphic_combined_module (
|
||||
|
||||
$i=0;
|
||||
$array_data = array();
|
||||
|
||||
foreach ($module_list as $key => $agent_module_id) {
|
||||
if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){
|
||||
$server = metaconsole_get_connection_by_id ($agent_module_id['server']);
|
||||
if (metaconsole_connect ($server) != NOERR){
|
||||
continue;
|
||||
}
|
||||
$agent_module_id = $agent_module_id['module'];
|
||||
}
|
||||
|
||||
$module_data = db_get_row_sql (
|
||||
'SELECT * FROM tagente_modulo
|
||||
WHERE id_agente_modulo = ' .
|
||||
@ -1338,12 +1352,12 @@ function graphic_combined_module (
|
||||
$data_module_graph['id_module_type'] = $module_data['id_tipo_modulo'];
|
||||
$data_module_graph['module_type'] = modules_get_moduletype_name($data_module_graph['id_module_type']);
|
||||
$data_module_graph['uncompressed'] = is_module_uncompressed($data_module_graph['module_type']);
|
||||
$data_module_graph['w_min'] = $module_data['min_warning'];
|
||||
$data_module_graph['w_max'] = $module_data['max_warning'];
|
||||
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
|
||||
$data_module_graph['c_min'] = $module_data['min_critical'];
|
||||
$data_module_graph['c_max'] = $module_data['max_critical'];
|
||||
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
||||
$data_module_graph['w_min'] = $module_data['min_warning'];
|
||||
$data_module_graph['w_max'] = $module_data['max_warning'];
|
||||
$data_module_graph['w_inv'] = $module_data['warning_inverse'];
|
||||
$data_module_graph['c_min'] = $module_data['min_critical'];
|
||||
$data_module_graph['c_max'] = $module_data['max_critical'];
|
||||
$data_module_graph['c_inv'] = $module_data['critical_inverse'];
|
||||
$data_module_graph['module_id'] = $agent_module_id;
|
||||
|
||||
//stract data
|
||||
@ -1355,7 +1369,7 @@ function graphic_combined_module (
|
||||
$i
|
||||
);
|
||||
|
||||
$series_suffix = $i;
|
||||
$series_suffix = $i;
|
||||
|
||||
//convert to array graph and weight
|
||||
foreach ($array_data_module as $key => $value) {
|
||||
@ -1384,6 +1398,10 @@ function graphic_combined_module (
|
||||
|
||||
//$array_events_alerts[$series_suffix] = $events;
|
||||
$i++;
|
||||
|
||||
if(is_metaconsole() && $params_combined['type_report'] == 'automatic_graph'){
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
if($params_combined['projection']){
|
||||
@ -1542,7 +1560,6 @@ function graphic_combined_module (
|
||||
$water_mark,
|
||||
$array_events_alerts
|
||||
);
|
||||
|
||||
break;
|
||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||
case CUSTOM_GRAPH_BULLET_CHART:
|
||||
@ -2456,7 +2473,9 @@ function graph_sla_slicebar (
|
||||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
$ttl,
|
||||
false,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@ -3282,13 +3301,10 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
|
||||
|
||||
$data = array ();
|
||||
|
||||
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||
$interval = (int) ($period / $resolution);
|
||||
$date = get_system_time ();
|
||||
$interval = 24;
|
||||
$date = get_system_time();
|
||||
$datelimit = $date - $period;
|
||||
$periodtime = floor ($period / $interval);
|
||||
$time = array ();
|
||||
$data = array ();
|
||||
$legend = array();
|
||||
$full_legend = array();
|
||||
@ -3592,6 +3608,7 @@ function fullscale_data (
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ($data_uncompress === false) $data_uncompress = array();
|
||||
foreach ($data_uncompress as $k) {
|
||||
foreach ($k["data"] as $v) {
|
||||
if (isset($v["type"]) && $v["type"] == 1) { # skip unnecesary virtual data
|
||||
@ -3660,7 +3677,9 @@ function fullscale_data (
|
||||
|
||||
$data["sum" . $series_suffix]['min'] = $min_value_min;
|
||||
$data["sum" . $series_suffix]['max'] = $max_value_max;
|
||||
$data["sum" . $series_suffix]['avg'] = $sum_data/$count_data;
|
||||
$data["sum" . $series_suffix]['avg'] = $count_data == 0
|
||||
? 0
|
||||
: $sum_data/$count_data;
|
||||
}
|
||||
|
||||
if($show_percentil && !$compare){
|
||||
@ -4068,19 +4087,17 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
|
||||
}
|
||||
|
||||
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {
|
||||
$image = ui_get_full_url('images/image_problem_area_small.png',
|
||||
$image = ui_get_full_url('images/image_problem_area.png',
|
||||
false, false, false);
|
||||
|
||||
// if ($text == '') {
|
||||
// $text = __('No data to show');
|
||||
// }
|
||||
$text_div = '<div class="nodata_text" style="text-align:center; padding: 30px 0; display:block; font-size:9.5pt;">' . $text . '</div>';
|
||||
|
||||
$text_div = '<div class="nodata_text">' . $text . '</div>';
|
||||
$image_div = $text_div . '<div class="nodata_container" style="background-position: top; width:40%;height:40%;background-size: contain;background-image: url(\'' . $image . '\');"><div></div></div>';
|
||||
|
||||
$image_div = '<div class="nodata_container" style="width:80%;height:80%;background-size: 80% 80%;background-image: url(\'' . $image . '\');">' .
|
||||
$text_div . '</div>';
|
||||
|
||||
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px; border: 1px dotted #ddd; background-color: white; margin: 0 auto;">' .
|
||||
$div = '<div style="width:' . $width . 'px; height:' . $height . 'px; background-color: white; margin: 0 auto;">' .
|
||||
$image_div . '</div>';
|
||||
|
||||
return $div;
|
||||
|
@ -441,7 +441,7 @@ function groups_get_all($groupWithAgents = false) {
|
||||
* Get all groups recursive from an initial group.
|
||||
*
|
||||
* @param int Id of the parent group
|
||||
* @param bool Whether to return All group or not
|
||||
* @param bool Whether to force recursive search ignoring propagation (true) or not (false)
|
||||
*
|
||||
* @return Array with all result groups
|
||||
*/
|
||||
@ -451,10 +451,11 @@ function groups_get_id_recursive($id_parent, $all = false) {
|
||||
$return = array_merge($return, array($id_parent));
|
||||
|
||||
//Check propagate
|
||||
$id = db_get_value_filter('id_grupo', 'tgrupo', array('id_grupo' => $id_parent, 'propagate' => 1));
|
||||
$propagate = db_get_value_filter('propagate', 'tgrupo', array('id_grupo' => $id_parent));
|
||||
|
||||
if (($id !== false) || $all) {
|
||||
if (($propagate != 1) || $all) {
|
||||
$children = db_get_all_rows_filter("tgrupo", array('parent' => $id_parent, 'disabled' => 0), array('id_grupo'));
|
||||
|
||||
if ($children === false) {
|
||||
$children = array();
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ function groupview_get_modules_counters($groups_ids = false) {
|
||||
ta.id_grupo AS g
|
||||
FROM $table ta
|
||||
WHERE ta.id_grupo IN ($groups_ids)
|
||||
AND ta.disabled = 0
|
||||
GROUP BY ta.id_grupo
|
||||
UNION ALL
|
||||
SELECT SUM(ta.normal_count) AS module_normal,
|
||||
|
@ -97,6 +97,15 @@ function hd ($var, $file = '', $oneline = false) {
|
||||
html_debug_print ($var, $file, $oneline);
|
||||
}
|
||||
|
||||
function debug () {
|
||||
$args_num = func_num_args();
|
||||
$arg_list = func_get_args();
|
||||
|
||||
for ($i = 0; $i < $args_num; $i++) {
|
||||
html_debug_print($arg_list[$i], true);
|
||||
}
|
||||
}
|
||||
|
||||
function html_f2str($function, $params) {
|
||||
ob_start();
|
||||
|
||||
@ -726,8 +735,11 @@ function html_print_extended_select_for_post_process($name, $selected = '',
|
||||
$selected_float = (float)$selected;
|
||||
$found = false;
|
||||
|
||||
if (array_key_exists(number_format($selected, 14, '.', ','), $fields))
|
||||
$found = true;
|
||||
if($selected){
|
||||
if (array_key_exists(number_format($selected, 14, '.', ','), $fields)) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
$fields[$selected] = floatval($selected);
|
||||
@ -1008,12 +1020,13 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle
|
||||
++$idcounter;
|
||||
|
||||
$valid_attrs = array ("accept", "disabled", "maxlength",
|
||||
"name", "readonly", "size", "value", "accesskey",
|
||||
"name", "readonly", "placeholder", "size", "value", "accesskey",
|
||||
"class", "dir", "id", "lang", "style", "tabindex",
|
||||
"title", "xml:lang", "onfocus", "onblur", "onselect",
|
||||
"onchange", "onclick", "ondblclick", "onmousedown",
|
||||
"onmouseup", "onmouseover", "onmousemove", "onmouseout",
|
||||
"onkeypress", "onkeydown", "onkeyup", "required");
|
||||
"onkeypress", "onkeydown", "onkeyup", "required",
|
||||
"autocomplete");
|
||||
|
||||
$output = '<input '.($password ? 'type="password" autocomplete="off" ' : 'type="text" ');
|
||||
|
||||
@ -1184,22 +1197,27 @@ function html_print_input_password ($name, $value, $alt = '',
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false, $required = false, $function = "", $class = "", $onChange ="") {
|
||||
function html_print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false, $required = false, $function = "", $class = "", $onChange ="", $autocomplete="") {
|
||||
if ($maxlength == 0)
|
||||
$maxlength = 255;
|
||||
|
||||
|
||||
if ($size == 0)
|
||||
$size = 10;
|
||||
|
||||
|
||||
$attr = array();
|
||||
if ($required)
|
||||
if ($required){
|
||||
$attr['required'] = 'required';
|
||||
if ($class != '')
|
||||
}
|
||||
if ($class != ''){
|
||||
$attr['class'] = $class;
|
||||
}
|
||||
if ($onChange != '') {
|
||||
$attr['onchange'] = $onChange;
|
||||
}
|
||||
|
||||
if($autocomplete !== ''){
|
||||
$attr['autocomplete'] = $autocomplete;
|
||||
}
|
||||
|
||||
return html_print_input_text_extended ($name, $value, 'text-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, false, $function);
|
||||
}
|
||||
|
||||
@ -1338,6 +1356,36 @@ function html_print_input_hidden_extended($name, $value, $id, $return = false, $
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a color input element.
|
||||
*
|
||||
* The element will have an id like: "hidden-$name"
|
||||
*
|
||||
* @param string $name Input name.
|
||||
* @param int $value Input value. Decimal representation of the color's hexadecimal value.
|
||||
* @param string $class Set the class of input.
|
||||
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_input_color ($name, $value, $class = false, $return = false) {
|
||||
$attr_type = 'type="color"';
|
||||
$attr_id = 'id="color-' . htmlspecialchars($name, ENT_QUOTES) . '"';
|
||||
$attr_name = 'name="' . htmlspecialchars($name, ENT_QUOTES) . '"';
|
||||
$attr_value = 'value="' . htmlspecialchars($value, ENT_QUOTES) . '"';
|
||||
$attr_class = 'class="' . ($class !== false ? htmlspecialchars($class, ENT_QUOTES) : "") . '"';
|
||||
|
||||
$output = '<input '
|
||||
. $attr_type . ' '
|
||||
. $attr_id . ' '
|
||||
. $attr_name . ' '
|
||||
. $attr_value . ' '
|
||||
. $attr_class . ' />';
|
||||
|
||||
if ($return) return $output;
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an submit input button element.
|
||||
*
|
||||
@ -2479,7 +2527,7 @@ function html_print_result_div ($text) {
|
||||
$text = preg_replace ('/\n/i','<br>',$text);
|
||||
$text = preg_replace ('/\s/i',' ',$text);
|
||||
|
||||
$enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: scroll; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
|
||||
$enclose = "<div id='result_div' style='width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'>";
|
||||
$enclose .= $text;
|
||||
$enclose .= "</div>";
|
||||
return $enclose;
|
||||
|
@ -375,8 +375,8 @@ function __ ($string /*, variable arguments */) {
|
||||
global $config;
|
||||
static $extensions_cache = array();
|
||||
|
||||
if( !isset($config["id_user"]) && count($extensions_cache) > 0 ) {
|
||||
if (array_key_exists($config["id_user"], $extensions_cache)) {
|
||||
if( isset($config["id_user"]) ) {
|
||||
if ( count($extensions_cache) > 0 && array_key_exists($config["id_user"], $extensions_cache)) {
|
||||
$extensions = $extensions_cache[$config["id_user"]];
|
||||
}
|
||||
else {
|
||||
@ -385,8 +385,9 @@ function __ ($string /*, variable arguments */) {
|
||||
}
|
||||
}
|
||||
else{
|
||||
$extension =null;
|
||||
$extensions=null;
|
||||
}
|
||||
|
||||
if (empty($extensions))
|
||||
$extensions = array();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user