Merge branch 'develop' into ent-4618-8580-4526-Bug-en-los-CSV-report
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, AIX version
|
||||
# Version 7.0NG.739, 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.738, FreeBSD Version
|
||||
# Version 7.0NG.739, 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.738, HP-UX Version
|
||||
# Version 7.0NG.739, 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.738, GNU/Linux
|
||||
# Version 7.0NG.739, 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.738, GNU/Linux
|
||||
# Version 7.0NG.739, 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.738, Solaris Version
|
||||
# Version 7.0NG.739, 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.738
|
||||
# Version 7.0NG.739
|
||||
|
||||
# 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.738, AIX version
|
||||
# Version 7.0NG.739, 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.738
|
||||
# Version 7.0NG.739
|
||||
# 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.738, HPUX Version
|
||||
# Version 7.0NG.739, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
# 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.738, Solaris version
|
||||
# Version 7.0NG.739, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, AIX version
|
||||
# Version 7.0NG.739, 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.738-190917
|
||||
Version: 7.0NG.739-191011
|
||||
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.738-190917"
|
||||
pandora_version="7.0NG.739-191011"
|
||||
|
||||
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.738, GNU/Linux
|
||||
# Version 7.0NG.739, 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.738, FreeBSD Version
|
||||
# Version 7.0NG.739, 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.738, HP-UX Version
|
||||
# Version 7.0NG.739, 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.738, GNU/Linux
|
||||
# Version 7.0NG.739, 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.738, GNU/Linux
|
||||
# Version 7.0NG.739, 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.738, NetBSD Version
|
||||
# Version 7.0NG.739, 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.738, Solaris Version
|
||||
# Version 7.0NG.739, 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.738';
|
||||
use constant AGENT_BUILD => '190917';
|
||||
use constant AGENT_VERSION => '7.0NG.739';
|
||||
use constant AGENT_BUILD => '191011';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -239,6 +239,15 @@ my $tentacle_pid = undef;
|
|||
# PID of udp_server
|
||||
my $udp_server_pid = undef;
|
||||
|
||||
# BrokerFlag
|
||||
my $BrokerFlag = 0;
|
||||
|
||||
# Global loop counter.
|
||||
my $LoopCounter = 0;
|
||||
|
||||
# Define a max value for loopCounter to avoid overflow.
|
||||
use constant MAX_LOOP_COUNTER => 1000000000;
|
||||
|
||||
################################################################################
|
||||
# Print usage information and exit.
|
||||
################################################################################
|
||||
|
@ -1385,6 +1394,7 @@ sub sleep_agent {
|
|||
exit (0);
|
||||
}
|
||||
|
||||
$LoopCounter = ($LoopCounter + 1) % MAX_LOOP_COUNTER;
|
||||
return $iter_base_time;
|
||||
}
|
||||
|
||||
|
@ -1699,6 +1709,14 @@ sub exec_module {
|
|||
}
|
||||
|
||||
# Check module interval
|
||||
if ($BrokerFlag > 0) {
|
||||
if ($LoopCounter == 0) {
|
||||
$module->{'counter'} = $module->{'intensive_interval'};
|
||||
} else {
|
||||
$module->{'counter'} = (($LoopCounter -1 ) % $module->{'intensive_interval'});
|
||||
}
|
||||
}
|
||||
|
||||
if (++($module->{'counter'}) < $module->{'intensive_interval'}) {
|
||||
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
|
||||
return;
|
||||
|
@ -2985,7 +3003,6 @@ while (1) {
|
|||
@BrokerPid = ();
|
||||
my @broker_agents = read_config ('broker_agent');
|
||||
foreach my $broker_agent (@broker_agents) {
|
||||
|
||||
# Create broker conf file if it does not exist
|
||||
if (! -e "$ConfDir/${broker_agent}.conf") {
|
||||
write_broker_conf($broker_agent);
|
||||
|
@ -2995,7 +3012,9 @@ while (1) {
|
|||
|
||||
# Broker agent
|
||||
if ($main_agent == 0) {
|
||||
|
||||
# Mark broker flag.
|
||||
$BrokerFlag = 1;
|
||||
|
||||
# Set the configuration file
|
||||
$ConfFile = "${broker_agent}.conf";
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.738
|
||||
%define release 190917
|
||||
%define version 7.0NG.739
|
||||
%define release 191011
|
||||
|
||||
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.738
|
||||
%define release 190917
|
||||
%define version 7.0NG.739
|
||||
%define release 191011
|
||||
|
||||
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.738"
|
||||
PI_BUILD="190917"
|
||||
PI_VERSION="7.0NG.739"
|
||||
PI_BUILD="191011"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -162,7 +162,15 @@ uninstall () {
|
|||
rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null
|
||||
rm -Rf $PANDORA_BASE$PANDORA_REVENT_BIN 2> /dev/null
|
||||
rm -f $DESTDIR/etc/logrotate.d/pandora_agent
|
||||
|
||||
|
||||
# Remove systemd service if exists
|
||||
if [ $(systemctl --v | grep systemd | wc -l) != 0 ]
|
||||
then
|
||||
PANDORA_AGENT_SERVICE="/etc/systemd/system/pandora_agent_daemon.service"
|
||||
rm -f $PANDORA_AGENT_SERVICE
|
||||
systemctl reset-failed
|
||||
fi
|
||||
|
||||
#Test if exist Pandora Server in this machine
|
||||
if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ]
|
||||
then
|
||||
|
@ -465,6 +473,22 @@ install () {
|
|||
else
|
||||
RCDIRS="/etc/rc2.d /etc/rc3.d"
|
||||
fi
|
||||
|
||||
# Create systemd service
|
||||
if [ $(systemctl --v | grep systemd | wc -l) != 0 ]
|
||||
then
|
||||
echo "Creating systemd service for pandora_agent_daemon"
|
||||
|
||||
PANDORA_AGENT_SERVICE="/etc/systemd/system/pandora_agent_daemon.service"
|
||||
EXEC_START='ExecStart='$PANDORA_BASE$PANDORA_BIN' '$PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
rm -f $PANDORA_AGENT_SERVICE
|
||||
cp pandora_agent_daemon.service $PANDORA_AGENT_SERVICE
|
||||
|
||||
sed -i "s|^ExecStart=.*$|$EXEC_START|g" $PANDORA_AGENT_SERVICE
|
||||
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
[ "$RCDIRS" ] && for RCDIR in $RCDIRS
|
||||
do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
|
||||
# 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.738}
|
||||
{Pandora FMS Windows Agent v7.0NG.739}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{190917}
|
||||
{191011}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -1422,48 +1422,48 @@ Pandora_Module::evaluatePreconditions () {
|
|||
buffer[read] = '\0';
|
||||
output += (char *) buffer;
|
||||
}
|
||||
|
||||
try {
|
||||
double_output = Pandora_Strutils::strtodouble (output);
|
||||
} catch (Pandora_Strutils::Invalid_Conversion e) {
|
||||
double_output = 0;
|
||||
|
||||
try {
|
||||
double_output = Pandora_Strutils::strtodouble (output);
|
||||
} catch (Pandora_Strutils::Invalid_Conversion e) {
|
||||
double_output = 0;
|
||||
}
|
||||
|
||||
if (dwRet == WAIT_OBJECT_0) {
|
||||
break;
|
||||
} else if(this->getTimeout() < GetTickCount() - tickbase) {
|
||||
/* STILL_ACTIVE */
|
||||
TerminateProcess(pi.hThread, STILL_ACTIVE);
|
||||
pandoraLog ("evaluatePreconditions: %s timed out (retcode: %d)", this->module_name.c_str (), STILL_ACTIVE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dwRet == WAIT_OBJECT_0) {
|
||||
break;
|
||||
} else if(this->getTimeout() < GetTickCount() - tickbase) {
|
||||
/* STILL_ACTIVE */
|
||||
TerminateProcess(pi.hThread, STILL_ACTIVE);
|
||||
pandoraLog ("evaluatePreconditions: %s timed out (retcode: %d)", this->module_name.c_str (), STILL_ACTIVE);
|
||||
break;
|
||||
GetExitCodeProcess (pi.hProcess, &retval);
|
||||
|
||||
if (retval != 0) {
|
||||
if (! TerminateJobObject (job, 0)) {
|
||||
pandoraLog ("evaluatePreconditions: TerminateJobObject failed. (error %d)",
|
||||
GetLastError ());
|
||||
}
|
||||
if (retval != STILL_ACTIVE) {
|
||||
pandoraLog ("evaluatePreconditions: %s did not executed well (retcode: %d)",
|
||||
this->module_name.c_str (), retval);
|
||||
}
|
||||
/* Close job, process and thread handles. */
|
||||
CloseHandle (job);
|
||||
CloseHandle (pi.hProcess);
|
||||
CloseHandle (pi.hThread);
|
||||
CloseHandle (new_stdout);
|
||||
CloseHandle (out_read);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
GetExitCodeProcess (pi.hProcess, &retval);
|
||||
|
||||
if (retval != 0) {
|
||||
if (! TerminateJobObject (job, 0)) {
|
||||
pandoraLog ("evaluatePreconditions: TerminateJobObject failed. (error %d)",
|
||||
GetLastError ());
|
||||
}
|
||||
if (retval != STILL_ACTIVE) {
|
||||
pandoraLog ("evaluatePreconditions: %s did not executed well (retcode: %d)",
|
||||
this->module_name.c_str (), retval);
|
||||
}
|
||||
|
||||
/* Close job, process and thread handles. */
|
||||
CloseHandle (job);
|
||||
CloseHandle (pi.hProcess);
|
||||
CloseHandle (pi.hThread);
|
||||
CloseHandle (new_stdout);
|
||||
CloseHandle (out_read);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Close job, process and thread handles. */
|
||||
CloseHandle (job);
|
||||
CloseHandle (pi.hProcess);
|
||||
CloseHandle (pi.hThread);
|
||||
}
|
||||
|
||||
CloseHandle (new_stdout);
|
||||
CloseHandle (out_read);
|
||||
|
@ -1693,4 +1693,18 @@ Pandora_Module::getAsync () {
|
|||
return this->async;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current exections
|
||||
*/
|
||||
long
|
||||
Pandora_Module::getExecutions () {
|
||||
return this->executions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set current execution (global) used for brokers.
|
||||
*/
|
||||
void
|
||||
Pandora_Module::setExecutions (long executions) {
|
||||
this->executions = executions;
|
||||
}
|
||||
|
|
|
@ -234,6 +234,8 @@ namespace Pandora_Modules {
|
|||
int getTimeout ();
|
||||
string getSave ();
|
||||
bool getAsync ();
|
||||
void setExecutions(long executions=0);
|
||||
long getExecutions();
|
||||
|
||||
virtual string getXml ();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.738(Build 190917)")
|
||||
#define PANDORA_VERSION ("7.0NG.739(Build 191011)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -1849,7 +1849,7 @@ Pandora_Windows_Service::sendBufferedXml (string path) {
|
|||
}
|
||||
|
||||
void
|
||||
Pandora_Windows_Service::pandora_run_broker (string config) {
|
||||
Pandora_Windows_Service::pandora_run_broker (string config, long executions) {
|
||||
Pandora_Agent_Conf *conf = NULL;
|
||||
string server_addr;
|
||||
unsigned char data_flag = 0;
|
||||
|
@ -1876,7 +1876,10 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||
Pandora_Module *module;
|
||||
|
||||
module = this->broker_modules->getCurrentValue ();
|
||||
|
||||
|
||||
/* Keep executions matching main agent */
|
||||
module->setExecutions(executions);
|
||||
|
||||
/* Check preconditions */
|
||||
if (module->evaluatePreconditions () == 0) {
|
||||
pandoraDebug ("Preconditions not matched for module %s", module->getName ().c_str ());
|
||||
|
@ -2074,7 +2077,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
|||
check_broker_agents(all_conf);
|
||||
for (i=0;i<num;i++){
|
||||
pandora_init_broker(all_conf[i]);
|
||||
pandora_run_broker(all_conf[i]);
|
||||
pandora_run_broker(all_conf[i], execution_number);
|
||||
}
|
||||
delete []all_conf;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace Pandora {
|
|||
int checkConfig (string file);
|
||||
void purgeDiskCollections ();
|
||||
void pandora_init_broker (string file_conf);
|
||||
void pandora_run_broker (string config);
|
||||
void pandora_run_broker (string config, long executions=0);
|
||||
int count_broker_agents();
|
||||
void check_broker_agents(string *all_conf);
|
||||
int launchTentacleProxy();
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.738(Build 190917))"
|
||||
VALUE "ProductVersion", "(7.0NG.739(Build 191011))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.738-190917
|
||||
Version: 7.0NG.739-191011
|
||||
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.738-190917"
|
||||
pandora_version="7.0NG.739-191011"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -239,17 +239,18 @@ function output_xml_report($id)
|
|||
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
break;
|
||||
/*
|
||||
case 'TTRT':
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
break;
|
||||
case 'TTO':
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
break;
|
||||
case 'MTBF':
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
break;
|
||||
case 'MTTR':
|
||||
break;*/
|
||||
}
|
||||
|
||||
echo "</item>\n";
|
||||
|
|
|
@ -376,17 +376,18 @@ function process_upload_xml_report($xml, $group_filter=0)
|
|||
$values['column_separator'] = io_safe_input($item['column_separator']);
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
break;
|
||||
/*
|
||||
case 'TTRT':
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
break;
|
||||
case 'TTO':
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
break;
|
||||
case 'MTBF':
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
break;
|
||||
case 'MTTR':
|
||||
break;*/
|
||||
}
|
||||
|
||||
if (empty($agents_item)) {
|
||||
|
|
|
@ -1,7 +1,44 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tdatabase` MODIFY `last_error` text;
|
||||
ALTER TABLE `tdatabase` MODIFY `host` VARCHAR(255) DEFAULT '';
|
||||
ALTER TABLE `tdatabase` ADD COLUMN `label` VARCHAR(255) DEFAULT '';
|
||||
ALTER TABLE `tdatabase` MODIFY `os_user` VARCHAR(255) DEFAULT '';
|
||||
ALTER TABLE `tdatabase` MODIFY `db_port` INT UNSIGNED NOT NULL DEFAULT 3306;
|
||||
ALTER TABLE `tdatabase` MODIFY `os_port` INT UNSIGNED NOT NULL DEFAULT 22;
|
||||
ALTER TABLE `tdatabase` ADD COLUMN `ssh_key` TEXT;
|
||||
ALTER TABLE `tdatabase` ADD COLUMN `ssh_pubkey` TEXT;
|
||||
|
||||
UPDATE `tdatabase` set `label`=`host`;
|
||||
|
||||
UPDATE `tlayout_data` SET `height` = 70 , `width` = 70 WHERE `height` = 0 && `width` = 0 && image NOT LIKE '%dot%' && ((`type` IN (0,5)) ||
|
||||
(`type` = 10 && `image` IS NOT NULL && `image` != '' && `image` != 'none') ||
|
||||
(`type` = 11 && `image` IS NOT NULL && `image` != '' && `image` != 'none' && `show_statistics` = 0));
|
||||
|
||||
COMMIT;
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_enabled', 0);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_user', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_pass', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_hostname', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_api_pass', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_req_timeout', 5);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('default_group', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('default_criticity', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('default_creator', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('default_owner', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_type', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_status', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_title', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_content', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_group', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_criticity', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_creator', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_owner', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_type', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_status', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -726,7 +726,7 @@ render_info_data(
|
|||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Pandora FMS Licence Information').'</th></tr>';
|
||||
|
||||
render_row(html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true), 'Customer key');
|
||||
render_row($license['expiry_date'], 'Expires');
|
||||
render_row($license['expiry_date'], $license['expiry_caption']);
|
||||
render_row($license['limit'].' agents', 'Platform Limit');
|
||||
render_row($license['count'].' agents', 'Current Platform Count');
|
||||
render_row($license['count_enabled'].' agents', 'Current Platform Count (enabled: items)');
|
||||
|
|
|
@ -219,14 +219,17 @@ CREATE TABLE IF NOT EXISTS `tdashboard` (
|
|||
-- Table `tdatabase`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tdatabase` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`host` varchar(100) default '',
|
||||
`os_port` int(4) unsigned default '22',
|
||||
`os_user` varchar(100) default '',
|
||||
`db_port` int(4) unsigned default '3306',
|
||||
`id` INT(10) unsigned NOT NULL auto_increment,
|
||||
`host` VARCHAR(255) default '',
|
||||
`label` VARCHAR(255) default '',
|
||||
`os_port` INT UNSIGNED NOT NULL DEFAULT 22,
|
||||
`os_user` VARCHAR(255) default '',
|
||||
`db_port` INT UNSIGNED NOT NULL DEFAULT 3306,
|
||||
`status` tinyint(1) unsigned default '0',
|
||||
`action` tinyint(1) unsigned default '0',
|
||||
`last_error` varchar(255) default '',
|
||||
`ssh_key` TEXT,
|
||||
`ssh_pubkey` TEXT,
|
||||
`last_error` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
||||
|
||||
|
@ -798,6 +801,7 @@ ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) D
|
|||
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
|
||||
ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
|
||||
|
@ -1243,19 +1247,39 @@ 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', 31);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 32);
|
||||
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', '737');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '739');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_enabled';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_inventory';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_url';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_user', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_pass', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_hostname', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_api_pass', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('integria_req_timeout', 5);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('default_group', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('default_criticity', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('default_creator', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('default_owner', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_type', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_status', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_title', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('incident_content', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_group', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_criticity', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_creator', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_default_owner', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_type', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_status', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_title', '');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('cr_incident_content', '');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
|
@ -1454,6 +1478,7 @@ ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
|||
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
|
||||
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
|
||||
ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
|
||||
ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
<?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 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.
|
||||
/**
|
||||
* Manage database HA cluster.
|
||||
*
|
||||
* @category Manager
|
||||
* @package Pandora FMS
|
||||
* @subpackage Database HA cluster
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2007-2012 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
* You cannnot redistribute it without written permission of copyright holder.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
@ -24,8 +34,6 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
|||
}
|
||||
|
||||
ui_require_css_file('firts_task');
|
||||
?>
|
||||
<?php
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clusters defined yet.') ]);
|
||||
?>
|
||||
|
||||
|
@ -44,8 +52,9 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clus
|
|||
</p>
|
||||
|
||||
<?php
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
echo "<div id='create_master_window'></div>";
|
||||
echo "<div id='msg'></div>";
|
||||
?>
|
||||
<input style="margin-bottom:20px;" onclick="show_create_ha_cluster();" type="submit" class="button_task" value="<?php echo __('Add new node'); ?>" />
|
||||
<?php
|
||||
|
@ -53,35 +62,3 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clus
|
|||
?>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function show_create_ha_cluster() {
|
||||
var params = {};
|
||||
params["dialog_master"] = 1;
|
||||
params["page"] = "enterprise/include/ajax/HA_cluster.ajax";
|
||||
jQuery.ajax ({
|
||||
data: params,
|
||||
dataType: "html",
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
success: function (data) {
|
||||
$("#create_master_window").dialog ({
|
||||
title: '<?php echo __('Add master node'); ?>',
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
close: function() {
|
||||
|
||||
},
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 800,
|
||||
height: 600
|
||||
}).empty()
|
||||
.html(data)
|
||||
.show ();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -353,7 +353,7 @@ html_print_table($table);
|
|||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
echo '<span id="oid_loading" class="invisible">'.html_print_image('images/spinner.gif', true).'</span>';
|
||||
html_print_submit_button(__('WMI Explore'), 'wmi_explore', false, ['class' => 'sub next']);
|
||||
echo '</div>';
|
||||
echo '</div><br>';
|
||||
|
||||
if ($wmiexplore && $fail) {
|
||||
ui_print_error_message(__('Unable to do WMI explorer'));
|
||||
|
@ -364,7 +364,7 @@ unset($table);
|
|||
echo '</form>';
|
||||
|
||||
if ($wmiexplore && !$fail) {
|
||||
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||
echo '<br><span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=wmi_explorer&id_agente=$id_agent'>";
|
||||
echo '<span id="form_interfaces">';
|
||||
|
||||
|
@ -379,7 +379,7 @@ if ($wmiexplore && !$fail) {
|
|||
// Namespace
|
||||
html_print_input_hidden('server_to_exec', $server_to_exec);
|
||||
|
||||
$table->width = '98%';
|
||||
$table->width = '100%';
|
||||
|
||||
// Mode selector
|
||||
$modes = [];
|
||||
|
@ -404,7 +404,7 @@ if ($wmiexplore && !$fail) {
|
|||
|
||||
$table->colspan[1][0] = 2;
|
||||
$table->data[1][2] = '<b>'.__('Modules').'</b>';
|
||||
$table->cellstyle[1][2] = 'vertical-align: middle;';
|
||||
$table->cellstyle[1][2] = 'text-align: center;';
|
||||
|
||||
// Components list
|
||||
$table->data[2][0] = '<div class="wizard_mode_form wizard_mode_components">';
|
||||
|
@ -495,7 +495,7 @@ if ($wmiexplore && !$fail) {
|
|||
'width: 300px;'
|
||||
);
|
||||
$table->data[2][0] .= '</div>';
|
||||
$table->cellstyle[2][0] = 'vertical-align: top; text-align: center;';
|
||||
$table->cellstyle[2][0] = 'vertical-align: bottom; text-align: center;';
|
||||
|
||||
|
||||
// Components arrow
|
||||
|
|
|
@ -1382,8 +1382,8 @@ if ($update_module || $create_module) {
|
|||
$ff_event_normal = (int) get_parameter('ff_event_normal');
|
||||
$ff_event_warning = (int) get_parameter('ff_event_warning');
|
||||
$ff_event_critical = (int) get_parameter('ff_event_critical');
|
||||
$ff_type = (int) get_parameter('ff_type');
|
||||
$each_ff = (int) get_parameter('each_ff');
|
||||
$ff_type = (int) get_parameter('ff_type', $module['ff_type']);
|
||||
$each_ff = (int) get_parameter('each_ff', $module['each_ff']);
|
||||
$ff_timeout = (int) get_parameter('ff_timeout');
|
||||
$unit = (string) get_parameter('unit');
|
||||
$id_tag = (array) get_parameter('id_tag_selected');
|
||||
|
|
|
@ -1191,49 +1191,54 @@ $table_relations->data[-1][3] .= html_print_image('images/lock.png', true).'</a>
|
|||
$table_relations->data[-1][4] = '<a id="delete_relation_button" href="">';
|
||||
$table_relations->data[-1][4] .= html_print_image('images/cross.png', true).'</a>';
|
||||
|
||||
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
|
||||
if (!$module_relations) {
|
||||
$module_relations = [];
|
||||
}
|
||||
|
||||
$relations_count = 0;
|
||||
foreach ($module_relations as $key => $module_relation) {
|
||||
if ($module_relation['module_a'] == $id_agent_module) {
|
||||
$module_id = $module_relation['module_b'];
|
||||
$agent_id = modules_give_agent_id_from_module_id(
|
||||
$module_relation['module_b']
|
||||
);
|
||||
} else {
|
||||
$module_id = $module_relation['module_a'];
|
||||
$agent_id = modules_give_agent_id_from_module_id(
|
||||
$module_relation['module_a']
|
||||
);
|
||||
if ($id_agent_module) {
|
||||
$module_relations = modules_get_relations(['id_module' => $id_agent_module]);
|
||||
|
||||
if (!$module_relations) {
|
||||
$module_relations = [];
|
||||
}
|
||||
|
||||
$agent_name = ui_print_agent_name($agent_id, true);
|
||||
$relations_count = 0;
|
||||
foreach ($module_relations as $key => $module_relation) {
|
||||
if ($module_relation['module_a'] == $id_agent_module) {
|
||||
$module_id = $module_relation['module_b'];
|
||||
$agent_id = modules_give_agent_id_from_module_id(
|
||||
$module_relation['module_b']
|
||||
);
|
||||
} else {
|
||||
$module_id = $module_relation['module_a'];
|
||||
$agent_id = modules_give_agent_id_from_module_id(
|
||||
$module_relation['module_a']
|
||||
);
|
||||
}
|
||||
|
||||
$module_name = modules_get_agentmodule_name($module_id);
|
||||
if (empty($module_name) || $module_name == 'false') {
|
||||
$module_name = $module_id;
|
||||
$agent_name = ui_print_agent_name($agent_id, true);
|
||||
|
||||
$module_name = modules_get_agentmodule_name($module_id);
|
||||
if (empty($module_name) || $module_name == 'false') {
|
||||
$module_name = $module_id;
|
||||
}
|
||||
|
||||
if ($module_relation['disable_update']) {
|
||||
$disabled_update_class = '';
|
||||
} else {
|
||||
$disabled_update_class = 'alpha50';
|
||||
}
|
||||
|
||||
// Agent name.
|
||||
$table_relations->data[$relations_count][0] = $agent_name;
|
||||
// Module name.
|
||||
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[…]').'</a>';
|
||||
// Type.
|
||||
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
|
||||
// Lock relationship updates.
|
||||
$table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
|
||||
// Delete relationship.
|
||||
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
|
||||
$relations_count++;
|
||||
}
|
||||
|
||||
if ($module_relation['disable_update']) {
|
||||
$disabled_update_class = '';
|
||||
} else {
|
||||
$disabled_update_class = 'alpha50';
|
||||
}
|
||||
|
||||
// Agent name.
|
||||
$table_relations->data[$relations_count][0] = $agent_name;
|
||||
// Module name.
|
||||
$table_relations->data[$relations_count][1] = "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=".$agent_id.'&tab=module&edit_module=1&id_agent_module='.$module_id."'>".ui_print_truncate_text($module_name, 'module_medium', true, true, true, '[…]').'</a>';
|
||||
// Type.
|
||||
$table_relations->data[$relations_count][2] = ($module_relation['type'] === 'direct') ? __('Direct') : __('Failover');
|
||||
// Lock relationship updates.
|
||||
$table_relations->data[$relations_count][3] = '<a id="disable_updates_button" class="'.$disabled_update_class.'"href="javascript: change_lock_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/lock.png', true).'</a>';
|
||||
// Delete relationship.
|
||||
$table_relations->data[$relations_count][4] = '<a id="delete_relation_button" href="javascript: delete_relation('.$relations_count.', '.$module_relation['id'].');">'.html_print_image('images/cross.png', true).'</a>';
|
||||
$relations_count++;
|
||||
}
|
||||
|
||||
html_print_input_hidden('module_relations_count', $relations_count);
|
||||
|
|
|
@ -29,599 +29,43 @@
|
|||
// Begin.
|
||||
global $config;
|
||||
|
||||
// Check access.
|
||||
check_login();
|
||||
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access event viewer'
|
||||
);
|
||||
$ajaxPage = 'godmode/groups/credential_store';
|
||||
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$cs = new CredentialStore($ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
if (is_ajax()) {
|
||||
return ['error' => 'noaccess'];
|
||||
echo json_encode(['error' => '[CredentialStore]'.$e->getMessage() ]);
|
||||
exit;
|
||||
} else {
|
||||
echo '[CredentialStore]'.$e->getMessage();
|
||||
}
|
||||
|
||||
include 'general/noaccess.php';
|
||||
// Stop this execution, but continue 'globally'.
|
||||
return;
|
||||
}
|
||||
|
||||
// Required files.
|
||||
ui_require_css_file('credential_store');
|
||||
require_once $config['homedir'].'/include/functions_credential_store.php';
|
||||
require_once $config['homedir'].'/include/functions_io.php';
|
||||
|
||||
// AJAX controller.
|
||||
if (is_ajax()) {
|
||||
$draw = get_parameter('draw', 0);
|
||||
$filter = get_parameter('filter', []);
|
||||
$get_key = get_parameter('get_key', 0);
|
||||
$new_form = get_parameter('new_form', 0);
|
||||
$new_key = get_parameter('new_key', 0);
|
||||
$update_key = get_parameter('update_key', 0);
|
||||
$delete_key = get_parameter('delete_key', 0);
|
||||
$method = get_parameter('method');
|
||||
|
||||
if ($new_form) {
|
||||
echo print_inputs();
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($delete_key) {
|
||||
$identifier = get_parameter('identifier', null);
|
||||
|
||||
if (empty($identifier)) {
|
||||
ajax_msg('error', __('identifier cannot be empty'));
|
||||
}
|
||||
|
||||
if (db_process_sql_delete(
|
||||
'tcredential_store',
|
||||
['identifier' => $identifier]
|
||||
) === false
|
||||
) {
|
||||
ajax_msg('error', $config['dbconnection']->error, true);
|
||||
if (method_exists($cs, $method) === true) {
|
||||
if ($cs->ajaxMethod($method) === true) {
|
||||
$cs->{$method}();
|
||||
} else {
|
||||
ajax_msg('result', $identifier, true);
|
||||
$cs->error('Unavailable method.');
|
||||
}
|
||||
} else {
|
||||
$cs->error('Method not found. ['.$method.']');
|
||||
}
|
||||
|
||||
if ($update_key) {
|
||||
$data = get_parameter('values', null);
|
||||
|
||||
if ($data === null || !is_array($data)) {
|
||||
echo json_encode(['error' => __('Invalid parameters, please retry')]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
foreach ($data as $key => $value) {
|
||||
if ($key == 'identifier') {
|
||||
$identifier = base64_decode($value);
|
||||
} else if ($key == 'product') {
|
||||
$product = base64_decode($value);
|
||||
} else {
|
||||
$values[$key] = base64_decode($value);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($identifier)) {
|
||||
ajax_msg('error', __('identifier cannot be empty'));
|
||||
}
|
||||
|
||||
if (empty($product)) {
|
||||
ajax_msg('error', __('product cannot be empty'));
|
||||
}
|
||||
|
||||
if (db_process_sql_update(
|
||||
'tcredential_store',
|
||||
$values,
|
||||
['identifier' => $identifier]
|
||||
) === false
|
||||
) {
|
||||
ajax_msg('error', $config['dbconnection']->error);
|
||||
} else {
|
||||
ajax_msg('result', $identifier);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($new_key) {
|
||||
$data = get_parameter('values', null);
|
||||
|
||||
if ($data === null || !is_array($data)) {
|
||||
echo json_encode(['error' => __('Invalid parameters, please retry')]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$values[$key] = base64_decode($value);
|
||||
if ($key == 'identifier') {
|
||||
$values[$key] = preg_replace('/\s+/', '-', trim($values[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
$identifier = $values['identifier'];
|
||||
|
||||
if (empty($identifier)) {
|
||||
ajax_msg('error', __('identifier cannot be empty'));
|
||||
}
|
||||
|
||||
if (empty($values['product'])) {
|
||||
ajax_msg('error', __('product cannot be empty'));
|
||||
}
|
||||
|
||||
if (db_process_sql_insert('tcredential_store', $values) === false) {
|
||||
ajax_msg('error', $config['dbconnection']->error);
|
||||
} else {
|
||||
ajax_msg('result', $identifier);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($get_key) {
|
||||
$identifier = get_parameter('identifier', null);
|
||||
|
||||
$key = get_key($identifier);
|
||||
echo print_inputs($key);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($draw) {
|
||||
// Datatables offset, limit and order.
|
||||
$start = get_parameter('start', 0);
|
||||
$length = get_parameter('length', $config['block_size']);
|
||||
$order = get_datatable_order(true);
|
||||
try {
|
||||
ob_start();
|
||||
|
||||
$fields = [
|
||||
'cs.*',
|
||||
'tg.nombre as `group`',
|
||||
];
|
||||
|
||||
// Retrieve data.
|
||||
$data = credentials_get_all(
|
||||
// Fields.
|
||||
$fields,
|
||||
// Filter.
|
||||
$filter,
|
||||
// Offset.
|
||||
$start,
|
||||
// Limit.
|
||||
$length,
|
||||
// Order.
|
||||
$order['direction'],
|
||||
// Sort field.
|
||||
$order['field']
|
||||
);
|
||||
|
||||
// Retrieve counter.
|
||||
$count = credentials_get_all(
|
||||
'count',
|
||||
$filter
|
||||
);
|
||||
|
||||
if ($data) {
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $item) {
|
||||
// Transforms array of arrays $data into an array
|
||||
// of objects, making a post-process of certain fields.
|
||||
$tmp = (object) $item;
|
||||
$tmp->username = io_safe_output($tmp->username);
|
||||
|
||||
if (empty($tmp->group)) {
|
||||
$tmp->group = __('All');
|
||||
} else {
|
||||
$tmp->group = io_safe_output($tmp->group);
|
||||
}
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Datatables format: RecordsTotal && recordsfiltered.
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $data,
|
||||
'recordsTotal' => $count,
|
||||
'recordsFiltered' => $count,
|
||||
]
|
||||
);
|
||||
// Capture output.
|
||||
$response = ob_get_clean();
|
||||
} catch (Exception $e) {
|
||||
return json_encode(['error' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
// If not valid, show error with issue.
|
||||
json_decode($response);
|
||||
if (json_last_error() == JSON_ERROR_NONE) {
|
||||
// If valid dump.
|
||||
echo $response;
|
||||
} else {
|
||||
echo json_encode(
|
||||
['error' => $response]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
||||
} else {
|
||||
// Run.
|
||||
$cs->run();
|
||||
}
|
||||
|
||||
// Datatables list.
|
||||
try {
|
||||
$columns = [
|
||||
'group',
|
||||
'identifier',
|
||||
'product',
|
||||
'username',
|
||||
'options',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('Group'),
|
||||
__('Identifier'),
|
||||
__('Product'),
|
||||
__('User'),
|
||||
[
|
||||
'text' => __('Options'),
|
||||
'class' => 'action_buttons',
|
||||
],
|
||||
];
|
||||
|
||||
$table_id = 'keystore';
|
||||
// Load datatables user interface.
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => $table_id,
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => 'godmode/groups/credential_store',
|
||||
'ajax_postprocess' => 'process_datatables_item(item)',
|
||||
'no_sortable_columns' => [-1],
|
||||
'order' => [
|
||||
'field' => 'identifier',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Group'),
|
||||
'type' => 'select',
|
||||
'id' => 'filter_id_group',
|
||||
'name' => 'filter_id_group',
|
||||
'options' => users_get_groups_for_select(
|
||||
$config['id_user'],
|
||||
'AR',
|
||||
true,
|
||||
true,
|
||||
false
|
||||
),
|
||||
],
|
||||
[
|
||||
'label' => __('Free search'),
|
||||
'type' => 'text',
|
||||
'class' => 'mw250px',
|
||||
'id' => 'free_search',
|
||||
'name' => 'free_search',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
// Auxiliar div.
|
||||
$new = '<div id="new_key" style="display: none"><form id="form_new">';
|
||||
$new .= '</form></div>';
|
||||
$details = '<div id="info_key" style="display: none"><form id="form_update">';
|
||||
$details .= '</form></div>';
|
||||
$aux = '<div id="aux" style="display: none"></div>';
|
||||
|
||||
|
||||
echo $new.$details.$aux;
|
||||
|
||||
// Create button.
|
||||
echo '<div class="w100p flex-content-right">';
|
||||
html_print_submit_button(
|
||||
__('Add key'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function process_datatables_item(item) {
|
||||
item.options = '<a href="javascript:" onclick="display_key(\'';
|
||||
item.options += item.identifier;
|
||||
item.options += '\')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show')]); ?></a>';
|
||||
|
||||
item.options += '<a href="javascript:" onclick="delete_key(\'';
|
||||
item.options += item.identifier;
|
||||
item.options += '\')" ><?php echo html_print_image('images/cross.png', true, ['title' => __('Delete')]); ?></a>';
|
||||
}
|
||||
|
||||
function handle_response(data) {
|
||||
var title = "<?php echo __('Success'); ?>";
|
||||
var text = '';
|
||||
var failed = 0;
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
text = data['result'];
|
||||
} catch (err) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = err.message;
|
||||
failed = 1;
|
||||
}
|
||||
if (!failed && data['error'] != undefined) {
|
||||
title = "<?php echo __('Failed'); ?>";
|
||||
text = data['error'];
|
||||
failed = 1;
|
||||
}
|
||||
|
||||
$('#aux').empty();
|
||||
$('#aux').html(text);
|
||||
$('#aux').dialog({
|
||||
width: 450,
|
||||
position: {
|
||||
my: 'center',
|
||||
at: 'center',
|
||||
of: window,
|
||||
collision: 'fit'
|
||||
},
|
||||
title: title,
|
||||
buttons: [
|
||||
{
|
||||
text: 'OK',
|
||||
click: function(e) {
|
||||
if (!failed) {
|
||||
dt_<?php echo $table_id; ?>.draw(0);
|
||||
$(".ui-dialog-content").dialog("close");
|
||||
cleanupDOM();
|
||||
} else {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function delete_key(id) {
|
||||
$('#aux').empty();
|
||||
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
||||
$('#aux').dialog({
|
||||
title: '<?php echo __('Delete'); ?> ' + id,
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: '<?php echo __('Cancel'); ?>',
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Delete',
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
click: function(e) {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
delete_key: 1,
|
||||
identifier: id
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
handle_response(data);
|
||||
},
|
||||
error: function(e) {
|
||||
handle_response(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function display_key(id) {
|
||||
$('#form_update').empty();
|
||||
$('#form_update').html('Loading...');
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
get_key: 1,
|
||||
identifier: id
|
||||
},
|
||||
success: function (data) {
|
||||
$('#info_key').dialog({
|
||||
width: 580,
|
||||
height: 400,
|
||||
position: {
|
||||
my: 'center',
|
||||
at: 'center',
|
||||
of: window,
|
||||
collision: 'fit'
|
||||
},
|
||||
title: id,
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: '<?php echo __('Cancel'); ?>',
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Update',
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
click: function(e) {
|
||||
var values = {};
|
||||
|
||||
$('#form_update :input').each(function() {
|
||||
values[this.name] = btoa($(this).val());
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
update_key: 1,
|
||||
values: values
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
handle_response(data);
|
||||
},
|
||||
error: function(e) {
|
||||
handle_response(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
$('#form_update').html(data);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function cleanupDOM() {
|
||||
$('#div-identifier').empty();
|
||||
$('#div-product').empty();
|
||||
$('#div-username').empty();
|
||||
$('#div-password').empty();
|
||||
$('#div-extra_1').empty();
|
||||
$('#div-extra_2').empty();
|
||||
}
|
||||
|
||||
function calculate_inputs() {
|
||||
if ($('#product :selected').val() == "CUSTOM") {
|
||||
$('#div-username label').text('<?php echo __('User'); ?>');
|
||||
$('#div-password label').text('<?php echo __('Password'); ?>');
|
||||
$('#div-extra_1').hide();
|
||||
$('#div-extra_2').hide();
|
||||
} else if ($('#product :selected').val() == "AWS") {
|
||||
$('#div-username label').text('<?php echo __('Access key ID'); ?>');
|
||||
$('#div-password label').text('<?php echo __('Secret access key'); ?>');
|
||||
$('#div-extra_1').hide();
|
||||
$('#div-extra_2').hide();
|
||||
} else if ($('#product :selected').val() == "AZURE") {
|
||||
$('#div-username label').text('<?php echo __('Client ID'); ?>');
|
||||
$('#div-password label').text('<?php echo __('Application secret'); ?>');
|
||||
$('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
|
||||
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
|
||||
$('#div-extra_1').show();
|
||||
$('#div-extra_2').show();
|
||||
}
|
||||
}
|
||||
|
||||
function add_key() {
|
||||
// Clear form.
|
||||
$('#form_update').empty();
|
||||
$('#form_update').html('Loading...');
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
new_form: 1
|
||||
},
|
||||
success: function(data) {
|
||||
$('#form_new').html(data);
|
||||
$('#id_group').val(0);
|
||||
// By default CUSTOM.
|
||||
$('#product').val('CUSTOM');
|
||||
calculate_inputs();
|
||||
|
||||
$('#product').on('change', function() {
|
||||
calculate_inputs()
|
||||
});
|
||||
|
||||
// Show form.
|
||||
$('#new_key').dialog({
|
||||
width: 580,
|
||||
height: 400,
|
||||
position: {
|
||||
my: 'center',
|
||||
at: 'center',
|
||||
of: window,
|
||||
collision: 'fit'
|
||||
},
|
||||
title: "<?php echo __('Register new key into keystore'); ?>",
|
||||
buttons: [
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
||||
text: "<?php echo __('Cancel'); ?>",
|
||||
click: function(e) {
|
||||
$(this).dialog('close');
|
||||
cleanupDOM();
|
||||
}
|
||||
},
|
||||
{
|
||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
||||
text: 'OK',
|
||||
click: function(e) {
|
||||
var values = {};
|
||||
$('#form_new :input').each(function() {
|
||||
values[this.name] = btoa($(this).val());
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
data: {
|
||||
page: 'godmode/groups/credential_store',
|
||||
new_key: 1,
|
||||
values: values
|
||||
},
|
||||
datatype: "json",
|
||||
success: function (data) {
|
||||
handle_response(data);
|
||||
},
|
||||
error: function(e) {
|
||||
handle_response(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
]
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#submit-create").on('click', function(){
|
||||
add_key();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -199,7 +199,7 @@ if ($update_agents) {
|
|||
}
|
||||
|
||||
// Update the configuration files.
|
||||
if ($result && ($old_interval_value != $values['intervalo'])) {
|
||||
if ($result && ($old_interval_value != $values['intervalo']) && !empty($values['intervalo'])) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
[
|
||||
|
|
|
@ -21,27 +21,42 @@ require_once 'include/functions_menu.php';
|
|||
$menu_godmode = [];
|
||||
$menu_godmode['class'] = 'godmode';
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (check_acl($config['id_user'], 0, 'AR')
|
||||
|| check_acl($config['id_user'], 0, 'AW')
|
||||
|| check_acl($config['id_user'], 0, 'RR')
|
||||
|| check_acl($config['id_user'], 0, 'RW')
|
||||
|| check_acl($config['id_user'], 0, 'PM')
|
||||
) {
|
||||
$sub = [];
|
||||
$sub['godmode/servers/discovery&wiz=main']['text'] = __('Main');
|
||||
$sub['godmode/servers/discovery&wiz=main']['id'] = 'Discovery';
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['text'] = __('Task list');
|
||||
$sub['godmode/servers/discovery&wiz=tasklist']['id'] = 'tasklist';
|
||||
|
||||
$sub2 = [];
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
|
||||
enterprise_hook('hostdevices_submenu');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
|
||||
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
|
||||
if (check_acl($config['id_user'], 0, 'AW')
|
||||
|| check_acl($config['id_user'], 0, 'PM')
|
||||
) {
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$sub2 = [];
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=netscan']['text'] = __('Network scan');
|
||||
enterprise_hook('hostdevices_submenu');
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=customnetscan']['text'] = __('Custom network scan');
|
||||
}
|
||||
|
||||
enterprise_hook('applications_menu');
|
||||
enterprise_hook('cloud_menu');
|
||||
enterprise_hook('console_task_menu');
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub2['godmode/servers/discovery&wiz=hd&mode=managenetscanscripts']['text'] = __('Manage scan scripts');
|
||||
}
|
||||
|
||||
$sub['godmode/servers/discovery&wiz=hd']['text'] = __('Host & devices');
|
||||
$sub['godmode/servers/discovery&wiz=hd']['id'] = 'hd';
|
||||
$sub['godmode/servers/discovery&wiz=hd']['sub2'] = $sub2;
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
enterprise_hook('applications_menu');
|
||||
enterprise_hook('cloud_menu');
|
||||
enterprise_hook('console_task_menu');
|
||||
}
|
||||
|
||||
// Add to menu.
|
||||
$menu_godmode['discovery']['text'] = __('Discovery');
|
||||
|
@ -92,7 +107,7 @@ if (!empty($sub)) {
|
|||
}
|
||||
|
||||
$sub = [];
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub['godmode/groups/group_list']['text'] = __('Manage agents groups');
|
||||
$sub['godmode/groups/group_list']['id'] = 'Manage agents groups';
|
||||
}
|
||||
|
@ -295,6 +310,9 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
|||
$sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus');
|
||||
$sub2['godmode/setup/setup&section=ehorus']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup&section=integria']['text'] = __('Integria IMS');
|
||||
$sub2['godmode/setup/setup&section=integria']['refr'] = 0;
|
||||
|
||||
$sub2['godmode/setup/setup&section=notifications']['text'] = __('Notifications');
|
||||
$sub2['godmode/setup/setup&section=notifications']['refr'] = 0;
|
||||
|
||||
|
@ -381,9 +399,6 @@ if (is_array($config['extensions'])) {
|
|||
if (strlen($extmenu['fatherId']) > 0) {
|
||||
if (array_key_exists('subfatherId', $extmenu)) {
|
||||
if (strlen($extmenu['subfatherId']) > 0) {
|
||||
if ($extmenu['name'] = 'DB schema check') {
|
||||
}
|
||||
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['text'] = __($extmenu['name']);
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['id'] = $extmenu['name'];
|
||||
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]['refr'] = 0;
|
||||
|
|
|
@ -257,11 +257,6 @@ $table_aux = new stdClass();
|
|||
$table->cellspacing = 0;
|
||||
$table->align = [];
|
||||
$table->head = [];
|
||||
if ($report_w || $report_m) {
|
||||
$table->align[5] = 'left';
|
||||
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size[5] = '20px';
|
||||
}
|
||||
|
||||
$table->head[0] = __('Graph name');
|
||||
$table->head[1] = __('Description');
|
||||
|
@ -280,6 +275,12 @@ $table_aux = new stdClass();
|
|||
$table->size[4] = '90px';
|
||||
}
|
||||
|
||||
if ($report_w || $report_m) {
|
||||
$table->align[5] = 'left';
|
||||
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size[5] = '20px';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$result_graphs = array_slice($graphs, $offset, $config['block_size']);
|
||||
|
@ -287,10 +288,6 @@ $table_aux = new stdClass();
|
|||
foreach ($result_graphs as $graph) {
|
||||
$data = [];
|
||||
|
||||
if ($report_m) {
|
||||
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
|
||||
}
|
||||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
|
||||
|
||||
$data[1] = ui_print_truncate_text($graph['description'], 70);
|
||||
|
@ -309,6 +306,10 @@ $table_aux = new stdClass();
|
|||
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
if ($report_m) {
|
||||
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ $checks_in_ok_status = true;
|
|||
$unknown_checks = true;
|
||||
$agent_max_value = true;
|
||||
$agent_min_value = true;
|
||||
$uncompressed_module = true;
|
||||
|
||||
switch ($action) {
|
||||
case 'new':
|
||||
|
@ -232,6 +233,8 @@ switch ($action) {
|
|||
|
||||
$style = json_decode(io_safe_output($item['style']), true);
|
||||
|
||||
$name_from_template = $style['name_label'];
|
||||
|
||||
$show_in_same_row = $style['show_in_same_row'];
|
||||
$show_in_landscape = $style['show_in_landscape'];
|
||||
$hide_notinit_agents = $style['hide_notinit_agents'];
|
||||
|
@ -427,6 +430,7 @@ switch ($action) {
|
|||
);
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$period = $item['period'];
|
||||
$uncompressed_module = $item['uncompressed_module'];
|
||||
break;
|
||||
|
||||
case 'historical_data':
|
||||
|
@ -478,7 +482,8 @@ switch ($action) {
|
|||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
/*
|
||||
case 'TTRT':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
|
@ -487,9 +492,9 @@ switch ($action) {
|
|||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
case 'TTO':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
|
@ -498,9 +503,9 @@ switch ($action) {
|
|||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
case 'MTBF':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
|
@ -509,9 +514,9 @@ switch ($action) {
|
|||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
case 'MTTR':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
|
@ -520,8 +525,8 @@ switch ($action) {
|
|||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
break;
|
||||
*/
|
||||
case 'alert_report_module':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
|
@ -786,10 +791,11 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
/*
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'simple_baseline_graph':
|
||||
case 'event_report_log':
|
||||
case 'increment':
|
||||
|
@ -810,7 +816,6 @@ switch ($action) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
$urlForm = $config['homeurl'].'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action='.$actionParameter.'&id_report='.$idReport;
|
||||
|
||||
echo '<form action="'.$urlForm.'" method="post">';
|
||||
|
@ -868,18 +873,33 @@ $class = 'databox filters';
|
|||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
80,
|
||||
100,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'fullwidth'
|
||||
);
|
||||
if ($name_from_template != '') {
|
||||
html_print_input_text(
|
||||
'name',
|
||||
$name_from_template,
|
||||
'',
|
||||
80,
|
||||
100,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'fullwidth'
|
||||
);
|
||||
} else {
|
||||
html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
80,
|
||||
100,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'fullwidth'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -2792,6 +2812,23 @@ $class = 'databox filters';
|
|||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_uncompressed_module" style="" class="datos">
|
||||
<td style="font-weight:bold;">
|
||||
<?php
|
||||
echo __('Uncompress module').ui_print_help_tip(
|
||||
__('Use uncompressed module data.'),
|
||||
true
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_checkbox('uncompressed_module', 1, $item['uncompressed_module'], false, false, '', false);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -3720,10 +3757,10 @@ $(document).ready (function () {
|
|||
case 'event_report_module':
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
case 'TTRT':
|
||||
/* case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'MTTR':*/
|
||||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'avg_value':
|
||||
|
@ -3761,10 +3798,10 @@ $(document).ready (function () {
|
|||
case 'event_report_module':
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
case 'TTRT':
|
||||
/* case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'MTTR':*/
|
||||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'avg_value':
|
||||
|
@ -4524,6 +4561,7 @@ function chooseType() {
|
|||
$('#row_select_fields').hide();
|
||||
$("#row_select_fields2").hide();
|
||||
$("#row_select_fields3").hide();
|
||||
$("#row_uncompressed_module").hide();
|
||||
|
||||
// SLA list default state.
|
||||
$("#sla_list").hide();
|
||||
|
@ -4732,6 +4770,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_uncompressed_module").show();
|
||||
break;
|
||||
|
||||
case 'historical_data':
|
||||
|
@ -4794,7 +4833,7 @@ function chooseType() {
|
|||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'TTRT':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
|
@ -4825,7 +4864,7 @@ function chooseType() {
|
|||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
break;*/
|
||||
|
||||
case 'alert_report_module':
|
||||
$("#row_description").show();
|
||||
|
@ -5179,10 +5218,10 @@ function chooseType() {
|
|||
case 'min_value':
|
||||
case 'max_value':
|
||||
case 'avg_value':
|
||||
case 'TTRT':
|
||||
/* case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'MTTR':*/
|
||||
case 'simple_baseline_graph':
|
||||
$("#row_label").show();
|
||||
break;
|
||||
|
|
|
@ -489,11 +489,18 @@ foreach ($items as $item) {
|
|||
$row[4] = '-';
|
||||
}
|
||||
|
||||
if ($item['name'] == '' && $item['description'] == '') {
|
||||
$row[5] = '-';
|
||||
} else {
|
||||
$text = empty($item['name']) ? $item['description'] : $item['name'];
|
||||
$style = json_decode(io_safe_output($item['style']), true);
|
||||
|
||||
if ($style['name_label'] != '') {
|
||||
$text = empty($style['name_label']) ? $item['description'] : $style['name_label'];
|
||||
$row[5] = ui_print_truncate_text($text, 'description', true, true);
|
||||
} else {
|
||||
if ($item['name'] == '' && $item['description'] == '') {
|
||||
$row[5] = '-';
|
||||
} else {
|
||||
$text = empty($item['name']) ? $item['description'] : $item['name'];
|
||||
$row[5] = ui_print_truncate_text($text, 'description', true, true);
|
||||
}
|
||||
}
|
||||
|
||||
$row[6] = '';
|
||||
|
|
|
@ -1908,6 +1908,11 @@ switch ($action) {
|
|||
$values['id_agent'] = get_parameter('group');
|
||||
}
|
||||
|
||||
if ($values['type'] == 'sumatory') {
|
||||
$values['uncompressed_module'] = get_parameter('uncompressed_module', 0);
|
||||
}
|
||||
|
||||
|
||||
$values['header_definition'] = get_parameter('header');
|
||||
$values['column_separator'] = get_parameter('field');
|
||||
$values['line_separator'] = get_parameter('line');
|
||||
|
@ -2001,10 +2006,11 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
/*
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
|
@ -2464,6 +2470,10 @@ switch ($action) {
|
|||
$values['id_agent'] = get_parameter('group');
|
||||
}
|
||||
|
||||
if ($values['type'] == 'sumatory') {
|
||||
$values['uncompressed_module'] = get_parameter('uncompressed_module', 0);
|
||||
}
|
||||
|
||||
$values['header_definition'] = get_parameter('header');
|
||||
$values['column_separator'] = get_parameter('field');
|
||||
$values['line_separator'] = get_parameter('line');
|
||||
|
@ -2603,10 +2613,11 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
/*
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
|
|
|
@ -4,7 +4,14 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (! check_acl($config['id_user'], 0, 'AR')
|
||||
&& ! check_acl($config['id_user'], 0, 'AW')
|
||||
&& ! check_acl($config['id_user'], 0, 'AM')
|
||||
&& ! check_acl($config['id_user'], 0, 'RR')
|
||||
&& ! check_acl($config['id_user'], 0, 'RW')
|
||||
&& ! check_acl($config['id_user'], 0, 'RM')
|
||||
&& ! check_acl($config['id_user'], 0, 'PM')
|
||||
) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Server Management'
|
||||
|
@ -134,11 +141,18 @@ if ($classname_selected === null) {
|
|||
$classname = basename($classpath, '.class.php');
|
||||
$obj = new $classname();
|
||||
|
||||
$button = $obj->load();
|
||||
|
||||
if ($button === false) {
|
||||
// No acess, skip.
|
||||
continue;
|
||||
}
|
||||
|
||||
// DiscoveryTaskList must be first button.
|
||||
if ($classname == 'DiscoveryTaskList') {
|
||||
array_unshift($wiz_data, $obj->load());
|
||||
array_unshift($wiz_data, $button);
|
||||
} else {
|
||||
$wiz_data[] = $obj->load();
|
||||
$wiz_data[] = $button;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ $table->data = [];
|
|||
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
|
||||
$table->data[0][1] = html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:50px; width:450px;"', true);
|
||||
|
||||
$table->data[1][0] = '<strong>'.__('Expires').'</strong>';
|
||||
$table->data[1][0] = '<strong>'.__($license['expiry_caption']).'</strong>';
|
||||
$table->data[1][1] = html_print_input_text('expires', $license['expiry_date'], '', 10, 255, true, true);
|
||||
|
||||
$table->data[2][0] = '<strong>'.__('Platform Limit').'</strong>';
|
||||
|
|
|
@ -117,6 +117,11 @@ if (check_acl($config['id_user'], 0, 'AW')) {
|
|||
}
|
||||
}
|
||||
|
||||
$buttons['integria'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=integria').'">'.html_print_image('images/integria.png', true, ['title' => __('Integria IMS')]).'</a>',
|
||||
];
|
||||
|
||||
$buttons['ehorus'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=ehorus').'">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
|
||||
|
@ -167,6 +172,12 @@ switch ($section) {
|
|||
$help_header = 'setup_ehorus_tab';
|
||||
break;
|
||||
|
||||
case 'integria':
|
||||
$buttons['integria']['active'] = true;
|
||||
$subpage = ' » '.__('Integria IMS');
|
||||
$help_header = 'setup_integria_tab';
|
||||
break;
|
||||
|
||||
case 'notifications':
|
||||
$buttons['notifications']['active'] = true;
|
||||
$subpage = ' » '.__('Notifications');
|
||||
|
@ -228,6 +239,10 @@ switch ($section) {
|
|||
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
|
||||
break;
|
||||
|
||||
case 'integria':
|
||||
include_once $config['homedir'].'/godmode/setup/setup_integria.php';
|
||||
break;
|
||||
|
||||
case 'notifications':
|
||||
include_once $config['homedir'].'/godmode/setup/setup_notifications.php';
|
||||
break;
|
||||
|
|
|
@ -58,6 +58,16 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
if (is_ajax()) {
|
||||
enterprise_include_once('include/functions_cron.php');
|
||||
|
||||
$test_address = get_parameter('test_address', '');
|
||||
|
||||
$res = enterprise_hook('send_email_attachment', [$test_address, __('This is an email test sent from Pandora FMS. If you can read this, your configuration works.'), __('Testing Pandora FMS email'), null]);
|
||||
|
||||
echo $res;
|
||||
}
|
||||
|
||||
$table = new StdClass();
|
||||
$table->class = 'databox filters';
|
||||
$table->id = 'setup_general';
|
||||
|
@ -68,6 +78,12 @@ $table->size[0] = '30%';
|
|||
$table->style[0] = 'font-weight:bold';
|
||||
$table->size[1] = '70%';
|
||||
|
||||
$table_mail_conf = new stdClass();
|
||||
$table_mail_conf->width = '100%';
|
||||
$table_mail_conf->class = 'databox filters';
|
||||
$table_mail_conf->data = [];
|
||||
$table_mail_conf->style[0] = 'font-weight: bold';
|
||||
|
||||
// Current config["language"] could be set by user, not taken from global setup !
|
||||
$current_system_lang = db_get_sql(
|
||||
'SELECT `value` FROM tconfig WHERE `token` = "language"'
|
||||
|
@ -330,6 +346,49 @@ echo '<legend>'.__('General options').'</legend>';
|
|||
html_print_input_hidden('update_config', 1);
|
||||
html_print_table($table);
|
||||
|
||||
$encryption = [
|
||||
'ssl' => 'SSL/TLS',
|
||||
'sslv2' => 'SSLv2',
|
||||
'sslv3' => 'SSLv3',
|
||||
'tls' => 'STARTTLS',
|
||||
];
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Mail configuration').'</legend>';
|
||||
|
||||
$table_mail_conf->data[0][0] = __('From address');
|
||||
$table_mail_conf->data[0][1] = html_print_input_text('email_from_dir', $config['email_from_dir'], '', 30, 100, true);
|
||||
|
||||
$table_mail_conf->data[1][0] = __('From name');
|
||||
$table_mail_conf->data[1][2] = html_print_input_text('email_from_name', $config['email_from_name'], '', 30, 100, true);
|
||||
|
||||
$table_mail_conf->data[2][0] = __('SMTP Server');
|
||||
$table_mail_conf->data[2][1] = html_print_input_text('email_smtpServer', $config['email_smtpServer'], '', 30, 100, true);
|
||||
|
||||
$table_mail_conf->data[3][0] = __('SMTP Port');
|
||||
$table_mail_conf->data[3][1] = html_print_input_text('email_smtpPort', $config['email_smtpPort'], '', 30, 100, true);
|
||||
|
||||
$table_mail_conf->data[4][0] = __('Encryption');
|
||||
$table_mail_conf->data[4][1] = html_print_select($encryption, 'email_encryption', $config['email_encryption'], '', __('none'), 0, true);
|
||||
|
||||
$table_mail_conf->data[5][0] = __('Email user');
|
||||
$table_mail_conf->data[5][1] = html_print_input_text('email_username', $config['email_username'], '', 30, 100, true);
|
||||
|
||||
$table_mail_conf->data[6][0] = __('Email password');
|
||||
$table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true);
|
||||
|
||||
$uniqid = uniqid();
|
||||
|
||||
$table_mail_conf->data[7][0] = html_print_button(__('Email test'), 'email_test_dialog', false, "show_email_test('$uniqid');", 'class="sub next"', true).ui_print_help_tip(__('Check the current saved email configuration by sending a test email to a desired account.'), true);
|
||||
|
||||
print_email_test_modal_window($uniqid);
|
||||
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_table($table_mail_conf);
|
||||
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
@ -337,6 +396,25 @@ html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'
|
|||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
// Print the modal window for the summary of each alerts group
|
||||
function print_email_test_modal_window($id)
|
||||
{
|
||||
// Email config table.
|
||||
$table_mail_test = new stdClass();
|
||||
$table_mail_test->width = '100%';
|
||||
$table_mail_test->class = 'databox filters';
|
||||
$table_mail_test->data = [];
|
||||
$table_mail_test->style[0] = 'font-weight: bold';
|
||||
$table_mail_test->colspan[1][0] = 2;
|
||||
|
||||
$table_mail_test->data[0][0] = __('Address').ui_print_help_tip(__('Email address to which the test email will be sent. Please check your inbox after email is sent.'), true);
|
||||
$table_mail_test->data[0][1] = html_print_input_text('email_test_address', '', '', 40, 100, true);
|
||||
|
||||
$table_mail_test->data[1][0] = html_print_button(__('Send'), 'email_test', false, '', 'class="sub next"', true).'  <span id="email_test_sent_message" style="display:none;">Email sent</span><span id="email_test_failure_message" style="display:none;">Email could not been sent</span>';
|
||||
|
||||
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" style="display:none">'.html_print_table($table_mail_test, true).'</div>';
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
@ -375,6 +453,40 @@ function show_timezone () {
|
|||
});
|
||||
}
|
||||
|
||||
function show_email_test(id) {
|
||||
$('#email_test_sent_message').hide();
|
||||
$('#email_test_failure_message').hide();
|
||||
|
||||
$("#email_test_"+id).dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 175,
|
||||
width: 450,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function perform_email_test () {
|
||||
var test_address = $('#text-email_test_address').val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: "page=godmode/setup/setup_general&test_address="+test_address,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$('#email_test_sent_message').show();
|
||||
},
|
||||
error: function() {
|
||||
$('#email_test_failure_message').show();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
$("#zone").attr("hidden", true);
|
||||
|
@ -431,5 +543,7 @@ $(document).ready (function () {
|
|||
});
|
||||
}
|
||||
})
|
||||
|
||||
$('input#button-email_test').click(perform_email_test);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,702 @@
|
|||
<?php
|
||||
/**
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access Setup Management');
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
require_once $config['homedir'].'/include/functions_integriaims.php';
|
||||
|
||||
if (is_ajax()) {
|
||||
$integria_user = get_parameter('integria_user', '');
|
||||
$integria_pass = get_parameter('integria_pass', '');
|
||||
$integria_api_hostname = get_parameter('api_hostname', '');
|
||||
$integria_api_pass = get_parameter('api_pass', '');
|
||||
|
||||
$login_result = integria_api_call($integria_api_hostname, $integria_user, $integria_pass, $integria_api_pass, 'get_login', []);
|
||||
|
||||
if ($login_result != false) {
|
||||
echo json_encode(['login' => 1]);
|
||||
} else {
|
||||
echo json_encode(['login' => 0]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []);
|
||||
|
||||
if ($has_connection === false && $config['integria_enabled']) {
|
||||
ui_print_error_message(__('Integria IMS API is not reachable'));
|
||||
}
|
||||
|
||||
if (get_parameter('update_config', 0) == 1) {
|
||||
// Try to retrieve event response 'Create incident in IntegriaIMS from event' to check if it exists.
|
||||
$event_response_exists = db_get_row_filter('tevent_response', ['name' => io_safe_input('Create ticket in IntegriaIMS from event')]);
|
||||
|
||||
// Try to retrieve command 'Integia IMS Ticket' to check if it exists.
|
||||
$command_exists = db_get_row_filter('talert_commands', ['name' => io_safe_input('Integria IMS Ticket')]);
|
||||
|
||||
if ($config['integria_enabled'] == 1) {
|
||||
if ($event_response_exists === false) {
|
||||
// Create 'Create incident in IntegriaIMS from event' event response only when user enables IntegriaIMS integration and it does not exist in database.
|
||||
db_process_sql_insert(
|
||||
'tevent_response',
|
||||
[
|
||||
'name' => io_safe_input('Create ticket in IntegriaIMS from event'),
|
||||
'description' => io_safe_input('Create a ticket in Integria IMS from an event'),
|
||||
'target' => io_safe_input('index.php?sec=incident&sec2=operation/incidents/configure_integriaims_incident&from_event=_event_id_'),
|
||||
'type' => 'url',
|
||||
'id_group' => '0',
|
||||
'modal_width' => '0',
|
||||
'modal_height' => '0',
|
||||
'new_window' => '1',
|
||||
'params' => '',
|
||||
'server_to_exec' => '0',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($command_exists === false) {
|
||||
// Create 'Integria IMS Ticket' command only when user enables IntegriaIMS integration and it does not exist in database.
|
||||
$id_command_inserted = db_process_sql_insert(
|
||||
'talert_commands',
|
||||
[
|
||||
'name' => io_safe_input('Integria IMS Ticket'),
|
||||
'command' => io_safe_input('Internal type'),
|
||||
'internal' => 1,
|
||||
'description' => io_safe_input('Create a ticket in Integria IMS'),
|
||||
'fields_descriptions' => '["'.io_safe_input('Ticket title').'","'.io_safe_input('Ticket group ID').'","'.io_safe_input('Ticket priority').'","'.io_safe_input('Ticket owner').'","'.io_safe_input('Ticket type').'","'.io_safe_input('Ticket status').'","'.io_safe_input('Ticket description').'"]',
|
||||
]
|
||||
);
|
||||
|
||||
// Create 'Create Integria IMS Ticket' action only when user enables IntegriaIMS integration and command exists in database.
|
||||
$action_values = [
|
||||
'field1' => io_safe_input($config['incident_title']),
|
||||
'field1_recovery' => io_safe_input($config['incident_title']),
|
||||
'field2' => io_safe_input($config['default_group']),
|
||||
'field2_recovery' => io_safe_input($config['default_group']),
|
||||
'field3' => io_safe_input($config['default_criticity']),
|
||||
'field3_recovery' => io_safe_input($config['default_criticity']),
|
||||
'field4' => io_safe_input($config['default_owner']),
|
||||
'field4_recovery' => io_safe_input($config['default_owner']),
|
||||
'field5' => io_safe_input($config['incident_type']),
|
||||
'field5_recovery' => io_safe_input($config['incident_type']),
|
||||
'field6' => io_safe_input($config['incident_status']),
|
||||
'field6_recovery' => io_safe_input($config['incident_status']),
|
||||
'field7' => io_safe_input($config['incident_content']),
|
||||
'field7_recovery' => io_safe_input($config['incident_content']),
|
||||
'id_group' => 0,
|
||||
'action_threshold' => 0,
|
||||
];
|
||||
|
||||
alerts_create_alert_action(io_safe_input('Create Integria IMS ticket'), $id_command_inserted, $action_values);
|
||||
} else {
|
||||
// Update 'Create Integria IMS Ticket' action when setup data is updated, user enables IntegriaIMS integration and command does exist in database.
|
||||
db_process_sql_update(
|
||||
'talert_actions',
|
||||
[
|
||||
'field1' => io_safe_input($config['incident_title']),
|
||||
'field1_recovery' => io_safe_input($config['incident_title']),
|
||||
'field2' => io_safe_input($config['default_group']),
|
||||
'field2_recovery' => io_safe_input($config['default_group']),
|
||||
'field3' => io_safe_input($config['default_criticity']),
|
||||
'field3_recovery' => io_safe_input($config['default_criticity']),
|
||||
'field4' => io_safe_input($config['default_owner']),
|
||||
'field4_recovery' => io_safe_input($config['default_owner']),
|
||||
'field5' => io_safe_input($config['incident_type']),
|
||||
'field5_recovery' => io_safe_input($config['incident_type']),
|
||||
'field6' => io_safe_input($config['incident_status']),
|
||||
'field6_recovery' => io_safe_input($config['incident_status']),
|
||||
'field7' => io_safe_input($config['incident_content']),
|
||||
'field7_recovery' => io_safe_input($config['incident_content']),
|
||||
],
|
||||
['name' => io_safe_input('Create Integria IMS ticket')]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ($event_response_exists != false) {
|
||||
// Delete 'Create incident in IntegriaIMS from event' event response if it does exist and IntegriaIMS integration is disabled.
|
||||
db_process_sql_delete('tevent_response', ['name' => io_safe_input('Create ticket in IntegriaIMS from event')]);
|
||||
}
|
||||
|
||||
if ($command_exists != false) {
|
||||
// Delete 'Integria IMS Ticket' command if it does exist and IntegriaIMS integration is disabled.
|
||||
db_process_sql_delete('talert_commands', ['name' => io_safe_input('Integria IMS Ticket')]);
|
||||
|
||||
// Delete 'Create Integria IMS Ticket' action if command exists and IntegriaIMS integration is disabled.
|
||||
db_process_sql_delete('talert_actions', ['name' => io_safe_input('Create Integria IMS ticket')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get parameters from Integria IMS API.
|
||||
$integria_group_values = [];
|
||||
$integria_criticity_values = [];
|
||||
$integria_users_values = [];
|
||||
$integria_types_values = [];
|
||||
$integria_status_values = [];
|
||||
|
||||
$integria_groups_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_groups', []);
|
||||
|
||||
get_array_from_csv_data_pair($integria_groups_csv, $integria_group_values);
|
||||
|
||||
$integria_status_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incidents_status', []);
|
||||
|
||||
get_array_from_csv_data_pair($integria_status_csv, $integria_status_values);
|
||||
|
||||
$integria_criticity_levels_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_priorities', []);
|
||||
|
||||
get_array_from_csv_data_pair($integria_criticity_levels_csv, $integria_criticity_values);
|
||||
|
||||
$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []);
|
||||
|
||||
$csv_array = explode("\n", $integria_users_csv);
|
||||
|
||||
foreach ($csv_array as $csv_line) {
|
||||
if (!empty($csv_line)) {
|
||||
$integria_users_values[$csv_line] = $csv_line;
|
||||
}
|
||||
}
|
||||
|
||||
$integria_types_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_types', []);
|
||||
|
||||
get_array_from_csv_data_pair($integria_types_csv, $integria_types_values);
|
||||
|
||||
// Enable table.
|
||||
$table_enable = new StdClass();
|
||||
$table_enable->data = [];
|
||||
$table_enable->width = '100%';
|
||||
$table_enable->id = 'integria-enable-setup';
|
||||
$table_enable->class = 'databox filters';
|
||||
$table_enable->size['name'] = '30%';
|
||||
$table_enable->style['name'] = 'font-weight: bold';
|
||||
|
||||
// Enable Integria.
|
||||
$row = [];
|
||||
$row['name'] = __('Enable Integria IMS');
|
||||
$row['control'] = html_print_checkbox_switch('integria_enabled', 1, $config['integria_enabled'], true);
|
||||
$table_enable->data['integria_enabled'] = $row;
|
||||
|
||||
// Remote config table.
|
||||
$table_remote = new StdClass();
|
||||
$table_remote->data = [];
|
||||
$table_remote->width = '100%';
|
||||
$table_remote->styleTable = 'margin-bottom: 10px;';
|
||||
$table_remote->id = 'integria-remote-setup';
|
||||
$table_remote->class = 'databox filters';
|
||||
$table_remote->size['name'] = '30%';
|
||||
$table_remote->style['name'] = 'font-weight: bold';
|
||||
|
||||
// Integria user.
|
||||
$row = [];
|
||||
$row['name'] = __('User');
|
||||
$row['control'] = html_print_input_text('integria_user', $config['integria_user'], '', 30, 100, true);
|
||||
$table_remote->data['integria_user'] = $row;
|
||||
|
||||
// Integria password.
|
||||
$row = [];
|
||||
$row['name'] = __('Password');
|
||||
$row['control'] = html_print_input_password('integria_pass', io_output_password($config['integria_pass']), '', 30, 100, true);
|
||||
$table_remote->data['integria_pass'] = $row;
|
||||
|
||||
// Integria hostname.
|
||||
$row = [];
|
||||
$row['name'] = __('API Hostname');
|
||||
$row['control'] = html_print_input_text('integria_hostname', $config['integria_hostname'], '', 30, 100, true);
|
||||
$row['control'] .= ui_print_help_tip(__('Hostname of Integria IMS\' API (scheme must be specified. Example: http://192.168.0.0)'), true);
|
||||
$table_remote->data['integria_hostname'] = $row;
|
||||
|
||||
// API password.
|
||||
$row = [];
|
||||
$row['name'] = __('API Password');
|
||||
$row['control'] = html_print_input_password('integria_api_pass', io_output_password($config['integria_api_pass']), '', 30, 100, true);
|
||||
$row['control'] .= ui_print_help_tip(__('Password of Integria IMS\' API'), true);
|
||||
$table_remote->data['integria_api_pass'] = $row;
|
||||
|
||||
// Request timeout.
|
||||
$row = [];
|
||||
$row['name'] = __('Request timeout');
|
||||
$row['control'] = html_print_input_text('integria_req_timeout', $config['integria_req_timeout'], '', 3, 10, true);
|
||||
$row['control'] .= ui_print_help_tip(__('Time in seconds to set the maximum time of the requests to the Integria API').'. '.__('0 to disable'), true);
|
||||
$table_remote->data['integria_req_timeout'] = $row;
|
||||
|
||||
// Alert settings.
|
||||
$table_alert_settings = new StdClass();
|
||||
$table_alert_settings->data = [];
|
||||
$table_alert_settings->width = '100%';
|
||||
$table_alert_settings->styleTable = 'margin-bottom: 10px;';
|
||||
$table_alert_settings->id = 'integria-cr-settings-setup';
|
||||
$table_alert_settings->class = 'databox filters';
|
||||
$table_alert_settings->size['name'] = '30%';
|
||||
$table_alert_settings->style['name'] = 'font-weight: bold';
|
||||
|
||||
// Alert incident title.
|
||||
$row = [];
|
||||
$row['name'] = __('Title');
|
||||
$row['control'] = html_print_input_text(
|
||||
'incident_title',
|
||||
$config['incident_title'],
|
||||
__('Name'),
|
||||
50,
|
||||
100,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
).ui_print_help_icon('alert_macros', true);
|
||||
$table_alert_settings->data['custom_response_incident_title'] = $row;
|
||||
|
||||
// Alert incident description.
|
||||
$row = [];
|
||||
$row['name'] = __('Description');
|
||||
$row['control'] = html_print_input_text(
|
||||
'incident_content',
|
||||
$config['incident_content'],
|
||||
'',
|
||||
50,
|
||||
100,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
).ui_print_help_icon('alert_macros', true);
|
||||
$table_alert_settings->data['custom_response_incident_content'] = $row;
|
||||
|
||||
// Alert default group.
|
||||
$row = [];
|
||||
$row['name'] = __('Group');
|
||||
$row['control'] = html_print_select(
|
||||
$integria_group_values,
|
||||
'default_group',
|
||||
$config['default_group'],
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$table_alert_settings->data['custom_response_def_group'] = $row;
|
||||
|
||||
// Alert default criticity.
|
||||
$row = [];
|
||||
$row['name'] = __('Priority');
|
||||
$row['control'] = html_print_select(
|
||||
$integria_criticity_values,
|
||||
'default_criticity',
|
||||
$config['default_criticity'],
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$table_alert_settings->data['custom_response_def_criticity'] = $row;
|
||||
|
||||
// Alert default owner.
|
||||
$row = [];
|
||||
$row['name'] = __('Owner');
|
||||
$row['control'] = html_print_autocomplete_users_from_integria(
|
||||
'default_owner',
|
||||
$config['default_owner'],
|
||||
true
|
||||
);
|
||||
|
||||
$table_alert_settings->data['custom_response_def_owner'] = $row;
|
||||
|
||||
// Alert default incident type.
|
||||
$row = [];
|
||||
$row['name'] = __('Type');
|
||||
$row['control'] = html_print_select(
|
||||
$integria_types_values,
|
||||
'incident_type',
|
||||
$config['incident_type'],
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$table_alert_settings->data['custom_response_incident_type'] = $row;
|
||||
|
||||
// Alert default incident status.
|
||||
$row = [];
|
||||
$row['name'] = __('Status');
|
||||
$row['control'] = html_print_select(
|
||||
$integria_status_values,
|
||||
'incident_status',
|
||||
$config['incident_status'],
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$table_alert_settings->data['custom_response_incident_status'] = $row;
|
||||
|
||||
// Custom response settings.
|
||||
$table_cr_settings = new StdClass();
|
||||
$table_cr_settings->data = [];
|
||||
$table_cr_settings->width = '100%';
|
||||
$table_cr_settings->styleTable = 'margin-bottom: 10px;';
|
||||
$table_cr_settings->id = 'integria-cr-settings-setup';
|
||||
$table_cr_settings->class = 'databox filters';
|
||||
$table_cr_settings->size['name'] = '30%';
|
||||
$table_cr_settings->style['name'] = 'font-weight: bold';
|
||||
|
||||
// Custom response incident title.
|
||||
$row = [];
|
||||
$row['name'] = __('Title');
|
||||
$row['control'] = html_print_input_text(
|
||||
'cr_incident_title',
|
||||
$config['cr_incident_title'],
|
||||
__('Name'),
|
||||
50,
|
||||
100,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
).ui_print_help_icon('response_macros', true);
|
||||
$table_cr_settings->data['custom_response_incident_title'] = $row;
|
||||
|
||||
// Custom response incident description.
|
||||
$row = [];
|
||||
$row['name'] = __('Description');
|
||||
$row['control'] = html_print_input_text(
|
||||
'cr_incident_content',
|
||||
$config['cr_incident_content'],
|
||||
'',
|
||||
50,
|
||||
100,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
).ui_print_help_icon('response_macros', true);
|
||||
$table_cr_settings->data['custom_response_incident_content'] = $row;
|
||||
|
||||
// Custom response default group.
|
||||
$row = [];
|
||||
$row['name'] = __('Group');
|
||||
$row['control'] = html_print_select(
|
||||
$integria_group_values,
|
||||
'cr_default_group',
|
||||
$config['cr_default_group'],
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$table_cr_settings->data['custom_response_def_group'] = $row;
|
||||
|
||||
// Custom response default criticity.
|
||||
$row = [];
|
||||
$row['name'] = __('Priority');
|
||||
$row['control'] = html_print_select(
|
||||
$integria_criticity_values,
|
||||
'cr_default_criticity',
|
||||
$config['cr_default_criticity'],
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$table_cr_settings->data['custom_response_def_criticity'] = $row;
|
||||
|
||||
// Custom response default owner.
|
||||
$row = [];
|
||||
$row['name'] = __('Owner');
|
||||
$row['control'] = html_print_autocomplete_users_from_integria(
|
||||
'cr_default_owner',
|
||||
$config['cr_default_owner'],
|
||||
true
|
||||
);
|
||||
|
||||
$table_cr_settings->data['custom_response_def_owner'] = $row;
|
||||
|
||||
// Custom response default incident type.
|
||||
$row = [];
|
||||
$row['name'] = __('Type');
|
||||
$row['control'] = html_print_select(
|
||||
$integria_types_values,
|
||||
'cr_incident_type',
|
||||
$config['cr_incident_type'],
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$table_cr_settings->data['custom_response_incident_type'] = $row;
|
||||
|
||||
// Custom response default incident status.
|
||||
$row = [];
|
||||
$row['name'] = __('Status');
|
||||
$row['control'] = html_print_select(
|
||||
$integria_status_values,
|
||||
'cr_incident_status',
|
||||
$config['cr_incident_status'],
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false
|
||||
);
|
||||
$table_cr_settings->data['custom_response_incident_status'] = $row;
|
||||
|
||||
// Test.
|
||||
$row = [];
|
||||
$row['name'] = __('Test');
|
||||
$row['control'] = html_print_button(__('Start'), 'test-integria', false, '', 'class="sub next"', true);
|
||||
$row['control'] .= '<span id="test-integria-spinner" style="display:none;"> '.html_print_image('images/spinner.gif', true).'</span>';
|
||||
$row['control'] .= '<span id="test-integria-success" style="display:none;"> '.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
|
||||
$row['control'] .= '<span id="test-integria-failure" style="display:none;"> '.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
|
||||
$row['control'] .= ' <span id="test-integria-message" style="display:none;"></span>';
|
||||
$table_remote->data['integria_test'] = $row;
|
||||
|
||||
// Print.
|
||||
echo '<div style="text-align: center; padding-bottom: 20px;">';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="http://integriaims.com">';
|
||||
html_print_image('images/integria_logo.png');
|
||||
echo '</a>';
|
||||
echo '<br />';
|
||||
echo '<div style="font-family: lato, "Helvetica Neue", Helvetica, Arial, sans-serif; color: #515151;">';
|
||||
echo __('Integria IMS');
|
||||
echo '</div>';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="https://integriaims.com">';
|
||||
echo 'https://integriaims.com';
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
|
||||
echo "<form method='post'>";
|
||||
html_print_input_hidden('update_config', 1);
|
||||
|
||||
// Form enable.
|
||||
echo '<div id="form_enable">';
|
||||
html_print_table($table_enable);
|
||||
echo '</div>';
|
||||
|
||||
// Form remote.
|
||||
echo '<div id="form_remote">';
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Integria API settings').'</legend>';
|
||||
|
||||
html_print_table($table_remote);
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</div>';
|
||||
|
||||
if ($has_connection != false) {
|
||||
// Form alert default settings.
|
||||
echo '<div id="form_alert_settings">';
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Alert default values').'</legend>';
|
||||
|
||||
html_print_table($table_alert_settings);
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</div>';
|
||||
|
||||
// Form custom response default settings.
|
||||
echo '<div id="form_custom_response_settings">';
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Event custom response default values').'</legend>';
|
||||
|
||||
html_print_table($table_cr_settings);
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table_remote->width.'">';
|
||||
html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"');
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '<div class="action-buttons" style="width: '.$table_remote->width.'">';
|
||||
html_print_submit_button(__('Update and continue'), 'update_button', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
if(!$('input:checkbox[name="integria_enabled"]').is(':checked')) {
|
||||
$('#form_remote').hide();
|
||||
$('#form_custom_response_settings').hide();
|
||||
} else {
|
||||
$('#form_remote').show();
|
||||
$('#form_custom_response_settings').show();
|
||||
}
|
||||
|
||||
$('#form_enable').css('margin-bottom','20px');
|
||||
var showFields = function () {
|
||||
$('#form_remote').show();
|
||||
$('#form_custom_response_settings').show();
|
||||
}
|
||||
var hideFields = function () {
|
||||
$('#form_remote').hide();
|
||||
$('#form_custom_response_settings').hide();
|
||||
}
|
||||
|
||||
var hideUserPass = function () {
|
||||
$('#integria-remote-setup-integria_user').hide();
|
||||
$('#integria-remote-setup-integria_pass').hide();
|
||||
}
|
||||
|
||||
var showUserPass = function () {
|
||||
$('#integria-remote-setup-integria_user').show();
|
||||
$('#integria-remote-setup-integria_pass').show();
|
||||
}
|
||||
|
||||
var handleEnable = function (event) {
|
||||
var is_checked = $('input:checkbox[name="integria_enabled"]').is(':checked');
|
||||
|
||||
if (event.target.value == '1' && is_checked) {
|
||||
showFields();
|
||||
$('input:checkbox[name="integria_enabled"]').attr('checked', true);
|
||||
}
|
||||
else {
|
||||
hideFields();
|
||||
$('input:checkbox[name="integria_enabled"]').attr('checked', false);
|
||||
};
|
||||
}
|
||||
|
||||
$('input:checkbox[name="integria_enabled"]').change(handleEnable);
|
||||
|
||||
var handleTest = function (event) {
|
||||
var user = $('input#text-integria_user').val();
|
||||
var pass = $('input#password-integria_pass').val();
|
||||
var host = $('input#text-integria_hostname').val();
|
||||
var timeout = Number.parseInt($('input#text-integria_req_timeout').val(), 10);
|
||||
|
||||
var timeoutMessage = '<?php echo __('Connection timeout'); ?>';
|
||||
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
|
||||
var notFoundMessage = '<?php echo __('User not found'); ?>';
|
||||
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
|
||||
|
||||
var hideLoadingImage = function () {
|
||||
$('span#test-integria-spinner').hide();
|
||||
}
|
||||
var showLoadingImage = function () {
|
||||
$('span#test-integria-spinner').show();
|
||||
}
|
||||
var hideSuccessImage = function () {
|
||||
$('span#test-integria-success').hide();
|
||||
}
|
||||
var showSuccessImage = function () {
|
||||
$('span#test-integria-success').show();
|
||||
}
|
||||
var hideFailureImage = function () {
|
||||
$('span#test-integria-failure').hide();
|
||||
}
|
||||
var showFailureImage = function () {
|
||||
$('span#test-integria-failure').show();
|
||||
}
|
||||
var hideMessage = function () {
|
||||
$('span#test-integria-message').hide();
|
||||
}
|
||||
var showMessage = function () {
|
||||
$('span#test-integria-message').show();
|
||||
}
|
||||
var changeTestMessage = function (message) {
|
||||
$('span#test-integria-message').text(message);
|
||||
}
|
||||
|
||||
hideSuccessImage();
|
||||
hideFailureImage();
|
||||
hideMessage();
|
||||
showLoadingImage();
|
||||
|
||||
var integria_user = $('input[name=integria_user]').val();
|
||||
var integria_pass = $('input[name=integria_pass]').val();
|
||||
var api_hostname = $('input[name=integria_hostname]').val();
|
||||
var api_pass = $('input[name=integria_api_pass]').val();
|
||||
|
||||
var data = {
|
||||
page: "godmode/setup/setup_integria",
|
||||
check_api_access: 1,
|
||||
integria_user: integria_user,
|
||||
integria_pass: integria_pass,
|
||||
api_hostname: api_hostname,
|
||||
api_pass: api_pass,
|
||||
}
|
||||
|
||||
// AJAX call to check API connection.
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
timeout: timeout ? timeout * 1000 : 0,
|
||||
data: data
|
||||
})
|
||||
.done(function(data, textStatus, xhr) {
|
||||
if (data.login == '1') {
|
||||
showSuccessImage();
|
||||
} else {
|
||||
showFailureImage();
|
||||
showMessage();
|
||||
}
|
||||
|
||||
})
|
||||
.fail(function(xhr, textStatus, errorThrown) {
|
||||
showFailureImage();
|
||||
showMessage();
|
||||
})
|
||||
.always(function(xhr, textStatus) {
|
||||
hideLoadingImage();
|
||||
});
|
||||
}
|
||||
$('input#button-test-integria').click(handleTest);
|
||||
|
||||
|
||||
|
||||
</script>
|
|
@ -828,7 +828,7 @@ $values = [
|
|||
0 => __('No'),
|
||||
];
|
||||
|
||||
$table->data[12][0] = __('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true);
|
||||
$table->data[12][0] = __('Home screen').ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true);
|
||||
$values = [
|
||||
'Default' => __('Default'),
|
||||
'Visual console' => __('Visual console'),
|
||||
|
|
|
@ -200,7 +200,7 @@ class DiscoveryTaskList extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
|
@ -241,7 +241,7 @@ class DiscoveryTaskList extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (!$this->aclMulticheck('RR|RW|RM|PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
|
@ -270,7 +270,7 @@ class DiscoveryTaskList extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'RM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
|
@ -313,13 +313,9 @@ class DiscoveryTaskList extends Wizard
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon task viewer'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return false;
|
||||
if (!$this->aclMulticheck('AR|AW|AM')) {
|
||||
// Tasklist are allowed only of agent managers.
|
||||
return '';
|
||||
}
|
||||
|
||||
// Get all discovery servers.
|
||||
|
@ -341,7 +337,7 @@ class DiscoveryTaskList extends Wizard
|
|||
// --------------------------------
|
||||
// FORCE A RECON TASK
|
||||
// --------------------------------
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
if (isset($_GET['force'])) {
|
||||
$id = (int) get_parameter_get('force', 0);
|
||||
servers_force_recon_task($id);
|
||||
|
@ -387,8 +383,10 @@ class DiscoveryTaskList extends Wizard
|
|||
// Operations.
|
||||
$table->headstyle[9] .= 'min-width: 150px; width: 150px;';
|
||||
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = 'left';
|
||||
}
|
||||
|
||||
$table->head[1] = __('Task name');
|
||||
$table->align[1] = 'left';
|
||||
|
@ -455,11 +453,13 @@ class DiscoveryTaskList extends Wizard
|
|||
}
|
||||
|
||||
if ($task['disabled'] == 0 && $server_name !== '') {
|
||||
$data[0] = '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
||||
).'">';
|
||||
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
||||
$data[0] .= '</a>';
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$data[0] = '<a href="'.ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist&server_id='.$id_server.'&force='.$task['id_rt']
|
||||
).'">';
|
||||
$data[0] .= html_print_image('images/target.png', true, ['title' => __('Force')]);
|
||||
$data[0] .= '</a>';
|
||||
}
|
||||
} else if ($task['disabled'] == 2) {
|
||||
$data[0] = ui_print_help_tip(
|
||||
__('This task has not been completely defined, please edit it'),
|
||||
|
@ -622,18 +622,20 @@ class DiscoveryTaskList extends Wizard
|
|||
&& $task['type'] != DISCOVERY_APP_ORACLE
|
||||
&& $task['type'] != DISCOVERY_CLOUD_AWS_RDS
|
||||
) {
|
||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/dynamic_network_icon.png',
|
||||
true
|
||||
);
|
||||
$data[9] .= '</a>';
|
||||
if (check_acl($config['id_user'], 0, 'MR')) {
|
||||
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\')">';
|
||||
$data[9] .= html_print_image(
|
||||
'images/dynamic_network_icon.png',
|
||||
true
|
||||
);
|
||||
$data[9] .= '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$task['id_group'],
|
||||
'PM'
|
||||
'AW'
|
||||
)
|
||||
) {
|
||||
if ($ipam === true) {
|
||||
|
@ -733,6 +735,16 @@ class DiscoveryTaskList extends Wizard
|
|||
{
|
||||
if ($script !== false) {
|
||||
switch ($script['type']) {
|
||||
case DISCOVERY_SCRIPT_APP_VMWARE:
|
||||
return 'wiz=app&mode=vmware&page=0';
|
||||
|
||||
case DISCOVERY_SCRIPT_IPAM_RECON:
|
||||
return '';
|
||||
|
||||
case DISCOVERY_SCRIPT_IPMI_RECON:
|
||||
default:
|
||||
return 'wiz=hd&mode=customnetscan';
|
||||
|
||||
case DISCOVERY_SCRIPT_CLOUD_AWS:
|
||||
switch ($task['type']) {
|
||||
case DISCOVERY_CLOUD_AWS_EC2:
|
||||
|
@ -744,16 +756,6 @@ class DiscoveryTaskList extends Wizard
|
|||
default:
|
||||
return 'wiz=cloud';
|
||||
}
|
||||
|
||||
case DISCOVERY_SCRIPT_APP_VMWARE:
|
||||
return 'wiz=app&mode=vmware&page=0';
|
||||
|
||||
case DISCOVERY_SCRIPT_IPAM_RECON:
|
||||
return '';
|
||||
|
||||
case DISCOVERY_SCRIPT_IPMI_RECON:
|
||||
default:
|
||||
return 'wiz=hd&mode=customnetscan';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ class HostDevices extends Wizard
|
|||
) {
|
||||
$this->setBreadcrum([]);
|
||||
|
||||
$this->access = 'AW';
|
||||
$this->task = [];
|
||||
$this->msg = $msg;
|
||||
$this->icon = $icon;
|
||||
|
@ -100,6 +101,32 @@ class HostDevices extends Wizard
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if environment is ready,
|
||||
* returns array
|
||||
* icon: icon to be displayed
|
||||
* label: label to be displayed
|
||||
*
|
||||
* @return array With data.
|
||||
**/
|
||||
public function load()
|
||||
{
|
||||
global $config;
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! $this->aclMulticheck('AW|PM')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return [
|
||||
'icon' => $this->icon,
|
||||
'label' => $this->label,
|
||||
'url' => $this->url,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run wizard manager.
|
||||
*
|
||||
|
@ -116,37 +143,42 @@ class HostDevices extends Wizard
|
|||
|
||||
if ($mode === null) {
|
||||
$buttons = [];
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=netscan',
|
||||
'icon' => 'images/wizard/netscan.png',
|
||||
'label' => __('Net Scan'),
|
||||
];
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if (check_acl($config['id_user'], 0, $this->access)) {
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=importcsv',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
|
||||
'label' => __('Import CSV'),
|
||||
'url' => $this->url.'&mode=netscan',
|
||||
'icon' => 'images/wizard/netscan.png',
|
||||
'label' => __('Net Scan'),
|
||||
];
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=importcsv',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
|
||||
'label' => __('Import CSV'),
|
||||
];
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=deploy',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
|
||||
'label' => __('Agent deployment'),
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=deploy',
|
||||
'icon' => ENTERPRISE_DIR.'/images/wizard/deployment.png',
|
||||
'label' => __('Agent deployment'),
|
||||
'url' => $this->url.'&mode=customnetscan',
|
||||
'icon' => '/images/wizard/customnetscan.png',
|
||||
'label' => __('Custom NetScan'),
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=customnetscan',
|
||||
'icon' => '/images/wizard/customnetscan.png',
|
||||
'label' => __('Custom NetScan'),
|
||||
];
|
||||
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=managenetscanscripts',
|
||||
'icon' => '/images/wizard/managenetscanscripts.png',
|
||||
'label' => __('Manage NetScan scripts'),
|
||||
];
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$buttons[] = [
|
||||
'url' => $this->url.'&mode=managenetscanscripts',
|
||||
'icon' => '/images/wizard/managenetscanscripts.png',
|
||||
'label' => __('Manage NetScan scripts'),
|
||||
];
|
||||
}
|
||||
|
||||
$this->prepareBreadcrum(
|
||||
[
|
||||
|
@ -311,11 +343,11 @@ class HostDevices extends Wizard
|
|||
) {
|
||||
// Default values, no data received.
|
||||
// User is accesing directly to this page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
if (check_acl(
|
||||
$config['id_usuario'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
$this->access
|
||||
) != true
|
||||
) {
|
||||
$this->msg = __('You have no access to edit this task.');
|
||||
return false;
|
||||
|
@ -487,7 +519,7 @@ class HostDevices extends Wizard
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, $this->access)) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
|
@ -529,11 +561,11 @@ class HostDevices extends Wizard
|
|||
|
||||
// Check ACL. If user is not able to manage target task,
|
||||
// redirect him to main page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
if (check_acl(
|
||||
$config['id_usuario'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
$this->access
|
||||
) != true
|
||||
) {
|
||||
$form['form']['action'] = $this->url.'&mode=netscan&page='.($this->page - 1);
|
||||
}
|
||||
|
@ -750,7 +782,7 @@ class HostDevices extends Wizard
|
|||
[
|
||||
'name' => 'id_group',
|
||||
'returnAllGroup' => false,
|
||||
'privilege' => 'PM',
|
||||
'privilege' => $this->access,
|
||||
'type' => 'select_groups',
|
||||
'selected' => $this->task['id_group'],
|
||||
'return' => true,
|
||||
|
|
|
@ -87,6 +87,13 @@ class Wizard
|
|||
*/
|
||||
public $msg;
|
||||
|
||||
/**
|
||||
* Defines access level to use this util.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $access = 'AR';
|
||||
|
||||
|
||||
/**
|
||||
* Setter for breadcrum
|
||||
|
@ -234,6 +241,42 @@ class Wizard
|
|||
public function run()
|
||||
{
|
||||
ui_require_css_file('wizard');
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! $this->aclMulticheck()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check multiple acl perms.
|
||||
*
|
||||
* @param string $access Access in PM|AR|RR format. Optional.
|
||||
*
|
||||
* @return boolean Alowed or not.
|
||||
*/
|
||||
public function aclMulticheck($access=null)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($access)) {
|
||||
$perms = explode('|', $access);
|
||||
} else {
|
||||
$perms = explode('|', $this->access);
|
||||
}
|
||||
|
||||
$allowed = false;
|
||||
foreach ($perms as $perm) {
|
||||
$allowed = $allowed || (bool) check_acl(
|
||||
$config['id_user'],
|
||||
0,
|
||||
$perm
|
||||
);
|
||||
}
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
|
||||
|
@ -247,6 +290,14 @@ class Wizard
|
|||
**/
|
||||
public function load()
|
||||
{
|
||||
global $config;
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
if (! $this->aclMulticheck()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return [
|
||||
'icon' => $this->icon,
|
||||
'label' => $this->label,
|
||||
|
|
After Width: | Height: | Size: 229 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 895 B |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* Integria incidents management.
|
||||
*
|
||||
* @category Ajax library.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Modules.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for 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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
if (check_login()) {
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/functions_integriaims.php';
|
||||
|
||||
$get_users = get_parameter('get_users');
|
||||
$search_term = get_parameter('search_term', '');
|
||||
|
||||
if ($get_users) {
|
||||
$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []);
|
||||
|
||||
$csv_array = explode("\n", $integria_users_csv);
|
||||
|
||||
foreach ($csv_array as $csv_line) {
|
||||
if (!empty($csv_line)) {
|
||||
$integria_users_values[$csv_line] = $csv_line;
|
||||
}
|
||||
}
|
||||
|
||||
$integria_users_filtered_values = array_filter(
|
||||
$integria_users_values,
|
||||
function ($item) use ($search_term) {
|
||||
if (strpos($item, $search_term) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
echo json_encode($integria_users_filtered_values);
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -209,6 +209,12 @@ class ConsoleSupervisor
|
|||
|
||||
$this->getUMMessages();
|
||||
|
||||
/*
|
||||
* Check if the Server and Console has
|
||||
* the same versions.
|
||||
*/
|
||||
$this->checkConsoleServerVersions();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -435,6 +441,12 @@ class ConsoleSupervisor
|
|||
|
||||
$this->getUMMessages();
|
||||
|
||||
/*
|
||||
* Check if the Server and Console has
|
||||
* the same versions.
|
||||
*/
|
||||
$this->checkConsoleServerVersions();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -873,18 +885,20 @@ class ConsoleSupervisor
|
|||
{
|
||||
global $config;
|
||||
|
||||
$remote_config_dir = io_safe_output($config['remote_config']);
|
||||
|
||||
if (enterprise_installed()
|
||||
&& isset($config['license_nms'])
|
||||
&& $config['license_nms'] != 1
|
||||
) {
|
||||
if (is_readable($config['remote_config']) !== true) {
|
||||
if (is_readable($remote_config_dir) !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG',
|
||||
'title' => __('Remote configuration directory is not readable'),
|
||||
'message' => __(
|
||||
'Remote configuration directory %s is not readable. Please, adjust configuration.',
|
||||
$config['remote_config']
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
]
|
||||
|
@ -896,14 +910,14 @@ class ConsoleSupervisor
|
|||
);
|
||||
}
|
||||
|
||||
if (is_writable($config['remote_config'].'/conf') !== true) {
|
||||
if (is_writable($remote_config_dir.'/conf') !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF',
|
||||
'title' => __('Remote configuration directory is not writable'),
|
||||
'message' => __(
|
||||
'Remote configuration directory %s is not writable. Please, adjust configuration.',
|
||||
$config['remote_config'].'/conf'
|
||||
$remote_config_dir.'/conf'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
]
|
||||
|
@ -914,14 +928,14 @@ class ConsoleSupervisor
|
|||
);
|
||||
}
|
||||
|
||||
if (is_writable($config['remote_config'].'/collections') !== true) {
|
||||
if (is_writable($remote_config_dir.'/collections') !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS',
|
||||
'title' => __('Remote collections directory is not writable'),
|
||||
'message' => __(
|
||||
'Collections directory %s is not writable. Please, adjust configuration.',
|
||||
$config['remote_config'].'/collections'
|
||||
$remote_config_dir.'/collections'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
]
|
||||
|
@ -932,14 +946,14 @@ class ConsoleSupervisor
|
|||
);
|
||||
}
|
||||
|
||||
if (is_writable($config['remote_config'].'/md5') !== true) {
|
||||
if (is_writable($remote_config_dir.'/md5') !== true) {
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5',
|
||||
'title' => __('Remote md5 directory is not writable'),
|
||||
'message' => __(
|
||||
'MD5 directory %s is not writable. Please, adjust configuration.',
|
||||
$config['remote_config'].'/md5'
|
||||
$remote_config_dir.'/md5'
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||
]
|
||||
|
@ -957,7 +971,7 @@ class ConsoleSupervisor
|
|||
$MAX_BADXML_FILES_DATA_IN = 150;
|
||||
|
||||
$filecount = $this->countFiles(
|
||||
$config['remote_config'],
|
||||
$remote_config_dir,
|
||||
'',
|
||||
$MAX_FILES_DATA_IN
|
||||
);
|
||||
|
@ -970,7 +984,7 @@ class ConsoleSupervisor
|
|||
'message' => __(
|
||||
'There are more than %d files in %s. Consider checking DataServer performance',
|
||||
$MAX_FILES_DATA_IN,
|
||||
$config['remote_config']
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
]
|
||||
|
@ -980,7 +994,7 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
$filecount = $this->countFiles(
|
||||
$config['remote_config'],
|
||||
$remote_config_dir,
|
||||
'/^.*BADXML$/',
|
||||
$MAX_BADXML_FILES_DATA_IN
|
||||
);
|
||||
|
@ -993,7 +1007,7 @@ class ConsoleSupervisor
|
|||
'message' => __(
|
||||
'There are more than %d files in %s. Consider checking software agents.',
|
||||
$MAX_BADXML_FILES_DATA_IN,
|
||||
$config['remote_config']
|
||||
$remote_config_dir
|
||||
),
|
||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||
]
|
||||
|
@ -1266,7 +1280,8 @@ class ConsoleSupervisor
|
|||
$PHPSerialize_precision = ini_get('serialize_precision');
|
||||
|
||||
// PhantomJS status.
|
||||
$result_ejecution = exec($config['phantomjs_bin'].'/phantomjs --version');
|
||||
$phantomjs_dir = io_safe_output($config['phantomjs_bin']);
|
||||
$result_ejecution = exec($phantomjs_dir.'/phantomjs --version');
|
||||
|
||||
// PHP version checks.
|
||||
$php_version = phpversion();
|
||||
|
@ -1451,8 +1466,9 @@ class ConsoleSupervisor
|
|||
'type' => 'NOTIF.PHP.SERIALIZE_PRECISION',
|
||||
'title' => sprintf(
|
||||
__("Not recommended '%s' value in PHP configuration"),
|
||||
'serialze_precision'
|
||||
), 'message' => sprintf(
|
||||
'serialize_precision'
|
||||
),
|
||||
'message' => sprintf(
|
||||
__('Recommended value is: %s'),
|
||||
sprintf('-1')
|
||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
||||
|
@ -2061,8 +2077,10 @@ class ConsoleSupervisor
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (($config['fontpath'] == '')
|
||||
|| (file_exists($config['fontpath']) === false)
|
||||
$fontpath = io_safe_output($config['fontpath']);
|
||||
|
||||
if (($fontpath == '')
|
||||
|| (file_exists($fontpath) === false)
|
||||
) {
|
||||
$this->notify(
|
||||
[
|
||||
|
@ -2328,4 +2346,35 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if all servers and console versions are the same
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkConsoleServerVersions()
|
||||
{
|
||||
global $config;
|
||||
// List all servers except satellite server
|
||||
$server_version_list = db_get_all_rows_sql(
|
||||
'SELECT name, version FROM tserver WHERE server_type != '.SERVER_TYPE_ENTERPRISE_SATELLITE
|
||||
);
|
||||
|
||||
foreach ($server_version_list as $server) {
|
||||
if (strpos($server['version'], $config['current_package_enterprise']) === false) {
|
||||
$title_ver_misaligned = $server['name'].' version misaligned with Console';
|
||||
$message_ver_misaligned = 'Server '.$server['name'].' and this console have different versions. This might cause several malfunctions. Please, update this server.';
|
||||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.MISALIGNED',
|
||||
'title' => __($title_ver_misaligned),
|
||||
'message' => __($message_ver_misaligned),
|
||||
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ class CustomNetScan extends Wizard
|
|||
$this->url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
|
||||
);
|
||||
|
||||
$this->access = 'AW';
|
||||
$this->page = $page;
|
||||
$this->breadcrum = $breadcrum;
|
||||
}
|
||||
|
@ -77,6 +79,8 @@ class CustomNetScan extends Wizard
|
|||
*/
|
||||
public function parseNetScan()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($this->page) === true && $this->page === 0) {
|
||||
// Check if we're updating a task.
|
||||
$task_id = get_parameter('task', null);
|
||||
|
@ -145,11 +149,11 @@ class CustomNetScan extends Wizard
|
|||
) {
|
||||
// Default values, no data received.
|
||||
// User is accesing directly to this page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
$config['id_usuario'],
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
$this->access
|
||||
) != true
|
||||
) {
|
||||
$this->msg = __('You have no access to edit this task.');
|
||||
return false;
|
||||
|
@ -275,7 +279,7 @@ class CustomNetScan extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (!check_acl($config['id_user'], 0, $this->access)) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Custom Net Scan.'
|
||||
|
@ -317,11 +321,11 @@ class CustomNetScan extends Wizard
|
|||
|
||||
// Check ACL. If user is not able to manage target task,
|
||||
// redirect him to main page.
|
||||
if (users_is_admin() !== true && check_acl(
|
||||
$config['id_usuario'],
|
||||
if (check_acl(
|
||||
$config['id_user'],
|
||||
$this->task['id_group'],
|
||||
'PM'
|
||||
) !== true
|
||||
$this->access
|
||||
) != true
|
||||
) {
|
||||
$form['form']['action'] = $this->url.'&mode=customnetscan&page='.($this->page - 1);
|
||||
}
|
||||
|
@ -496,7 +500,7 @@ class CustomNetScan extends Wizard
|
|||
'arguments' => [
|
||||
'name' => 'id_group',
|
||||
'returnAllGroup' => false,
|
||||
'privilege' => 'PM',
|
||||
'privilege' => $this->access,
|
||||
'type' => 'select_groups',
|
||||
'selected' => $this->task['id_group'],
|
||||
'return' => true,
|
||||
|
|
|
@ -65,6 +65,8 @@ class ManageNetScanScripts extends Wizard
|
|||
$this->url = ui_get_full_url(
|
||||
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
|
||||
);
|
||||
|
||||
$this->access = 'PM';
|
||||
$this->page = $page;
|
||||
$this->breadcrum = $breadcrum;
|
||||
}
|
||||
|
@ -81,7 +83,7 @@ class ManageNetScanScripts extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW') === 0) {
|
||||
if (check_acl($config['id_user'], 0, $this->access) === 0) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Net Scan Script.'
|
||||
|
|
|
@ -1075,6 +1075,8 @@ class Tree
|
|||
ON ta.id_agente = tasg.id_agent
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
AND tatm.id_alert_template = 1
|
||||
OR tatm.id_alert_template = NULL
|
||||
$inner
|
||||
WHERE tam.disabled = 0 AND ta.disabled = 0
|
||||
$condition
|
||||
|
|
|
@ -104,7 +104,7 @@ class TreeService extends Tree
|
|||
break;
|
||||
|
||||
case SERVICE_STATUS_WARNING:
|
||||
$processed_items[$row['id']][$key]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
$processed_items[$row['id']]['statusImageHTML'] = '<img src="images/status_sets/default/agent_warning_ball.png" data-title="WARNING status." data-use_title_for_force_title="1" class="forced_title" alt="WARNING status." />';
|
||||
break;
|
||||
|
||||
case SERVICE_STATUS_UNKNOWN:
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC190917';
|
||||
$pandora_version = 'v7.0NG.738';
|
||||
$build_version = 'PC191011';
|
||||
$pandora_version = 'v7.0NG.739';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -630,3 +630,21 @@ define('DEFAULT_NODE_COLOR', COL_NOTINIT);
|
|||
define('DEFAULT_NODE_IMAGE', 'images/networkmap/unknown.png');
|
||||
|
||||
define('NODE_IMAGE_PADDING', 5);
|
||||
|
||||
// Pandora Database HA constants.
|
||||
define('HA_ACTION_NONE', 0);
|
||||
define('HA_ACTION_DEPLOY', 1);
|
||||
define('HA_ACTION_RECOVER', 2);
|
||||
define('HA_ACTION_PROMOTE', 3);
|
||||
define('HA_ACTION_DEMOTE', 4);
|
||||
define('HA_ACTION_DISABLE', 5);
|
||||
define('HA_ACTION_ENABLE', 6);
|
||||
define('HA_ACTION_CLEANUP', 7);
|
||||
define('HA_ACTION_RESYNC', 8);
|
||||
|
||||
define('HA_UNINITIALIZED', 0);
|
||||
define('HA_ONLINE', 1);
|
||||
define('HA_PENDING', 2);
|
||||
define('HA_PROCESSING', 3);
|
||||
define('HA_DISABLED', 4);
|
||||
define('HA_FAILED', 5);
|
||||
|
|
|
@ -3789,11 +3789,20 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||
} else if (strpos($key, 'percentil') !== false) {
|
||||
$data_return['series_type'][$key] = 'percentil';
|
||||
if ($show_elements_graph['percentil']) {
|
||||
$data_return['legend'][$key] = __('Percentil').' '.$config['percentil'].'º '.__('of module').' ';
|
||||
if ($show_elements_graph['unit']) {
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$show_elements_graph['unit'].': ';
|
||||
$name_legend = __('Percentil').' ';
|
||||
$name_legend .= $config['percentil'].'º ';
|
||||
$name_legend .= __('of module').' ';
|
||||
$name_legend .= $value['agent_alias'].' / ';
|
||||
$name_legend .= $value['module_name'].' / ';
|
||||
$name_legend .= __('Unit ').' ';
|
||||
$name_legend .= $show_elements_graph['unit'].': ';
|
||||
} else {
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': ';
|
||||
$name_legend = __('Percentil').' ';
|
||||
$name_legend .= $config['percentil'].'º ';
|
||||
$name_legend .= __('of module').' ';
|
||||
$name_legend .= $value['agent_alias'].' / ';
|
||||
$name_legend .= $value['module_name'].': ';
|
||||
}
|
||||
|
||||
$data_return['legend'][$key] .= $name_legend;
|
||||
|
@ -4086,7 +4095,7 @@ function mask2cidr($mask)
|
|||
function get_help_info($section_name)
|
||||
{
|
||||
global $config;
|
||||
// hd($section_name);
|
||||
|
||||
$user_language = get_user_language($id_user);
|
||||
|
||||
$es = false;
|
||||
|
@ -5412,7 +5421,6 @@ function get_help_info($section_name)
|
|||
break;
|
||||
}
|
||||
|
||||
// hd($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,57 @@ function agents_get_agent_id_by_module_id($id_agente_modulo)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Search for agent data anywhere.
|
||||
*
|
||||
* Note: This method matches with server (perl) locate_agent.
|
||||
* Do not change order!
|
||||
*
|
||||
* @param string $field Alias, name or IP address of searchable agent.
|
||||
*
|
||||
* @return array Agent of false if not found.
|
||||
*/
|
||||
function agents_locate_agent(string $field)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$table = 'tagente';
|
||||
if (is_metaconsole()) {
|
||||
$table = 'tmetaconsole_agent';
|
||||
}
|
||||
|
||||
// Alias.
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM %s
|
||||
WHERE alias = "%s"',
|
||||
$table,
|
||||
$field
|
||||
);
|
||||
$agent = db_get_row_sql($sql);
|
||||
|
||||
if ($agent !== false) {
|
||||
return $agent;
|
||||
}
|
||||
|
||||
// Addr.
|
||||
$agent = agents_get_agent_with_ip($field);
|
||||
if ($agent !== false) {
|
||||
return $agent;
|
||||
}
|
||||
|
||||
// Name.
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM %s
|
||||
WHERE nombre = "%s"',
|
||||
$table,
|
||||
$field
|
||||
);
|
||||
return db_get_row_sql($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get agent id from an agent alias.
|
||||
*
|
||||
|
|
|
@ -1492,7 +1492,7 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
|
|||
global $config;
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'AW')) {
|
||||
returnError('forbidden', 'string');
|
||||
returnError('forbidden', 'you havent got permissions to do this');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1500,127 +1500,101 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
|
|||
return;
|
||||
}
|
||||
|
||||
$alias = $other['data'][0];
|
||||
$ip = $other['data'][1];
|
||||
$idParent = $other['data'][2];
|
||||
$idGroup = $other['data'][3];
|
||||
$cascadeProtection = $other['data'][4];
|
||||
$cascadeProtectionModule = $other['data'][5];
|
||||
$intervalSeconds = $other['data'][6];
|
||||
$idOS = $other['data'][7];
|
||||
// $idServer = $other['data'][7];
|
||||
$nameServer = $other['data'][8];
|
||||
$customId = $other['data'][9];
|
||||
$learningMode = $other['data'][10];
|
||||
$disabled = $other['data'][11];
|
||||
$description = $other['data'][12];
|
||||
$alias_as_name = $other['data'][13];
|
||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $other['data'][0])));
|
||||
$direccion_agente = io_safe_input($other['data'][1]);
|
||||
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
|
||||
$id_parent = (int) $other['data'][2];
|
||||
$grupo = (int) $other['data'][3];
|
||||
$cascade_protection = (int) $other['data'][4];
|
||||
$cascade_protection_module = (int) $other['data'][5];
|
||||
$intervalo = (string) $other['data'][6];
|
||||
$id_os = (int) $other['data'][7];
|
||||
$server_name = (string) $other['data'][8];
|
||||
$custom_id = (string) $other['data'][9];
|
||||
$modo = (int) $other['data'][10];
|
||||
$disabled = (int) $other['data'][11];
|
||||
$comentarios = (string) $other['data'][12];
|
||||
$alias_as_name = (int) $other['data'][13];
|
||||
$update_module_count = (int) $config['metaconsole_agent_cache'] == 1;
|
||||
|
||||
if ($alias_as_name && !empty($alias)) {
|
||||
$name = $alias;
|
||||
} else {
|
||||
$name = hash('sha256', $alias.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
|
||||
if (empty($alias)) {
|
||||
$alias = $name;
|
||||
}
|
||||
}
|
||||
|
||||
if ($cascadeProtection == 1) {
|
||||
if (($idParent != 0) && (db_get_value_sql(
|
||||
if ($cascade_protection == 1) {
|
||||
if (($id_parent != 0) && (db_get_value_sql(
|
||||
'SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = '.$idParent.' AND id_agente_modulo = '.$cascadeProtectionModule
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente = '.$id_parent.' AND id_agente_modulo = '.$cascade_protection_module
|
||||
) === false)
|
||||
) {
|
||||
returnError('parent_agent_not_exist', 'Is not a parent module to do cascade protection.');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$cascadeProtectionModule = 0;
|
||||
}
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql1 = 'SELECT name
|
||||
FROM tserver WHERE BINARY name LIKE "'.$nameServer.'"';
|
||||
break;
|
||||
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE BINARY name LIKE "'.$server_name.'"');
|
||||
|
||||
case 'postgresql':
|
||||
case 'oracle':
|
||||
$sql1 = 'SELECT name
|
||||
FROM tserver WHERE name LIKE \''.$nameServer.'\'';
|
||||
break;
|
||||
}
|
||||
|
||||
$nameServer = db_get_value_sql($sql1);
|
||||
|
||||
// Check ACL group
|
||||
if (!check_acl($config['id_user'], $idGroup, 'AW')) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check selected parent
|
||||
if ($idParent != 0) {
|
||||
$parentCheck = agents_check_access_agent($idParent);
|
||||
if ($parentCheck === null) {
|
||||
returnError('parent_agent_not_exist', __('The agent parent don`t exist.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($parentCheck === false) {
|
||||
returnError('parent_agent_forbidden', __('The user cannot access to parent agent.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (agents_get_agent_id($name)) {
|
||||
// Check if agent exists (BUG WC-50518-2).
|
||||
if ($alias == '' && $alias_as_name === 0) {
|
||||
returnError('alias_not_specified', 'No agent alias specified');
|
||||
} else if (agents_get_agent_id($name)) {
|
||||
returnError('agent_name_exist', 'The name of agent yet exist in DB.');
|
||||
} else if (db_get_value_sql(
|
||||
'SELECT id_grupo
|
||||
FROM tgrupo
|
||||
WHERE id_grupo = '.$idGroup
|
||||
) === false
|
||||
) {
|
||||
} else if (db_get_value_sql('SELECT id_grupo FROM tgrupo WHERE id_grupo = '.$grupo) === false) {
|
||||
returnError('id_grupo_not_exist', 'The group don`t exist.');
|
||||
} else if (db_get_value_sql(
|
||||
'SELECT id_os
|
||||
FROM tconfig_os
|
||||
WHERE id_os = '.$idOS
|
||||
) === false
|
||||
) {
|
||||
} else if (db_get_value_sql('SELECT id_os FROM tconfig_os WHERE id_os = '.$id_os) === false) {
|
||||
returnError('id_os_not_exist', 'The OS don`t exist.');
|
||||
} else if (db_get_value_sql($sql1) === false) {
|
||||
} else if ($server_name === false) {
|
||||
returnError('server_not_exist', 'The '.get_product_name().' Server don`t exist.');
|
||||
} else {
|
||||
$idAgente = db_process_sql_insert(
|
||||
'tagente',
|
||||
[
|
||||
'nombre' => $name,
|
||||
'alias' => $alias,
|
||||
'direccion' => $ip,
|
||||
'id_grupo' => $idGroup,
|
||||
'intervalo' => $intervalSeconds,
|
||||
'comentarios' => $description,
|
||||
'modo' => $learningMode,
|
||||
'id_os' => $idOS,
|
||||
'disabled' => $disabled,
|
||||
'cascade_protection' => $cascadeProtection,
|
||||
'cascade_protection_module' => $cascadeProtectionModule,
|
||||
'server_name' => $nameServer,
|
||||
'id_parent' => $idParent,
|
||||
'custom_id' => $customId,
|
||||
]
|
||||
);
|
||||
|
||||
if (!empty($idAgente) && !empty($ip)) {
|
||||
// register ip for this agent in 'taddress'
|
||||
agents_add_address($idAgente, $ip);
|
||||
if ($alias_as_name === 1) {
|
||||
$exists_alias = db_get_row_sql('SELECT nombre FROM tagente WHERE nombre = "'.$alias.'"');
|
||||
$nombre_agente = $alias;
|
||||
}
|
||||
|
||||
if ($idGroup && !empty($idAgente)) {
|
||||
if ($direccion_agente != '') {
|
||||
$exists_ip = db_get_row_sql('SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"');
|
||||
}
|
||||
|
||||
if (!$exists_alias && !$exists_ip) {
|
||||
$id_agente = db_process_sql_insert(
|
||||
'tagente',
|
||||
[
|
||||
'nombre' => $nombre_agente,
|
||||
'alias' => $alias,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'direccion' => $direccion_agente,
|
||||
'id_grupo' => $grupo,
|
||||
'intervalo' => $intervalo,
|
||||
'comentarios' => $comentarios,
|
||||
'modo' => $modo,
|
||||
'id_os' => $id_os,
|
||||
'disabled' => $disabled,
|
||||
'cascade_protection' => $cascade_protection,
|
||||
'cascade_protection_module' => $cascade_protection_module,
|
||||
'server_name' => $server_name,
|
||||
'id_parent' => $id_parent,
|
||||
'custom_id' => $custom_id,
|
||||
'os_version' => '',
|
||||
'agent_version' => '',
|
||||
'timezone_offset' => 0,
|
||||
'icon_path' => '',
|
||||
'url_address' => '',
|
||||
'update_module_count' => $update_module_count,
|
||||
]
|
||||
);
|
||||
enterprise_hook('update_agent', [$id_agente]);
|
||||
} else {
|
||||
$id_agente = false;
|
||||
}
|
||||
|
||||
if ($id_agente !== false) {
|
||||
// Create address for this agent in taddress.
|
||||
if ($direccion_agente != '') {
|
||||
agents_add_address($id_agente, $direccion_agente);
|
||||
}
|
||||
|
||||
$tpolicy_group_old = db_get_all_rows_sql(
|
||||
'SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = '.$idGroup
|
||||
WHERE id_group = '.$grupo
|
||||
);
|
||||
|
||||
if ($tpolicy_group_old) {
|
||||
|
@ -1629,18 +1603,54 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
|
|||
'tpolicy_agents',
|
||||
[
|
||||
'id_policy' => $old_group['id_policy'],
|
||||
'id_agent' => $idAgente,
|
||||
'id_agent' => $id_agente,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$info = '{"Name":"'.$nombre_agente.'",
|
||||
"IP":"'.$direccion_agente.'",
|
||||
"Group":"'.$grupo.'",
|
||||
"Interval":"'.$intervalo.'",
|
||||
"Comments":"'.$comentarios.'",
|
||||
"Mode":"'.$modo.'",
|
||||
"ID_parent:":"'.$id_parent.'",
|
||||
"Server":"'.$server_name.'",
|
||||
"ID os":"'.$id_os.'",
|
||||
"Disabled":"'.$disabled.'",
|
||||
"Custom ID":"'.$custom_id.'",
|
||||
"Cascade protection":"'.$cascade_protection.'",
|
||||
"Cascade protection module":"'.$cascade_protection_module.'"}';
|
||||
|
||||
$unsafe_alias = io_safe_output($alias);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
'Created agent '.$unsafe_alias,
|
||||
false,
|
||||
true,
|
||||
$info
|
||||
);
|
||||
} else {
|
||||
$id_agente = 0;
|
||||
|
||||
if ($exists_alias) {
|
||||
$agent_creation_error = __('Could not be created, because name already exists');
|
||||
} else if ($exists_ip) {
|
||||
$agent_creation_error = __('Could not be created, because IP already exists');
|
||||
} else {
|
||||
$agent_creation_error = __('Could not be created for unknown reason');
|
||||
}
|
||||
|
||||
returnError('generic error', $agent_creation_error);
|
||||
return;
|
||||
}
|
||||
|
||||
returnData(
|
||||
'string',
|
||||
[
|
||||
'type' => 'string',
|
||||
'data' => $idAgente,
|
||||
'data' => $id_agente,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -325,6 +325,34 @@ function config_update_config()
|
|||
if (!config_update_value('unique_ip', get_parameter('unique_ip'))) {
|
||||
$error_update[] = __('unique_ip');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_smtpServer', get_parameter('email_smtpServer'))) {
|
||||
$error_update[] = __('Server SMTP');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_from_dir', get_parameter('email_from_dir'))) {
|
||||
$error_update[] = __('From dir');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_from_name', get_parameter('email_from_name'))) {
|
||||
$error_update[] = __('From name');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_smtpPort', (int) get_parameter('email_smtpPort'))) {
|
||||
$error_update[] = __('Port SMTP');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_encryption', get_parameter('email_encryption'))) {
|
||||
$error_update[] = __('Encryption');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_username', get_parameter('email_username'))) {
|
||||
$error_update[] = __('Email user');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_password', get_parameter('email_password'))) {
|
||||
$error_update[] = __('Email password');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'enterprise':
|
||||
|
@ -419,34 +447,6 @@ function config_update_config()
|
|||
if (!config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist))) {
|
||||
$error_update[] = __('Inventory changes blacklist');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_from_dir', get_parameter('email_from_dir'))) {
|
||||
$error_update[] = __('From dir');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_from_name', get_parameter('email_from_name'))) {
|
||||
$error_update[] = __('From name');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_smtpServer', get_parameter('email_smtpServer'))) {
|
||||
$error_update[] = __('Server SMTP');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_smtpPort', (int) get_parameter('email_smtpPort'))) {
|
||||
$error_update[] = __('Port SMTP');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_encryption', get_parameter('email_encryption'))) {
|
||||
$error_update[] = __('Encryption');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_username', get_parameter('email_username'))) {
|
||||
$error_update[] = __('Email user');
|
||||
}
|
||||
|
||||
if (!config_update_value('email_password', get_parameter('email_password'))) {
|
||||
$error_update[] = __('Email password');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1434,6 +1434,92 @@ function config_update_config()
|
|||
}
|
||||
break;
|
||||
|
||||
case 'integria':
|
||||
if (!config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0))) {
|
||||
$error_update[] = __('Enable Integria IMS');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_user', (string) get_parameter('integria_user', $config['integria_user']))) {
|
||||
$error_update[] = __('Integria user');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_pass', io_input_password((string) get_parameter('integria_pass', $config['integria_pass'])))) {
|
||||
$error_update[] = __('Integria password');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_hostname', (string) get_parameter('integria_hostname', $config['integria_hostname']))) {
|
||||
$error_update[] = __('integria API hostname');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_api_pass', io_input_password((string) get_parameter('integria_api_pass', $config['integria_api_pass'])))) {
|
||||
$error_update[] = __('Integria API password');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_req_timeout', (int) get_parameter('integria_req_timeout', $config['integria_req_timeout']))) {
|
||||
$error_update[] = __('Integria request timeout');
|
||||
}
|
||||
|
||||
if (!config_update_value('default_group', (int) get_parameter('default_group', $config['default_group']))) {
|
||||
$error_update[] = __('Integria default group');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_default_group', (int) get_parameter('cr_default_group', $config['cr_default_group']))) {
|
||||
$error_update[] = __('Integria custom response default group');
|
||||
}
|
||||
|
||||
if (!config_update_value('default_criticity', (int) get_parameter('default_criticity', $config['default_criticity']))) {
|
||||
$error_update[] = __('Integria default priority');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_default_criticity', (int) get_parameter('cr_default_criticity', $config['cr_default_criticity']))) {
|
||||
$error_update[] = __('Integria custom response default priority');
|
||||
}
|
||||
|
||||
if (!config_update_value('default_creator', (string) get_parameter('default_creator', $config['default_creator']))) {
|
||||
$error_update[] = __('Integria default creator');
|
||||
}
|
||||
|
||||
if (!config_update_value('default_owner', (string) get_parameter('default_owner', $config['default_owner']))) {
|
||||
$error_update[] = __('Integria default owner');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_default_owner', (string) get_parameter('cr_default_owner', $config['cr_default_owner']))) {
|
||||
$error_update[] = __('Integria custom response default owner');
|
||||
}
|
||||
|
||||
if (!config_update_value('incident_type', (int) get_parameter('incident_type', $config['incident_type']))) {
|
||||
$error_update[] = __('Integria default ticket type');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_incident_type', (int) get_parameter('cr_incident_type', $config['cr_incident_type']))) {
|
||||
$error_update[] = __('Integria custom response default ticket type');
|
||||
}
|
||||
|
||||
if (!config_update_value('incident_status', (int) get_parameter('incident_status', $config['incident_status']))) {
|
||||
$error_update[] = __('Integria default ticket status');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_incident_status', (int) get_parameter('cr_incident_status', $config['cr_incident_status']))) {
|
||||
$error_update[] = __('Integria custom response default ticket status');
|
||||
}
|
||||
|
||||
if (!config_update_value('incident_title', (string) get_parameter('incident_title', $config['incident_title']))) {
|
||||
$error_update[] = __('Integria default ticket title');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_incident_title', (string) get_parameter('cr_incident_title', $config['cr_incident_title']))) {
|
||||
$error_update[] = __('Integria custom response default ticket title');
|
||||
}
|
||||
|
||||
if (!config_update_value('incident_content', (string) get_parameter('incident_content', $config['incident_content']))) {
|
||||
$error_update[] = __('Integria default ticket content');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_incident_content', (string) get_parameter('cr_incident_content', $config['cr_incident_content']))) {
|
||||
$error_update[] = __('Integria custom response default ticket content');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
|
@ -1500,7 +1586,7 @@ function config_process_config()
|
|||
|
||||
if (!isset($config['remote_config'])) {
|
||||
if ($is_windows) {
|
||||
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in';
|
||||
$default = 'C:\PandoraFMS\Pandora_Server\data_in';
|
||||
} else {
|
||||
$default = '/var/spool/pandora/data_in';
|
||||
}
|
||||
|
@ -1510,7 +1596,7 @@ function config_process_config()
|
|||
|
||||
if (!isset($config['phantomjs_bin'])) {
|
||||
if ($is_windows) {
|
||||
$default = 'C:\\PandoraFMS\\phantomjs';
|
||||
$default = 'C:\PandoraFMS\Pandora_Server\bin';
|
||||
} else {
|
||||
$default = '/usr/bin';
|
||||
}
|
||||
|
@ -1760,7 +1846,13 @@ function config_process_config()
|
|||
}
|
||||
|
||||
if (!isset($config['auditdir'])) {
|
||||
config_update_value('auditdir', '/var/www/html/pandora_console');
|
||||
$auditdir = '/var/www/html/pandora_console';
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// Windows.
|
||||
$auditdir = $config['homedir'];
|
||||
}
|
||||
|
||||
config_update_value('auditdir', $auditdir);
|
||||
}
|
||||
|
||||
if (!isset($config['elasticsearch_ip'])) {
|
||||
|
@ -1794,6 +1886,7 @@ function config_process_config()
|
|||
/*
|
||||
* Parse the ACL IP list for access API
|
||||
*/
|
||||
|
||||
$temp_list_ACL_IPs_for_API = [];
|
||||
if (isset($config['list_ACL_IPs_for_API'])) {
|
||||
if (!empty($config['list_ACL_IPs_for_API'])) {
|
||||
|
@ -1804,13 +1897,16 @@ function config_process_config()
|
|||
$config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API;
|
||||
$keysConfig = array_keys($config);
|
||||
|
||||
// This is not set here. The first time, when no
|
||||
// setup is done, update_manager extension manage it
|
||||
// the first time make a conenction and disable itself
|
||||
// Not Managed here !
|
||||
// if (!isset ($config["autoupdate"])) {
|
||||
// config_update_value ('autoupdate', true);.
|
||||
// }
|
||||
/*
|
||||
* This is not set here. The first time, when no
|
||||
* setup is done, update_manager extension manage it
|
||||
* the first time make a conenction and disable itself
|
||||
* Not Managed here !
|
||||
* if (!isset ($config["autoupdate"])) {
|
||||
* config_update_value ('autoupdate', true);.
|
||||
* }
|
||||
*/
|
||||
|
||||
include_once $config['homedir'].'/include/auth/mysql.php';
|
||||
include_once $config['homedir'].'/include/functions_io.php';
|
||||
|
||||
|
@ -1819,10 +1915,16 @@ function config_process_config()
|
|||
// user, and should be in pandora root. By default, Pandora adds
|
||||
// /attachment to this, so by default is the pandora console home
|
||||
// dir.
|
||||
$attachment_store_path = $config['homedir'].'/attachment';
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// Windows.
|
||||
$attachment_store_path = $config['homedir'].'\attachment';
|
||||
}
|
||||
|
||||
if (!isset($config['attachment_store'])) {
|
||||
config_update_value(
|
||||
'attachment_store',
|
||||
io_safe_input($config['homedir']).'/attachment'
|
||||
$attachment_store_path
|
||||
);
|
||||
} else {
|
||||
// Fixed when the user moves the pandora console to another dir
|
||||
|
@ -1830,16 +1932,23 @@ function config_process_config()
|
|||
if (!is_dir($config['attachment_store'])) {
|
||||
config_update_value(
|
||||
'attachment_store',
|
||||
$config['homedir'].'/attachment'
|
||||
$attachment_store_path
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($config['fontpath'])) {
|
||||
$home = str_replace('\\', '/', $config['homedir']);
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// Windows.
|
||||
$fontpath = $config['homedir'].'\include\fonts\smallfont.ttf';
|
||||
} else {
|
||||
$home = str_replace('\\', '/', $config['homedir']);
|
||||
$fontpath = $home.'/include/fonts/smallfont.ttf';
|
||||
}
|
||||
|
||||
config_update_value(
|
||||
'fontpath',
|
||||
$home.'/include/fonts/smallfont.ttf'
|
||||
$fontpath
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2077,7 +2186,7 @@ function config_process_config()
|
|||
|
||||
if (!isset($config['netflow_path'])) {
|
||||
if ($is_windows) {
|
||||
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in\\netflow';
|
||||
$default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow';
|
||||
} else {
|
||||
$default = '/var/spool/pandora/data_in/netflow';
|
||||
}
|
||||
|
@ -2639,6 +2748,10 @@ function config_process_config()
|
|||
config_update_value('zoom_graph', 1);
|
||||
}
|
||||
|
||||
if (!isset($config['percentil'])) {
|
||||
config_update_value('percentil', 95);
|
||||
}
|
||||
|
||||
if (!isset($config['render_proc_ok'])) {
|
||||
config_update_value('render_proc_ok', __('Ok'));
|
||||
}
|
||||
|
@ -2820,6 +2933,19 @@ function config_process_config()
|
|||
}
|
||||
}
|
||||
|
||||
// Integria.
|
||||
if (!isset($config['integria_enabled'])) {
|
||||
config_update_value('integria_enabled', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['integria_req_timeout'])) {
|
||||
config_update_value('integria_req_timeout', 5);
|
||||
}
|
||||
|
||||
if (!isset($config['integria_hostname'])) {
|
||||
config_update_value('integria_hostname', '');
|
||||
}
|
||||
|
||||
// Finally, check if any value was overwritten in a form.
|
||||
config_update_config();
|
||||
}
|
||||
|
|
|
@ -24,422 +24,8 @@
|
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*
|
||||
* Moved to CredentialStore.class.php
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array with all the credentials matching filter and ACL.
|
||||
*
|
||||
* @param array $fields Fields array or 'count' keyword to retrieve count.
|
||||
* @param array $filter Filters to be applied.
|
||||
* @param integer $offset Offset (pagination).
|
||||
* @param integer $limit Limit (pagination).
|
||||
* @param string $order Sort order.
|
||||
* @param string $sort_field Sort field.
|
||||
*
|
||||
* @return array With all results or false if error.
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
function credentials_get_all(
|
||||
$fields,
|
||||
array $filter,
|
||||
$offset=null,
|
||||
$limit=null,
|
||||
$order=null,
|
||||
$sort_field=null
|
||||
) {
|
||||
$sql_filters = [];
|
||||
$order_by = '';
|
||||
$pagination = '';
|
||||
|
||||
global $config;
|
||||
|
||||
if (!is_array($filter)) {
|
||||
error_log('[credential_get_all] Filter must be an array.');
|
||||
throw new Exception('[credential_get_all] Filter must be an array.');
|
||||
}
|
||||
|
||||
$count = false;
|
||||
if (!is_array($fields) && $fields == 'count') {
|
||||
$fields = ['cs.*'];
|
||||
$count = true;
|
||||
} else if (!is_array($fields)) {
|
||||
error_log('[credential_get_all] Fields must be an array or "count".');
|
||||
throw new Exception('[credential_get_all] Fields must be an array or "count".');
|
||||
}
|
||||
|
||||
if (isset($filter['product']) && !empty($filter['product'])) {
|
||||
$sql_filters[] = sprintf(' AND cs.product = "%s"', $filter['product']);
|
||||
}
|
||||
|
||||
if (isset($filter['free_search']) && !empty($filter['free_search'])) {
|
||||
$sql_filters[] = vsprintf(
|
||||
' AND (lower(cs.username) like lower("%%%s%%")
|
||||
OR cs.identifier like "%%%s%%"
|
||||
OR lower(cs.product) like lower("%%%s%%"))',
|
||||
array_fill(0, 3, $filter['free_search'])
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($filter['filter_id_group']) && $filter['filter_id_group'] > 0) {
|
||||
$propagate = db_get_value(
|
||||
'propagate',
|
||||
'tgrupo',
|
||||
'id_grupo',
|
||||
$filter['filter_id_group']
|
||||
);
|
||||
|
||||
if (!$propagate) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND cs.id_group = %d ',
|
||||
$filter['filter_id_group']
|
||||
);
|
||||
} else {
|
||||
$groups = [ $filter['filter_id_group'] ];
|
||||
$childrens = groups_get_childrens($id_group, null, true);
|
||||
if (!empty($childrens)) {
|
||||
foreach ($childrens as $child) {
|
||||
$groups[] = (int) $child['id_grupo'];
|
||||
}
|
||||
}
|
||||
|
||||
$filter['filter_id_group'] = $groups;
|
||||
$sql_filters[] = sprintf(
|
||||
' AND cs.id_group IN (%s) ',
|
||||
join(',', $filter['filter_id_group'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($filter['group_list']) && is_array($filter['group_list'])) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND cs.id_group IN (%s) ',
|
||||
join(',', $filter['group_list'])
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($order)) {
|
||||
$dir = 'asc';
|
||||
if ($order == 'desc') {
|
||||
$dir = 'desc';
|
||||
};
|
||||
|
||||
if (in_array(
|
||||
$sort_field,
|
||||
[
|
||||
'group',
|
||||
'identifier',
|
||||
'product',
|
||||
'username',
|
||||
'options',
|
||||
]
|
||||
)
|
||||
) {
|
||||
$order_by = sprintf(
|
||||
'ORDER BY `%s` %s',
|
||||
$sort_field,
|
||||
$dir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($limit) && $limit > 0
|
||||
&& isset($offset) && $offset >= 0
|
||||
) {
|
||||
$pagination = sprintf(
|
||||
' LIMIT %d OFFSET %d ',
|
||||
$limit,
|
||||
$offset
|
||||
);
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
FROM tcredential_store cs
|
||||
LEFT JOIN tgrupo tg
|
||||
ON tg.id_grupo = cs.id_group
|
||||
WHERE 1=1
|
||||
%s
|
||||
%s
|
||||
%s',
|
||||
join(',', $fields),
|
||||
join(' ', $sql_filters),
|
||||
$order_by,
|
||||
$pagination
|
||||
);
|
||||
|
||||
if ($count) {
|
||||
$sql = sprintf('SELECT count(*) as n FROM ( %s ) tt', $sql);
|
||||
|
||||
return db_get_value_sql($sql);
|
||||
}
|
||||
|
||||
return db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves target key from keystore or false in case of error.
|
||||
*
|
||||
* @param string $identifier Key identifier.
|
||||
*
|
||||
* @return array Key or false if error.
|
||||
*/
|
||||
function get_key($identifier)
|
||||
{
|
||||
return db_get_row_filter(
|
||||
'tcredential_store',
|
||||
[ 'identifier' => $identifier ]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Minor function to dump json message as ajax response.
|
||||
*
|
||||
* @param string $type Type: result || error.
|
||||
* @param string $msg Message.
|
||||
* @param boolean $delete Deletion messages.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function ajax_msg($type, $msg, $delete=false)
|
||||
{
|
||||
$msg_err = 'Failed while saving: %s';
|
||||
$msg_ok = 'Successfully saved into keystore ';
|
||||
|
||||
if ($delete) {
|
||||
$msg_err = 'Failed while removing: %s';
|
||||
$msg_ok = 'Successfully deleted ';
|
||||
}
|
||||
|
||||
if ($type == 'error') {
|
||||
echo json_encode(
|
||||
[
|
||||
$type => ui_print_error_message(
|
||||
__(
|
||||
$msg_err,
|
||||
$msg
|
||||
),
|
||||
'',
|
||||
true
|
||||
),
|
||||
]
|
||||
);
|
||||
} else {
|
||||
echo json_encode(
|
||||
[
|
||||
$type => ui_print_success_message(
|
||||
__(
|
||||
$msg_ok,
|
||||
$msg
|
||||
),
|
||||
'',
|
||||
true
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for new/update forms.
|
||||
*
|
||||
* @param array $values Values or null.
|
||||
*
|
||||
* @return string Inputs.
|
||||
*/
|
||||
function print_inputs($values=null)
|
||||
{
|
||||
if (!is_array($values)) {
|
||||
$values = [];
|
||||
}
|
||||
|
||||
$return = '';
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => __('Identifier'),
|
||||
'name' => 'identifier',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'text',
|
||||
'value' => $values['identifier'],
|
||||
'disabled' => (bool) $values['identifier'],
|
||||
'return' => true,
|
||||
'script' => 'alert(\'puta\')',
|
||||
]
|
||||
);
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => __('Group'),
|
||||
'name' => 'id_group',
|
||||
'id' => 'id_group',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'select_groups',
|
||||
'selected' => $values['id_group'],
|
||||
'return' => true,
|
||||
'class' => 'w50p',
|
||||
]
|
||||
);
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => __('Product'),
|
||||
'name' => 'product',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'select',
|
||||
'script' => 'calculate_inputs()',
|
||||
'fields' => [
|
||||
'CUSTOM' => __('Custom'),
|
||||
'AWS' => __('Aws'),
|
||||
'AZURE' => __('Azure'),
|
||||
// 'GOOGLE' => __('Google'),
|
||||
],
|
||||
'selected' => $values['product'],
|
||||
'disabled' => (bool) $values['product'],
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
$user_label = __('Username');
|
||||
$pass_label = __('Password');
|
||||
$extra_1_label = __('Extra');
|
||||
$extra_2_label = __('Extra (2)');
|
||||
$extra1 = true;
|
||||
$extra2 = true;
|
||||
|
||||
// Remember to update credential_store.php also.
|
||||
switch ($values['product']) {
|
||||
case 'AWS':
|
||||
$user_label = __('Access key ID');
|
||||
$pass_label = __('Secret access key');
|
||||
$extra1 = false;
|
||||
$extra2 = false;
|
||||
break;
|
||||
|
||||
case 'AZURE':
|
||||
$user_label = __('Account ID');
|
||||
$pass_label = __('Application secret');
|
||||
$extra_1_label = __('Tenant or domain name');
|
||||
$extra_2_label = __('Subscription id');
|
||||
break;
|
||||
|
||||
case 'GOOGLE':
|
||||
// Need further investigation.
|
||||
case 'CUSTOM':
|
||||
$user_label = __('Account ID');
|
||||
$pass_label = __('Password');
|
||||
$extra1 = false;
|
||||
$extra2 = false;
|
||||
default:
|
||||
// Use defaults.
|
||||
break;
|
||||
}
|
||||
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => $user_label,
|
||||
'name' => 'username',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'text',
|
||||
'value' => $values['username'],
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => $pass_label,
|
||||
'name' => 'password',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'password',
|
||||
'value' => $values['password'],
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
if ($extra1) {
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => $extra_1_label,
|
||||
'name' => 'extra_1',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'text',
|
||||
'value' => $values['extra_1'],
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ($extra2) {
|
||||
$return .= html_print_input(
|
||||
[
|
||||
'label' => $extra_2_label,
|
||||
'name' => 'extra_2',
|
||||
'input_class' => 'flex-row',
|
||||
'type' => 'text',
|
||||
'value' => $values['extra_2'],
|
||||
'return' => true,
|
||||
'display' => $extra2,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve all identifiers available for current user.
|
||||
*
|
||||
* @param string $product Target product.
|
||||
*
|
||||
* @return array Of account identifiers.
|
||||
*/
|
||||
function credentials_list_accounts($product)
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
include_once $config['homedir'].'/include/functions_users.php';
|
||||
|
||||
static $user_groups;
|
||||
|
||||
if (!isset($user_groups)) {
|
||||
$user_groups = users_get_groups(
|
||||
$config['id_user'],
|
||||
'AR'
|
||||
);
|
||||
|
||||
// Always add group 'ALL' because 'ALL' group credentials
|
||||
// must be available for all users.
|
||||
if (is_array($user_groups)) {
|
||||
$user_groups = ([0] + array_keys($user_groups));
|
||||
} else {
|
||||
$user_groups = [0];
|
||||
}
|
||||
}
|
||||
|
||||
$creds = credentials_get_all(
|
||||
['identifier'],
|
||||
[
|
||||
'product' => $product,
|
||||
'group_list' => $user_groups,
|
||||
]
|
||||
);
|
||||
|
||||
if ($creds === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$ret = array_reduce(
|
||||
$creds,
|
||||
function ($carry, $item) {
|
||||
$carry[$item['identifier']] = $item['identifier'];
|
||||
return $carry;
|
||||
}
|
||||
);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
// Deprecated.
|
||||
|
|
|
@ -124,8 +124,26 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
|
|||
}
|
||||
|
||||
$groups = users_get_groups($id_user, $privileges, $returnAllGroup);
|
||||
$all_graphs = [];
|
||||
if (is_metaconsole()) {
|
||||
$servers = metaconsole_get_connection_names();
|
||||
foreach ($servers as $key => $server) {
|
||||
$connection = metaconsole_get_connection($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$all_graph = db_get_all_rows_in_table('tgraph', 'name');
|
||||
if ($all_graph !== false) {
|
||||
$all_graphs = array_merge($all_graphs, $all_graph);
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$all_graphs = db_get_all_rows_in_table('tgraph', 'name');
|
||||
}
|
||||
|
||||
$all_graphs = db_get_all_rows_in_table('tgraph', 'name');
|
||||
if ($all_graphs === false) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -46,6 +46,25 @@ function db_select_engine()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Connects to target DB.
|
||||
*
|
||||
* @param array $setup Database definition.
|
||||
*
|
||||
* @return mixed Dbconnection or null.
|
||||
*/
|
||||
function get_dbconnection(array $setup)
|
||||
{
|
||||
return mysqli_connect(
|
||||
$setup['dbhost'],
|
||||
$setup['dbuser'],
|
||||
$setup['dbpass'],
|
||||
$setup['dbname'],
|
||||
$setup['dbport']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function db_connect($host=null, $db=null, $user=null, $pass=null, $port=null, $critical=true, $charset=null)
|
||||
{
|
||||
global $config;
|
||||
|
|
|
@ -2739,6 +2739,10 @@ function events_get_agent(
|
|||
$date = time_w_fixed_tz($date);
|
||||
}
|
||||
|
||||
if (is_metaconsole() && $events_group === false) {
|
||||
$id_server = true;
|
||||
}
|
||||
|
||||
if (empty($date)) {
|
||||
$date = get_system_time();
|
||||
}
|
||||
|
@ -4378,7 +4382,7 @@ function events_page_general($event)
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Event name');
|
||||
$data[1] = events_display_name($event['evento']);
|
||||
$data[1] = '<span style="word-break: break-word;">'.events_display_name($event['evento']).'</span>';
|
||||
$table_general->data[] = $data;
|
||||
|
||||
$data = [];
|
||||
|
@ -6634,3 +6638,297 @@ function events_get_secondary_groups_left_join($table)
|
|||
return 'LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON te.id_agente = tasg.id_tagente AND te.server_id = tasg.id_tmetaconsole_setup';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Replace macros in any string given an event id.
|
||||
* If server_id > 0, it's a metaconsole query.
|
||||
*
|
||||
* @param integer $event_id Event identifier.
|
||||
* @param integer $value String value in which we want to apply macros.
|
||||
*
|
||||
* @return string The response text with the macros applied.
|
||||
*/
|
||||
function events_get_field_value_by_event_id(
|
||||
int $event_id,
|
||||
$value
|
||||
) {
|
||||
global $config;
|
||||
|
||||
$meta = false;
|
||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
||||
|
||||
// Replace each macro.
|
||||
if (strpos($value, '_agent_address_') !== false) {
|
||||
if ($meta) {
|
||||
$agente_table_name = 'tmetaconsole_agent';
|
||||
$filter = [
|
||||
'id_tagente' => $event['id_agente'],
|
||||
'id_tmetaconsole_setup' => $server_id,
|
||||
];
|
||||
} else {
|
||||
$agente_table_name = 'tagente';
|
||||
$filter = ['id_agente' => $event['id_agente']];
|
||||
}
|
||||
|
||||
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
|
||||
// If agent does not have an IP, display N/A.
|
||||
if ($ip === false) {
|
||||
$ip = __('N/A');
|
||||
}
|
||||
|
||||
$value = str_replace('_agent_address_', $ip, $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_agent_id_') !== false) {
|
||||
$value = str_replace('_agent_id_', $event['id_agente'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_module_address_') !== false) {
|
||||
if ($event['id_agentmodule'] != 0) {
|
||||
if ($meta) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$module = db_get_row('tagente_modulo', 'id_agente_modulo', $event['id_agentmodule']);
|
||||
if (empty($module['ip_target'])) {
|
||||
$module['ip_target'] = __('N/A');
|
||||
}
|
||||
|
||||
$value = str_replace('_module_address_', $module['ip_target'], $value);
|
||||
if (empty($module['nombre'])) {
|
||||
$module['nombre'] = __('N/A');
|
||||
}
|
||||
|
||||
if ($meta) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$value = str_replace('_module_address_', __('N/A'), $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_module_name_') !== false) {
|
||||
if ($event['id_agentmodule'] != 0) {
|
||||
if ($meta) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$module = db_get_row('tagente_modulo', 'id_agente_modulo', $event['id_agentmodule']);
|
||||
if (empty($module['ip_target'])) {
|
||||
$module['ip_target'] = __('N/A');
|
||||
}
|
||||
|
||||
$value = str_replace(
|
||||
'_module_name_',
|
||||
io_safe_output($module['nombre']),
|
||||
$value
|
||||
);
|
||||
|
||||
if ($meta) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$value = str_replace('_module_name_', __('N/A'), $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_id_') !== false) {
|
||||
$value = str_replace('_event_id_', $event['id_evento'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_user_id_') !== false) {
|
||||
if (!empty($event['id_usuario'])) {
|
||||
$value = str_replace('_user_id_', $event['id_usuario'], $value);
|
||||
} else {
|
||||
$value = str_replace('_user_id_', __('N/A'), $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_group_id_') !== false) {
|
||||
$value = str_replace('_group_id_', $event['id_grupo'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_group_name_') !== false) {
|
||||
$value = str_replace(
|
||||
'_group_name_',
|
||||
groups_get_name($event['id_grupo'], true),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_utimestamp_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_utimestamp_',
|
||||
$event['utimestamp'],
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_date_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_date_',
|
||||
date($config['date_format'], $event['utimestamp']),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_text_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_text_',
|
||||
events_display_name($event['evento']),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_type_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_type_',
|
||||
events_print_type_description($event['event_type'], true),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_alert_id_') !== false) {
|
||||
$value = str_replace(
|
||||
'_alert_id_',
|
||||
empty($event['is_alert_am']) ? __('N/A') : $event['is_alert_am'],
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_severity_id_') !== false) {
|
||||
$value = str_replace('_event_severity_id_', $event['criticity'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_severity_text_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_severity_text_',
|
||||
get_priority_name($event['criticity']),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_module_id_') !== false) {
|
||||
$value = str_replace('_module_id_', $event['id_agentmodule'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_tags_') !== false) {
|
||||
$value = str_replace('_event_tags_', $event['tags'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_extra_id_') !== false) {
|
||||
if (empty($event['id_extra'])) {
|
||||
$value = str_replace('_event_extra_id_', __('N/A'), $value);
|
||||
} else {
|
||||
$value = str_replace('_event_extra_id_', $event['id_extra'], $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_source_') !== false) {
|
||||
$value = str_replace('_event_source_', $event['source'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_instruction_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_instruction_',
|
||||
events_display_instructions($event['event_type'], $event, false),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_owner_user_') !== false) {
|
||||
if (empty($event['owner_user'])) {
|
||||
$value = str_replace('_owner_user_', __('N/A'), $value);
|
||||
} else {
|
||||
$value = str_replace('_owner_user_', $event['owner_user'], $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_status_') !== false) {
|
||||
$event_st = events_display_status($event['estado']);
|
||||
$value = str_replace('_event_status_', $event_st['title'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_group_custom_id_') !== false) {
|
||||
$group_custom_id = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT custom_id FROM tgrupo WHERE id_grupo=%s',
|
||||
$event['id_grupo']
|
||||
)
|
||||
);
|
||||
$event_st = events_display_status($event['estado']);
|
||||
$value = str_replace('_group_custom_id_', $group_custom_id, $value);
|
||||
}
|
||||
|
||||
// Parse the event custom data.
|
||||
if (!empty($event['custom_data'])) {
|
||||
$custom_data = json_decode(base64_decode($event['custom_data']));
|
||||
foreach ($custom_data as $key => $val) {
|
||||
$value = str_replace('_customdata_'.$key.'_', $val, $value);
|
||||
}
|
||||
}
|
||||
|
||||
// This will replace the macro with the current logged user.
|
||||
if (strpos($value, '_current_user_') !== false) {
|
||||
$value = str_replace('_current_user_', $config['id_user'], $value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function events_get_instructions($event)
|
||||
{
|
||||
if (!is_array($event)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
switch ($event['event_type']) {
|
||||
case 'going_unknown':
|
||||
if ($event['unknown_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['unknown_instructions']));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'going_up_warning':
|
||||
case 'going_down_warning':
|
||||
if ($event['warning_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['warning_instructions']));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'going_up_critical':
|
||||
case 'going_down_critical':
|
||||
if ($event['critical_instructions'] != '') {
|
||||
$value = str_replace("\n", '<br>', io_safe_output($event['critical_instructions']));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isset($value)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$max_text_length = 300;
|
||||
$over_text = io_safe_output($value);
|
||||
if (strlen($over_text) > ($max_text_length + 3)) {
|
||||
$over_text = substr($over_text, 0, $max_text_length).'...';
|
||||
}
|
||||
|
||||
$output = '<div id="hidden_event_instructions_'.$event['id_evento'].'"';
|
||||
$output .= ' style="display: none; width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left">';
|
||||
$output .= $value;
|
||||
$output .= '</div>';
|
||||
$output .= '<center>';
|
||||
$output .= '<span id="value_event_'.$event['id_evento'].'" style="white-space: nowrap;">';
|
||||
$output .= '<span id="value_event_text_'.$event['id_evento'].'"></span>';
|
||||
$output .= '<a href="javascript:show_instructions('.$event['id_evento'].')">';
|
||||
$output .= html_print_image('images/default_list.png', true, ['title' => $over_text]).'</a></span>';
|
||||
$output .= '</center>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -295,12 +295,41 @@ function grafico_modulo_sparse_data(
|
|||
return false;
|
||||
}
|
||||
|
||||
$array_data['sum'.$series_suffix]['agent_module_id'] = $agent_module_id;
|
||||
$array_data['sum'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
||||
$array_data['sum'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
||||
$array_data['sum'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
|
||||
$array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||
$array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||
$array_data = series_suffix_leyend(
|
||||
'sum',
|
||||
$series_suffix,
|
||||
$agent_module_id,
|
||||
$data_module_graph,
|
||||
$array_data
|
||||
);
|
||||
|
||||
if ($params['percentil']) {
|
||||
$array_data = series_suffix_leyend(
|
||||
'percentil',
|
||||
$series_suffix,
|
||||
$agent_module_id,
|
||||
$data_module_graph,
|
||||
$array_data
|
||||
);
|
||||
}
|
||||
|
||||
if ($params['type_mode_graph']) {
|
||||
$array_data = series_suffix_leyend(
|
||||
'min',
|
||||
$series_suffix,
|
||||
$agent_module_id,
|
||||
$data_module_graph,
|
||||
$array_data
|
||||
);
|
||||
|
||||
$array_data = series_suffix_leyend(
|
||||
'max',
|
||||
$series_suffix,
|
||||
$agent_module_id,
|
||||
$data_module_graph,
|
||||
$array_data
|
||||
);
|
||||
}
|
||||
|
||||
// This is for a specific type of report that consists in passing
|
||||
// an interval and doing the average sum and avg.
|
||||
|
@ -378,12 +407,6 @@ function grafico_modulo_sparse_data(
|
|||
$array_data['sum1']['data'] = $acum_array_data;
|
||||
}
|
||||
|
||||
if ($params['percentil']) {
|
||||
$percentil_value = $array_data['percentil'.$series_suffix]['data'][0][1];
|
||||
} else {
|
||||
$percentil_value = 0;
|
||||
}
|
||||
|
||||
$events = [];
|
||||
if (isset($array_data['sum'.$series_suffix]['max'])) {
|
||||
$max = $array_data['sum'.$series_suffix]['max'];
|
||||
|
@ -1471,8 +1494,6 @@ function graphic_combined_module(
|
|||
$min = $array_data['sum'.$i]['min'];
|
||||
$avg = $array_data['sum'.$i]['avg'];
|
||||
|
||||
$percentil_value = $array_data['percentil'.$i]['data'][0][1];
|
||||
|
||||
if ($config['fixed_graph'] == false) {
|
||||
$water_mark = [
|
||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||
|
@ -1521,7 +1542,8 @@ function graphic_combined_module(
|
|||
$array_data,
|
||||
$params_combined['average'],
|
||||
$params_combined['summatory'],
|
||||
$params_combined['modules_series']
|
||||
$params_combined['modules_series'],
|
||||
$date_array
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2222,7 +2244,7 @@ function graphic_combined_module(
|
|||
* @param boolean $average Average.
|
||||
* @param boolean $summatory Summatory.
|
||||
* @param boolean $modules_series Series module.
|
||||
* @param boolean $baseline Baseline data.
|
||||
* @param array $date_array Date data.
|
||||
*
|
||||
* @return array Data.
|
||||
*/
|
||||
|
@ -2231,106 +2253,82 @@ function combined_graph_summatory_average(
|
|||
$average=false,
|
||||
$summatory=false,
|
||||
$modules_series=false,
|
||||
$baseline=false
|
||||
$date_array=[]
|
||||
) {
|
||||
if (isset($array_data) && is_array($array_data)) {
|
||||
$reduce_array = [];
|
||||
foreach ($array_data as $key => $value) {
|
||||
if (strpos($key, 'sum') !== false) {
|
||||
$data_array_reverse[$key] = array_reverse($value['data']);
|
||||
if (!$modules_series) {
|
||||
unset($array_data[$key]);
|
||||
}
|
||||
$last = $date_array['start_date'];
|
||||
$reduce_array = array_reduce(
|
||||
$value['data'],
|
||||
function ($carry, $item) use ($date_array, $last, $reduce_array) {
|
||||
$slice_start = $date_array['start_date'];
|
||||
$iterator = $last;
|
||||
|
||||
// JS to PHP timestamp format.
|
||||
$item[0] /= 1000;
|
||||
while ($iterator <= $date_array['final_date']) {
|
||||
if ($item[0] >= $slice_start && $item[0] < $iterator) {
|
||||
$array = [];
|
||||
$val = 0;
|
||||
$n = 0;
|
||||
|
||||
if (is_array($reduce_array[$slice_start])) {
|
||||
$val = $reduce_array[$slice_start]['value'];
|
||||
$n = ($reduce_array[$slice_start]['n'] + 1);
|
||||
}
|
||||
|
||||
$array['value'] = ($item[1] + $val);
|
||||
$array['n'] = $n;
|
||||
$array['t'] = ($slice_start * 1000);
|
||||
|
||||
$carry[$slice_start] = $array;
|
||||
$last = $iterator;
|
||||
break;
|
||||
} else {
|
||||
$slice_start = $iterator;
|
||||
$iterator += 300;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
return $carry;
|
||||
},
|
||||
$reduce_array
|
||||
);
|
||||
}
|
||||
|
||||
if (!$modules_series) {
|
||||
unset($array_data[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($data_array_reverse) && is_array($data_array_reverse)) {
|
||||
$array_sum_reverse = [];
|
||||
$array_avg_reverse = [];
|
||||
$data_array_prev = false;
|
||||
$data_array_pop = [];
|
||||
$count = 0;
|
||||
$reduce_array_summatory = [];
|
||||
$reduce_array_average = [];
|
||||
$i = 0;
|
||||
foreach ($reduce_array as $item) {
|
||||
$reduce_array_summatory[$i][0] = $item['t'];
|
||||
$reduce_array_summatory[$i][1] = $item['value'];
|
||||
|
||||
$count_data_array_reverse = count($data_array_reverse['sum0']);
|
||||
while ($count_data_array_reverse > 0) {
|
||||
foreach ($data_array_reverse as $key_reverse => $value_reverse) {
|
||||
if (is_array($value_reverse) && count($value_reverse) > 0) {
|
||||
$data_array_pop[$key_reverse] = array_pop(
|
||||
$data_array_reverse[$key_reverse]
|
||||
);
|
||||
}
|
||||
}
|
||||
$reduce_array_average[$i][0] = $item['t'];
|
||||
$reduce_array_average[$i][1] = ($item['value'] / ($item['n'] + 1));
|
||||
|
||||
if (isset($data_array_pop) && is_array($data_array_pop)) {
|
||||
$acum_data = 0;
|
||||
$acum_array = [];
|
||||
$sum_data = 0;
|
||||
$count_pop = 0;
|
||||
foreach ($data_array_pop as $key_pop => $value_pop) {
|
||||
if ($value_pop[0] > $acum_data) {
|
||||
if ($acum_data != 0) {
|
||||
$sum_data = ($sum_data + $data_array_prev[$key_pop][1]);
|
||||
$data_array_reverse[$key_pop][] = $value_pop;
|
||||
$data_array_prev[$acum_key] = $acum_array;
|
||||
} else {
|
||||
if ($data_array_prev[$key_pop] == false) {
|
||||
$data_array_prev[$key_pop] = $value_pop;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$acum_key = $key_pop;
|
||||
$acum_data = $value_pop[0];
|
||||
$acum_array = $value_pop;
|
||||
$sum_data = $value_pop[1];
|
||||
}
|
||||
} else if ($value_pop[0] < $acum_data) {
|
||||
$sum_data = ($sum_data + $data_array_prev[$key_pop][1]);
|
||||
$data_array_reverse[$acum_key][] = $acum_array;
|
||||
$data_array_prev[$key_pop] = $value_pop;
|
||||
$acum_key = $key_pop;
|
||||
$acum_data = $value_pop[0];
|
||||
$acum_array = $value_pop;
|
||||
} else if ($value_pop[0] == $acum_data) {
|
||||
$data_array_prev[$key_pop] = $value_pop;
|
||||
$sum_data += $value_pop[1];
|
||||
}
|
||||
if ($summatory && isset($reduce_array_summatory)
|
||||
&& is_array($reduce_array_summatory)
|
||||
&& count($reduce_array_summatory) > 0
|
||||
) {
|
||||
$array_data['summatory']['data'] = $reduce_array_summatory;
|
||||
}
|
||||
|
||||
$count_pop++;
|
||||
}
|
||||
|
||||
if ($summatory) {
|
||||
$array_sum_reverse[$count][0] = $acum_data;
|
||||
$array_sum_reverse[$count][1] = $sum_data;
|
||||
}
|
||||
|
||||
if ($average) {
|
||||
$array_avg_reverse[$count][0] = $acum_data;
|
||||
$array_avg_reverse[$count][1] = ($sum_data / $count_pop);
|
||||
}
|
||||
}
|
||||
|
||||
$count++;
|
||||
$count_data_array_reverse--;
|
||||
}
|
||||
|
||||
if ($summatory && isset($array_sum_reverse)
|
||||
&& is_array($array_sum_reverse)
|
||||
&& count($array_sum_reverse) > 0
|
||||
) {
|
||||
$array_data['summatory']['data'] = $array_sum_reverse;
|
||||
$array_data['summatory']['color'] = 'purple';
|
||||
}
|
||||
|
||||
if ($average && isset($array_avg_reverse)
|
||||
&& is_array($array_avg_reverse)
|
||||
&& count($array_avg_reverse) > 0
|
||||
) {
|
||||
if ($baseline) {
|
||||
$array_data['baseline']['data'] = $array_avg_reverse;
|
||||
$array_data['baseline']['color'] = 'green';
|
||||
} else {
|
||||
$array_data['average']['data'] = $array_avg_reverse;
|
||||
$array_data['average']['color'] = 'orange';
|
||||
}
|
||||
}
|
||||
if ($average && isset($reduce_array_average)
|
||||
&& is_array($reduce_array_average)
|
||||
&& count($reduce_array_average) > 0
|
||||
) {
|
||||
$array_data['average']['data'] = $reduce_array_average;
|
||||
}
|
||||
|
||||
return $array_data;
|
||||
|
@ -3191,6 +3189,21 @@ function graphic_incident_source($width=320, $height=200)
|
|||
}
|
||||
|
||||
|
||||
function series_suffix_leyend($series_name, $series_suffix, $id_agent, $data_module_graph, $array_data)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$array_data[$series_name.$series_suffix]['agent_module_id'] = $id_agent;
|
||||
$array_data[$series_name.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
||||
$array_data[$series_name.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
||||
$array_data[$series_name.$series_suffix]['module_name'] = $data_module_graph['module_name'];
|
||||
$array_data[$series_name.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||
$array_data[$series_name.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||
|
||||
return $array_data;
|
||||
}
|
||||
|
||||
|
||||
function graph_events_validated($width=300, $height=200, $extra_filters=[], $meta=false, $history=false)
|
||||
{
|
||||
global $config;
|
||||
|
|
|
@ -98,6 +98,23 @@ function hd($var, $file='', $oneline=false)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encapsulation (ob) for debug print function.
|
||||
*
|
||||
* @param mixed $var Variable to be dumped.
|
||||
* @param string $file Target file path.
|
||||
* @param boolean $oneline Show in oneline.
|
||||
*
|
||||
* @return string Dump string.
|
||||
*/
|
||||
function obhd($var, $file='', $oneline=false)
|
||||
{
|
||||
ob_start();
|
||||
hd($var, $file, $oneline);
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
function debug()
|
||||
{
|
||||
$args_num = func_num_args();
|
||||
|
@ -1458,6 +1475,14 @@ function html_print_input_password(
|
|||
$attr['class'] = $class;
|
||||
}
|
||||
|
||||
if ($disabled === false) {
|
||||
// Trick to avoid password completion on most browsers.
|
||||
if ($autocomplete !== 'on') {
|
||||
$disabled = true;
|
||||
$attr['onfocus'] = "this.removeAttribute('readonly');";
|
||||
}
|
||||
}
|
||||
|
||||
return html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete);
|
||||
}
|
||||
|
||||
|
@ -1570,6 +1595,7 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $
|
|||
'onkeypress',
|
||||
'onkeydown',
|
||||
'onkeyup',
|
||||
'class',
|
||||
];
|
||||
|
||||
foreach ($attrs as $attribute) {
|
||||
|
@ -3152,7 +3178,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||
((isset($data['required']) === true) ? $data['required'] : false),
|
||||
((isset($data['class']) === true) ? $data['class'] : '')
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : 'off')
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -3356,3 +3383,116 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print an autocomplete input filled out with Integria IMS users.
|
||||
*
|
||||
* @param string $name The name of ajax control, by default is "users".
|
||||
* @param string $default The default value to show in the ajax control.
|
||||
* @param boolean $return If it is true return a string with the output instead to echo the output.
|
||||
* @param string $size Size.
|
||||
*
|
||||
* @return mixed If the $return is true, return the output as string.
|
||||
*/
|
||||
function html_print_autocomplete_users_from_integria(
|
||||
$name='users',
|
||||
$default='',
|
||||
$return=false,
|
||||
$size='30',
|
||||
$disable=false,
|
||||
$required=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
ob_start();
|
||||
|
||||
$attrs = ['style' => 'background: url(images/user_green.png) no-repeat right;'];
|
||||
|
||||
if ($required) {
|
||||
$attrs['required'] = 'required';
|
||||
}
|
||||
|
||||
html_print_input_text_extended(
|
||||
$name,
|
||||
$default,
|
||||
'text-'.$name,
|
||||
'',
|
||||
$size,
|
||||
100,
|
||||
$disable,
|
||||
'',
|
||||
$attrs
|
||||
);
|
||||
html_print_input_hidden($name.'_hidden', $id_agent_module);
|
||||
|
||||
ui_print_help_tip(__('Type at least two characters to search the user.'), false);
|
||||
|
||||
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function escapeHTML (str)
|
||||
{
|
||||
var div = document.createElement('div');
|
||||
var text = document.createTextNode(str);
|
||||
div.appendChild(text);
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
$("#text-<?php echo $name; ?>").autocomplete({
|
||||
minLength: 2,
|
||||
source: function( request, response ) {
|
||||
var term = request.term; //Word to search
|
||||
|
||||
data_params = {
|
||||
page: "include/ajax/integria_incidents.ajax",
|
||||
search_term: term,
|
||||
get_users: 1,
|
||||
};
|
||||
|
||||
jQuery.ajax ({
|
||||
data: data_params,
|
||||
async: false,
|
||||
type: "POST",
|
||||
url: action="<?php echo $javascript_ajax_page; ?>",
|
||||
timeout: 10000,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
temp = [];
|
||||
$.each(data, function (id, module) {
|
||||
temp.push({
|
||||
'value' : id,
|
||||
'label' : module});
|
||||
});
|
||||
|
||||
response(temp);
|
||||
}
|
||||
});
|
||||
},
|
||||
change: function( event, ui ) {
|
||||
if (!ui.item)
|
||||
$("input[name='<?php echo $name; ?>_hidden']")
|
||||
.val(0);
|
||||
return false;
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
$("input[name='<?php echo $name; ?>_hidden']")
|
||||
.val(ui.item.value);
|
||||
|
||||
$("#text-<?php echo $name; ?>").val( ui.item.label );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$output = ob_get_clean();
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,420 @@
|
|||
<?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
|
||||
* @subpackage Incidents
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_ui.php';
|
||||
require_once $config['homedir'].'/include/functions_html.php';
|
||||
require_once $config['homedir'].'/include/functions.php';
|
||||
|
||||
|
||||
/**
|
||||
* Show header tabs.
|
||||
*
|
||||
* @param string $active_tab Current tab or false for View page.
|
||||
* @param number $view Id of incident. Show View tab.
|
||||
*
|
||||
* @return html Print tabs in header.
|
||||
*/
|
||||
function integriaims_tabs($active_tab, $view=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$url_tabs = ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/');
|
||||
|
||||
$setup_tab['text'] = '<a href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=integria').'">'.html_print_image('images/setup.png', true, ['title' => __('Configure Integria IMS')]).'</a>';
|
||||
$list_tab['text'] = '<a href="'.$url_tabs.'list_integriaims_incidents">'.html_print_image('images/list.png', true, ['title' => __('Ticket list')]).'</a>';
|
||||
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident">'.html_print_image('images/pencil.png', true, ['title' => __('New ticket')]).'</a>';
|
||||
|
||||
switch ($active_tab) {
|
||||
case 'setup_tab':
|
||||
$setup_tab['active'] = true;
|
||||
$list_tab['active'] = false;
|
||||
$create_tab['active'] = false;
|
||||
break;
|
||||
|
||||
case 'list_tab':
|
||||
$setup_tab['active'] = false;
|
||||
$list_tab['active'] = true;
|
||||
$create_tab['active'] = false;
|
||||
break;
|
||||
|
||||
case 'create_tab':
|
||||
$setup_tab['active'] = false;
|
||||
$list_tab['active'] = false;
|
||||
$create_tab['active'] = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$setup_tab['active'] = false;
|
||||
$list_tab['active'] = false;
|
||||
$create_tab['active'] = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($view) {
|
||||
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/pencil.png', true, ['title' => __('Edit ticket')]).'</a>';
|
||||
$view_tab['text'] = '<a href="'.$url_tabs.'dashboard_detail_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/operation.png', true, ['title' => __('View ticket')]).'</a>';
|
||||
// When the current page is the View page.
|
||||
if (!$active_tab) {
|
||||
$view_tab['active'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$onheader = [];
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IR') && $view) {
|
||||
$onheader['view'] = $view_tab;
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$onheader['configure'] = $setup_tab;
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IR')) {
|
||||
$onheader['list'] = $list_tab;
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||
$onheader['create'] = $create_tab;
|
||||
}
|
||||
|
||||
return $onheader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets all the details of Integria IMS API
|
||||
*
|
||||
* @param string $details Type of API call.
|
||||
* @param number $detail_index Send index if you want return the text.
|
||||
*
|
||||
* @return string or array with result of API call.
|
||||
*/
|
||||
function integriaims_get_details($details, $detail_index=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
switch ($details) {
|
||||
case 'status':
|
||||
$operation = 'get_incidents_status';
|
||||
break;
|
||||
|
||||
case 'group':
|
||||
$operation = 'get_groups';
|
||||
break;
|
||||
|
||||
case 'priority':
|
||||
$operation = 'get_incident_priorities';
|
||||
break;
|
||||
|
||||
case 'resolution':
|
||||
$operation = 'get_incidents_resolutions';
|
||||
break;
|
||||
|
||||
case 'type':
|
||||
$operation = 'get_types';
|
||||
break;
|
||||
|
||||
default:
|
||||
// code...
|
||||
break;
|
||||
}
|
||||
|
||||
$api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], $operation);
|
||||
$result = [];
|
||||
get_array_from_csv_data_pair($api_call, $result);
|
||||
|
||||
if ($detail_index !== false) {
|
||||
if ($result[$detail_index] == '' || $result[$detail_index] === null) {
|
||||
return __('None');
|
||||
} else {
|
||||
return $result[$detail_index];
|
||||
}
|
||||
} else {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform an API call to Integria IMS.
|
||||
*
|
||||
* @param string API host URL.
|
||||
* @param string User name.
|
||||
* @param string User password.
|
||||
* @param string API password.
|
||||
* @param string API Operation.
|
||||
* @param array Array with parameters required by the API function.
|
||||
*
|
||||
* @return boolean True if API request succeeded, false if API request failed.
|
||||
*/
|
||||
function integria_api_call($api_hostname, $user, $user_pass, $api_pass, $operation, $params_array=[], $show_credentials_error_msg=false)
|
||||
{
|
||||
$params_string = implode(',', $params_array);
|
||||
|
||||
$url_data = [
|
||||
'user' => $user,
|
||||
'user_pass' => $user_pass,
|
||||
'pass' => $api_pass,
|
||||
'op' => $operation,
|
||||
'params' => html_entity_decode($params_string),
|
||||
];
|
||||
|
||||
// Build URL for API request.
|
||||
$url = $api_hostname.'/integria/include/api.php';
|
||||
|
||||
// ob_start();
|
||||
// $out = fopen('php://output', 'w');
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $url_data);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||
curl_setopt($ch, CURLOPT_STDERR, $out);
|
||||
$result = curl_exec($ch);
|
||||
|
||||
// fclose($out);
|
||||
// $debug = ob_get_clean();
|
||||
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
$error = false;
|
||||
|
||||
if ($result === false) {
|
||||
$error = curl_error($ch);
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
if ($error === true || $http_status !== 200) {
|
||||
if ($show_credentials_error_msg === true) {
|
||||
ui_print_error_message(__('API request failed. Please check Integria IMS\' access credentials in Pandora setup.'));
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Parse CSV consisting of one or more lines of the form key-value pair into an array.
|
||||
function get_array_from_csv_data_pair($csv_data, &$array_values)
|
||||
{
|
||||
$csv_array = explode("\n", $csv_data);
|
||||
|
||||
foreach ($csv_array as $csv_value) {
|
||||
if (empty($csv_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$new_csv_value = str_getcsv($csv_value);
|
||||
|
||||
$array_values[$new_csv_value[0]] = $new_csv_value[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse CSV consisting of all lines into an array.
|
||||
*
|
||||
* @param string $csv_data Data returned of csv api call.
|
||||
* @param string $array_values Returned array.
|
||||
* @param array $index Array to create an associative index (opcional).
|
||||
*/
|
||||
function get_array_from_csv_data_all($csv_data, &$array_values, $index=false)
|
||||
{
|
||||
$csv_array = explode("\n", $csv_data);
|
||||
|
||||
foreach ($csv_array as $csv_value) {
|
||||
if (empty($csv_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$new_csv_value = str_getcsv($csv_value);
|
||||
|
||||
if ($index !== false) {
|
||||
foreach ($new_csv_value as $key => $value) {
|
||||
$new_csv_value_index[$index[$key]] = str_replace(':::', ',', $value);
|
||||
;
|
||||
}
|
||||
|
||||
$array_values[$new_csv_value[0]] = $new_csv_value_index;
|
||||
} else {
|
||||
$new_csv_value_comma = array_map(
|
||||
function ($item) {
|
||||
return str_replace(':::', ',', $item);
|
||||
},
|
||||
$new_csv_value
|
||||
);
|
||||
$array_values[$new_csv_value[0]] = $new_csv_value_comma;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print priority for Integria IMS with colors.
|
||||
*
|
||||
* @param string $priority value of priority in Integria IMS.
|
||||
* @param string $priority_label text shown in color box.
|
||||
*
|
||||
* @return HTML code to print the color box.
|
||||
*/
|
||||
function ui_print_integria_incident_priority($priority, $priority_label)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$output = '';
|
||||
switch ($priority) {
|
||||
case 0:
|
||||
$color = COL_UNKNOWN;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$color = COL_NORMAL;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
$color = COL_NOTINIT;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$color = COL_WARNING;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$color = COL_ALERTFIRED;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$color = COL_CRITICAL;
|
||||
break;
|
||||
}
|
||||
|
||||
$output = '<div class="priority" style="background: '.$color.'">';
|
||||
$output .= $priority_label;
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get tickets from Integria IMS.
|
||||
*
|
||||
* @param array $tickets_filters Filters to send to API.
|
||||
*
|
||||
* @return array Tickets returned by API call.
|
||||
*/
|
||||
function get_tickets_integriaims($tickets_filters)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Filters.
|
||||
$incident_text = $tickets_filters['incident_text'];
|
||||
$incident_status = $tickets_filters['incident_status'];
|
||||
$incident_group = $tickets_filters['incident_group'];
|
||||
$incident_owner = $tickets_filters['incident_owner'];
|
||||
$incident_creator = $tickets_filters['incident_creator'];
|
||||
$incident_priority = $tickets_filters['incident_priority'];
|
||||
$incident_resolution = $tickets_filters['incident_resolution'];
|
||||
$created_from = $tickets_filters['created_from'];
|
||||
$created_to = $tickets_filters['created_to'];
|
||||
|
||||
// API call.
|
||||
$result_api_call_list = integria_api_call(
|
||||
$config['integria_hostname'],
|
||||
$config['integria_user'],
|
||||
$config['integria_pass'],
|
||||
$config['integria_api_pass'],
|
||||
'get_incidents',
|
||||
[
|
||||
$incident_text,
|
||||
$incident_status,
|
||||
$incident_group,
|
||||
$incident_priority,
|
||||
'0',
|
||||
$incident_owner,
|
||||
$incident_creator,
|
||||
]
|
||||
);
|
||||
|
||||
// Return array of api call 'get_incidents'.
|
||||
$array_get_incidents = [];
|
||||
get_array_from_csv_data_all($result_api_call_list, $array_get_incidents);
|
||||
|
||||
// Modify $array_get_incidents if filter for resolution exists.
|
||||
$filter_resolution = [];
|
||||
foreach ($array_get_incidents as $key => $value) {
|
||||
if ($incident_resolution !== '' && ($array_get_incidents[$key][12] == $incident_resolution)) {
|
||||
$filter_resolution[$key] = $array_get_incidents[$key];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($incident_resolution !== '') {
|
||||
$array_get_incidents = $filter_resolution;
|
||||
}
|
||||
|
||||
// Modify $array_get_incidents if filter for date is selected.
|
||||
if ($created_from !== '' && $created_to !== '') {
|
||||
$date = [];
|
||||
$date_utimestamp = [];
|
||||
foreach ($array_get_incidents as $key => $value) {
|
||||
// Change format date / to -.
|
||||
$date[$key] = date('Y-m-d', strtotime($array_get_incidents[$key][9]));
|
||||
// Covert date to utimestamp.
|
||||
$date_utimestamp[$key] = strtotime($date[$key]);
|
||||
}
|
||||
|
||||
// Change format date / to -.
|
||||
$created_from_date = date('Y-m-d', strtotime($created_from));
|
||||
$created_to_date = date('Y-m-d', strtotime($created_to));
|
||||
|
||||
// Covert date to utimestamp.
|
||||
$created_from_timestamp = strtotime($created_from_date);
|
||||
$created_to_timestamp = strtotime($created_to_date);
|
||||
|
||||
// Dates within the selected period.
|
||||
$selected_period = array_filter(
|
||||
$date_utimestamp,
|
||||
function ($value) use ($created_from_timestamp, $created_to_timestamp) {
|
||||
return ($value >= $created_from_timestamp && $value <= $created_to_timestamp);
|
||||
}
|
||||
);
|
||||
|
||||
// Return incidents with the correct dates.
|
||||
$filter_date = [];
|
||||
foreach ($array_get_incidents as $key => $value) {
|
||||
foreach ($selected_period as $index => $value) {
|
||||
if ($array_get_incidents[$key][0] == $index) {
|
||||
$filter_date[$key] = $array_get_incidents[$key];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_get_incidents = $filter_date;
|
||||
}
|
||||
|
||||
return $array_get_incidents;
|
||||
}
|
|
@ -507,7 +507,7 @@ function ___($string /*, variable arguments */)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* json_encode for multibyte characters.
|
||||
*
|
||||
* @param string Text string to be encoded.
|
||||
|
@ -528,7 +528,7 @@ function io_json_mb_encode($string, $encode_options=0)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Prepare the given password to be stored in the Pandora FMS Database,
|
||||
* encrypting it if necessary.
|
||||
*
|
||||
|
@ -541,16 +541,22 @@ function io_input_password($password)
|
|||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_crypto.php');
|
||||
$ciphertext = enterprise_hook('openssl_encrypt_decrypt', ['encrypt', io_safe_output($password)]);
|
||||
$ciphertext = enterprise_hook(
|
||||
'openssl_encrypt_decrypt',
|
||||
[
|
||||
'encrypt',
|
||||
io_safe_input($password),
|
||||
]
|
||||
);
|
||||
if ($ciphertext === ENTERPRISE_NOT_HOOK) {
|
||||
return $password;
|
||||
return io_safe_input($password);
|
||||
}
|
||||
|
||||
return $ciphertext;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* Process the given password read from the Pandora FMS Database,
|
||||
* decrypting it if necessary.
|
||||
*
|
||||
|
@ -563,10 +569,17 @@ function io_output_password($password)
|
|||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_crypto.php');
|
||||
$plaintext = enterprise_hook('openssl_encrypt_decrypt', ['decrypt', io_safe_output($password)]);
|
||||
$plaintext = enterprise_hook(
|
||||
'openssl_encrypt_decrypt',
|
||||
[
|
||||
'decrypt',
|
||||
$password,
|
||||
]
|
||||
);
|
||||
|
||||
if ($plaintext === ENTERPRISE_NOT_HOOK) {
|
||||
return $password;
|
||||
return io_safe_output($password);
|
||||
}
|
||||
|
||||
return $plaintext;
|
||||
return io_safe_output($plaintext);
|
||||
}
|
||||
|
|
|
@ -545,7 +545,6 @@ function menu_add_extras(&$menu)
|
|||
$menu_extra['estado']['sub']['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters');
|
||||
$menu_extra['estado']['sub']['enterprise/godmode/snmpconsole/snmp_trap_editor']['text'] = __('SNMP trap editor');
|
||||
$menu_extra['estado']['sub']['snmpconsole']['sub2']['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator');
|
||||
|
||||
$menu_extra['estado']['sub']['snmpconsole']['sub2']['operation/snmpconsole/snmp_view']['text'] = __('SNMP console');
|
||||
|
||||
$menu_extra['workspace']['sub']['operation/incidents/incident_detail']['text'] = __('Manage incident');
|
||||
|
|
|
@ -2654,21 +2654,18 @@ function modules_get_relations($params=[])
|
|||
}
|
||||
|
||||
$modules_type = '';
|
||||
$modules_type_filter = '';
|
||||
if (isset($params['modules_type'])) {
|
||||
$modules_type = $params['modules_type'];
|
||||
$module_type = 'INNER JOIN ttipo_modulo ttm ON tam.id_tipo_modulo = ttm.id_tipo';
|
||||
$modules_type_filter = sprintf(
|
||||
"AND ttm.nombre = '%s'",
|
||||
$params['modules_type']
|
||||
);
|
||||
}
|
||||
|
||||
$sql = 'SELECT DISTINCT tmr.id, tmr.module_a, tmr.module_b,
|
||||
tmr.disable_update, tmr.type
|
||||
FROM tmodule_relationship tmr,
|
||||
tagente_modulo tam,
|
||||
tagente ta,
|
||||
ttipo_modulo ttm
|
||||
WHERE ';
|
||||
|
||||
$agent_filter = '';
|
||||
if ($id_agent > 0) {
|
||||
$agent_filter = sprintf('AND ta.id_agente = %d', $id_agent);
|
||||
$distinct = '';
|
||||
if (empty($params)) {
|
||||
$distinct = 'DISTINCT';
|
||||
}
|
||||
|
||||
$module_a_filter = '';
|
||||
|
@ -2678,6 +2675,11 @@ function modules_get_relations($params=[])
|
|||
$module_b_filter = sprintf('AND tmr.module_b = %d', $id_module);
|
||||
}
|
||||
|
||||
$agent_filter = '';
|
||||
if ($id_agent > 0) {
|
||||
$agent_filter = sprintf('AND ta.id_agente = %d', $id_agent);
|
||||
}
|
||||
|
||||
$disabled_update_filter = '';
|
||||
if ($disabled_update >= 0) {
|
||||
$disabled_update_filter = sprintf(
|
||||
|
@ -2686,22 +2688,25 @@ function modules_get_relations($params=[])
|
|||
);
|
||||
}
|
||||
|
||||
$modules_type_filter = '';
|
||||
if ($modules_type != '') {
|
||||
$modules_type_filter = sprintf(
|
||||
"AND (tam.id_tipo_modulo = ttm.id_tipo AND ttm.nombre = '%s')",
|
||||
$modules_type
|
||||
);
|
||||
}
|
||||
|
||||
$sql .= "( (tmr.module_a = tam.id_agente_modulo
|
||||
$module_a_filter)
|
||||
OR (tmr.module_b = tam.id_agente_modulo
|
||||
$module_b_filter) )
|
||||
AND tam.id_agente = ta.id_agente
|
||||
$agent_filter
|
||||
$disabled_update_filter
|
||||
$modules_type_filter";
|
||||
$sql = sprintf(
|
||||
'SELECT %s tmr.id, tmr.module_a, tmr.module_b,
|
||||
tmr.disable_update, tmr.type
|
||||
FROM tmodule_relationship tmr
|
||||
INNER JOIN tagente_modulo tam
|
||||
ON (tmr.module_a = tam.id_agente_modulo %s)
|
||||
OR (tmr.module_b = tam.id_agente_modulo %s)
|
||||
INNER JOIN tagente ta
|
||||
ON tam.id_agente = ta.id_agente
|
||||
%s
|
||||
WHERE 1=1 %s %s %s',
|
||||
$distinct,
|
||||
$module_a_filter,
|
||||
$module_b_filter,
|
||||
$module_type,
|
||||
$agent_filter,
|
||||
$disabled_update_filter,
|
||||
$modules_type_filter
|
||||
);
|
||||
|
||||
return db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
|
|
@ -748,7 +748,9 @@ function planned_downtimes_created($values)
|
|||
'return' => false,
|
||||
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the current time'),
|
||||
];
|
||||
} else if ($values['type_execution'] == 'once' && $values['date_from'] >= $values['date_to']) {
|
||||
} else if ($values['type_execution'] == 'once' && ($values['date_from'] > $values['date_to'])
|
||||
|| (($values['date_from'] == $values['date_to']) && ($values['periodically_time_from'] >= $values['periodically_time_to']))
|
||||
) {
|
||||
return [
|
||||
'return' => false,
|
||||
'message' => __('Not created. Error inserting data').'. '.__('The end date must be higher than the start date'),
|
||||
|
|
|
@ -505,42 +505,43 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
/*
|
||||
case 'MTTR':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'MTTR',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
case 'MTBF':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'MTBF',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
case 'TTO':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'TTO',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
case 'TTRT':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'TTRT',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
break;
|
||||
*/
|
||||
case 'agent_configuration':
|
||||
$report['contents'][] = io_safe_output(
|
||||
reporting_agent_configuration(
|
||||
|
@ -3105,6 +3106,13 @@ function reporting_historical_data($report, $content)
|
|||
$content['name'] = __('Historical data');
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
|
||||
$server = metaconsole_get_connection_by_id($id_meta);
|
||||
$connection = metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$id_agent = agents_get_module_id(
|
||||
$content['id_agent_module']
|
||||
);
|
||||
|
@ -3196,6 +3204,10 @@ function reporting_historical_data($report, $content)
|
|||
|
||||
$return['data'] = $data;
|
||||
|
||||
if (is_metaconsole() && $connection > 0) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
@ -4690,21 +4702,22 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$return['type'] = 'sumatory';
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
/*
|
||||
case 'MTTR':
|
||||
$return['type'] = 'MTTR';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
case 'MTBF':
|
||||
$return['type'] = 'MTBF';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
case 'TTO':
|
||||
$return['type'] = 'TTO';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
case 'TTRT':
|
||||
$return['type'] = 'TTRT';
|
||||
break;
|
||||
break;*/
|
||||
}
|
||||
|
||||
if (empty($content['name'])) {
|
||||
|
@ -4725,21 +4738,22 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$content['name'] = __('Summatory');
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
/*
|
||||
case 'MTTR':
|
||||
$content['name'] = __('MTTR');
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
case 'MTBF':
|
||||
$content['name'] = __('MTBF');
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
case 'TTO':
|
||||
$content['name'] = __('TTO');
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
case 'TTRT':
|
||||
$content['name'] = __('TTRT');
|
||||
break;
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4902,7 +4916,8 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$value = reporting_get_agentmodule_data_sum(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
$report['datetime'],
|
||||
$content['uncompressed_module']
|
||||
);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
|
@ -4911,25 +4926,26 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
}
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
/*
|
||||
case 'MTTR':
|
||||
$value = reporting_get_agentmodule_mttr(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
$formated_value = null;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
case 'MTBF':
|
||||
$value = reporting_get_agentmodule_mtbf(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
$formated_value = null;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
case 'TTO':
|
||||
$value = reporting_get_agentmodule_tto(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
|
@ -4940,9 +4956,9 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
} else {
|
||||
$formated_value = human_time_description_raw($value);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
case 'TTRT':
|
||||
$value = reporting_get_agentmodule_ttr(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
|
@ -4953,7 +4969,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
} else {
|
||||
$formated_value = human_time_description_raw($value);
|
||||
}
|
||||
break;
|
||||
break;*/
|
||||
}
|
||||
|
||||
$return['data'] = [
|
||||
|
@ -7486,10 +7502,12 @@ function reporting_custom_graph(
|
|||
|
||||
if ($type_report == 'custom_graph') {
|
||||
if (is_metaconsole()) {
|
||||
$id_meta = metaconsole_get_id_server($content['server_name']);
|
||||
$server = metaconsole_get_connection_by_id($id_meta);
|
||||
if (metaconsole_connect($server) != NOERR) {
|
||||
return false;
|
||||
$servers = metaconsole_get_connection_names();
|
||||
foreach ($servers as $server) {
|
||||
$connection = metaconsole_get_connection($server);
|
||||
if (metaconsole_connect($connection) != NOERR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10743,17 +10761,19 @@ function reporting_get_agentmodule_data_min($id_agent_module, $period=0, $date=0
|
|||
* @param int Agent module id to get the sumatory.
|
||||
* @param int Period of time to check (in seconds)
|
||||
* @param int Top date to check the values. Default current time.
|
||||
* @param boolean Show uncompressed data from module
|
||||
*
|
||||
* @return float The sumatory of the module values in the interval.
|
||||
*/
|
||||
function reporting_get_agentmodule_data_sum(
|
||||
$id_agent_module,
|
||||
$period=0,
|
||||
$date=0
|
||||
$date=0,
|
||||
$uncompressed_module=true
|
||||
) {
|
||||
global $config;
|
||||
|
||||
// Initialize variables
|
||||
// Initialize variables.
|
||||
if (empty($date)) {
|
||||
$date = get_system_time();
|
||||
}
|
||||
|
@ -10775,21 +10795,24 @@ function reporting_get_agentmodule_data_sum(
|
|||
$id_module_type
|
||||
);
|
||||
$module_interval = modules_get_interval($id_agent_module);
|
||||
$uncompressed_module = is_module_uncompressed($module_name);
|
||||
// Check if module must be compressed.
|
||||
if (!$uncompressed_module) {
|
||||
$uncompressed_module = is_module_uncompressed($module_name);
|
||||
}
|
||||
|
||||
// Wrong module type
|
||||
if (is_module_data_string($module_name)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Incremental modules are treated differently
|
||||
// Incremental modules are treated differently.
|
||||
$module_inc = is_module_inc($module_name);
|
||||
|
||||
if ($uncompressed_module) {
|
||||
// Get module data
|
||||
if (!$uncompressed_module) {
|
||||
// Get module data.
|
||||
$interval_data = db_get_all_rows_sql(
|
||||
'
|
||||
SELECT * FROM tagente_datos
|
||||
SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = '.(int) $id_agent_module.'
|
||||
AND utimestamp > '.(int) $datelimit.'
|
||||
AND utimestamp < '.(int) $date.'
|
||||
|
@ -10810,7 +10833,7 @@ function reporting_get_agentmodule_data_sum(
|
|||
return false;
|
||||
}
|
||||
|
||||
// Set initial conditions
|
||||
// Set initial conditions.
|
||||
$total = 0;
|
||||
$partial_total = 0;
|
||||
$count_sum = 0;
|
||||
|
@ -10819,18 +10842,9 @@ function reporting_get_agentmodule_data_sum(
|
|||
$partial_total = 0;
|
||||
$count_sum = 0;
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
// Do none
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$data['datos'] = oracle_format_float_to_php($data['datos']);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$module_inc) {
|
||||
if (!$uncompressed_module) {
|
||||
$total += $data['datos'];
|
||||
} else if (!$module_inc) {
|
||||
foreach ($data['data'] as $val) {
|
||||
if (is_numeric($val['datos'])) {
|
||||
$partial_total += $val['datos'];
|
||||
|
@ -10842,7 +10856,7 @@ function reporting_get_agentmodule_data_sum(
|
|||
continue;
|
||||
}
|
||||
|
||||
$total += ($partial_total / $count_sum);
|
||||
$total += $partial_total;
|
||||
} else {
|
||||
$last = end($data['data']);
|
||||
$total += $last['datos'];
|
||||
|
|
|
@ -251,6 +251,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_sql($table, $item);
|
||||
break;
|
||||
|
||||
case 'simple_baseline_graph':
|
||||
case 'simple_graph':
|
||||
reporting_html_graph($table, $item);
|
||||
break;
|
||||
|
@ -287,22 +288,23 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_sum_value($table, $item, $mini);
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
/*
|
||||
case 'MTTR':
|
||||
reporting_html_MTTR_value($table, $item, $mini, true, true);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
case 'MTBF':
|
||||
reporting_html_MTBF_value($table, $item, $mini, true, true);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
case 'TTO':
|
||||
reporting_html_TTO_value($table, $item, $mini, false, true);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
case 'TTRT':
|
||||
reporting_html_TTRT_value($table, $item, $mini, false, true);
|
||||
break;
|
||||
|
||||
break;
|
||||
*/
|
||||
case 'agent_configuration':
|
||||
reporting_html_agent_configuration($table, $item);
|
||||
break;
|
||||
|
@ -315,10 +317,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_prediction_date($table, $item, $mini);
|
||||
break;
|
||||
|
||||
case 'simple_baseline_graph':
|
||||
reporting_html_graph($table, $item);
|
||||
break;
|
||||
|
||||
case 'netflow_area':
|
||||
case 'netflow_data':
|
||||
case 'netflow_summary':
|
||||
|
@ -2207,12 +2205,15 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
|
|||
{
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '100%';
|
||||
$table1->head = [__('Date')];
|
||||
$table1->head = [
|
||||
__('Date'),
|
||||
__('Data'),
|
||||
];
|
||||
if (!empty($item['keys'])) {
|
||||
$table1->head = array_merge($table1->head, $item['keys']);
|
||||
}
|
||||
|
||||
$table1->style[0] = 'text-align: left';
|
||||
$table1->style[0] = 'text-align: center';
|
||||
|
||||
$table1->data = [];
|
||||
foreach ($item['data'] as $data) {
|
||||
|
@ -2728,29 +2729,30 @@ function reporting_html_agent_configuration(
|
|||
}
|
||||
|
||||
|
||||
function reporting_html_TTRT_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
/*
|
||||
function reporting_html_TTRT_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_TTO_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
function reporting_html_TTO_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_MTBF_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
function reporting_html_MTBF_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_MTTR_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
function reporting_html_MTTR_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
function reporting_html_sum_value(&$table, $item, $mini)
|
||||
{
|
||||
|
|
|
@ -679,23 +679,24 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'name' => __('Module Histogram graph'),
|
||||
];
|
||||
|
||||
$types['TTRT'] = [
|
||||
/*
|
||||
$types['TTRT'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('TTRT'),
|
||||
];
|
||||
$types['TTO'] = [
|
||||
];
|
||||
$types['TTO'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('TTO'),
|
||||
];
|
||||
$types['MTBF'] = [
|
||||
];
|
||||
$types['MTBF'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('MTBF'),
|
||||
];
|
||||
$types['MTTR'] = [
|
||||
];
|
||||
$types['MTTR'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('MTTR'),
|
||||
];
|
||||
|
||||
];
|
||||
*/
|
||||
$types['SLA'] = [
|
||||
'optgroup' => __('SLA'),
|
||||
'name' => __('S.L.A.'),
|
||||
|
@ -777,13 +778,15 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'name' => __('Exception'),
|
||||
];
|
||||
if ($config['metaconsole'] != 1) {
|
||||
$types['agent_module'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Agents/Modules'),
|
||||
];
|
||||
if (!$template) {
|
||||
$types['agent_module'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
'name' => __('Agents/Modules'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Only pandora managers have access to the whole database
|
||||
// Only pandora managers have access to the whole database.
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$types['sql'] = [
|
||||
'optgroup' => __('Grouped'),
|
||||
|
|
|
@ -162,6 +162,10 @@ function ui_print_truncate_text($text, $numChars=GENERIC_SIZE_TEXT, $showTextInA
|
|||
}
|
||||
|
||||
if ($showTextInAToopTip) {
|
||||
if (is_string($showTextInAToopTip)) {
|
||||
$text = ui_print_truncate_text($showTextInAToopTip, ($numChars * 2), false, true, false);
|
||||
}
|
||||
|
||||
$truncateText = $truncateText.ui_print_help_tip(htmlspecialchars($text), true);
|
||||
} else {
|
||||
if ($style !== false) {
|
||||
|
@ -2679,6 +2683,7 @@ function get_shape_status_set($type)
|
|||
case STATUS_MODULE_UNKNOWN:
|
||||
case STATUS_AGENT_UNKNOWN:
|
||||
case STATUS_AGENT_DOWN:
|
||||
case STATUS_AGENT_NO_MONITORS:
|
||||
$return = ['class' => 'status_rounded_rectangles'];
|
||||
break;
|
||||
|
||||
|
|