Merge remote-tracking branch 'origin/develop' into ent-4623-Exportar-a-CSV-los-eventos-separador-erroneo
@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
docker build --rm=true --pull --no-cache --build-arg BRANCH="develop" --build-arg DB_PASS="pandora" -t pandorafms/pandorafms:7 . && \
|
||||
[ "$QA_ENV" == "" ] && \
|
||||
docker push pandorafms/pandorafms:7
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, AIX version
|
||||
# Version 7.0NG.740, 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.740, 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.740, 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.740, 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.740, 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.740, 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.740
|
||||
|
||||
# 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.740, 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.740
|
||||
# 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.740, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.740
|
||||
# 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.740
|
||||
# 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.740
|
||||
# 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.740, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, AIX version
|
||||
# Version 7.0NG.740, 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-190913
|
||||
Version: 7.0NG.740-191029
|
||||
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-190913"
|
||||
pandora_version="7.0NG.740-191029"
|
||||
|
||||
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.740, 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.740, 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.740, 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.740, 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.740, 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.740, 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.740, 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 => '190913';
|
||||
use constant AGENT_VERSION => '7.0NG.740';
|
||||
use constant AGENT_BUILD => '191029';
|
||||
|
||||
# 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 190913
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
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 190913
|
||||
%define version 7.0NG.740
|
||||
%define release 191029
|
||||
|
||||
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="190913"
|
||||
PI_VERSION="7.0NG.740"
|
||||
PI_BUILD="191029"
|
||||
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.740
|
||||
|
||||
# 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.740}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{190913}
|
||||
{191029}
|
||||
|
||||
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 190913)")
|
||||
#define PANDORA_VERSION ("7.0NG.740(Build 191029)")
|
||||
|
||||
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 190913))"
|
||||
VALUE "ProductVersion", "(7.0NG.740(Build 191029))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.738-190913
|
||||
Version: 7.0NG.740-191029
|
||||
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-190913"
|
||||
pandora_version="7.0NG.740-191029"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -238,18 +238,6 @@ function output_xml_report($id)
|
||||
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
|
||||
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
break;
|
||||
}
|
||||
|
||||
echo "</item>\n";
|
||||
|
@ -375,18 +375,6 @@ function process_upload_xml_report($xml, $group_filter=0)
|
||||
$values['line_separator'] = io_safe_input($item['line_separator']);
|
||||
$values['column_separator'] = io_safe_input($item['column_separator']);
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($agents_item)) {
|
||||
|
66
pandora_console/extensions/sample_agent.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
require_once __DIR__.'/../include/config.php';
|
||||
require_once __DIR__.'/../include/auth/mysql.php';
|
||||
require_once __DIR__.'/../include/functions.php';
|
||||
require_once __DIR__.'/../include/functions_db.php';
|
||||
/*
|
||||
* Review if sample agent is active and deploys configuration for
|
||||
* visual consoles if necessary
|
||||
*/
|
||||
global $config;
|
||||
|
||||
// Deployment of sample agent for visual consoles.
|
||||
if ($config['sample_agent'] == 1 && !isset($config['sample_agent_deployed'])) {
|
||||
$id_agente = db_get_sql('SELECT id_agente FROM tagente WHERE nombre = "Sample_Agent";');
|
||||
$modules = db_get_all_rows_filter('tagente_modulo', ['id_agente' => $id_agente], 'id_agente_modulo');
|
||||
$count_modules = count($modules);
|
||||
|
||||
// Update of layout 1 (Rack sample).
|
||||
$images_rack_server = [
|
||||
'rack_server_rack',
|
||||
'rack_server',
|
||||
'rack_switch',
|
||||
'rack_firewall',
|
||||
'rack_double_server',
|
||||
'rack_frame',
|
||||
'rack_pdu',
|
||||
];
|
||||
$query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE ';
|
||||
for ($i = 0; $i < $count_modules; $i++) {
|
||||
$query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' ';
|
||||
}
|
||||
|
||||
$query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");';
|
||||
|
||||
db_process_sql($query);
|
||||
// Update of layout 2 (Dashboard).
|
||||
$query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE ';
|
||||
$query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' ';
|
||||
$query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);';
|
||||
|
||||
db_process_sql($query);
|
||||
|
||||
// This setting will avoid regenerate all the times the visual consoles.
|
||||
config_update_value('sample_agent_deployed', 1);
|
||||
}
|
||||
|
||||
extensions_add_main_function('sample_agent_deployment');
|
@ -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;
|
||||
|
5
pandora_console/extras/mr/33.sql
Normal file
@ -0,0 +1,5 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL 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`
|
||||
@ -1882,6 +1907,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
||||
`linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_node_id` INT(10) NOT NULL default 0,
|
||||
`cache_expiration` INTEGER UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
@ -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>
|
||||
|
@ -33,7 +33,7 @@ ui_require_css_file('firts_task');
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<form action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" method="post">
|
||||
<form action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Create Planned Downtime'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
@ -765,7 +765,7 @@ $table_adv_agent_icon .= html_print_select(
|
||||
).'</div>';
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$table_adv_gis = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Ignore new GIS data:').'</p>';
|
||||
$table_adv_gis = '<div class="label_select_simple label_simple_one_item"><p class="input_label input_label_simple">'.__('Update new GIS data:').'</p>';
|
||||
if ($new_agent) {
|
||||
$update_gis_data = true;
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -842,7 +842,9 @@ foreach ($modules as $module) {
|
||||
$module['str_warning'],
|
||||
$module['max_critical'],
|
||||
$module['min_critical'],
|
||||
$module['str_critical']
|
||||
$module['str_critical'],
|
||||
$module['warning_inverse'],
|
||||
$module['critical_inverse']
|
||||
);
|
||||
} else {
|
||||
$data[7] = '';
|
||||
|
@ -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);
|
||||
|
@ -827,7 +827,7 @@ $table->data[5][1] = "
|
||||
</table>
|
||||
</div>';
|
||||
|
||||
echo '<form method="POST" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
echo '<form method="POST" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
|
||||
if ($id_downtime > 0) {
|
||||
echo '<table width=100% border=0 cellpadding=4 >';
|
||||
@ -929,7 +929,7 @@ if ($id_downtime > 0) {
|
||||
$disabled_add_button = true;
|
||||
}
|
||||
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
||||
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
||||
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
|
||||
|
||||
html_print_checkbox('recursion', 1, $recursion, false, false, '');
|
||||
@ -939,7 +939,7 @@ if ($id_downtime > 0) {
|
||||
echo '</form>';
|
||||
// Show available agents to include into downtime
|
||||
echo '<h4>'.__('Available agents').':</h4>';
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
|
||||
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
|
||||
|
||||
echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;');
|
||||
|
||||
@ -1085,7 +1085,7 @@ if ($id_downtime > 0) {
|
||||
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
$data[5] .= '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
$table->data['agent_'.$downtime_agent['id_agente']] = $data;
|
||||
|
@ -357,7 +357,7 @@ if (!$downtimes && !$filter_performed) {
|
||||
// No downtimes cause the user performed a search.
|
||||
else if (!$downtimes) {
|
||||
// Filter form.
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
@ -369,7 +369,7 @@ else if (!$downtimes) {
|
||||
// Create button.
|
||||
if ($write_permisson) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
@ -378,11 +378,11 @@ else if (!$downtimes) {
|
||||
}
|
||||
// Has downtimes.
|
||||
else {
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
|
||||
// User groups with AR, AD or AW permission.
|
||||
$groupsAD = users_get_groups($config['id_user'], $access);
|
||||
@ -476,7 +476,7 @@ else {
|
||||
if (in_array($downtime['id_group'], $groupsAD)) {
|
||||
// Stop button
|
||||
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
|
||||
$data['stop'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
$data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
} else {
|
||||
$data['stop'] = '';
|
||||
}
|
||||
@ -484,12 +484,12 @@ else {
|
||||
// Edit & delete buttons.
|
||||
if ($downtime['executed'] == 0) {
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
// Delete.
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
// Delete.
|
||||
$data['delete'] = __('N/A');
|
||||
} else {
|
||||
@ -515,7 +515,7 @@ else {
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
// CSV export button.
|
||||
@ -532,7 +532,7 @@ else {
|
||||
// Create button.
|
||||
if ($write_permisson) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
@ -559,7 +559,7 @@ $(document).ready (function () {
|
||||
|
||||
if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) {
|
||||
if (confirm("<?php echo __('WARNING: There are malformed planned downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
|
||||
window.location.href = "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
|
||||
window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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>
|
||||
|
@ -59,8 +59,10 @@ if ($update_agents) {
|
||||
$values['id_grupo'] = get_parameter('group');
|
||||
}
|
||||
|
||||
if (get_parameter('interval', 0) != 0) {
|
||||
$values['intervalo'] = get_parameter('interval');
|
||||
if (!(get_parameter('interval_select') == -1 && empty(get_parameter('interval_text')))) {
|
||||
if (get_parameter('interval', 0) != 0) {
|
||||
$values['intervalo'] = get_parameter('interval');
|
||||
}
|
||||
}
|
||||
|
||||
if (get_parameter('id_os', '') != -1) {
|
||||
@ -199,7 +201,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',
|
||||
[
|
||||
@ -523,7 +525,7 @@ $table->data[1][1] = html_print_select_groups(false, 'AR', false, 'group', $grou
|
||||
|
||||
$table->data[2][0] = __('Interval');
|
||||
|
||||
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px');
|
||||
$table->data[2][1] = html_print_extended_select_for_time('interval', 0, '', __('No change'), '0', 10, true, 'width: 150px', false);
|
||||
|
||||
$table->data[3][0] = __('OS');
|
||||
$table->data[3][1] = html_print_select_from_sql(
|
||||
|
@ -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;
|
||||
|
@ -16,10 +16,10 @@ global $config;
|
||||
// Check user credentials
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'RR')) {
|
||||
if (! check_acl($config['id_user'], 0, 'RR') || enterprise_installed() === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Inventory Module Management'
|
||||
'Trying to access Graph container'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
|
@ -71,10 +71,12 @@ switch ($activeTab) {
|
||||
break;
|
||||
}
|
||||
|
||||
$buttons['graph_container'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
|
||||
];
|
||||
if ($enterpriseEnable) {
|
||||
$buttons['graph_container'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_container">'.html_print_image('images/graph-container.png', true, ['title' => __('Graphs containers')]).'</a>',
|
||||
];
|
||||
}
|
||||
|
||||
$delete_graph = (bool) get_parameter('delete_graph');
|
||||
$view_graph = (bool) get_parameter('view_graph');
|
||||
@ -257,11 +259,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 +277,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 +290,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 +308,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,12 +233,14 @@ 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'];
|
||||
$dyn_height = $style['dyn_height'];
|
||||
$type = $item['type'];
|
||||
$name = $item['name'];
|
||||
$name = $style['name_label'];
|
||||
|
||||
switch ($type) {
|
||||
case 'event_report_log':
|
||||
@ -427,6 +430,7 @@ switch ($action) {
|
||||
);
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$period = $item['period'];
|
||||
$uncompressed_module = $item['uncompressed_module'];
|
||||
break;
|
||||
|
||||
case 'historical_data':
|
||||
@ -478,50 +482,6 @@ switch ($action) {
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'alert_report_module':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
@ -786,10 +746,6 @@ switch ($action) {
|
||||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
case 'event_report_log':
|
||||
case 'increment':
|
||||
@ -810,7 +766,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 +823,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>
|
||||
@ -1565,10 +1535,8 @@ $class = 'databox filters';
|
||||
$all_modules = '';
|
||||
} else {
|
||||
$all_modules = db_get_all_rows_sql(
|
||||
'SELECT DISTINCT nombre, id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente
|
||||
IN ('.implode(',', array_values($id_agents)).')'
|
||||
'SELECT DISTINCT nombre FROM
|
||||
tagente_modulo WHERE id_agente IN ('.implode(',', array_values($id_agents)).')'
|
||||
);
|
||||
}
|
||||
|
||||
@ -2794,6 +2762,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>
|
||||
|
||||
@ -3529,6 +3514,9 @@ $(document).ready (function () {
|
||||
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
|
||||
// Load selected modules by default
|
||||
$("#id_agents2").trigger('click');
|
||||
|
||||
$("#combo_group").change (
|
||||
function () {
|
||||
jQuery.post ("ajax.php",
|
||||
@ -3719,10 +3707,6 @@ $(document).ready (function () {
|
||||
case 'event_report_module':
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'avg_value':
|
||||
@ -3760,10 +3744,6 @@ $(document).ready (function () {
|
||||
case 'event_report_module':
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'avg_value':
|
||||
@ -4523,6 +4503,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();
|
||||
@ -4731,6 +4712,7 @@ function chooseType() {
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_uncompressed_module").show();
|
||||
break;
|
||||
|
||||
case 'historical_data':
|
||||
@ -4794,38 +4776,6 @@ function chooseType() {
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'alert_report_module':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
@ -5178,10 +5128,6 @@ function chooseType() {
|
||||
case 'min_value':
|
||||
case 'max_value':
|
||||
case 'avg_value':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
$("#row_label").show();
|
||||
break;
|
||||
|
@ -1,18 +1,34 @@
|
||||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU 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.
|
||||
/**
|
||||
* Report item list.
|
||||
*
|
||||
* @category Reporting
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
// Login check
|
||||
// Login check.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'RW')) {
|
||||
@ -39,12 +55,16 @@ switch ($config['dbtype']) {
|
||||
'type'
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$report_w = check_acl($config['id_user'], 0, 'RW');
|
||||
$report_m = check_acl($config['id_user'], 0, 'RM');
|
||||
|
||||
if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
||||
if (is_metaconsole()) {
|
||||
$agents = [];
|
||||
$agents = metaconsole_get_report_agents($idReport);
|
||||
$modules = [];
|
||||
@ -52,7 +72,7 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
||||
$types = [];
|
||||
$types = metaconsole_get_report_types($idReport);
|
||||
} else {
|
||||
// FORM FILTER
|
||||
// FORM FILTER.
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
@ -87,7 +107,10 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
||||
ON (t4.id_agent = t5.id_agente OR t4.id_agente = t5.id_agente)
|
||||
WHERE t4.id_report = '.$idReport
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
@ -124,6 +147,10 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
||||
WHERE t1.id_report = '.$idReport
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
if ($rows === false) {
|
||||
@ -135,8 +162,8 @@ if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
||||
$modules[$row['id_agent_module']] = $row['nombre'];
|
||||
}
|
||||
|
||||
// Filter report items created from metaconsole in normal console list and the opposite
|
||||
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
|
||||
// Filter report items created from metaconsole in normal console list and the opposite.
|
||||
if (is_metaconsole()) {
|
||||
$where_types = ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR '.$type_escaped.' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
|
||||
} else {
|
||||
$where_types = ' AND ((server_name IS NULL OR length(server_name) = 0) OR '.$type_escaped.' IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
|
||||
@ -184,7 +211,6 @@ if (!defined('METACONSOLE')) {
|
||||
$table->data[0][1] .= html_print_select($modules, 'module_filter', $moduleFilter, '', __('All'), 0, true);
|
||||
$table->data[0][2] = __('Type');
|
||||
$table->data[0][2] .= html_print_select($types, 'type_filter', $typeFilter, '', __('All'), 0, true);
|
||||
// $table->data[1][2] = $table->data[1][3] = '';
|
||||
$form = '<form method="post" action ="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=filter&id_report='.$idReport.'">';
|
||||
$form .= html_print_table($table, true);
|
||||
$form .= '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
@ -265,13 +291,6 @@ if ($moduleFilter != 0) {
|
||||
$where .= ' AND id_agent_module = '.$moduleFilter;
|
||||
}
|
||||
|
||||
// Filter report items created from metaconsole in normal console list and the opposite
|
||||
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
|
||||
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'availability_graph\', \'top_n\',\'SLA_monthly\',\'SLA_weekly\',\'SLA_hourly\',\'text\'))';
|
||||
} else {
|
||||
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) '.'OR '.$type_escaped.' IN (\'general\', \'SLA\', \'exception\', \'availability\', \'top_n\'))';
|
||||
}
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$items = db_get_all_rows_sql(
|
||||
@ -306,13 +325,17 @@ switch ($config['dbtype']) {
|
||||
'AND',
|
||||
false
|
||||
);
|
||||
// Delete rnum row generated by oracle_recode_query() function
|
||||
// Delete rnum row generated by oracle_recode_query() function.
|
||||
if ($items !== false) {
|
||||
for ($i = 0; $i < count($items); $i++) {
|
||||
unset($items[$i]['rnum']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$countItems = db_get_sql(
|
||||
@ -421,29 +444,30 @@ foreach ($items as $item) {
|
||||
|
||||
$row[1] = get_report_name($item['type']);
|
||||
|
||||
if ($item['type'] == 'custom_graph') {
|
||||
$custom_graph_name = db_get_row_sql('select name from tgraph where id_graph = '.$item['id_gs']);
|
||||
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
|
||||
}
|
||||
|
||||
$server_name = $item['server_name'];
|
||||
|
||||
if (($config['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
|
||||
if (is_metaconsole()) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
||||
}
|
||||
}
|
||||
|
||||
if ($item['type'] == 'custom_graph') {
|
||||
$custom_graph_name = db_get_row_sql('SELECT name FROM tgraph WHERE id_graph = '.$item['id_gs']);
|
||||
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
|
||||
}
|
||||
|
||||
|
||||
if ($item['id_agent'] == 0) {
|
||||
$is_inventory_item = $item['type'] == 'inventory' || $item['type'] == 'inventory_changes';
|
||||
|
||||
// Due to SLA or top N or general report items
|
||||
// Due to SLA or top N or general report items.
|
||||
if (!$is_inventory_item && ($item['id_agent_module'] == '' || $item['id_agent_module'] == 0)) {
|
||||
$row[2] = '';
|
||||
$row[3] = '';
|
||||
} else {
|
||||
// The inventory items have the agents and modules in json format in the field external_source
|
||||
// The inventory items have the agents and modules in json format in the field external_source.
|
||||
if ($is_inventory_item) {
|
||||
$external_source = json_decode($item['external_source'], true);
|
||||
$agents = $external_source['id_agents'];
|
||||
@ -489,11 +513,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] = '';
|
||||
@ -515,7 +546,7 @@ foreach ($items as $item) {
|
||||
|
||||
$table->data[] = $row;
|
||||
$count++;
|
||||
// Restore db connection
|
||||
// Restore db connection.
|
||||
if (($config['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
@ -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,6 @@ switch ($action) {
|
||||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
@ -2464,6 +2465,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 +2608,6 @@ switch ($action) {
|
||||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
@ -3133,17 +3134,19 @@ if ($enterpriseEnable && defined('METACONSOLE')) {
|
||||
break;
|
||||
}
|
||||
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
if ($action !== 'update' && !is_metaconsole()) {
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($resultOperationDB !== null) {
|
||||
@ -3165,6 +3168,26 @@ if ($resultOperationDB !== null) {
|
||||
__('Successfull action'),
|
||||
__('Unsuccessful action<br><br>'.$err)
|
||||
);
|
||||
|
||||
if ($action == 'update') {
|
||||
$buttons[$activeTab]['active'] = false;
|
||||
$activeTab = 'list_items';
|
||||
$buttons[$activeTab]['active'] = true;
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
ui_print_page_header(
|
||||
$textReportName,
|
||||
'images/op_reporting.png',
|
||||
false,
|
||||
$helpers,
|
||||
false,
|
||||
$buttons,
|
||||
false,
|
||||
'',
|
||||
60
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($activeTab) {
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -928,10 +928,10 @@ if (($create != '') || ($view != '')) {
|
||||
$other['plugin_type'] = $plugin_meta['plugin_type'];
|
||||
$other['macros'] = urlencode($plugin_meta['macros']);
|
||||
$other['parameters'] = urlencode($plugin_meta['parameters']);
|
||||
$other = implode('%7C', $other);
|
||||
$other = implode('%7E', $other);
|
||||
|
||||
$auth_token = json_decode($value['auth_token']);
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7C&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7E&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$file_path = realpath($plugin_meta['execute']);
|
||||
$post = '';
|
||||
if (file_exists($file_path)) {
|
||||
|
@ -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>
|
||||
|
702
pandora_console/godmode/setup/setup_integria.php
Normal file
@ -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>
|
@ -18,7 +18,7 @@ check_login();
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'UM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Profile Management'
|
||||
@ -320,24 +320,29 @@ if ($id_profile || $new_profile) {
|
||||
$table->data['IM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
$disable_option = 'javascript: return false;';
|
||||
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
|
||||
$disable_option = '';
|
||||
}
|
||||
|
||||
// Users
|
||||
$row = [];
|
||||
$row['name'] = __('Manage users');
|
||||
$row['input'] = html_print_checkbox('user_management', 1, $user_management, true);
|
||||
$row['input'] = html_print_checkbox('user_management', 1, $user_management, true, false, $disable_option);
|
||||
$table->data['UM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
// DB
|
||||
$row = [];
|
||||
$row['name'] = __('Manage database');
|
||||
$row['input'] = html_print_checkbox('db_management', 1, $db_management, true);
|
||||
$row['input'] = html_print_checkbox('db_management', 1, $db_management, true, false, $disable_option);
|
||||
$table->data['DM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
// Pandora
|
||||
$row = [];
|
||||
$row['name'] = __('%s management', get_product_name());
|
||||
$row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true);
|
||||
$row['input'] = html_print_checkbox('pandora_management', 1, $pandora_management, true, false, $disable_option);
|
||||
$table->data['PM'] = $row;
|
||||
$table->data[] = '<hr>';
|
||||
|
||||
@ -359,3 +364,18 @@ if ($id_profile || $new_profile) {
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready (function () {
|
||||
var disable_option = '<?php echo $disable_option; ?>';
|
||||
|
||||
if (disable_option != '') {
|
||||
var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management'];
|
||||
ids.forEach(id => {
|
||||
$(id).css({'cursor':'not-allowed', 'opacity':'0.5'});
|
||||
});
|
||||
}
|
||||
});
|
||||
</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'),
|
||||
|
@ -362,7 +362,10 @@ foreach ($profiles as $profile) {
|
||||
$data['PM'] = ($profile['pandora_management'] ? $img : '');
|
||||
$table->cellclass[]['operations'] = 'action_buttons';
|
||||
$data['operations'] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>';
|
||||
$data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
|
||||
if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) {
|
||||
$data['operations'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true).'</a>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,9 @@ else {
|
||||
$u = get_user_info($key);
|
||||
$g = users_get_groups($key, 'AR', $u['is_admin']);
|
||||
$result = array_intersect($g, $own_groups);
|
||||
if (!$usr['is_admin'] && !empty($result)) {
|
||||
|
||||
// Show users without profile too.
|
||||
if (!$usr['is_admin'] && !empty($result) || (!$usr['is_admin'] && db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $usr['id_user']) === false)) {
|
||||
$info[$key] = $usr;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
BIN
pandora_console/images/console/background/fondo-keep-alive.jpg
Normal file
After Width: | Height: | Size: 229 KiB |
BIN
pandora_console/images/console/icons/status.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
pandora_console/images/console/icons/status_bad.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
pandora_console/images/console/icons/status_ok.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
pandora_console/images/console/icons/status_warning.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
pandora_console/images/integria.png
Normal file
After Width: | Height: | Size: 895 B |
BIN
pandora_console/images/integria_logo.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
pandora_console/images/integria_logo_gray.png
Normal file
After Width: | Height: | Size: 14 KiB |
60
pandora_console/include/ajax/integria_incidents.ajax.php
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -1113,7 +1113,7 @@ if (check_login()) {
|
||||
}
|
||||
|
||||
if ($module['id_tipo_modulo'] != 25) {
|
||||
$data[6] = ui_print_module_warn_value($module['max_warning'], $module['min_warning'], $module['str_warning'], $module['max_critical'], $module['min_critical'], $module['str_critical']);
|
||||
$data[6] = ui_print_module_warn_value($module['max_warning'], $module['min_warning'], $module['str_warning'], $module['max_critical'], $module['min_critical'], $module['str_critical'], $module['warning_inverse'], $module['critical_inverse']);
|
||||
} else {
|
||||
$data[6] = '';
|
||||
}
|
||||
|
@ -1,15 +1,32 @@
|
||||
<?php
|
||||
// Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 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.
|
||||
/**
|
||||
* Pandora FMS integration API.
|
||||
*
|
||||
* @category API
|
||||
* @package Pandora FMS
|
||||
* @subpackage Console
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require_once 'config.php';
|
||||
require_once 'functions_api.php';
|
||||
|
||||
@ -18,7 +35,7 @@ global $config;
|
||||
define('DEBUG', 0);
|
||||
define('VERBOSE', 0);
|
||||
|
||||
// TESTING THE UPDATE MANAGER
|
||||
// TESTING THE UPDATE MANAGER.
|
||||
enterprise_include_once('include/functions_enterprise_api.php');
|
||||
|
||||
$ipOrigin = $_SERVER['REMOTE_ADDR'];
|
||||
@ -41,26 +58,30 @@ $info = get_parameter('info', '');
|
||||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||
|
||||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
|
||||
$apiPassword = io_output_password(
|
||||
db_get_value_filter(
|
||||
'value',
|
||||
'tconfig',
|
||||
['token' => 'api_password']
|
||||
)
|
||||
);
|
||||
|
||||
$correctLogin = false;
|
||||
$no_login_msg = '';
|
||||
|
||||
// Clean unwanted output
|
||||
// Clean unwanted output.
|
||||
ob_clean();
|
||||
|
||||
// READ THIS:
|
||||
// Special call without checks to retrieve version and build of the Pandora FMS
|
||||
// This info is avalable from the web console without login
|
||||
// Don't change the format, it is parsed by applications
|
||||
switch ($info) {
|
||||
case 'version':
|
||||
if (!$config['MR']) {
|
||||
$config['MR'] = 0;
|
||||
}
|
||||
|
||||
echo 'Pandora FMS '.$pandora_version.' - '.$build_version.' MR'.$config['MR'];
|
||||
// Don't change the format, it is parsed by applications.
|
||||
if ($info == 'version') {
|
||||
if (!$config['MR']) {
|
||||
$config['MR'] = 0;
|
||||
}
|
||||
|
||||
echo 'Pandora FMS '.$pandora_version.' - '.$build_version.' MR'.$config['MR'];
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -68,14 +89,19 @@ if (isInACL($ipOrigin)) {
|
||||
if (empty($apiPassword) || (!empty($apiPassword) && $api_password === $apiPassword)) {
|
||||
$user_in_db = process_user_login($user, $password, true);
|
||||
if ($user_in_db !== false) {
|
||||
$config['id_usuario'] = $user_in_db;
|
||||
// Compat.
|
||||
$config['id_user'] = $user_in_db;
|
||||
$correctLogin = true;
|
||||
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
$_SESSION = [];
|
||||
}
|
||||
|
||||
$_SESSION['id_usuario'] = $user;
|
||||
|
||||
config_prepare_session();
|
||||
session_write_close();
|
||||
} else {
|
||||
$no_login_msg = 'Incorrect user credentials';
|
||||
@ -84,7 +110,7 @@ if (isInACL($ipOrigin)) {
|
||||
$no_login_msg = 'Incorrect given API password';
|
||||
}
|
||||
} else {
|
||||
$no_login_msg = "IP $ipOrigin is not in ACL list";
|
||||
$no_login_msg = 'IP '.$ipOrigin.' is not in ACL list';
|
||||
}
|
||||
|
||||
if ($correctLogin) {
|
||||
@ -93,11 +119,14 @@ if ($correctLogin) {
|
||||
} else {
|
||||
$function_name = '';
|
||||
|
||||
// Check if is an extension function and get the function name
|
||||
// Check if is an extension function and get the function name.
|
||||
if ($op2 == 'extension') {
|
||||
$extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR."/$ext_name/$ext_name.api.php";
|
||||
// The extension API file must exist and the extension must be enabled
|
||||
if (file_exists($extension_api_url) && !in_array($ext_name, extensions_get_disabled_extensions())) {
|
||||
$extension_api_url = $config['homedir'].'/'.EXTENSIONS_DIR.'/'.$ext_name.'/'.$ext_name.'.api.php';
|
||||
// The extension API file must exist and the extension must be
|
||||
// enabled.
|
||||
if (file_exists($extension_api_url)
|
||||
&& !in_array($ext_name, extensions_get_disabled_extensions())
|
||||
) {
|
||||
include_once $extension_api_url;
|
||||
$function_name = 'apiextension_'.$op.'_'.$ext_function;
|
||||
}
|
||||
@ -107,16 +136,19 @@ if ($correctLogin) {
|
||||
if ($op == 'set' && $id) {
|
||||
switch ($op2) {
|
||||
case 'update_agent':
|
||||
|
||||
case 'add_module_in_conf':
|
||||
case 'update_module_in_conf':
|
||||
case 'delete_module_in_conf':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = '.$id);
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
$agent = agents_locate_agent($id);
|
||||
if ($agent !== false) {
|
||||
$id_os = $agent['id_os'];
|
||||
if ($id_os == 100) {
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -127,12 +159,16 @@ if ($correctLogin) {
|
||||
case 'create_snmp_module':
|
||||
case 'delete_module':
|
||||
case 'delete_agent':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where nombre = "'.$id.'"');
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
return false;
|
||||
$agent = agents_locate_agent($id);
|
||||
if ($agent !== false) {
|
||||
$id_os = $agent['id_os'];
|
||||
if ($id_os == 100) {
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -141,60 +177,98 @@ if ($correctLogin) {
|
||||
case 'update_data_module':
|
||||
case 'update_snmp_module':
|
||||
|
||||
$id_os = db_get_value_sql('select id_os from tagente where id_agente = (select id_agente from tagente_modulo where id_agente_modulo ='.$id.')');
|
||||
$id_os = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT id_os
|
||||
FROM tagente
|
||||
WHERE id_agente = (
|
||||
SELECT id_agente
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente_modulo = %d
|
||||
)',
|
||||
$id
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if ($id_os == 100) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete_user_permission':
|
||||
|
||||
if ($user_db === '') {
|
||||
returnError(__('User or group not specified'), __('User, group not specified'));
|
||||
returnError(
|
||||
__('User or group not specified'),
|
||||
__('User, group not specified')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$id_os = api_set_delete_user_profiles($thrash1, $thrash2, $other, $returnType);
|
||||
$id_os = api_set_delete_user_profiles(
|
||||
$thrash1,
|
||||
$thrash2,
|
||||
$other,
|
||||
$returnType
|
||||
);
|
||||
|
||||
if ($id_os != 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id_os == false) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add_permission_user_to_group':
|
||||
|
||||
if ($user_db == null || $group_db == null || $id_up == null) {
|
||||
returnError(__('User, group or profile not specified'), __('User, group or profile status not specified'));
|
||||
if ($user_db == null
|
||||
|| $group_db == null
|
||||
|| $id_up == null
|
||||
) {
|
||||
returnError(
|
||||
__('User, group or profile not specified'),
|
||||
__('User, group or profile status not specified')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$id_os = api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType);
|
||||
$id_os = api_set_add_permission_user_to_group(
|
||||
$thrash1,
|
||||
$thrash2,
|
||||
$other,
|
||||
$returnType
|
||||
);
|
||||
|
||||
if ($id_os != 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($id_os == false) {
|
||||
returnError('not_allowed_operation_cluster', $returnType);
|
||||
returnError(
|
||||
'not_allowed_operation_cluster',
|
||||
$returnType
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// break;
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the function exists
|
||||
// Check if the function exists.
|
||||
if (function_exists($function_name)) {
|
||||
if (!DEBUG) {
|
||||
error_reporting(0);
|
||||
@ -205,18 +279,37 @@ if ($correctLogin) {
|
||||
ini_set('display_errors', 1);
|
||||
}
|
||||
|
||||
call_user_func($function_name, $id, $id2, $other, $returnType, $user_in_db);
|
||||
call_user_func(
|
||||
$function_name,
|
||||
$id,
|
||||
$id2,
|
||||
$other,
|
||||
$returnType,
|
||||
$user_in_db
|
||||
);
|
||||
} else {
|
||||
returnError('no_exist_operation', $returnType);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: Implement a new switch in config to enable / disable
|
||||
// ACL auth failure: if enabled and have lots of traffic can produce millions
|
||||
// of records and a considerable OVERHEAD in the system :(
|
||||
// db_pandora_audit("API access Failed", $no_login_msg, $user, $ipOrigin);
|
||||
/*
|
||||
* //TODO: Implement a new switch in config to enable / disable
|
||||
* ACL auth failure: if enabled and have lots of traffic can produce
|
||||
* millions of records and a considerable OVERHEAD in the system :(
|
||||
* db_pandora_audit("API access Failed", $no_login_msg, $user, $ipOrigin);
|
||||
*/
|
||||
|
||||
sleep(15);
|
||||
|
||||
// Protection on DoS attacks
|
||||
// Protection on DoS attacks.
|
||||
echo 'auth error';
|
||||
}
|
||||
|
||||
// Logout.
|
||||
if (session_status() === PHP_SESSION_ACTIVE) {
|
||||
$_SESSION = [];
|
||||
// Could give a warning if no session file is created. Ignore.
|
||||
@session_destroy();
|
||||
header_remove('Set-Cookie');
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
}
|
||||
|
@ -1,22 +1,39 @@
|
||||
<?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 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 & session manageme
|
||||
session_id($_REQUEST['session_id']);
|
||||
/**
|
||||
* Generate charts with given parameters.
|
||||
*
|
||||
* @category ChartGenerator.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Opensource.
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require_once 'config.php';
|
||||
require_once $config['homedir'].'/include/auth/mysql.php';
|
||||
require_once $config['homedir'].'/include/functions.php';
|
||||
require_once $config['homedir'].'/include/functions_db.php';
|
||||
|
||||
require_once __DIR__.'/config.php';
|
||||
require_once __DIR__.'/functions.php';
|
||||
require_once __DIR__.'/functions_db.php';
|
||||
require_once __DIR__.'/auth/mysql.php';
|
||||
require_once $config['homedir'].'/include/lib/User.php';
|
||||
require_once $config['homedir'].'/include/functions_reporting.php';
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
require_once $config['homedir'].'/include/functions_custom_graphs.php';
|
||||
@ -24,32 +41,91 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_tags.php';
|
||||
|
||||
check_login();
|
||||
|
||||
/**
|
||||
* Echo to stdout a PhantomJS callback call.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function echoPhantomCallback()
|
||||
{
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
var status = window.callPhantom({ status: "loaded" });
|
||||
} catch (error) {
|
||||
console.log("CALLBACK ERROR", error.message)
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
// Initialize session.
|
||||
global $config;
|
||||
// get_parameter(array)('data', '');
|
||||
|
||||
// Try to initialize session using existing php session id.
|
||||
$user = new PandoraFMS\User(['phpsessionid' => $_REQUEST['session_id']]);
|
||||
if (check_login(false) === false) {
|
||||
// Error handler.
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Access denied</title>
|
||||
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css" type="text/css" />
|
||||
<script language="javascript" type='text/javascript' src='javascript/pandora.js'></script>
|
||||
<script language="javascript" type='text/javascript' src='javascript/jquery-3.3.1.min.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Access is not granted</h1>
|
||||
<?php echoPhantomCallback(); ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
// Access granted.
|
||||
$params = json_decode($_REQUEST['data'], true);
|
||||
|
||||
// Metaconsole connection to the node
|
||||
// Metaconsole connection to the node.
|
||||
$server_id = $params['server_id'];
|
||||
|
||||
if ($config['metaconsole'] && !empty($server_id)) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
// Error connecting
|
||||
// Error connecting.
|
||||
if (metaconsole_connect($server) !== NOERR) {
|
||||
echo '<html>';
|
||||
echo '<body>';
|
||||
ui_print_error_message(__('There was a problem connecting with the node'));
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
ui_print_error_message(
|
||||
__('There was a problem connecting with the node')
|
||||
);
|
||||
echoPhantomCallback();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$user_language = get_user_language($config['id_user']);
|
||||
if (file_exists('languages/'.$user_language.'.mo')) {
|
||||
$l10n = new gettext_reader(new CachedFileReader('languages/'.$user_language.'.mo'));
|
||||
if (file_exists('languages/'.$user_language.'.mo') === true) {
|
||||
$cfr = new CachedFileReader('languages/'.$user_language.'.mo');
|
||||
$l10n = new gettext_reader($cfr);
|
||||
$l10n->load_tables();
|
||||
}
|
||||
|
||||
@ -85,16 +161,18 @@ if (file_exists('languages/'.$user_language.'.mo')) {
|
||||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||
<?php
|
||||
$params['only_image'] = false;
|
||||
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||
$params['menu'] = false;
|
||||
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||
$params['menu'] = false;
|
||||
|
||||
if ((!isset($params['width']) || ($params['width'] <= 0))) {
|
||||
if ((isset($params['width']) === false
|
||||
|| ($params['width'] <= 0))
|
||||
) {
|
||||
$params['width'] = 650;
|
||||
}
|
||||
|
||||
$params_combined = json_decode($_REQUEST['data_combined'], true);
|
||||
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
||||
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
||||
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
||||
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
||||
|
||||
echo '<div>';
|
||||
switch ($type_graph_pdf) {
|
||||
@ -208,25 +286,12 @@ if (file_exists('languages/'.$user_language.'.mo')) {
|
||||
break;
|
||||
|
||||
default:
|
||||
// code...
|
||||
// Code...
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echoPhantomCallback();
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
try {
|
||||
var status = window.callPhantom({ status: "loaded" });
|
||||
} catch (error) {
|
||||
console.log("CALLBACK ERROR", error.message)
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -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'),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
1203
pandora_console/include/class/CredentialStore.class.php
Normal file
@ -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.'
|
||||
|
@ -2642,8 +2642,17 @@ class NetworkMap
|
||||
*/
|
||||
public function loadMapData()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$networkmap = $this->map;
|
||||
|
||||
// ACL.
|
||||
$networkmap_write = check_acl(
|
||||
$config['id_user'],
|
||||
$networkmap['id_group'],
|
||||
'MW'
|
||||
);
|
||||
|
||||
$simulate = false;
|
||||
if (isset($networkmap['__simulated']) === false) {
|
||||
$networkmap['filter'] = json_decode(
|
||||
@ -2711,6 +2720,7 @@ class NetworkMap
|
||||
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
|
||||
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
|
||||
$output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n";
|
||||
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
|
||||
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
|
||||
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
|
||||
$output .= "var networkmap = {'nodes': [], 'links': []};\n";
|
||||
|
@ -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 = 'PC190913';
|
||||
$pandora_version = 'v7.0NG.738';
|
||||
$build_version = 'PC191029';
|
||||
$pandora_version = 'v7.0NG.740';
|
||||
|
||||
// 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.
|
||||
*
|
||||
|