mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-25 19:09:08 +02:00
Merge branch 'develop' into 3114_Error_en_reportes_de_tipo_ITIL_y_tipo_Modulo
Conflicts: pandora_console/include/functions_reporting.php Former-commit-id: b379a4c9d87c3dc7404ccde8ee9a279138f73e3b
This commit is contained in:
commit
5c4ad3e845
@ -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"
|
||||
|
@ -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-181120
|
||||
Version: 7.0NG.730-181219
|
||||
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-181120"
|
||||
pandora_version="7.0NG.730-181219"
|
||||
|
||||
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 => '181120';
|
||||
use constant AGENT_VERSION => '7.0NG.730';
|
||||
use constant AGENT_BUILD => '181219';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.729
|
||||
%define release 181120
|
||||
%define version 7.0NG.730
|
||||
%define release 181219
|
||||
|
||||
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 181120
|
||||
%define version 7.0NG.730
|
||||
%define release 181219
|
||||
|
||||
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="181120"
|
||||
PI_VERSION="7.0NG.730"
|
||||
PI_BUILD="181219"
|
||||
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
|
||||
{181120}
|
||||
{181219}
|
||||
|
||||
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 181120)")
|
||||
#define PANDORA_VERSION ("7.0NG.730(Build 181219)")
|
||||
|
||||
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 181120))"
|
||||
VALUE "ProductVersion", "(7.0NG.730(Build 181219))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,10 +1,10 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.729-181120
|
||||
Version: 7.0NG.730-181219
|
||||
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-181120"
|
||||
pandora_version="7.0NG.730-181219"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -18,9 +18,8 @@ if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"
|
||||
exit;
|
||||
}
|
||||
|
||||
// Real start
|
||||
session_start();
|
||||
|
||||
// Don't start a session before this import.
|
||||
// The session is configured and started inside the config process.
|
||||
require_once ('include/config.php');
|
||||
require_once ('include/functions.php');
|
||||
require_once ('include/functions_db.php');
|
||||
@ -82,7 +81,6 @@ if (isset($config['metaconsole'])) {
|
||||
if ($config['metaconsole'])
|
||||
define ('METACONSOLE', true);
|
||||
}
|
||||
session_write_close ();
|
||||
|
||||
if (file_exists ($page)) {
|
||||
require_once ($page);
|
||||
|
@ -16,14 +16,14 @@
|
||||
|
||||
if (isset($_GET['get_ptr'])) {
|
||||
if ($_GET['get_ptr'] == 1) {
|
||||
|
||||
session_start ();
|
||||
session_write_close ();
|
||||
|
||||
|
||||
$ownDir = dirname(__FILE__) . '/';
|
||||
$ownDir = str_replace("\\", "/", $ownDir);
|
||||
|
||||
// Don't start a session before this import.
|
||||
// The session is configured and started inside the config process.
|
||||
require_once ($ownDir.'../include/config.php');
|
||||
|
||||
|
||||
// Login check
|
||||
if (!isset($_SESSION["id_usuario"])) {
|
||||
$config['id_user'] = null;
|
||||
|
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;
|
@ -544,6 +544,7 @@ CREATE TABLE IF NOT EXISTS `tevent_rule` (
|
||||
`user_comment` text NOT NULL,
|
||||
`id_tag` integer(10) unsigned NOT NULL default '0',
|
||||
`name` text default '',
|
||||
`group_recursion` INT(1) unsigned default 0,
|
||||
PRIMARY KEY (`id_event_rule`),
|
||||
KEY `idx_id_event_alert` (`id_event_alert`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@ -1180,13 +1181,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 22);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 23);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '729');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '730');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
@ -1826,3 +1827,9 @@ CREATE TABLE IF NOT EXISTS `tagent_custom_fields_filter` (
|
||||
`module_search` varchar(600) default '',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `module_status` varchar(600) default '';
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `recursion` int(1) unsigned default '0';
|
||||
|
||||
ALTER TABLE `tagent_custom_fields_filter` ADD COLUMN `group_search` int(10) unsigned default '0';
|
||||
|
@ -32,9 +32,7 @@ if (!$config["MR"]) {
|
||||
|
||||
echo '<a class="white_bold footer" target="_blank" href="' . $config["homeurl"] . $license_file. '">';
|
||||
|
||||
if(enterprise_installed()){
|
||||
enterprise_include_once("../include/functions_update_manager.php");
|
||||
}
|
||||
include_once ($config["homedir"]."/include/functions_update_manager.php");
|
||||
|
||||
$current_package = update_manager_get_current_package();
|
||||
|
||||
@ -48,7 +46,7 @@ else{
|
||||
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config["MR"]));
|
||||
|
||||
echo '</a><br />';
|
||||
echo '<a class="white footer">'. __('Page generated at') . ' '. date('F j, Y h:i a'); //Always use timestamp here
|
||||
echo '<a class="white footer">'. __('Page generated at') . ' '. date($config["date_format"]);
|
||||
echo '</a><br /><span style="color:#eff">® '.get_copyright_notice().'</span>';
|
||||
|
||||
if (isset ($config['debug'])) {
|
||||
|
@ -335,11 +335,8 @@ $(document).ready( function() {
|
||||
handsIn = 0;
|
||||
handsIn2 = 0;
|
||||
|
||||
//Daniel maya 02/06/2016 Display menu with click --INI
|
||||
if(!click_display){
|
||||
//Daniel barbero 10/08/2016 Display menu with click --INI
|
||||
if (autohidden_menu) {
|
||||
//Daniel barbero 10/08/2016 Display menu with click --END
|
||||
$('.menu_icon').mouseenter(function() {
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
@ -359,37 +356,10 @@ $(document).ready( function() {
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
//Daniel barbero 10/08/2016 Display menu with click --INI
|
||||
} else {
|
||||
$('.menu_icon').mouseenter(function() {
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
if( typeof(table_noHover) != 'undefined')
|
||||
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
}).mouseleave(function() {
|
||||
table_noHover = $(this);
|
||||
handsIn = 0;
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
/*
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime;
|
||||
if(opened > 3000 && handsIn == 0) {
|
||||
openTime = 4000;
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
}, 2500);
|
||||
*/
|
||||
});
|
||||
}
|
||||
//Daniel barbero 10/08/2016 Display menu with click --END
|
||||
}else{
|
||||
$(document).ready(function() {
|
||||
//Daniel barbero 10/08/2016 Display menu with click --INI
|
||||
if (autohidden_menu) {
|
||||
//Daniel barbero 10/08/2016 Display menu with click --END
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
@ -409,7 +379,6 @@ $(document).ready( function() {
|
||||
}
|
||||
}, 5500);
|
||||
});
|
||||
//Daniel barbero 10/08/2016 Display menu with click --INI
|
||||
} else {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
@ -421,10 +390,8 @@ $(document).ready( function() {
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
});
|
||||
}
|
||||
//Daniel barbero 10/08/2016 Display menu with click --END
|
||||
});
|
||||
}
|
||||
//Daniel maya 02/06/2016 Display menu with click --END
|
||||
|
||||
- $('.has_submenu').mouseenter(function() {
|
||||
table_hover2 = $(this);
|
||||
|
@ -14,8 +14,10 @@
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// Don't start a session before this import.
|
||||
// The session is configured and started inside the config process.
|
||||
require_once ("../include/config.php");
|
||||
|
||||
require_once ("../include/functions.php");
|
||||
require_once ("../include/functions_html.php");
|
||||
?>
|
||||
@ -33,11 +35,6 @@ require_once ("../include/functions_html.php");
|
||||
$id = get_parameter ('id');
|
||||
$id_user = get_parameter ('id_user');
|
||||
|
||||
if (! isset($_SESSION['id_usuario'])) {
|
||||
session_start();
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
$user_language = get_user_language ($id_user);
|
||||
|
||||
if (file_exists ('../include/languages/'.$user_language.'.mo')) {
|
||||
|
@ -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) {
|
||||
|
@ -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"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,10 @@
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
session_start ();
|
||||
|
||||
// Don't start a session before this import.
|
||||
// The session is configured and started inside the config process.
|
||||
require_once ("../../include/config.php");
|
||||
|
||||
require_once ("../../include/functions.php");
|
||||
require_once ("../../include/functions_db.php");
|
||||
require_once ("../../include/functions_users.php");
|
||||
|
@ -215,6 +215,7 @@ if ($delete_action) {
|
||||
__('Could not be deleted'));
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
$table->data = array ();
|
||||
|
@ -12,19 +12,17 @@
|
||||
|
||||
$ownDir = dirname(__FILE__) . '/';
|
||||
$ownDir = str_replace("\\", "/", $ownDir);
|
||||
require_once($ownDir . "../include/config.php");
|
||||
|
||||
require_once($config["homedir"] . "/include/functions.php");
|
||||
require_once($config["homedir"] . "/include/functions_db.php");
|
||||
require_once($config["homedir"] . "/include/auth/mysql.php");
|
||||
// Don't start a session before this import.
|
||||
// The session is configured and started inside the config process.
|
||||
require_once ($ownDir . "../include/config.php");
|
||||
|
||||
require_once ($config["homedir"] . "/include/functions.php");
|
||||
require_once ($config["homedir"] . "/include/functions_db.php");
|
||||
require_once ($config["homedir"] . "/include/auth/mysql.php");
|
||||
|
||||
global $config;
|
||||
|
||||
if (! isset($_SESSION["id_usuario"])) {
|
||||
session_start();
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
// Login check
|
||||
if (!isset($_SESSION["id_usuario"])) {
|
||||
$config['id_user'] = null;
|
||||
|
@ -229,15 +229,31 @@ $(document).ready (function () {
|
||||
});
|
||||
|
||||
$("#left").click (function () {
|
||||
var current_fields_size = ($('#fields_selected option').length);
|
||||
var selected_fields = [];
|
||||
var selected_fields_total = '';
|
||||
|
||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
field_name = $(value).html();
|
||||
selected_fields.push(field_name);
|
||||
selected_fields_total = selected_fields.length;
|
||||
});
|
||||
|
||||
if(selected_fields_total === current_fields_size){
|
||||
display_confirm_dialog(
|
||||
"<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
|
||||
"<?php echo __('Confirm'); ?>",
|
||||
"<?php echo __('Cancel'); ?>",
|
||||
function () {
|
||||
move_left();
|
||||
$("#fields_available").find("option[value='timestamp']").remove();
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").val('timestamp').html('<i>' + 'Timestamp' + '</i>'));
|
||||
}
|
||||
);
|
||||
}
|
||||
else{
|
||||
move_left();
|
||||
}
|
||||
});
|
||||
|
||||
$("#submit-upd_button").click(function () {
|
||||
@ -247,4 +263,16 @@ $(document).ready (function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function move_left(){
|
||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
global $config;
|
||||
|
||||
include_once($config['homedir'] . "/include/functions_event_responses.php");
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, "PM")) {
|
||||
@ -25,14 +27,7 @@ if (! check_acl($config['id_user'], 0, "PM")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_user_admin($config['id_user'])) {
|
||||
$id_groups = array_keys(users_get_groups(false, "PM"));
|
||||
$event_responses = db_get_all_rows_filter('tevent_response',
|
||||
array('id_group' => $id_groups));
|
||||
}
|
||||
else {
|
||||
$event_responses = db_get_all_rows_in_table('tevent_response');
|
||||
}
|
||||
$event_responses = event_responses_get_responses();
|
||||
|
||||
if(empty($event_responses)) {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('No responses found') ) );
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
global $config;
|
||||
|
||||
include_once($config['homedir'] . "/include/functions_event_responses.php");
|
||||
|
||||
check_login ();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, "PM")) {
|
||||
@ -40,24 +42,9 @@ switch($action) {
|
||||
$values['modal_height'] = get_parameter('modal_height');
|
||||
$values['new_window'] = get_parameter('new_window');
|
||||
$values['params'] = get_parameter('params');
|
||||
if (enterprise_installed()) {
|
||||
if ($values['type'] == 'command') {
|
||||
$values['server_to_exec'] = get_parameter('server_to_exec');
|
||||
}
|
||||
else {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
|
||||
if($values['new_window'] == 1) {
|
||||
$values['modal_width'] = 0;
|
||||
$values['modal_height'] = 0;
|
||||
}
|
||||
|
||||
$result = db_process_sql_insert('tevent_response', $values);
|
||||
$values['server_to_exec'] = get_parameter('server_to_exec');
|
||||
|
||||
$result = event_responses_create_response($values);
|
||||
|
||||
if($result) {
|
||||
ui_print_success_message(__('Response added succesfully'));
|
||||
@ -78,26 +65,10 @@ switch($action) {
|
||||
$values['modal_height'] = get_parameter('modal_height');
|
||||
$values['new_window'] = get_parameter('new_window');
|
||||
$values['params'] = get_parameter('params');
|
||||
if (enterprise_installed()) {
|
||||
if ($values['type'] == 'command') {
|
||||
$values['server_to_exec'] = get_parameter('server_to_exec');
|
||||
}
|
||||
else {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$values['server_to_exec'] = 0;
|
||||
}
|
||||
|
||||
if($values['new_window'] == 1) {
|
||||
$values['modal_width'] = 0;
|
||||
$values['modal_height'] = 0;
|
||||
}
|
||||
|
||||
$values['server_to_exec'] = get_parameter('server_to_exec');
|
||||
$response_id = get_parameter('id_response',0);
|
||||
|
||||
$result = db_process_sql_update('tevent_response', $values, array('id' => $response_id));
|
||||
|
||||
$result = event_responses_update_response($response_id, $values);
|
||||
|
||||
if($result) {
|
||||
ui_print_success_message(__('Response updated succesfully'));
|
||||
|
@ -48,7 +48,7 @@ if ($create_profiles) {
|
||||
// If the profile doesnt exist, we create it
|
||||
if ($profile_data === false) {
|
||||
db_pandora_audit("User management",
|
||||
"Added profile for user ".io_safe_output($user));
|
||||
"Added profile for user ".io_safe_input($user));
|
||||
$return = profile_create_user_profile ($user, $profile, $group);
|
||||
if ($return !== false) {
|
||||
$n_added ++;
|
||||
|
@ -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';
|
||||
}
|
||||
|
||||
|
@ -1574,7 +1574,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
|
||||
|
@ -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:
|
||||
|
@ -1208,21 +1208,21 @@ $(".logo_preview").click (function(e) {
|
||||
switch (e.target.id) {
|
||||
case 'button-custom_logo_preview':
|
||||
icon_name = $("select#custom_logo option:selected").val();
|
||||
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
|
||||
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
|
||||
options.grayed = true;
|
||||
break;
|
||||
case 'button-custom_logo_white_bg_preview':
|
||||
icon_name = $("select#custom_logo_white_bg option:selected").val();
|
||||
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
|
||||
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo/" + icon_name;
|
||||
break;
|
||||
case 'button-custom_logo_login_preview':
|
||||
icon_name = $("select#custom_logo_login option:selected").val();
|
||||
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_logo_login/" + icon_name;
|
||||
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_logo_login/" + icon_name;
|
||||
options.grayed = true;
|
||||
break;
|
||||
case 'button-custom_splash_login_preview':
|
||||
icon_name = $("select#custom_splash_login option:selected").val();
|
||||
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed){ echo 'enterprise/'; } ?>images/custom_splash_login/" + icon_name;
|
||||
icon_path = "<?php echo $config['homeurl']; if(enterprise_installed()){ echo 'enterprise/'; } ?>images/custom_splash_login/" + icon_name;
|
||||
options.title = "<?php echo __('Splash Preview'); ?>";
|
||||
break;
|
||||
case 'button-custom_docs_logo_preview':
|
||||
|
@ -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 |
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -72,18 +72,14 @@ switch($info) {
|
||||
if (isInACL($ipOrigin)) {
|
||||
if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
|
||||
if ($user_in_db !== false) {
|
||||
$config['id_user'] = $user_in_db;
|
||||
$correctLogin = true;
|
||||
|
||||
//XXXX
|
||||
session_start();
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) session_start();
|
||||
$_SESSION["id_usuario"] = $user;
|
||||
session_write_close();
|
||||
|
||||
file_put_contents(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id(), $user);
|
||||
|
||||
}
|
||||
else {
|
||||
$no_login_msg = "Incorrect user credentials";
|
||||
@ -186,11 +182,6 @@ if ($correctLogin) {
|
||||
returnError('no_exist_operation', $returnType);
|
||||
}
|
||||
}
|
||||
|
||||
//XXXXX
|
||||
if (file_exists(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id())) {
|
||||
unlink(session_save_path() . DIRECTORY_SEPARATOR . "pansess_" . session_id());
|
||||
}
|
||||
}
|
||||
else {
|
||||
// TODO: Implement a new switch in config to enable / disable
|
||||
|
@ -1,160 +0,0 @@
|
||||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/**
|
||||
* @package Include/auth
|
||||
*/
|
||||
|
||||
|
||||
if (!isset ($config)) {
|
||||
die ('
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Pandora FMS - The Flexible Monitoring System - Console error</title>
|
||||
<meta http-equiv="expires" content="0">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf8">
|
||||
<meta name="resource-type" content="document">
|
||||
<meta name="distribution" content="global">
|
||||
<meta name="author" content="Artica ST">
|
||||
<meta name="copyright" content="(c) Artica ST">
|
||||
<meta name="robots" content="index, follow">
|
||||
<link rel="icon" href="../../images/pandora.ico" type="image/ico">
|
||||
<link rel="stylesheet" href="../styles/pandora.css" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="main" style="float:left; margin-left: 100px">
|
||||
<div align="center">
|
||||
<div id="login_f">
|
||||
<h1 id="log_f" class="error">You cannot access this file</h1>
|
||||
<div>
|
||||
<img src="../../images/pandora_logo.png" border="0"></a>
|
||||
</div>
|
||||
<div class="msg">
|
||||
<span class="error"><b>ERROR:</b>
|
||||
You can\'t access this file directly!</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
');
|
||||
}
|
||||
|
||||
$config["user_can_update_password"] = false;
|
||||
$config["admin_can_add_user"] = false;
|
||||
$config["admin_can_delete_user"] = false;
|
||||
$config["admin_can_disable_user"] = false;
|
||||
|
||||
global $dev_cache; //This variable needs to be globalized because this file is called from within a function and thus local
|
||||
|
||||
//DON'T USE THIS IF YOU DON'T KNOW WHAT YOU'RE DOING
|
||||
die ("This is a very dangerous authentication scheme. Only use for programming in case you should uncomment this line");
|
||||
|
||||
/**
|
||||
* process_user_login accepts $login and $pass and handles it according to current authentication scheme
|
||||
*
|
||||
* @param string $login
|
||||
* @param string $pass
|
||||
*
|
||||
* @return mixed False in case of error or invalid credentials, the username in case it's correct.
|
||||
*/
|
||||
function process_user_login ($login, $pass) {
|
||||
return false; //Error
|
||||
return $login; //Good
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a user is administrator.
|
||||
*
|
||||
* @param string User id.
|
||||
*
|
||||
* @return bool True is the user is admin
|
||||
*/
|
||||
function is_user_admin ($user) {
|
||||
return true; //User is admin
|
||||
return false; //User isn't
|
||||
}
|
||||
|
||||
/**
|
||||
* Check is a user exists in the system
|
||||
*
|
||||
* @param string User id.
|
||||
*
|
||||
* @return bool True if the user exists.
|
||||
*/
|
||||
function is_user ($id_user) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the users real name
|
||||
*
|
||||
* @param string User id.
|
||||
*
|
||||
* @return string The users full name
|
||||
*/
|
||||
function get_user_fullname ($id_user) {
|
||||
return "admin";
|
||||
return "";
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the users email
|
||||
*
|
||||
* @param string User id.
|
||||
*
|
||||
* @return string The users email address
|
||||
*/
|
||||
function get_user_email ($id_user) {
|
||||
return "test@example.com";
|
||||
return "";
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all users in an array [username] => real name
|
||||
*
|
||||
* @param string Field to order by (id_usuario, nombre_real or fecha_registro)
|
||||
*
|
||||
* @return array An array of users
|
||||
*/
|
||||
function get_users ($order = "nombre_real") {
|
||||
return array ("admin" => "Admini Strator");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the last login for a user
|
||||
*
|
||||
* @param string User id
|
||||
*/
|
||||
function process_user_contact ($id_user) {
|
||||
//void
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the user
|
||||
*
|
||||
* @param string User id
|
||||
*/
|
||||
function delete_user ($id_user) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//Reference the global use authorization error to last ldap error.
|
||||
$config["auth_error"] = &$dev_cache["auth_error"];
|
||||
?>
|
@ -13,17 +13,8 @@
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Global & session manageme
|
||||
|
||||
session_id($_REQUEST["session_id"]);
|
||||
if (file_exists(session_save_path() . "/pansess_" . session_id()) ) {
|
||||
$user = file_get_contents(session_save_path() . "/pansess_" . session_id());
|
||||
}
|
||||
session_start();
|
||||
if (isset($user)) {
|
||||
$_SESSION["id_usuario"] = $user;
|
||||
}
|
||||
session_write_close();
|
||||
|
||||
|
||||
|
||||
require_once ('config.php');
|
||||
require_once ($config['homedir'] . '/include/auth/mysql.php');
|
||||
@ -95,9 +86,8 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
<script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js"></script>
|
||||
</head>
|
||||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||
<?php
|
||||
|
||||
$params['only_image'] = false;
|
||||
<?php
|
||||
$params['only_image'] = false;
|
||||
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||
$params['menu'] = false;
|
||||
|
||||
@ -132,7 +122,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
$params['height'],
|
||||
$params['water_mark_url'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$config['font_size'],
|
||||
$params['legend_position'],
|
||||
$params['colors'],
|
||||
$params['hide_labels']
|
||||
@ -151,7 +141,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
$params['water_mark_url'],
|
||||
$params['homedir'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$config['font_size'],
|
||||
$params['from_ux'],
|
||||
$params['from_wux'],
|
||||
$params['backgroundColor'],
|
||||
@ -165,7 +155,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
$params['height'],
|
||||
$params['water_mark_url'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$config['font_size'],
|
||||
$params['backgroundColor'],
|
||||
$params['tick_color'],
|
||||
$params['val_min'],
|
||||
@ -185,7 +175,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
'',
|
||||
$params['water_mark'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$config['font_size'],
|
||||
$params['unit'],
|
||||
$params['ttl'],
|
||||
$params['homeurl'],
|
||||
@ -211,7 +201,9 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
$params['id_agent'],
|
||||
$params['full_legend_daterray'],
|
||||
$params['not_interactive'],
|
||||
1
|
||||
$params['ttl'],
|
||||
$params['widgets'],
|
||||
$params['show']
|
||||
);
|
||||
break;
|
||||
default:
|
||||
@ -221,7 +213,19 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
echo '</div>';
|
||||
|
||||
$config['font_size'] = $aux_font_size;
|
||||
?>
|
||||
</body>
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
var status = window.callPhantom({ status: "loaded" });
|
||||
} catch (error) {
|
||||
console.log("CALLBACK ERROR", error.message)
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -22,8 +22,8 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC181120';
|
||||
$pandora_version = 'v7.0NG.729';
|
||||
$build_version = 'PC181219';
|
||||
$pandora_version = 'v7.0NG.730';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
@ -171,19 +171,21 @@ require_once ($ownDir. 'functions_config.php');
|
||||
|
||||
date_default_timezone_set("Europe/Madrid");
|
||||
|
||||
//////////////////////////////////////
|
||||
//// PLEASE DO NOT CHANGE ORDER //////
|
||||
//////////////////////////////////////
|
||||
require_once ($config["homedir"].'/include/load_session.php');
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) session_start();
|
||||
|
||||
config_process_config();
|
||||
|
||||
config_prepare_session();
|
||||
require_once ($config["homedir"].'/include/load_session.php');
|
||||
if(session_id() == '') {
|
||||
$resultado = session_start();
|
||||
}
|
||||
|
||||
// Set a the system timezone default
|
||||
// Set a the system timezone default
|
||||
if ((!isset($config["timezone"])) OR ($config["timezone"] == "")) {
|
||||
$config["timezone"] = "Europe/Berlin";
|
||||
}
|
||||
////////////////////////////////////////
|
||||
|
||||
date_default_timezone_set($config["timezone"]);
|
||||
|
||||
|
@ -204,6 +204,7 @@ define('CIRCULAR_INTERIOR_PROGRESS_BAR', 16);
|
||||
define('DONUT_GRAPH', 17);
|
||||
define('BARS_GRAPH', 18);
|
||||
define('CLOCK', 19);
|
||||
define('COLOR_CLOUD', 20);
|
||||
//Some styles
|
||||
define('MIN_WIDTH', 300);
|
||||
define('MIN_HEIGHT', 120);
|
||||
|
@ -1787,10 +1787,7 @@ function check_login ($output = true) {
|
||||
}
|
||||
else {
|
||||
require_once($config["homedir"].'/mobile/include/user.class.php');
|
||||
if(session_id() == '') {
|
||||
session_start ();
|
||||
}
|
||||
session_write_close ();
|
||||
|
||||
if (isset($_SESSION['user'])) {
|
||||
$user = $_SESSION['user'];
|
||||
$id_user = $user->getIdUser();
|
||||
@ -3288,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;
|
||||
@ -3323,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
|
||||
@ -3372,7 +3381,7 @@ function get_copyright_notice () {
|
||||
*/
|
||||
function generate_csrf_code() {
|
||||
// Start session to make this var permanent
|
||||
session_start();
|
||||
if (session_status() === PHP_SESSION_NONE) session_start();
|
||||
$_SESSION['csrf_code'] = md5(uniqid(mt_rand(), true));
|
||||
session_write_close();
|
||||
return $_SESSION['csrf_code'];
|
||||
|
@ -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 = "(
|
||||
@ -922,7 +924,7 @@ function agents_get_group_agents (
|
||||
}
|
||||
|
||||
if (isset($search['id_os'])) {
|
||||
$filter[] = "id_os = ". $search['id_os'];
|
||||
$filter['id_os'] = $search['id_os'];
|
||||
}
|
||||
|
||||
if (isset($search['status'])) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,8 @@ include_once($config['homedir'] . "/include/functions_network_components.php");
|
||||
include_once($config['homedir'] . "/include/functions_netflow.php");
|
||||
include_once($config['homedir'] . "/include/functions_servers.php");
|
||||
include_once($config['homedir'] . "/include/functions_planned_downtimes.php");
|
||||
include_once($config['homedir'] . "/include/functions_db.php");
|
||||
include_once($config['homedir'] . "/include/functions_event_responses.php");
|
||||
enterprise_include_once ('include/functions_local_components.php');
|
||||
enterprise_include_once ('include/functions_events.php');
|
||||
enterprise_include_once ('include/functions_agents.php');
|
||||
@ -1410,10 +1412,6 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
|
||||
@ -1429,6 +1427,11 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
|
||||
$resultOrId = false;
|
||||
if ($other['data'][0] != '') {
|
||||
$resultOrId = db_process_sql_insert('tconfig_os', $values);
|
||||
|
||||
if ($resultOrId)
|
||||
echo __('Success creating OS');
|
||||
else
|
||||
echo __('Error creating OS');
|
||||
}
|
||||
|
||||
}
|
||||
@ -1436,10 +1439,6 @@ function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
|
||||
function api_set_update_os($id_os, $thrash2, $other, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "AW")) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
@ -1457,7 +1456,10 @@ function api_set_update_os($id_os, $thrash2, $other, $thrash3) {
|
||||
|
||||
if ($other['data'][0] != '') {
|
||||
|
||||
$result = db_process_sql_update('tconfig_os', $values, array('id_os' => $id_os));
|
||||
if (db_process_sql_update('tconfig_os', $values, array('id_os' => $id_os)))
|
||||
echo __('Success updating OS');
|
||||
else
|
||||
echo __('Error updating OS');
|
||||
}
|
||||
|
||||
}
|
||||
@ -8721,9 +8723,213 @@ function api_set_delete_user_profile($id, $thrash1, $other, $thrash2) {
|
||||
returnData('string', array('type' => 'string', 'data' => __('Delete user profile.')));
|
||||
}
|
||||
|
||||
/**
|
||||
* List all user profiles.
|
||||
*
|
||||
* @param Reserved $thrash1
|
||||
* @param Reserved $thrash2
|
||||
* @param Reserved $thrash3
|
||||
* @param string Return type (csv, json, string...)
|
||||
*
|
||||
* api.php?op=get&op2=user_profiles_info&return_type=json&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_get_user_profiles_info ($thrash1, $thrash2, $thrash3, $returnType) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "PM")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$profiles = db_get_all_rows_filter(
|
||||
'tperfil',
|
||||
array(),
|
||||
array(
|
||||
"id_perfil",
|
||||
"name",
|
||||
"incident_view as IR",
|
||||
"incident_edit as IW",
|
||||
"incident_management as IM",
|
||||
"agent_view as AR",
|
||||
"agent_edit as AW",
|
||||
"agent_disable as AD",
|
||||
"alert_edit as LW",
|
||||
"alert_management as LM",
|
||||
"user_management as UM",
|
||||
"db_management as DM",
|
||||
"event_view as ER",
|
||||
"event_edit as EW",
|
||||
"event_management as EM",
|
||||
"report_view as RR",
|
||||
"report_edit as RW",
|
||||
"report_management as RM",
|
||||
"map_view as MR",
|
||||
"map_edit as MW",
|
||||
"map_management as MM",
|
||||
"vconsole_view as VR",
|
||||
"vconsole_edit as VW",
|
||||
"vconsole_management as VM",
|
||||
"pandora_management as PM"
|
||||
)
|
||||
);
|
||||
|
||||
if ($profiles === false) {
|
||||
returnError('error_list_profiles', __('Error retrieving profiles'));
|
||||
} else {
|
||||
returnData($returnType, array('type' => 'array', 'data' => $profiles));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an user profile.
|
||||
*
|
||||
* @param Reserved $thrash1
|
||||
* @param Reserved $thrash2
|
||||
* @param array parameters in array: name|IR|IW|IM|AR|AW|AD|LW|LM|UM|DM|ER|EW|EM|RR|RW|RM|MR|MW|MM|VR|VW|VM|PM
|
||||
* @param string Return type (csv, json, string...)
|
||||
*
|
||||
* api.php?op=set&op2=create_user_profile_info&return_type=json&other=API_profile%7C1%7C0%7C0%7C1%7C0%7C0%7C0%7C0%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_create_user_profile_info ($thrash1, $thrash2, $other, $returnType) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "PM")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'name' => (string)$other['data'][0],
|
||||
'incident_view' => (bool)$other['data'][1] ? 1 : 0,
|
||||
'incident_edit' => (bool)$other['data'][2] ? 1 : 0,
|
||||
'incident_management' => (bool)$other['data'][3] ? 1 : 0,
|
||||
'agent_view' => (bool)$other['data'][4] ? 1 : 0,
|
||||
'agent_edit' => (bool)$other['data'][5] ? 1 : 0,
|
||||
'agent_disable' => (bool)$other['data'][6] ? 1 : 0,
|
||||
'alert_edit' => (bool)$other['data'][7] ? 1 : 0,
|
||||
'alert_management' => (bool)$other['data'][8] ? 1 : 0,
|
||||
'user_management' => (bool)$other['data'][9] ? 1 : 0,
|
||||
'db_management' => (bool)$other['data'][10] ? 1 : 0,
|
||||
'event_view' => (bool)$other['data'][11] ? 1 : 0,
|
||||
'event_edit' => (bool)$other['data'][12] ? 1 : 0,
|
||||
'event_management' => (bool)$other['data'][13] ? 1 : 0,
|
||||
'report_view' => (bool)$other['data'][14] ? 1 : 0,
|
||||
'report_edit' => (bool)$other['data'][15] ? 1 : 0,
|
||||
'report_management' => (bool)$other['data'][16] ? 1 : 0,
|
||||
'map_view' => (bool)$other['data'][17] ? 1 : 0,
|
||||
'map_edit' => (bool)$other['data'][18] ? 1 : 0,
|
||||
'map_management' => (bool)$other['data'][19] ? 1 : 0,
|
||||
'vconsole_view' => (bool)$other['data'][20] ? 1 : 0,
|
||||
'vconsole_edit' => (bool)$other['data'][21] ? 1 : 0,
|
||||
'vconsole_management' => (bool)$other['data'][22] ? 1 : 0,
|
||||
'pandora_management' => (bool)$other['data'][23] ? 1 : 0
|
||||
);
|
||||
|
||||
$return = db_process_sql_insert('tperfil', $values);
|
||||
|
||||
if ($return === false) {
|
||||
returnError('error_create_user_profile_info', __('Error creating user profile'));
|
||||
} else {
|
||||
returnData($returnType, array('type' => 'array', 'data' => 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an user profile.
|
||||
*
|
||||
* @param int Profile id
|
||||
* @param Reserved $thrash1
|
||||
* @param array parameters in array: name|IR|IW|IM|AR|AW|AD|LW|LM|UM|DM|ER|EW|EM|RR|RW|RM|MR|MW|MM|VR|VW|VM|PM
|
||||
* @param string Return type (csv, json, string...)
|
||||
*
|
||||
* api.php?op=set&op2=update_user_profile_info&return_type=json&id=6&other=API_profile_updated%7C%7C%7C%7C1%7C1%7C1%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_update_user_profile_info ($id_profile, $thrash1, $other, $returnType) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "PM")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$profile = db_get_row ('tperfil', 'id_perfil', $id_profile);
|
||||
if ($profile === false) {
|
||||
returnError('id_not_found', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
'name' => $other['data'][0] == '' ? $profile['name'] : (string)$other['data'][0],
|
||||
'incident_view' => $other['data'][1] == '' ? $profile['incident_view'] : (bool)$other['data'][1] ? 1 : 0,
|
||||
'incident_edit' => $other['data'][2] == '' ? $profile['incident_edit'] : (bool)$other['data'][2] ? 1 : 0,
|
||||
'incident_management' => $other['data'][3] == '' ? $profile['incident_management'] : (bool)$other['data'][3] ? 1 : 0,
|
||||
'agent_view' => $other['data'][4] == '' ? $profile['agent_view'] : (bool)$other['data'][4] ? 1 : 0,
|
||||
'agent_edit' => $other['data'][5] == '' ? $profile['agent_edit'] : (bool)$other['data'][5] ? 1 : 0,
|
||||
'agent_disable' => $other['data'][6] == '' ? $profile['agent_disable'] : (bool)$other['data'][6] ? 1 : 0,
|
||||
'alert_edit' => $other['data'][7] == '' ? $profile['alert_edit'] : (bool)$other['data'][7] ? 1 : 0,
|
||||
'alert_management' => $other['data'][8] == '' ? $profile['alert_management'] : (bool)$other['data'][8] ? 1 : 0,
|
||||
'user_management' => $other['data'][9] == '' ? $profile['user_management'] : (bool)$other['data'][9] ? 1 : 0,
|
||||
'db_management' => $other['data'][10] == '' ? $profile['db_management'] : (bool)$other['data'][10] ? 1 : 0,
|
||||
'event_view' => $other['data'][11] == '' ? $profile['event_view'] : (bool)$other['data'][11] ? 1 : 0,
|
||||
'event_edit' => $other['data'][12] == '' ? $profile['event_edit'] : (bool)$other['data'][12] ? 1 : 0,
|
||||
'event_management' => $other['data'][13] == '' ? $profile['event_management'] : (bool)$other['data'][13] ? 1 : 0,
|
||||
'report_view' => $other['data'][14] == '' ? $profile['report_view'] : (bool)$other['data'][14] ? 1 : 0,
|
||||
'report_edit' => $other['data'][15] == '' ? $profile['report_edit'] : (bool)$other['data'][15] ? 1 : 0,
|
||||
'report_management' => $other['data'][16] == '' ? $profile['report_management'] : (bool)$other['data'][16] ? 1 : 0,
|
||||
'map_view' => $other['data'][17] == '' ? $profile['map_view'] : (bool)$other['data'][17] ? 1 : 0,
|
||||
'map_edit' => $other['data'][18] == '' ? $profile['map_edit'] : (bool)$other['data'][18] ? 1 : 0,
|
||||
'map_management' => $other['data'][19] == '' ? $profile['map_management'] : (bool)$other['data'][19] ? 1 : 0,
|
||||
'vconsole_view' => $other['data'][20] == '' ? $profile['vconsole_view'] : (bool)$other['data'][20] ? 1 : 0,
|
||||
'vconsole_edit' => $other['data'][21] == '' ? $profile['vconsole_edit'] : (bool)$other['data'][21] ? 1 : 0,
|
||||
'vconsole_management' => $other['data'][22] == '' ? $profile['vconsole_management'] : (bool)$other['data'][22] ? 1 : 0,
|
||||
'pandora_management' => $other['data'][23] == '' ? $profile['pandora_management'] : (bool)$other['data'][23] ? 1 : 0
|
||||
);
|
||||
|
||||
$return = db_process_sql_update('tperfil', $values, array('id_perfil' => $id_profile));
|
||||
|
||||
if ($return === false) {
|
||||
returnError('error_update_user_profile_info', __('Error updating user profile'));
|
||||
} else {
|
||||
returnData($returnType, array('type' => 'array', 'data' => 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an user profile.
|
||||
*
|
||||
* @param int Profile id
|
||||
* @param Reserved $thrash1
|
||||
* @param Reserved $thrash2
|
||||
* @param string Return type (csv, json, string...)
|
||||
*
|
||||
* api.php?op=set&op2=delete_user_profile_info&return_type=json&id=7&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_delete_user_profile_info ($id_profile, $thrash1, $thrash2, $returnType) {
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "PM")){
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$profile = db_get_value ('id_perfil', 'tperfil', 'id_perfil', $id_profile);
|
||||
if ($profile === false) {
|
||||
returnError('id_not_found', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$return = profile_delete_profile_and_clean_users($id_profile);
|
||||
|
||||
if ($return === false) {
|
||||
returnError('error_delete_user_profile_info', __('Error deleting user profile'));
|
||||
} else {
|
||||
returnData($returnType, array('type' => 'array', 'data' => 1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new incident in Pandora.
|
||||
*
|
||||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <title>;<description>;
|
||||
@ -11468,6 +11674,159 @@ function api_get_modules_id_name_by_cluster_name ($cluster_name){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $trash1
|
||||
* @param $trash2
|
||||
* @param mixed $trash3
|
||||
* @param $returnType
|
||||
* Example:
|
||||
* api.php?op=get&op2=event_responses&return_type=csv&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_get_event_responses($trash1, $trash2, $trash3, $returnType) {
|
||||
global $config;
|
||||
|
||||
// Error if user cannot read event responses.
|
||||
if (!check_acl($config['id_user'], 0, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$responses = event_responses_get_responses();
|
||||
if (empty($responses)) {
|
||||
returnError('no_data_to_show', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
returnData ($returnType, array('type' => 'array', 'data' => $responses));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id_response
|
||||
* @param $trash2
|
||||
* @param mixed $trash3
|
||||
* @param $returnType
|
||||
* Example:
|
||||
* api.php?op=set&op2=delete_event_response&id=7&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_delete_event_response($id_response, $trash1, $trash2, $returnType) {
|
||||
global $config;
|
||||
|
||||
// Error if user cannot read event responses.
|
||||
if (!check_acl($config['id_user'], 0, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if id exists
|
||||
$event_group = db_get_value('id_group', 'tevent_response','id', $id_response);
|
||||
if ($event_group === false) {
|
||||
returnError('id_not_found', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check user if can edit the module
|
||||
if (!check_acl($config['id_user'], $event_group, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$result = db_process_sql_delete('tevent_response', array('id' => $id_response));
|
||||
returnData ($returnType, array('type' => 'string', 'data' => $result));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $trash1
|
||||
* @param $trash2
|
||||
* @param mixed $other. Serialized params
|
||||
* @param $returnType
|
||||
* Example:
|
||||
* api.php?op=set&op2=create_event_response&other=response%7Cdescription%20response%7Ctouch%7Ccommand%7C0%7C650%7C400%7C0%7Cresponse%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_create_event_response($trash1, $trash2, $other, $returnType) {
|
||||
global $config;
|
||||
|
||||
// Error if user cannot read event responses.
|
||||
if (!check_acl($config['id_user'], 0, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $other['data'][0];
|
||||
$values['description'] = $other['data'][1];
|
||||
$values['target'] = $other['data'][2];
|
||||
$values['type'] = $other['data'][3];
|
||||
$values['id_group'] = $other['data'][4];
|
||||
$values['modal_width'] = $other['data'][5];
|
||||
$values['modal_height'] = $other['data'][6];
|
||||
$values['new_window'] = $other['data'][7];
|
||||
$values['params'] = $other['data'][8];
|
||||
$values['server_to_exec'] = $other['data'][9];
|
||||
|
||||
// Error if user has not permission for the group.
|
||||
if (!check_acl($config['id_user'], $values['id_group'], "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$return = event_responses_create_response($values) ? 1 : 0;
|
||||
|
||||
returnData ($returnType, array('type' => 'string', 'data' => $return));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id_response
|
||||
* @param $trash2
|
||||
* @param mixed $other. Serialized params
|
||||
* @param $returnType
|
||||
* Example:
|
||||
* api.php?op=set&op2=update_event_response&id=7&other=response%7Cdescription%20response%7Ctouch%7Ccommand%7C0%7C650%7C400%7C0%7Cresponse%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
|
||||
*/
|
||||
function api_set_update_event_response($id_response, $trash1, $other, $returnType) {
|
||||
global $config;
|
||||
|
||||
// Error if user cannot read event responses.
|
||||
if (!check_acl($config['id_user'], 0, "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if id exists
|
||||
$event_response = db_get_row('tevent_response','id', $id_response);
|
||||
if ($event_response === false) {
|
||||
returnError('id_not_found', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check user if can edit the module
|
||||
if (!check_acl($config['id_user'], $event_response['id_group'], "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $other['data'][0] == '' ? $event_response['name'] : $other['data'][0];
|
||||
$values['description'] = $other['data'][1] == '' ? $event_response['description'] : $other['data'][1];
|
||||
$values['target'] = $other['data'][2] == '' ? $event_response['target'] : $other['data'][2];
|
||||
$values['type'] = $other['data'][3] == '' ? $event_response['type'] : $other['data'][3];
|
||||
$values['id_group'] = $other['data'][4] == '' ? $event_response['id_group'] : $other['data'][4];
|
||||
$values['modal_width'] = $other['data'][5] == '' ? $event_response['modal_width'] : $other['data'][5];
|
||||
$values['modal_height'] = $other['data'][6] == '' ? $event_response['modal_height'] : $other['data'][6];
|
||||
$values['new_window'] = $other['data'][7] == '' ? $event_response['new_window'] : $other['data'][7];
|
||||
$values['params'] = $other['data'][8] == '' ? $event_response['params'] : $other['data'][8];
|
||||
$values['server_to_exec'] = $other['data'][9] == '' ? $event_response['server_to_exec'] : $other['data'][9];
|
||||
|
||||
// Error if user has not permission for the group.
|
||||
if (!check_acl($config['id_user'], $values['id_group'], "PM")) {
|
||||
returnError('forbidden', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$return = event_responses_update_response($id_response, $values) ? 1 : 0;
|
||||
|
||||
returnData ($returnType, array('type' => 'string', 'data' => $return));
|
||||
}
|
||||
|
||||
function api_get_cluster_items ($cluster_id){
|
||||
global $config;
|
||||
|
||||
@ -11512,8 +11871,142 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
|
||||
return false;
|
||||
}
|
||||
|
||||
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($id == 'all'){
|
||||
$result = db_process_sql_update('ttrap',array('status' => 1));
|
||||
}
|
||||
else{
|
||||
$result = db_process_sql_update('ttrap',
|
||||
array('status' => 1), array('id_trap' => $id));
|
||||
}
|
||||
|
||||
if (is_error($result)) {
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_update_trap', __('Error in trap update.'));
|
||||
}
|
||||
else {
|
||||
returnData('string',
|
||||
array('type' => 'string',
|
||||
'data' => __('Validated traps.')));
|
||||
}
|
||||
}
|
||||
|
||||
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($id == 'all'){
|
||||
$result = db_process_sql ('delete from ttrap');
|
||||
}
|
||||
else{
|
||||
$result = db_process_sql_delete('ttrap',array('id_trap' => $id));
|
||||
}
|
||||
|
||||
if (is_error($result)) {
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_delete_trap', __('Error in trap delete.'));
|
||||
}
|
||||
else {
|
||||
returnData('string',
|
||||
array('type' => 'string',
|
||||
'data' => __('Deleted traps.')));
|
||||
}
|
||||
}
|
||||
|
||||
function api_get_group_id_by_name($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT id_grupo
|
||||
FROM tgrupo WHERE nombre = "'.$other['data'].'"');
|
||||
|
||||
$group_id = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($group_id) > 0 and $group_id !== false) {
|
||||
$data = array('type' => 'array', 'data' => $group_id);
|
||||
|
||||
returnData('csv', $data, ';');
|
||||
}
|
||||
else {
|
||||
returnError('error_group_name', 'No groups retrieved.');
|
||||
}
|
||||
}
|
||||
|
||||
function api_get_timezone($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT value
|
||||
FROM tconfig WHERE token = "timezone"');
|
||||
|
||||
$timezone = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($timezone) > 0 and $timezone !== false) {
|
||||
|
||||
$data = array('type' => 'string', 'data' => $timezone);
|
||||
|
||||
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
|
||||
|
||||
}
|
||||
else {
|
||||
returnError('error_timezone', 'No timezone retrieved.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_get_language($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT value
|
||||
FROM tconfig WHERE token = "language"');
|
||||
|
||||
$language = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($language) > 0 and $language !== false) {
|
||||
|
||||
$data = array('type' => 'string', 'data' => $language);
|
||||
|
||||
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
|
||||
|
||||
}
|
||||
else {
|
||||
returnError('error_language', 'No language retrieved.');
|
||||
}
|
||||
}
|
||||
|
||||
function api_get_session_timeout($thrash1, $thrash2, $other, $thrash3) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sql = sprintf('SELECT value
|
||||
FROM tconfig WHERE token = "session_timeout"');
|
||||
|
||||
$language = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($language) > 0 and $language !== false) {
|
||||
|
||||
$data = array('type' => 'string', 'data' => $language);
|
||||
|
||||
returnData('string',array('type' => 'string','data' => $data['data'][0]['value']));
|
||||
|
||||
}
|
||||
else {
|
||||
returnError('error_session_timeout', 'No session timeout retrieved.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
@ -2027,6 +2027,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 */
|
||||
@ -2329,11 +2337,7 @@ function config_prepare_session() {
|
||||
else
|
||||
$sessionCookieExpireTime *= 60;
|
||||
|
||||
@ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);
|
||||
@session_set_cookie_params ($sessionCookieExpireTime);
|
||||
|
||||
// Reset the expiration time upon page load //session_name() is default name of session PHPSESSID
|
||||
|
||||
if (isset($_COOKIE[session_name()]))
|
||||
setcookie(session_name(), $_COOKIE[session_name()], time() + $sessionCookieExpireTime, "/");
|
||||
|
||||
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
@ -95,7 +95,7 @@ function events_get_events ($filter = false, $fields = false) {
|
||||
*
|
||||
* @return mixed False in case of error or invalid values passed. Event row otherwise
|
||||
*/
|
||||
function events_get_event ($id, $fields = false) {
|
||||
function events_get_event ($id, $fields = false, $meta = false, $history = false) {
|
||||
if (empty ($id))
|
||||
return false;
|
||||
global $config;
|
||||
@ -104,8 +104,10 @@ function events_get_event ($id, $fields = false) {
|
||||
if (! in_array ('id_grupo', $fields))
|
||||
$fields[] = 'id_grupo';
|
||||
}
|
||||
|
||||
$table = events_get_events_table($meta, $history);
|
||||
|
||||
$event = db_get_row ('tevento', 'id_evento', $id, $fields);
|
||||
$event = db_get_row ($table, 'id_evento', $id, $fields);
|
||||
if (! check_acl ($config['id_user'], $event['id_grupo'], 'ER'))
|
||||
return false;
|
||||
|
||||
@ -851,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);
|
||||
|
||||
|
@ -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')
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2456,7 +2458,9 @@ function graph_sla_slicebar (
|
||||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
$ttl,
|
||||
false,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@ -3188,16 +3192,14 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||
* @param string homeurl
|
||||
* @param bool return or echo the result
|
||||
*/
|
||||
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
|
||||
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false, $widgets=false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
$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);
|
||||
//TODO interval
|
||||
$interval = 24;
|
||||
$date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
$periodtime = floor ($period / $interval);
|
||||
@ -3206,7 +3208,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
||||
$legend = array();
|
||||
$full_legend = array();
|
||||
$full_legend_date = array();
|
||||
|
||||
|
||||
$cont = 0;
|
||||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
@ -3216,24 +3218,24 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
||||
else {
|
||||
$name = $bottom;
|
||||
}
|
||||
|
||||
|
||||
// Show less values in legend
|
||||
if ($cont == 0 or $cont % 2)
|
||||
$legend[$cont] = $name;
|
||||
|
||||
|
||||
if ($from_agent_view) {
|
||||
$full_date = date('Y/m/d', $bottom);
|
||||
$full_legend_date[$cont] = $full_date;
|
||||
}
|
||||
|
||||
$full_legend[$cont] = $name;
|
||||
|
||||
|
||||
$top = $datelimit + ($periodtime * ($i + 1));
|
||||
$event = db_get_row_filter ('tevento',
|
||||
array ('id_agente' => $id_agent,
|
||||
'utimestamp > '.$bottom,
|
||||
'utimestamp < '.$top), 'criticity, utimestamp');
|
||||
|
||||
|
||||
if (!empty($event['utimestamp'])) {
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
switch ($event['criticity']) {
|
||||
@ -3258,7 +3260,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
||||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||
|
||||
// Draw slicebar graph
|
||||
$out = flot_slicesbar_graph($data, $period, 100, 40, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date, 0, 1, $widgets);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
@ -3284,13 +3286,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();
|
||||
@ -3594,6 +3593,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
|
||||
@ -3662,7 +3662,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){
|
||||
@ -4070,19 +4072,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;
|
||||
|
@ -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();
|
||||
|
||||
@ -1338,6 +1347,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.
|
||||
*
|
||||
|
@ -175,6 +175,7 @@ function networkmap_process_networkmap($id = 0) {
|
||||
$nodes_and_relations['nodes'] = array();
|
||||
$index = 0;
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id'] = $node["id"];
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0];
|
||||
@ -303,6 +304,7 @@ function networkmap_process_networkmap($id = 0) {
|
||||
$index = 0;
|
||||
$node_center = array();
|
||||
foreach ($nodes as $key => $node) {
|
||||
$nodes_and_relations['nodes'][$index]['id'] = $node["id"];
|
||||
$nodes_and_relations['nodes'][$index]['id_map'] = $id;
|
||||
|
||||
$children_count = 0;
|
||||
@ -1072,6 +1074,7 @@ function networkmap_loadfile($id = 0, $file = '',
|
||||
$node_id = $items[1];
|
||||
$node_x = $items[2] * 100; //200 is for show more big
|
||||
$node_y = $height_map - $items[3] * 100; //200 is for show more big
|
||||
$data['id'] = $node_id;
|
||||
$data['text'] = '';
|
||||
$data['image'] = '';
|
||||
$data['width'] = 10;
|
||||
|
@ -144,6 +144,25 @@ function profile_delete_profile ($id_profile) {
|
||||
return (bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete profile from database and remove from the assigned users (tusuario_perfil)
|
||||
*
|
||||
* @param int Profile ID
|
||||
*
|
||||
* @return bool Whether or not it's deleted in both tables
|
||||
*/
|
||||
function profile_delete_profile_and_clean_users ($id_profile) {
|
||||
|
||||
$profile_deletion = (bool)db_process_sql_delete('tperfil', array('id_perfil' => $id_profile));
|
||||
|
||||
// Delete in tusuario_perfil only if is needed
|
||||
if (!(bool)db_get_value('id_perfil', 'tusuario_perfil', 'id_perfil', $id_profile)) {
|
||||
return $profile_deletion;
|
||||
}
|
||||
return $profile_deletion &&
|
||||
(bool)db_process_sql_delete('tusuario_perfil', array('id_perfil' => $id_profile));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the table to display, create and delete profiles
|
||||
*
|
||||
|
@ -144,6 +144,36 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
$metaconsole_on = is_metaconsole();
|
||||
$index_content = 0;
|
||||
foreach ($contents as $content) {
|
||||
|
||||
if (!empty($content["id_agent_module"]) && !empty($content["id_agent"])
|
||||
&& tags_has_user_acl_tags($config['id_user'])) {
|
||||
$where_tags = tags_get_acl_tags(
|
||||
$config['id_user'],
|
||||
$id_groups,
|
||||
'AR',
|
||||
'module_condition',
|
||||
'AND',
|
||||
'tagente_modulo',
|
||||
false,
|
||||
array(),
|
||||
true);
|
||||
|
||||
$sql_tags_join = "INNER JOIN tagente ON tagente.id_agente = t1.id_agente
|
||||
INNER JOIN ttag_module ON ttag_module.id_agente_modulo = t1.id_agente_modulo
|
||||
LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent";
|
||||
|
||||
$sql = sprintf('SELECT count(*) FROM tagente_modulo t1
|
||||
%s WHERE t1.delete_pending = 0 AND t1.id_agente_modulo = '. $content["id_agent_module"] .'
|
||||
AND t1.id_agente = ' . $content['id_agent'] . ' %s',
|
||||
$sql_tags_join, $where_tags);
|
||||
|
||||
$result_tags = db_get_value_sql($sql);
|
||||
|
||||
if (!$result_tags) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$server_name = $content['server_name'];
|
||||
|
||||
// General reports with 0 period means last value
|
||||
@ -218,11 +248,11 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
}
|
||||
}
|
||||
|
||||
if(sizeof($content['id_agent']) != 1){
|
||||
if(is_array($content['id_agent']) && sizeof($content['id_agent']) != 1){
|
||||
$content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']);
|
||||
}
|
||||
|
||||
if(sizeof($content['id_agent_module']) != 1){
|
||||
if(is_array($content['id_agent_module']) && sizeof($content['id_agent_module']) != 1){
|
||||
$content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']);
|
||||
}
|
||||
|
||||
@ -320,25 +350,33 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'max',$pdf);
|
||||
'max',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'avg_value':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'avg',$pdf);
|
||||
'avg',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'min_value':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'min',$pdf);
|
||||
'min',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'sumatory':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'sum');
|
||||
'sum',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'historical_data':
|
||||
$report['contents'][] = reporting_historical_data(
|
||||
@ -349,25 +387,33 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'MTTR');
|
||||
'MTTR',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'MTBF':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'MTBF');
|
||||
'MTBF',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'TTO':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'TTO');
|
||||
'TTO',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'TTRT':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'TTRT');
|
||||
'TTRT',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'agent_configuration':
|
||||
$report['contents'][] = reporting_agent_configuration(
|
||||
@ -618,7 +664,9 @@ function reporting_make_reporting_data($report = null, $id_report,
|
||||
$content,
|
||||
$type,
|
||||
$force_width_chart,
|
||||
$force_height_chart);
|
||||
$force_height_chart,
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
case 'module_histogram_graph':
|
||||
$report['contents'][] = reporting_enterprise_module_histogram_graph(
|
||||
@ -1156,10 +1204,10 @@ function reporting_event_top_n($report, $content, $type = 'dinamic',
|
||||
}
|
||||
}
|
||||
|
||||
$ag_name = modules_get_agentmodule_agent_alias($row ['id_agent_module']);
|
||||
$ag_name = modules_get_agentmodule_agent_alias($row ['id_agent_module']);
|
||||
$mod_name = modules_get_agentmodule_name ($row ['id_agent_module']);
|
||||
$unit = db_get_value('unit', 'tagente_modulo',
|
||||
'id_agente_modulo', $row ['id_agent_module']);
|
||||
'id_agente_modulo', $row ['id_agent_module']);
|
||||
|
||||
|
||||
switch ($top_n) {
|
||||
@ -3774,7 +3822,7 @@ function reporting_agent_configuration($report, $content) {
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
function reporting_value($report, $content, $type,$pdf=false) {
|
||||
function reporting_value($report, $content, $type, $pdf=false) {
|
||||
global $config;
|
||||
|
||||
$return = array();
|
||||
@ -6047,6 +6095,7 @@ function reporting_general($report, $content) {
|
||||
$i = 0;
|
||||
$index = 0;
|
||||
$is_string = array();
|
||||
|
||||
foreach ($generals as $row) {
|
||||
//Metaconsole connection
|
||||
$server_name = $row ['server_name'];
|
||||
@ -6336,7 +6385,17 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||
}
|
||||
}
|
||||
else{
|
||||
$modules[] = $content['id_agent_module'];
|
||||
if ($content['id_agent_module']) {
|
||||
$modules[] = $content['id_agent_module'];
|
||||
} else {
|
||||
// restore to metaconsole database
|
||||
metaconsole_restore_db();
|
||||
$module_source = db_get_all_rows_sql("SELECT id_agent_module FROM tgraph_source WHERE id_graph = " . $content['id_gs']);
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key] = $value['id_agent_module'];
|
||||
}
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
}
|
||||
$id_graph = 0;
|
||||
}
|
||||
@ -6391,7 +6450,7 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||
break;
|
||||
}
|
||||
|
||||
if ($config['metaconsole'] && $type_report != 'automatic_graph') {
|
||||
if ($config['metaconsole']) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
@ -7487,8 +7546,8 @@ function reporting_get_stats_alerts($data, $links = false) {
|
||||
$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&pure=" . $config['pure'];
|
||||
$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&filter=fired&pure=" . $config['pure'];
|
||||
} else {
|
||||
$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60";
|
||||
$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired";
|
||||
$urls['monitor_alerts'] = $config['homeurl']."index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60";
|
||||
$urls['monitor_alerts_fired'] = $config['homeurl']."index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired";
|
||||
}
|
||||
}
|
||||
|
||||
@ -7544,19 +7603,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
|
||||
// Link URLS
|
||||
if ($links === false) {
|
||||
$urls = array();
|
||||
$urls['monitor_critical'] = "index.php?" .
|
||||
$urls['monitor_critical'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure'];
|
||||
$urls['monitor_warning'] = "index.php?" .
|
||||
$urls['monitor_warning'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure'];
|
||||
$urls['monitor_ok'] = "index.php?" .
|
||||
$urls['monitor_ok'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure'];
|
||||
$urls['monitor_unknown'] = "index.php?" .
|
||||
$urls['monitor_unknown'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure'];
|
||||
$urls['monitor_not_init'] = "index.php?" .
|
||||
$urls['monitor_not_init'] = $config['homeurl']."index.php?" .
|
||||
"sec=view&sec2=operation/agentes/status_monitor&" .
|
||||
"refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure'];
|
||||
}
|
||||
@ -7659,8 +7718,8 @@ function reporting_get_stats_agents_monitors($data) {
|
||||
}
|
||||
else {
|
||||
$urls = array();
|
||||
$urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
|
||||
$urls['monitor_checks'] = "index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1";
|
||||
$urls['total_agents'] = $config['homeurl']."index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
|
||||
$urls['monitor_checks'] = $config['homeurl']."index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1";
|
||||
}
|
||||
|
||||
// Agents and modules table
|
||||
@ -9284,6 +9343,7 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
$id_module_type);
|
||||
$module_interval = modules_get_interval ($id_agent_module);
|
||||
$uncompressed_module = is_module_uncompressed ($module_name);
|
||||
|
||||
|
||||
// Wrong module type
|
||||
if (is_module_data_string ($module_name)) {
|
||||
@ -9292,46 +9352,23 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
|
||||
// Incremental modules are treated differently
|
||||
$module_inc = is_module_inc ($module_name);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql('
|
||||
|
||||
if ($uncompressed_module) {
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql('
|
||||
SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module . '
|
||||
AND utimestamp > ' . (int) $datelimit . '
|
||||
AND utimestamp < ' . (int) $date . '
|
||||
ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
|
||||
}
|
||||
else
|
||||
$interval_data = db_uncompress_module_data((int) $id_agent_module, (int) $datelimit, (int) $date);
|
||||
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
$min_necessary = 1;
|
||||
|
||||
// Compressed module data
|
||||
}
|
||||
else {
|
||||
// Get previous data
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false) {
|
||||
$previous_data['utimestamp'] = $datelimit;
|
||||
array_unshift ($interval_data, $previous_data);
|
||||
}
|
||||
|
||||
// Get next data
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
if ($next_data !== false) {
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
else if (count ($interval_data) > 0) {
|
||||
// Propagate the last known data to the end of the interval
|
||||
$next_data = array_pop ($interval_data);
|
||||
array_push ($interval_data, $next_data);
|
||||
$next_data['utimestamp'] = $date;
|
||||
array_push ($interval_data, $next_data);
|
||||
}
|
||||
|
||||
$min_necessary = 2;
|
||||
}
|
||||
$min_necessary = 1;
|
||||
|
||||
if (count ($interval_data) < $min_necessary) {
|
||||
return false;
|
||||
@ -9339,11 +9376,14 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
|
||||
// Set initial conditions
|
||||
$total = 0;
|
||||
if (! $uncompressed_module) {
|
||||
$previous_data = array_shift ($interval_data);
|
||||
}
|
||||
|
||||
$partial_total = 0;
|
||||
$count_sum = 0;
|
||||
|
||||
foreach ($interval_data as $data) {
|
||||
|
||||
$partial_total = 0;
|
||||
$count_sum = 0;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
@ -9354,18 +9394,25 @@ function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
oracle_format_float_to_php($data['datos']);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($uncompressed_module) {
|
||||
$total += $data['datos'];
|
||||
}
|
||||
else if ($module_inc) {
|
||||
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']);
|
||||
|
||||
if (!$module_inc) {
|
||||
foreach ($data['data'] as $val) {
|
||||
if (is_numeric($val['datos'])) {
|
||||
$partial_total += $val['datos'];
|
||||
$count_sum++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($count_sum===0) continue;
|
||||
|
||||
$total += $partial_total/$count_sum;
|
||||
}
|
||||
else {
|
||||
$total += $previous_data['datos'] * ($data['utimestamp'] - $previous_data['utimestamp']) / $module_interval;
|
||||
$last = end($data['data']);
|
||||
$total += $last['datos'];
|
||||
}
|
||||
$previous_data = $data;
|
||||
}
|
||||
|
||||
|
||||
return $total;
|
||||
}
|
||||
@ -10315,7 +10362,7 @@ function reporting_label_macro ($item, $label) {
|
||||
case 'MTTR':
|
||||
case 'automatic_graph':
|
||||
if (preg_match("/_agent_/", $label)) {
|
||||
if (count($item['agents']) > 1) {
|
||||
if (isset($item['agents']) && count($item['agents']) > 1) {
|
||||
$agent_name = count($item['agents']) . __(' agents');
|
||||
}
|
||||
else {
|
||||
|
@ -2466,61 +2466,57 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
||||
$sla_value = sla_truncate($chart['sla_value'], $config['graph_precision']) . '%';
|
||||
$checks_resume = "(" . $chart['checks_ok'] . "/" . $chart['checks_total'] . ")";
|
||||
}
|
||||
$table1->data[] = array(
|
||||
$chart['agent'] . "<br />" . $chart['module'],
|
||||
$chart['chart'],
|
||||
"<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" .
|
||||
$sla_value .
|
||||
'</span>',
|
||||
$checks_resume
|
||||
);
|
||||
|
||||
$table1->data[0][0] = $chart['agent'] . "<br />" . $chart['module'];
|
||||
$table1->data[0][1] = $chart['chart'];
|
||||
$table1->data[0][2] = "<span style = 'font: bold 2em Arial, Sans-serif; color: ".$color."'>" . $sla_value . '</span>';
|
||||
$table1->data[0][3] = $checks_resume;
|
||||
}
|
||||
|
||||
if($item['type'] == 'availability_graph'){
|
||||
//table_legend_graphs;
|
||||
$table2 = new stdClass();
|
||||
$table2->width = '99%';
|
||||
$table2->data = array ();
|
||||
$table2->size = array ();
|
||||
$table2->size[0] = '2%';
|
||||
$table2->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
||||
$table2->size[1] = '14%';
|
||||
$table2->data[0][1] = '<span>'.__('OK') . '</span>';
|
||||
|
||||
//table_legend_graphs;
|
||||
$table2 = new stdClass();
|
||||
$table2->width = '99%';
|
||||
$table2->data = array ();
|
||||
$table2->size = array ();
|
||||
$table2->size[0] = '2%';
|
||||
$table2->data[0][0] = '<img src ="'. $src .'images/square_green.png">';
|
||||
$table2->size[1] = '14%';
|
||||
$table2->data[0][1] = '<span>'.__('OK') . '</span>';
|
||||
$table2->size[2] = '2%';
|
||||
$table2->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
||||
$table2->size[3] = '14%';
|
||||
$table2->data[0][3] = '<span>'.__('Critical'). '</span>';
|
||||
|
||||
$table2->size[2] = '2%';
|
||||
$table2->data[0][2] = '<img src ="'. $src .'images/square_red.png">';
|
||||
$table2->size[3] = '14%';
|
||||
$table2->data[0][3] = '<span>'.__('Critical'). '</span>';
|
||||
$table2->size[4] = '2%';
|
||||
$table2->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
||||
$table2->size[5] = '14%';
|
||||
$table2->data[0][5] = '<span>'.__('Unknow'). '</span>';
|
||||
|
||||
$table2->size[4] = '2%';
|
||||
$table2->data[0][4] = '<img src ="'. $src .'images/square_gray.png">';
|
||||
$table2->size[5] = '14%';
|
||||
$table2->data[0][5] = '<span>'.__('Unknow'). '</span>';
|
||||
$table2->size[6] = '2%';
|
||||
$table2->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
||||
$table2->size[7] = '14%';
|
||||
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
||||
|
||||
$table2->size[6] = '2%';
|
||||
$table2->data[0][6] = '<img src ="'. $src .'images/square_blue.png">';
|
||||
$table2->size[7] = '14%';
|
||||
$table2->data[0][7] = '<span>'.__('Not Init'). '</span>';
|
||||
|
||||
$table2->size[8] = '2%';
|
||||
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
||||
$table2->size[9] = '14%';
|
||||
$table2->data[0][9] = '<span>'.__('Downtimes'). '</span>';
|
||||
|
||||
$table2->size[10] = '2%';
|
||||
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
||||
$table2->size[11] = '15%';
|
||||
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
||||
$table2->size[8] = '2%';
|
||||
$table2->data[0][8] = '<img src ="'. $src .'images/square_violet.png">';
|
||||
$table2->size[9] = '14%';
|
||||
$table2->data[0][9] = '<span>'.__('Downtimes'). '</span>';
|
||||
|
||||
$table2->size[10] = '2%';
|
||||
$table2->data[0][10] = '<img src ="'. $src .'images/square_light_gray.png">';
|
||||
$table2->size[11] = '15%';
|
||||
$table2->data[0][11] = '<span>'.__('Ignore time'). '</span>';
|
||||
}
|
||||
|
||||
$table->colspan['charts']['cell'] = 2;
|
||||
$table->data['charts']['cell'] = html_print_table($table1, true);
|
||||
$table->colspan['legend']['cell'] = 2;
|
||||
$table->data['legend']['cell'] = html_print_table($table2, true);
|
||||
|
||||
if($pdf){
|
||||
return html_print_table($table, true);
|
||||
return html_print_table($table1, true) . '<br />' . html_print_table($table2, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3640,7 +3636,9 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
|
||||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
$ttl,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
@ -3823,7 +3821,9 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
0,
|
||||
$full_legend_date,
|
||||
true,
|
||||
1
|
||||
1,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
@ -3915,4 +3915,4 @@ function reporting_html_planned_downtimes_table ($planned_downtimes) {
|
||||
return $downtimes_table;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -770,7 +770,7 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
|
||||
function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group_and_tag = false, $force_equal = false) {
|
||||
|
||||
global $config;
|
||||
$condition = '';
|
||||
$condition = array();
|
||||
|
||||
// Get all tags of the system
|
||||
$all_tags = tags_get_all_tags(false);
|
||||
@ -808,8 +808,11 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
|
||||
$tags_condition = $group_condition . " AND (" . implode(" OR ", $tags_condition_array) . ")";
|
||||
$condition[] = "($tags_condition)\n";
|
||||
}
|
||||
|
||||
if (!empty($condition)) {
|
||||
$condition = implode(' OR ', $condition);
|
||||
} else {
|
||||
$condition = '';
|
||||
}
|
||||
|
||||
if (!empty($without_tags)) {
|
||||
|
@ -714,20 +714,15 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
||||
|
||||
ui_toggle($table_advanced, __('Advanced information'));
|
||||
|
||||
// Blank space below title, DONT remove this, this
|
||||
// Breaks the layout when Flash charts are enabled :-o
|
||||
//echo '<div id="id_div" style="height: 10px"> </div>';
|
||||
|
||||
if ($config["agentaccess"]) {
|
||||
$access_graph = '<div style="width:100%; height:130px;">';
|
||||
$access_graph .= graphic_agentaccess($id_agente, 380, 120, SECONDS_1DAY, true, true);
|
||||
$access_graph .= graphic_agentaccess ($id_agente, 380, 120, SECONDS_1DAY, true, true);
|
||||
$access_graph .= '</div>';
|
||||
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
||||
}
|
||||
|
||||
$events_graph = '<div style="margin-left: 10px;">';
|
||||
$events_graph .= graph_graphic_agentevents ($id_agente, 290, 15,
|
||||
SECONDS_1DAY, '', true);
|
||||
$events_graph = '<div style="margin-left:10px; width:100%;">';
|
||||
$events_graph .= graph_graphic_agentevents ($id_agente, 375, 45, SECONDS_1DAY, '', true, false, true);
|
||||
$events_graph .= '</div><br>';
|
||||
|
||||
ui_toggle($events_graph, __('Events (24h)'));
|
||||
|
@ -548,7 +548,7 @@ function ui_print_group_icon ($id_group, $return = false, $path = "groups_small"
|
||||
$link = false;
|
||||
|
||||
if ($link)
|
||||
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
||||
$output = '<a href="'.$config["homeurl"].'index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
||||
|
||||
if ($config['show_group_name']) {
|
||||
$output .= '<span title="'. groups_get_name($id_group, true) .'">' .
|
||||
|
@ -1205,7 +1205,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
@ -1213,7 +1213,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
@ -1223,7 +1223,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
@ -1231,7 +1231,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
@ -1240,14 +1240,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||
}
|
||||
else {
|
||||
$img = vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
|
||||
}
|
||||
@ -1259,7 +1259,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
@ -1267,7 +1267,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
@ -1277,7 +1277,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
@ -1285,7 +1285,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
|
||||
}
|
||||
@ -1294,14 +1294,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||
}
|
||||
else {
|
||||
$img = vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
ui_get_full_url("images/image_problem_area.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
|
||||
}
|
||||
@ -1569,6 +1569,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
case BOX_ITEM:
|
||||
$class .= "box_item";
|
||||
break;
|
||||
case COLOR_CLOUD:
|
||||
$class .= "color_cloud";
|
||||
break;
|
||||
default:
|
||||
if (!empty($element_enterprise)) {
|
||||
$class .= $element_enterprise['class'];
|
||||
@ -1633,78 +1636,11 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
break;
|
||||
case STATIC_GRAPH:
|
||||
case GROUP_ITEM:
|
||||
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
}
|
||||
else {
|
||||
// For each server defined and not disabled:
|
||||
$servers = db_get_all_rows_sql ('SELECT *
|
||||
FROM tmetaconsole_setup
|
||||
WHERE disabled = 0');
|
||||
if ($servers === false)
|
||||
$servers = array();
|
||||
|
||||
$result = array();
|
||||
$count_modules = 0;
|
||||
foreach ($servers as $server) {
|
||||
// If connection was good then retrieve all data server
|
||||
if (metaconsole_connect($server) == NOERR)
|
||||
$connection = true;
|
||||
else
|
||||
$connection = false;
|
||||
|
||||
$result_server = db_get_all_rows_sql ($sql);
|
||||
|
||||
if (!empty($result_server)) {
|
||||
|
||||
// Create HASH login info
|
||||
$pwd = $server['auth_token'];
|
||||
$auth_serialized = json_decode($pwd,true);
|
||||
|
||||
if (is_array($auth_serialized)) {
|
||||
$pwd = $auth_serialized['auth_token'];
|
||||
$api_password = $auth_serialized['api_password'];
|
||||
$console_user = $auth_serialized['console_user'];
|
||||
$console_password = $auth_serialized['console_password'];
|
||||
}
|
||||
|
||||
$user = $config['id_user'];
|
||||
$user_rot13 = str_rot13($config['id_user']);
|
||||
$hashdata = $user.$pwd;
|
||||
$hashdata = md5($hashdata);
|
||||
$url_hash = '&' .
|
||||
'loginhash=auto&' .
|
||||
'loginhash_data=' . $hashdata . '&' .
|
||||
'loginhash_user=' . $user_rot13;
|
||||
|
||||
foreach ($result_server as $result_element_key => $result_element_value) {
|
||||
|
||||
$result_server[$result_element_key]['server_id'] = $server['id'];
|
||||
$result_server[$result_element_key]['server_name'] = $server['server_name'];
|
||||
$result_server[$result_element_key]['server_url'] = $server['server_url'].'/';
|
||||
$result_server[$result_element_key]['hashdata'] = $hashdata;
|
||||
$result_server[$result_element_key]['user'] = $config['id_user'];
|
||||
|
||||
$count_modules++;
|
||||
|
||||
}
|
||||
|
||||
$result = array_merge($result, $result_server);
|
||||
}
|
||||
|
||||
if ($connection) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) {
|
||||
|
||||
$img_style_title = strip_tags($label);
|
||||
if ($layoutData['type'] == STATIC_GRAPH) {
|
||||
if ($layoutData['id_agente_modulo'] != 0) {
|
||||
|
||||
if ($layoutData['id_metaconsole'] != 0) {
|
||||
//Metaconsole db connection
|
||||
$connection = db_get_row_filter ('tmetaconsole_setup',
|
||||
@ -1780,83 +1716,84 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
else if($layoutData['label_position']=='right'){
|
||||
$imgpos = 'float:left';
|
||||
}
|
||||
|
||||
$varsize = getimagesize($config['homedir'] . '/' . $img);
|
||||
|
||||
|
||||
if($layoutData['show_statistics'] == 1){
|
||||
|
||||
|
||||
if($layoutData['show_statistics'] == 1) {
|
||||
if (get_parameter('action') == 'edit') {
|
||||
|
||||
if ($width == 0 || $height == 0) {
|
||||
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
|
||||
}
|
||||
else{
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$agents_critical = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_CRITICAL),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_warning = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_WARNING),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_unknown = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_UNKNOWN),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$agents_ok = agents_get_agents(array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_OK),
|
||||
array ('COUNT(*) as total'), 'AR', false);
|
||||
|
||||
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total'];
|
||||
|
||||
$stat_agent_ok = $agents_ok[0]['total']/$total_agents*100;
|
||||
$stat_agent_wa = $agents_warning[0]['total']/$total_agents*100;
|
||||
$stat_agent_cr = $agents_critical[0]['total']/$total_agents*100;
|
||||
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
|
||||
|
||||
if($width == 0 || $height == 0){
|
||||
$dyn_width = 520;
|
||||
$dyn_height = 80;
|
||||
}
|
||||
else{
|
||||
$dyn_width = $width;
|
||||
$dyn_height = $height;
|
||||
}
|
||||
|
||||
|
||||
echo '<table cellpadding="0" cellspacing="0" border="0" class="databox" style="width:'.$dyn_width.'px;height:'.$dyn_height.'px;text-align:center;';
|
||||
|
||||
if($layoutData['label_position'] == 'left'){
|
||||
echo "float:right;";
|
||||
}
|
||||
elseif ($layoutData['label_position'] == 'right') {
|
||||
echo "float:left;";
|
||||
}
|
||||
|
||||
echo '">';
|
||||
|
||||
echo "<tr style='height:10%;'>";
|
||||
echo "<th style='text-align:center;background-color:#9d9ea0;color:black;font-weight:bold;'>" .groups_get_name($layoutData['id_group'],true) . "</th>";
|
||||
|
||||
echo "</tr>";
|
||||
echo "<tr style='background-color:whitesmoke;height:90%;'>";
|
||||
echo "<td>";
|
||||
$agents_critical = agents_get_agents(
|
||||
array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_CRITICAL
|
||||
),
|
||||
array ('COUNT(*) as total'),
|
||||
'AR',
|
||||
false
|
||||
);
|
||||
$agents_warning = agents_get_agents(
|
||||
array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_WARNING
|
||||
),
|
||||
array ('COUNT(*) as total'),
|
||||
'AR',
|
||||
false
|
||||
);
|
||||
$agents_unknown = agents_get_agents(
|
||||
array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_UNKNOWN
|
||||
),
|
||||
array ('COUNT(*) as total'),
|
||||
'AR',
|
||||
false
|
||||
);
|
||||
$agents_ok = agents_get_agents(
|
||||
array (
|
||||
'disabled' => 0,
|
||||
'id_grupo' => $layoutData['id_group'],
|
||||
'status' => AGENT_STATUS_OK
|
||||
),
|
||||
array ('COUNT(*) as total'),
|
||||
'AR',
|
||||
false
|
||||
);
|
||||
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total'];
|
||||
$stat_agent_ok = $agents_ok[0]['total']/$total_agents*100;
|
||||
$stat_agent_wa = $agents_warning[0]['total']/$total_agents*100;
|
||||
$stat_agent_cr = $agents_critical[0]['total']/$total_agents*100;
|
||||
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
|
||||
if($width == 0 || $height == 0){
|
||||
$dyn_width = 520;
|
||||
$dyn_height = 80;
|
||||
} else {
|
||||
$dyn_width = $width;
|
||||
$dyn_height = $height;
|
||||
}
|
||||
echo '<table cellpadding="0" cellspacing="0" border="0" class="databox" style="width:'.$dyn_width.'px;height:'.$dyn_height.'px;text-align:center;';
|
||||
if($layoutData['label_position'] == 'left'){
|
||||
echo "float:right;";
|
||||
}
|
||||
elseif ($layoutData['label_position'] == 'right') {
|
||||
echo "float:left;";
|
||||
}
|
||||
|
||||
echo '">';
|
||||
echo "<tr style='height:10%;'>";
|
||||
echo "<th style='text-align:center;background-color:#9d9ea0;color:black;font-weight:bold;'>" .groups_get_name($layoutData['id_group'],true) . "</th>";
|
||||
echo "</tr>";
|
||||
echo "<tr style='background-color:whitesmoke;height:90%;'>";
|
||||
echo "<td>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#FC4444;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_cr, 2)) ."%</div>";
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Critical</div>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#f8db3f;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_wa, 2)) ."%</div>";
|
||||
@ -1865,68 +1802,38 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Normal</div>";
|
||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#9d9ea0;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_un, 2)) ."%</div>";
|
||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Unknown</div>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
} else {
|
||||
$options = array(
|
||||
"class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos
|
||||
);
|
||||
if ($width == 0 || $height == 0) {
|
||||
if($varsize[0] > 150 || $varsize[1] > 150){
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"width" => "70px",
|
||||
"height" => "70px",
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
}
|
||||
else{
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
$options['width'] = "70px";
|
||||
$options['height'] = "70px";
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo html_print_image($img, true,
|
||||
array("class" => "image",
|
||||
"id" => "image_" . $id,
|
||||
"width" => $width,
|
||||
"height" => $height,
|
||||
"title" => $img_style_title,
|
||||
"style" => $borderStyle.$imgpos), false,
|
||||
false, false, $isExternalLink);
|
||||
$options['width'] = $width;
|
||||
$options['height'] = $height;
|
||||
}
|
||||
|
||||
echo html_print_image($img, true, $options,
|
||||
false, false, false, $isExternalLink);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($layoutData['label_position']=='down'){
|
||||
echo io_safe_output($text);
|
||||
}
|
||||
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
|
||||
|
||||
if ($layoutData['label_position'] != 'up') {
|
||||
echo io_safe_output($text);
|
||||
}
|
||||
|
||||
if (! defined ('METACONSOLE')) {
|
||||
}
|
||||
else {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
if (is_metaconsole()) metaconsole_restore_db();
|
||||
break;
|
||||
case PERCENTILE_BAR:
|
||||
if (($layoutData['image'] == 'value') && ($value_text !== false)) {
|
||||
$unit_text = db_get_sql ('SELECT unit
|
||||
@ -1963,6 +1870,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
|
||||
echo $img;
|
||||
|
||||
if (get_parameter('tab')=='editor')
|
||||
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
|
||||
|
||||
break;
|
||||
case PERCENTILE_BUBBLE:
|
||||
@ -2006,6 +1916,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
|
||||
echo $img;
|
||||
|
||||
if (get_parameter('tab')=='editor')
|
||||
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
|
||||
|
||||
break;
|
||||
case CIRCULAR_PROGRESS_BAR:
|
||||
@ -2049,6 +1962,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
|
||||
echo $img;
|
||||
|
||||
if (get_parameter('tab')=='editor')
|
||||
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
|
||||
|
||||
break;
|
||||
case CIRCULAR_INTERIOR_PROGRESS_BAR:
|
||||
@ -2093,6 +2009,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
|
||||
echo $img;
|
||||
|
||||
if (get_parameter('tab')=='editor')
|
||||
echo "<span style='color:".$fill_color.";'>".io_safe_output($text)."</span>";
|
||||
|
||||
break;
|
||||
case MODULE_GRAPH:
|
||||
@ -2265,6 +2184,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
|
||||
}
|
||||
break;
|
||||
case COLOR_CLOUD:
|
||||
echo visual_map_get_color_cloud_element($layoutData);
|
||||
break;
|
||||
default:
|
||||
if (!empty($element_enterprise)) {
|
||||
echo $element_enterprise['item'];
|
||||
@ -2282,11 +2204,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
if ($layoutData['parent_item'] != 0) {
|
||||
$parent = db_get_row_filter('tlayout_data',
|
||||
array('id' => $layoutData['parent_item']));
|
||||
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo '$(document).ready (function() {
|
||||
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});
|
||||
});';
|
||||
echo 'lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});';
|
||||
echo '</script>';
|
||||
}
|
||||
}
|
||||
@ -2306,19 +2226,35 @@ function get_if_module_is_image ($id_module) {
|
||||
}
|
||||
|
||||
function get_bars_module_data ($id_module) {
|
||||
$mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module));
|
||||
//This charts is only serialize graphs.
|
||||
//In other string show image no data to show.
|
||||
|
||||
if (preg_match("/\r\n/", $mod_values)) {
|
||||
$values = explode("\r\n", $mod_values);
|
||||
}
|
||||
elseif (preg_match("/\n/", $mod_values)) {
|
||||
$values = explode("\n", $mod_values);
|
||||
$mod_values = db_get_value_filter(
|
||||
'datos',
|
||||
'tagente_estado',
|
||||
array(
|
||||
'id_agente_modulo' => $id_module
|
||||
)
|
||||
);
|
||||
|
||||
$values = false;
|
||||
//avoid showing the image type modules. WUX
|
||||
if(strpos($mod_values, 'data:image/png;base64') !== 0){
|
||||
if (preg_match("/\r\n/", $mod_values)) {
|
||||
$values = explode("\r\n", $mod_values);
|
||||
}
|
||||
elseif (preg_match("/\n/", $mod_values)) {
|
||||
$values = explode("\n", $mod_values);
|
||||
}
|
||||
}
|
||||
|
||||
$values_to_return = array();
|
||||
$index = 0;
|
||||
$color_index = 0;
|
||||
$total = 0;
|
||||
|
||||
if(!$values) return false;
|
||||
|
||||
foreach ($values as $val) {
|
||||
$data = explode(",", $val);
|
||||
$values_to_return[$data[0]] = array('g' =>$data[1]);
|
||||
@ -3323,9 +3259,7 @@ function visual_map_print_user_lines($layout_data, $proportion = null) {
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo '$(document).ready (function() {
|
||||
user_lines.push(' . json_encode($line) . ');
|
||||
});';
|
||||
echo 'user_lines.push(' . json_encode($line) . ');';
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
@ -3955,6 +3889,10 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
|
||||
case 'group_item':
|
||||
$text = __('Group') . " - ";
|
||||
break;
|
||||
case COLOR_CLOUD:
|
||||
case 'color_cloud':
|
||||
$text = __('Color cloud') . " - ";
|
||||
break;
|
||||
case 'icon':
|
||||
case ICON:
|
||||
$text = __('Icon') . " - " .
|
||||
@ -4092,6 +4030,8 @@ function visual_map_type_in_js($type) {
|
||||
break;
|
||||
case LINE_ITEM:
|
||||
return 'line_item';
|
||||
case COLOR_CLOUD:
|
||||
return 'color_cloud';
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4107,5 +4047,76 @@ function visual_map_macro($label,$module){
|
||||
return $label;
|
||||
}
|
||||
|
||||
function visual_map_get_color_cloud_element ($data) {
|
||||
$id = (int) $data["id"];
|
||||
$diameter = (int) $data["width"];
|
||||
$dynamic_fields = array();
|
||||
|
||||
try {
|
||||
// Yes, the dynamic fields object is stored into the label field. ¯\_(ツ)_/¯
|
||||
if (!empty($data["label"])) {
|
||||
$dynamic_fields = json_decode($data["label"], true);
|
||||
}
|
||||
} catch (Exception $ex) {}
|
||||
|
||||
$default_color = !empty($dynamic_fields["default_color"])
|
||||
? $dynamic_fields["default_color"]
|
||||
: "#FFFFFF";
|
||||
$color = $default_color;
|
||||
// The svg gradient needs a unique identifier
|
||||
$gradient_id = "grad_" . $id;
|
||||
|
||||
// Color ranges
|
||||
if (
|
||||
!empty($dynamic_fields["color_ranges"]) &&
|
||||
!empty($data["id_agente_modulo"])
|
||||
) {
|
||||
$node_id = null;
|
||||
$node_connected = false;
|
||||
// Connect to node
|
||||
if (is_metaconsole() && !empty($data["id_metaconsole"])) {
|
||||
$node_id = (int) $data["id_metaconsole"];
|
||||
if (metaconsole_connect(null, $node_id) === NOERR) $node_connected = true;
|
||||
}
|
||||
|
||||
// Fetch module value
|
||||
$value = (!$node_id || ($node_id && $node_connected))
|
||||
? modules_get_last_value($data["id_agente_modulo"])
|
||||
: false;
|
||||
|
||||
// Restore connection
|
||||
if ($node_connected) metaconsole_restore_db();
|
||||
|
||||
if ($value !== false) {
|
||||
/* TODO: It would be ok to give support to string values in the future?
|
||||
* It can be done by matching the range value with the value if it is a
|
||||
* string. I think the function to retrieve the value only supports
|
||||
* numeric values.
|
||||
*/
|
||||
$value = (float) $value;
|
||||
foreach ($dynamic_fields["color_ranges"] as $range) {
|
||||
if ($range["from_value"] <= $value && $range["to_value"] >= $value) {
|
||||
$color = $range["color"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<svg height="<?php echo $diameter; ?>" width="<?php echo $diameter; ?>">
|
||||
<defs>
|
||||
<radialGradient id="<?php echo $gradient_id; ?>" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
|
||||
<stop offset="0%" style="stop-color:<?php echo $color; ?>;stop-opacity:0.9" />
|
||||
<!-- <stop offset="50%" style="stop-color:<?php echo $color; ?>;stop-opacity:0.6" /> -->
|
||||
<stop offset="100%" style="stop-color:<?php echo $color; ?>;stop-opacity:0" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<circle cx="50%" cy="50%" r="50%" fill="url(#<?php echo $gradient_id; ?>)" />
|
||||
</svg>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
?>
|
@ -62,7 +62,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
'clock' => __('Clock'),
|
||||
'group_item' => __('Group'),
|
||||
'box_item' => __('Box'),
|
||||
'line_item' => __('Line'));
|
||||
'line_item' => __('Line'),
|
||||
'color_cloud' => __('Color cloud')
|
||||
);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
enterprise_visual_map_editor_add_title_palette($titles);
|
||||
@ -328,7 +330,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
$form_items['agent_row'] = array();
|
||||
$form_items['agent_row']['items'] = array('static_graph',
|
||||
'percentile_bar', 'percentile_item', 'module_graph',
|
||||
'simple_value', 'datos', 'auto_sla_graph');
|
||||
'simple_value', 'datos', 'auto_sla_graph', 'color_cloud');
|
||||
$form_items['agent_row']['html'] = '<td align="left">' .
|
||||
__('Agent') . '</td>';
|
||||
$params = array();
|
||||
@ -395,7 +397,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
$form_items['module_row'] = array();
|
||||
$form_items['module_row']['items'] = array('static_graph',
|
||||
'percentile_bar', 'percentile_item', 'module_graph',
|
||||
'simple_value', 'datos', 'auto_sla_graph', 'donut_graph', 'bars_graph');
|
||||
'simple_value', 'datos', 'auto_sla_graph', 'donut_graph', 'bars_graph',
|
||||
'color_cloud');
|
||||
$form_items['module_row']['html'] = '<td align="left">' .
|
||||
__('Module') . '</td>
|
||||
<td align="left">' .
|
||||
@ -510,7 +513,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
__('Max value') . '</td>
|
||||
<td align="left">' . html_print_input_text('max_percentile', 0, '', 3, 5, true) . '</td>';
|
||||
|
||||
$percentile_type = array('percentile' => __('Percentile'), 'bubble' => __('Bubble'), 'circular_progress_bar' => __('Circular porgress bar'), 'interior_circular_progress_bar' => __('Circular progress bar (interior)'));
|
||||
$percentile_type = array(
|
||||
"percentile" => __("Percentile"),
|
||||
"bubble" => __("Bubble"),
|
||||
"circular_progress_bar" => __("Circular porgress bar"),
|
||||
"interior_circular_progress_bar" => __("Circular progress bar (interior)")
|
||||
);
|
||||
$percentile_value = array('percent' => __('Percent'), 'value' => __('Value'));
|
||||
if (is_metaconsole()){
|
||||
$form_items['percentile_item_row_3'] = array();
|
||||
@ -534,14 +542,14 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
$form_items['percentile_item_row_3']['html'] = '<td align="left">' .
|
||||
__('Type') . '</td>
|
||||
<td align="left">' .
|
||||
html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true) .
|
||||
html_print_select($percentile_type, 'type_percentile', 'percentile', '', '', '', true, false, false) .
|
||||
'</td>';
|
||||
|
||||
$form_items['percentile_item_row_4'] = array();
|
||||
$form_items['percentile_item_row_4']['items'] = array('percentile_bar', 'percentile_item', 'datos');
|
||||
$form_items['percentile_item_row_4']['html'] = '<td align="left">' . __('Value to show') . '</td>
|
||||
<td align="left">' .
|
||||
html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true) .
|
||||
html_print_select($percentile_value, 'value_show', 'percent', '', '', '', true, false, false) .
|
||||
'</td>';
|
||||
}
|
||||
|
||||
@ -580,13 +588,76 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
'<td align="left" style="">' . __('Show statistics') . '</td>
|
||||
<td align="left" style="">' .
|
||||
html_print_checkbox('show_statistics', 1, '', true) . '</td>';
|
||||
|
||||
// Start of Color Cloud rows
|
||||
|
||||
// Diameter
|
||||
$default_diameter = 100;
|
||||
$form_items["color_cloud_diameter_row"] = array();
|
||||
$form_items["color_cloud_diameter_row"]["items"] = array("color_cloud");
|
||||
$form_items["color_cloud_diameter_row"]["html"] =
|
||||
"<td align=\"left\">" . __("Diameter") . "</td>
|
||||
<td align=\"left\">" .
|
||||
html_print_input_text("diameter", $default_diameter, "", 3, 5, true) .
|
||||
"</td>";
|
||||
|
||||
// Default color
|
||||
$default_color = "#FFFFFF";
|
||||
$form_items["color_cloud_def_color_row"] = array();
|
||||
$form_items["color_cloud_def_color_row"]["items"] = array("color_cloud");
|
||||
$form_items["color_cloud_def_color_row"]["html"] =
|
||||
"<td align=\"left\">" . __("Default color") . "</td>
|
||||
<td align=\"left\">" .
|
||||
html_print_input_color("default_color", $default_color, false, true) .
|
||||
"</td>";
|
||||
|
||||
// Color ranges
|
||||
$color_range_tip = __("The color of the element will be the one selected in the first range created in which the value of the module is found (with the initial and final values of the range included)") . ".";
|
||||
$form_items["color_cloud_color_ranges_row"] = array();
|
||||
$form_items["color_cloud_color_ranges_row"]["items"] = array("color_cloud");
|
||||
$form_items["color_cloud_color_ranges_row"]["html"] =
|
||||
"<td align=\"left\">" .
|
||||
__("Ranges") .
|
||||
ui_print_help_tip($color_range_tip, true) .
|
||||
"</td>" .
|
||||
"<td align=\"left\">" .
|
||||
"<table id=\"new-color-range\" class=\"databox color-range color-range-creation\">" .
|
||||
"<tr>" .
|
||||
"<td>" . __("From value") . "</td>" .
|
||||
"<td>" .
|
||||
html_print_input_text("from_value_new", "", "", 5, 255, true) .
|
||||
"</td>" .
|
||||
"<td rowspan=\"4\">" .
|
||||
"<a class=\"color-range-add\" href=\"#\">" .
|
||||
html_print_image("images/add.png", true) .
|
||||
"</a>" .
|
||||
"</td>" .
|
||||
"</tr>" .
|
||||
"<td>" . __("To value") . "</td>" .
|
||||
"<td>" .
|
||||
html_print_input_text("to_value_new", "", "", 5, 255, true) .
|
||||
"</td>" .
|
||||
"<td></td>" .
|
||||
"<tr>" .
|
||||
"</tr>" .
|
||||
"<tr>" .
|
||||
"<td>" . __("Color") . "</td>" .
|
||||
"<td>" .
|
||||
html_print_input_color("color_new", $default_color, false, true) .
|
||||
"</td>" .
|
||||
"<td></td>" .
|
||||
"</tr>" .
|
||||
"</table>" .
|
||||
"</td>";
|
||||
|
||||
// End of Color Cloud rows
|
||||
|
||||
$form_items['show_on_top_row'] = array();
|
||||
$form_items['show_on_top_row']['items'] = array('group_item');
|
||||
$form_items['show_on_top_row']['html'] =
|
||||
'<td align="left" style="">' . __('Always show on top') . '</td>
|
||||
<td align="left" style="">' .
|
||||
html_print_checkbox('show_on_top', 1, '', true) . '</td>';
|
||||
html_print_checkbox('show_on_top', 1, '', true) .ui_print_help_tip (__("It allows the element to be superimposed to the rest of items of the visual console"), true) . '</td>';
|
||||
|
||||
$show_last_value = array('0' => __('Hide last value on boolean modules'), '1' => __('Enabled'), '2' => __('Disabled'));
|
||||
$form_items['show_last_value_row'] = array();
|
||||
@ -616,7 +687,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
__('Type') . '</td>
|
||||
<td align="left">' . html_print_select($bars_graph_types, 'bars_graph_type', 'vertical', '', '', '', true) . '</td>';
|
||||
|
||||
|
||||
|
||||
//Insert and modify before the buttons to create or update.
|
||||
if (enterprise_installed()) {
|
||||
enterprise_visual_map_editor_modify_form_items_palette($form_items);
|
||||
@ -661,7 +732,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
$form_items_advance['position_row']['items'] = array('static_graph',
|
||||
'percentile_bar', 'percentile_item', 'module_graph',
|
||||
'simple_value', 'label', 'icon', 'datos', 'box_item',
|
||||
'auto_sla_graph', 'bars_graph','clock', 'donut_graph');
|
||||
'auto_sla_graph', 'bars_graph','clock', 'donut_graph', 'color_cloud');
|
||||
$form_items_advance['position_row']['html'] = '
|
||||
<td align="left">' . __('Position') . '</td>
|
||||
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) .
|
||||
@ -750,6 +821,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
var $mapLinkedSelect = $("select#map_linked");
|
||||
var $linkedMapNodeIDInput = $("input#hidden-linked_map_node_id");
|
||||
var visualMaps = <?php echo json_encode($visual_maps); ?>;
|
||||
if (!(visualMaps instanceof Array)) visualMaps = [];
|
||||
var nodesById = <?php echo json_encode($meta_servers_by_id); ?>;
|
||||
|
||||
visualMaps.forEach(function (vMap) {
|
||||
@ -870,7 +942,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
$form_items_advance['element_group_row']['items'] = array(
|
||||
'group_item', 'static_graph', 'percentile_bar',
|
||||
'percentile_item', 'module_graph', 'simple_value',
|
||||
'icon', 'label', 'datos', 'donut_graph');
|
||||
'icon', 'label', 'datos', 'donut_graph', 'color_cloud');
|
||||
$form_items_advance['element_group_row']['html'] = '<td align="left">'.
|
||||
__('Restrict access to group') . '</td>' .
|
||||
'<td align="left">' .
|
||||
@ -903,11 +975,6 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
@ -1026,6 +1093,7 @@ function visual_map_editor_print_toolbox() {
|
||||
visual_map_print_button_editor('group_item', __('Group'), 'left', false, 'group_item_min', true);
|
||||
visual_map_print_button_editor('box_item', __('Box'), 'left', false, 'box_item_min', true);
|
||||
visual_map_print_button_editor('line_item', __('Line'), 'left', false, 'line_item_min', true);
|
||||
visual_map_print_button_editor('color_cloud', __('Color cloud'), 'left', false, 'color_cloud_min', true);
|
||||
if(defined("METACONSOLE")){
|
||||
echo '<a href="javascript:" class="tip"><img src="'.$config['homeurl_static'].'/images/tip.png" data-title="The data displayed in editor mode is not real" data-use_title_for_force_title="1"
|
||||
class="forced_title" alt="The data displayed in editor mode is not real"></a>';
|
||||
|
@ -13,22 +13,23 @@
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
if (! isset($_SESSION['id_usuario'])) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
require_once('functions.php');
|
||||
require_once('functions_filemanager.php');
|
||||
|
||||
// Don't start a session before this import.
|
||||
// The session is configured and started inside the config process.
|
||||
require_once ("config.php");
|
||||
require_once ('functions.php');
|
||||
require_once ('functions_filemanager.php');
|
||||
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
|
||||
$auth_method = db_get_value('value', 'tconfig', 'token', 'auth');
|
||||
|
||||
if($auth_method != 'ad')
|
||||
if($auth_method != 'ad' && $auth_method != 'ldap'){
|
||||
require_once("auth/" . $auth_method . ".php");
|
||||
|
||||
}
|
||||
|
||||
|
||||
$styleError = "background:url(\"../images/err.png\") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;";
|
||||
|
@ -141,7 +141,17 @@ function vbar_graph(
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
return html_print_image (
|
||||
$no_data_image,
|
||||
true,
|
||||
array(
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => __('No data to show')
|
||||
),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if($ttl == 2){
|
||||
@ -271,7 +281,17 @@ function hbar_graph($chart_data, $width, $height,
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
return html_print_image (
|
||||
$no_data_image,
|
||||
true,
|
||||
array(
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'title' => __('No data to show')
|
||||
),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if($ttl == 2){
|
||||
|
@ -204,7 +204,7 @@
|
||||
|
||||
$form
|
||||
.prop('method', 'POST')
|
||||
.prop('action', plot.getOptions().export.homeurl + '/include/graphs/export_data.php')
|
||||
.prop('action', plot.getOptions().export.homeurl + 'include/graphs/export_data.php')
|
||||
.append($dataInput, $typeInput, $separatorInput, $excelInput)
|
||||
.hide()
|
||||
// Firefox made me write into the DOM for this :(
|
||||
@ -394,7 +394,7 @@
|
||||
|
||||
$form
|
||||
.prop('method', 'POST')
|
||||
.prop('action', plot.getOptions().export.homeurl + '/include/graphs/export_data.php')
|
||||
.prop('action', plot.getOptions().export.homeurl + 'include/graphs/export_data.php')
|
||||
.append($dataInput, $typeInput, $separatorInput, $excelInput)
|
||||
.hide()
|
||||
// Firefox made me write into the DOM for this :(
|
||||
|
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