Merge remote-tracking branch 'origin/develop' into new-vc-line-element
This commit is contained in:
commit
cf0ad42e2a
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, AIX version
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, FreeBSD Version
|
||||
# Version 7.0NG.739, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, HP-UX Version
|
||||
# Version 7.0NG.739, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, GNU/Linux
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, GNU/Linux
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, Solaris Version
|
||||
# Version 7.0NG.739, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.738, AIX version
|
||||
# Version 7.0NG.739, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.738, HPUX Version
|
||||
# Version 7.0NG.739, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.738, Solaris version
|
||||
# Version 7.0NG.739, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, AIX version
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.738-190924
|
||||
Version: 7.0NG.739-190927
|
||||
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-190924"
|
||||
pandora_version="7.0NG.739-190927"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, GNU/Linux
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, FreeBSD Version
|
||||
# Version 7.0NG.739, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, HP-UX Version
|
||||
# Version 7.0NG.739, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, GNU/Linux
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, GNU/Linux
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, NetBSD Version
|
||||
# Version 7.0NG.739, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.738, Solaris Version
|
||||
# Version 7.0NG.739, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.738';
|
||||
use constant AGENT_BUILD => '190924';
|
||||
use constant AGENT_VERSION => '7.0NG.739';
|
||||
use constant AGENT_BUILD => '190927';
|
||||
|
||||
# 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 190924
|
||||
%define version 7.0NG.739
|
||||
%define release 190927
|
||||
|
||||
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 190924
|
||||
%define version 7.0NG.739
|
||||
%define release 190927
|
||||
|
||||
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="190924"
|
||||
PI_VERSION="7.0NG.739"
|
||||
PI_BUILD="190927"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.738}
|
||||
{Pandora FMS Windows Agent v7.0NG.739}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{190924}
|
||||
{190927}
|
||||
|
||||
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 190924)")
|
||||
#define PANDORA_VERSION ("7.0NG.739(Build 190927)")
|
||||
|
||||
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 190924))"
|
||||
VALUE "ProductVersion", "(7.0NG.739(Build 190927))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.738-190924
|
||||
Version: 7.0NG.739-190927
|
||||
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-190924"
|
||||
pandora_version="7.0NG.739-190927"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -15,9 +15,30 @@ UPDATE `tlayout_data` SET `height` = 70 , `width` = 70 WHERE `height` = 0 && `wi
|
|||
(`type` = 10 && `image` IS NOT NULL && `image` != '' && `image` != 'none') ||
|
||||
(`type` = 11 && `image` IS NOT NULL && `image` != '' && `image` != 'none' && `show_statistics` = 0));
|
||||
|
||||
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;
|
||||
|
|
|
@ -1247,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`
|
||||
|
|
|
@ -295,6 +295,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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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://ehorus.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>
|
Binary file not shown.
After Width: | Height: | Size: 895 B |
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* Integria incidents management.
|
||||
*
|
||||
* @category Ajax library.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Modules.
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
if (check_login()) {
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/functions_integriaims.php';
|
||||
|
||||
$get_users = get_parameter('get_users');
|
||||
$search_term = get_parameter('search_term', '');
|
||||
|
||||
if ($get_users) {
|
||||
$integria_users_csv = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_users', []);
|
||||
|
||||
$csv_array = explode("\n", $integria_users_csv);
|
||||
|
||||
foreach ($csv_array as $csv_line) {
|
||||
if (!empty($csv_line)) {
|
||||
$integria_users_values[$csv_line] = $csv_line;
|
||||
}
|
||||
}
|
||||
|
||||
$integria_users_filtered_values = array_filter(
|
||||
$integria_users_values,
|
||||
function ($item) use ($search_term) {
|
||||
if (strpos($item, $search_term) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
echo json_encode($integria_users_filtered_values);
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -873,18 +873,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 +898,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 +916,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 +934,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 +959,7 @@ class ConsoleSupervisor
|
|||
$MAX_BADXML_FILES_DATA_IN = 150;
|
||||
|
||||
$filecount = $this->countFiles(
|
||||
$config['remote_config'],
|
||||
$remote_config_dir,
|
||||
'',
|
||||
$MAX_FILES_DATA_IN
|
||||
);
|
||||
|
@ -970,7 +972,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 +982,7 @@ class ConsoleSupervisor
|
|||
}
|
||||
|
||||
$filecount = $this->countFiles(
|
||||
$config['remote_config'],
|
||||
$remote_config_dir,
|
||||
'/^.*BADXML$/',
|
||||
$MAX_BADXML_FILES_DATA_IN
|
||||
);
|
||||
|
@ -993,7 +995,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 +1268,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 +1454,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 +2065,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(
|
||||
[
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC190924';
|
||||
$pandora_version = 'v7.0NG.738';
|
||||
$build_version = 'PC190927';
|
||||
$pandora_version = 'v7.0NG.739';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1434,6 +1434,92 @@ function config_update_config()
|
|||
}
|
||||
break;
|
||||
|
||||
case 'integria':
|
||||
if (!config_update_value('integria_enabled', (int) get_parameter('integria_enabled', 0))) {
|
||||
$error_update[] = __('Enable Integria IMS');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_user', (string) get_parameter('integria_user', $config['integria_user']))) {
|
||||
$error_update[] = __('Integria user');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_pass', io_input_password((string) get_parameter('integria_pass', $config['integria_pass'])))) {
|
||||
$error_update[] = __('Integria password');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_hostname', (string) get_parameter('integria_hostname', $config['integria_hostname']))) {
|
||||
$error_update[] = __('integria API hostname');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_api_pass', io_input_password((string) get_parameter('integria_api_pass', $config['integria_api_pass'])))) {
|
||||
$error_update[] = __('Integria API password');
|
||||
}
|
||||
|
||||
if (!config_update_value('integria_req_timeout', (int) get_parameter('integria_req_timeout', $config['integria_req_timeout']))) {
|
||||
$error_update[] = __('Integria request timeout');
|
||||
}
|
||||
|
||||
if (!config_update_value('default_group', (int) get_parameter('default_group', $config['default_group']))) {
|
||||
$error_update[] = __('Integria default group');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_default_group', (int) get_parameter('cr_default_group', $config['cr_default_group']))) {
|
||||
$error_update[] = __('Integria custom response default group');
|
||||
}
|
||||
|
||||
if (!config_update_value('default_criticity', (int) get_parameter('default_criticity', $config['default_criticity']))) {
|
||||
$error_update[] = __('Integria default priority');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_default_criticity', (int) get_parameter('cr_default_criticity', $config['cr_default_criticity']))) {
|
||||
$error_update[] = __('Integria custom response default priority');
|
||||
}
|
||||
|
||||
if (!config_update_value('default_creator', (string) get_parameter('default_creator', $config['default_creator']))) {
|
||||
$error_update[] = __('Integria default creator');
|
||||
}
|
||||
|
||||
if (!config_update_value('default_owner', (string) get_parameter('default_owner', $config['default_owner']))) {
|
||||
$error_update[] = __('Integria default owner');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_default_owner', (string) get_parameter('cr_default_owner', $config['cr_default_owner']))) {
|
||||
$error_update[] = __('Integria custom response default owner');
|
||||
}
|
||||
|
||||
if (!config_update_value('incident_type', (int) get_parameter('incident_type', $config['incident_type']))) {
|
||||
$error_update[] = __('Integria default ticket type');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_incident_type', (int) get_parameter('cr_incident_type', $config['cr_incident_type']))) {
|
||||
$error_update[] = __('Integria custom response default ticket type');
|
||||
}
|
||||
|
||||
if (!config_update_value('incident_status', (int) get_parameter('incident_status', $config['incident_status']))) {
|
||||
$error_update[] = __('Integria default ticket status');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_incident_status', (int) get_parameter('cr_incident_status', $config['cr_incident_status']))) {
|
||||
$error_update[] = __('Integria custom response default ticket status');
|
||||
}
|
||||
|
||||
if (!config_update_value('incident_title', (string) get_parameter('incident_title', $config['incident_title']))) {
|
||||
$error_update[] = __('Integria default ticket title');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_incident_title', (string) get_parameter('cr_incident_title', $config['cr_incident_title']))) {
|
||||
$error_update[] = __('Integria custom response default ticket title');
|
||||
}
|
||||
|
||||
if (!config_update_value('incident_content', (string) get_parameter('incident_content', $config['incident_content']))) {
|
||||
$error_update[] = __('Integria default ticket content');
|
||||
}
|
||||
|
||||
if (!config_update_value('cr_incident_content', (string) get_parameter('cr_incident_content', $config['cr_incident_content']))) {
|
||||
$error_update[] = __('Integria custom response default ticket content');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
|
@ -1500,7 +1586,7 @@ function config_process_config()
|
|||
|
||||
if (!isset($config['remote_config'])) {
|
||||
if ($is_windows) {
|
||||
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in';
|
||||
$default = 'C:\PandoraFMS\Pandora_Server\data_in';
|
||||
} else {
|
||||
$default = '/var/spool/pandora/data_in';
|
||||
}
|
||||
|
@ -1510,7 +1596,7 @@ function config_process_config()
|
|||
|
||||
if (!isset($config['phantomjs_bin'])) {
|
||||
if ($is_windows) {
|
||||
$default = 'C:\\PandoraFMS\\phantomjs';
|
||||
$default = 'C:\PandoraFMS\Pandora_Server\bin';
|
||||
} else {
|
||||
$default = '/usr/bin';
|
||||
}
|
||||
|
@ -1760,7 +1846,13 @@ function config_process_config()
|
|||
}
|
||||
|
||||
if (!isset($config['auditdir'])) {
|
||||
config_update_value('auditdir', '/var/www/html/pandora_console');
|
||||
$auditdir = '/var/www/html/pandora_console';
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// Windows.
|
||||
$auditdir = $config['homedir'];
|
||||
}
|
||||
|
||||
config_update_value('auditdir', $auditdir);
|
||||
}
|
||||
|
||||
if (!isset($config['elasticsearch_ip'])) {
|
||||
|
@ -1794,6 +1886,7 @@ function config_process_config()
|
|||
/*
|
||||
* Parse the ACL IP list for access API
|
||||
*/
|
||||
|
||||
$temp_list_ACL_IPs_for_API = [];
|
||||
if (isset($config['list_ACL_IPs_for_API'])) {
|
||||
if (!empty($config['list_ACL_IPs_for_API'])) {
|
||||
|
@ -1804,13 +1897,16 @@ function config_process_config()
|
|||
$config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API;
|
||||
$keysConfig = array_keys($config);
|
||||
|
||||
// This is not set here. The first time, when no
|
||||
// setup is done, update_manager extension manage it
|
||||
// the first time make a conenction and disable itself
|
||||
// Not Managed here !
|
||||
// if (!isset ($config["autoupdate"])) {
|
||||
// config_update_value ('autoupdate', true);.
|
||||
// }
|
||||
/*
|
||||
* This is not set here. The first time, when no
|
||||
* setup is done, update_manager extension manage it
|
||||
* the first time make a conenction and disable itself
|
||||
* Not Managed here !
|
||||
* if (!isset ($config["autoupdate"])) {
|
||||
* config_update_value ('autoupdate', true);.
|
||||
* }
|
||||
*/
|
||||
|
||||
include_once $config['homedir'].'/include/auth/mysql.php';
|
||||
include_once $config['homedir'].'/include/functions_io.php';
|
||||
|
||||
|
@ -1819,10 +1915,16 @@ function config_process_config()
|
|||
// user, and should be in pandora root. By default, Pandora adds
|
||||
// /attachment to this, so by default is the pandora console home
|
||||
// dir.
|
||||
$attachment_store_path = $config['homedir'].'/attachment';
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// Windows.
|
||||
$attachment_store_path = $config['homedir'].'\attachment';
|
||||
}
|
||||
|
||||
if (!isset($config['attachment_store'])) {
|
||||
config_update_value(
|
||||
'attachment_store',
|
||||
io_safe_input($config['homedir']).'/attachment'
|
||||
$attachment_store_path
|
||||
);
|
||||
} else {
|
||||
// Fixed when the user moves the pandora console to another dir
|
||||
|
@ -1830,16 +1932,23 @@ function config_process_config()
|
|||
if (!is_dir($config['attachment_store'])) {
|
||||
config_update_value(
|
||||
'attachment_store',
|
||||
$config['homedir'].'/attachment'
|
||||
$attachment_store_path
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($config['fontpath'])) {
|
||||
$home = str_replace('\\', '/', $config['homedir']);
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// Windows.
|
||||
$fontpath = $config['homedir'].'\include\fonts\smallfont.ttf';
|
||||
} else {
|
||||
$home = str_replace('\\', '/', $config['homedir']);
|
||||
$fontpath = $home.'/include/fonts/smallfont.ttf';
|
||||
}
|
||||
|
||||
config_update_value(
|
||||
'fontpath',
|
||||
$home.'/include/fonts/smallfont.ttf'
|
||||
$fontpath
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2077,7 +2186,7 @@ function config_process_config()
|
|||
|
||||
if (!isset($config['netflow_path'])) {
|
||||
if ($is_windows) {
|
||||
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in\\netflow';
|
||||
$default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow';
|
||||
} else {
|
||||
$default = '/var/spool/pandora/data_in/netflow';
|
||||
}
|
||||
|
@ -2639,6 +2748,10 @@ function config_process_config()
|
|||
config_update_value('zoom_graph', 1);
|
||||
}
|
||||
|
||||
if (!isset($config['percentil'])) {
|
||||
config_update_value('percentil', 95);
|
||||
}
|
||||
|
||||
if (!isset($config['render_proc_ok'])) {
|
||||
config_update_value('render_proc_ok', __('Ok'));
|
||||
}
|
||||
|
@ -2820,6 +2933,19 @@ function config_process_config()
|
|||
}
|
||||
}
|
||||
|
||||
// Integria.
|
||||
if (!isset($config['integria_enabled'])) {
|
||||
config_update_value('integria_enabled', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['integria_req_timeout'])) {
|
||||
config_update_value('integria_req_timeout', 5);
|
||||
}
|
||||
|
||||
if (!isset($config['integria_hostname'])) {
|
||||
config_update_value('integria_hostname', '');
|
||||
}
|
||||
|
||||
// Finally, check if any value was overwritten in a form.
|
||||
config_update_config();
|
||||
}
|
||||
|
|
|
@ -6638,3 +6638,244 @@ function events_get_secondary_groups_left_join($table)
|
|||
return 'LEFT JOIN tmetaconsole_agent_secondary_group tasg
|
||||
ON te.id_agente = tasg.id_tagente AND te.server_id = tasg.id_tmetaconsole_setup';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Replace macros in any string given an event id.
|
||||
* If server_id > 0, it's a metaconsole query.
|
||||
*
|
||||
* @param integer $event_id Event identifier.
|
||||
* @param integer $value String value in which we want to apply macros.
|
||||
*
|
||||
* @return string The response text with the macros applied.
|
||||
*/
|
||||
function events_get_field_value_by_event_id(
|
||||
int $event_id,
|
||||
$value
|
||||
) {
|
||||
global $config;
|
||||
|
||||
$meta = false;
|
||||
$event = db_get_row('tevento', 'id_evento', $event_id);
|
||||
|
||||
// Replace each macro.
|
||||
if (strpos($value, '_agent_address_') !== false) {
|
||||
if ($meta) {
|
||||
$agente_table_name = 'tmetaconsole_agent';
|
||||
$filter = [
|
||||
'id_tagente' => $event['id_agente'],
|
||||
'id_tmetaconsole_setup' => $server_id,
|
||||
];
|
||||
} else {
|
||||
$agente_table_name = 'tagente';
|
||||
$filter = ['id_agente' => $event['id_agente']];
|
||||
}
|
||||
|
||||
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
|
||||
// If agent does not have an IP, display N/A.
|
||||
if ($ip === false) {
|
||||
$ip = __('N/A');
|
||||
}
|
||||
|
||||
$value = str_replace('_agent_address_', $ip, $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_agent_id_') !== false) {
|
||||
$value = str_replace('_agent_id_', $event['id_agente'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_module_address_') !== false) {
|
||||
if ($event['id_agentmodule'] != 0) {
|
||||
if ($meta) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$module = db_get_row('tagente_modulo', 'id_agente_modulo', $event['id_agentmodule']);
|
||||
if (empty($module['ip_target'])) {
|
||||
$module['ip_target'] = __('N/A');
|
||||
}
|
||||
|
||||
$value = str_replace('_module_address_', $module['ip_target'], $value);
|
||||
if (empty($module['nombre'])) {
|
||||
$module['nombre'] = __('N/A');
|
||||
}
|
||||
|
||||
if ($meta) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$value = str_replace('_module_address_', __('N/A'), $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_module_name_') !== false) {
|
||||
if ($event['id_agentmodule'] != 0) {
|
||||
if ($meta) {
|
||||
$server = metaconsole_get_connection_by_id($server_id);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
$module = db_get_row('tagente_modulo', 'id_agente_modulo', $event['id_agentmodule']);
|
||||
if (empty($module['ip_target'])) {
|
||||
$module['ip_target'] = __('N/A');
|
||||
}
|
||||
|
||||
$value = str_replace(
|
||||
'_module_name_',
|
||||
io_safe_output($module['nombre']),
|
||||
$value
|
||||
);
|
||||
|
||||
if ($meta) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$value = str_replace('_module_name_', __('N/A'), $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_id_') !== false) {
|
||||
$value = str_replace('_event_id_', $event['id_evento'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_user_id_') !== false) {
|
||||
if (!empty($event['id_usuario'])) {
|
||||
$value = str_replace('_user_id_', $event['id_usuario'], $value);
|
||||
} else {
|
||||
$value = str_replace('_user_id_', __('N/A'), $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_group_id_') !== false) {
|
||||
$value = str_replace('_group_id_', $event['id_grupo'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_group_name_') !== false) {
|
||||
$value = str_replace(
|
||||
'_group_name_',
|
||||
groups_get_name($event['id_grupo'], true),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_utimestamp_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_utimestamp_',
|
||||
$event['utimestamp'],
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_date_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_date_',
|
||||
date($config['date_format'], $event['utimestamp']),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_text_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_text_',
|
||||
events_display_name($event['evento']),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_type_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_type_',
|
||||
events_print_type_description($event['event_type'], true),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_alert_id_') !== false) {
|
||||
$value = str_replace(
|
||||
'_alert_id_',
|
||||
empty($event['is_alert_am']) ? __('N/A') : $event['is_alert_am'],
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_severity_id_') !== false) {
|
||||
$value = str_replace('_event_severity_id_', $event['criticity'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_severity_text_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_severity_text_',
|
||||
get_priority_name($event['criticity']),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_module_id_') !== false) {
|
||||
$value = str_replace('_module_id_', $event['id_agentmodule'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_tags_') !== false) {
|
||||
$value = str_replace('_event_tags_', $event['tags'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_extra_id_') !== false) {
|
||||
if (empty($event['id_extra'])) {
|
||||
$value = str_replace('_event_extra_id_', __('N/A'), $value);
|
||||
} else {
|
||||
$value = str_replace('_event_extra_id_', $event['id_extra'], $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_source_') !== false) {
|
||||
$value = str_replace('_event_source_', $event['source'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_instruction_') !== false) {
|
||||
$value = str_replace(
|
||||
'_event_instruction_',
|
||||
events_display_instructions($event['event_type'], $event, false),
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
if (strpos($value, '_owner_user_') !== false) {
|
||||
if (empty($event['owner_user'])) {
|
||||
$value = str_replace('_owner_user_', __('N/A'), $value);
|
||||
} else {
|
||||
$value = str_replace('_owner_user_', $event['owner_user'], $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($value, '_event_status_') !== false) {
|
||||
$event_st = events_display_status($event['estado']);
|
||||
$value = str_replace('_event_status_', $event_st['title'], $value);
|
||||
}
|
||||
|
||||
if (strpos($value, '_group_custom_id_') !== false) {
|
||||
$group_custom_id = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT custom_id FROM tgrupo WHERE id_grupo=%s',
|
||||
$event['id_grupo']
|
||||
)
|
||||
);
|
||||
$event_st = events_display_status($event['estado']);
|
||||
$value = str_replace('_group_custom_id_', $group_custom_id, $value);
|
||||
}
|
||||
|
||||
// Parse the event custom data.
|
||||
if (!empty($event['custom_data'])) {
|
||||
$custom_data = json_decode(base64_decode($event['custom_data']));
|
||||
foreach ($custom_data as $key => $val) {
|
||||
$value = str_replace('_customdata_'.$key.'_', $val, $value);
|
||||
}
|
||||
}
|
||||
|
||||
// This will replace the macro with the current logged user.
|
||||
if (strpos($value, '_current_user_') !== false) {
|
||||
$value = str_replace('_current_user_', $config['id_user'], $value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
|
|
@ -302,6 +302,15 @@ function grafico_modulo_sparse_data(
|
|||
$array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||
$array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||
|
||||
if ($params['percentil']) {
|
||||
$array_data['percentil'.$series_suffix]['agent_module_id'] = $agent_module_id;
|
||||
$array_data['percentil'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
||||
$array_data['percentil'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
||||
$array_data['percentil'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
|
||||
$array_data['percentil'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||
$array_data['percentil'.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||
}
|
||||
|
||||
// This is for a specific type of report that consists in passing
|
||||
// an interval and doing the average sum and avg.
|
||||
if ($params['force_interval'] != '') {
|
||||
|
@ -378,12 +387,6 @@ function grafico_modulo_sparse_data(
|
|||
$array_data['sum1']['data'] = $acum_array_data;
|
||||
}
|
||||
|
||||
if ($params['percentil']) {
|
||||
$percentil_value = $array_data['percentil'.$series_suffix]['data'][0][1];
|
||||
} else {
|
||||
$percentil_value = 0;
|
||||
}
|
||||
|
||||
$events = [];
|
||||
if (isset($array_data['sum'.$series_suffix]['max'])) {
|
||||
$max = $array_data['sum'.$series_suffix]['max'];
|
||||
|
@ -1471,8 +1474,6 @@ function graphic_combined_module(
|
|||
$min = $array_data['sum'.$i]['min'];
|
||||
$avg = $array_data['sum'.$i]['avg'];
|
||||
|
||||
$percentil_value = $array_data['percentil'.$i]['data'][0][1];
|
||||
|
||||
if ($config['fixed_graph'] == false) {
|
||||
$water_mark = [
|
||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||
|
|
|
@ -3383,3 +3383,116 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print an autocomplete input filled out with Integria IMS users.
|
||||
*
|
||||
* @param string $name The name of ajax control, by default is "users".
|
||||
* @param string $default The default value to show in the ajax control.
|
||||
* @param boolean $return If it is true return a string with the output instead to echo the output.
|
||||
* @param string $size Size.
|
||||
*
|
||||
* @return mixed If the $return is true, return the output as string.
|
||||
*/
|
||||
function html_print_autocomplete_users_from_integria(
|
||||
$name='users',
|
||||
$default='',
|
||||
$return=false,
|
||||
$size='30',
|
||||
$disable=false,
|
||||
$required=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
ob_start();
|
||||
|
||||
$attrs = ['style' => 'background: url(images/user_green.png) no-repeat right;'];
|
||||
|
||||
if ($required) {
|
||||
$attrs['required'] = 'required';
|
||||
}
|
||||
|
||||
html_print_input_text_extended(
|
||||
$name,
|
||||
$default,
|
||||
'text-'.$name,
|
||||
'',
|
||||
$size,
|
||||
100,
|
||||
$disable,
|
||||
'',
|
||||
$attrs
|
||||
);
|
||||
html_print_input_hidden($name.'_hidden', $id_agent_module);
|
||||
|
||||
ui_print_help_tip(__('Type at least two characters to search the user.'), false);
|
||||
|
||||
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function escapeHTML (str)
|
||||
{
|
||||
var div = document.createElement('div');
|
||||
var text = document.createTextNode(str);
|
||||
div.appendChild(text);
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
$("#text-<?php echo $name; ?>").autocomplete({
|
||||
minLength: 2,
|
||||
source: function( request, response ) {
|
||||
var term = request.term; //Word to search
|
||||
|
||||
data_params = {
|
||||
page: "include/ajax/integria_incidents.ajax",
|
||||
search_term: term,
|
||||
get_users: 1,
|
||||
};
|
||||
|
||||
jQuery.ajax ({
|
||||
data: data_params,
|
||||
async: false,
|
||||
type: "POST",
|
||||
url: action="<?php echo $javascript_ajax_page; ?>",
|
||||
timeout: 10000,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
temp = [];
|
||||
$.each(data, function (id, module) {
|
||||
temp.push({
|
||||
'value' : id,
|
||||
'label' : module});
|
||||
});
|
||||
|
||||
response(temp);
|
||||
}
|
||||
});
|
||||
},
|
||||
change: function( event, ui ) {
|
||||
if (!ui.item)
|
||||
$("input[name='<?php echo $name; ?>_hidden']")
|
||||
.val(0);
|
||||
return false;
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
$("input[name='<?php echo $name; ?>_hidden']")
|
||||
.val(ui.item.value);
|
||||
|
||||
$("#text-<?php echo $name; ?>").val( ui.item.label );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$output = ob_get_clean();
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,420 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/**
|
||||
* @package Include
|
||||
* @subpackage Incidents
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_ui.php';
|
||||
require_once $config['homedir'].'/include/functions_html.php';
|
||||
require_once $config['homedir'].'/include/functions.php';
|
||||
|
||||
|
||||
/**
|
||||
* Show header tabs.
|
||||
*
|
||||
* @param string $active_tab Current tab or false for View page.
|
||||
* @param number $view Id of incident. Show View tab.
|
||||
*
|
||||
* @return html Print tabs in header.
|
||||
*/
|
||||
function integriaims_tabs($active_tab, $view=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$url_tabs = ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/');
|
||||
|
||||
$setup_tab['text'] = '<a href="'.ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=integria').'">'.html_print_image('images/setup.png', true, ['title' => __('Configure Integria IMS')]).'</a>';
|
||||
$list_tab['text'] = '<a href="'.$url_tabs.'list_integriaims_incidents">'.html_print_image('images/list.png', true, ['title' => __('Ticket list')]).'</a>';
|
||||
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident">'.html_print_image('images/pencil.png', true, ['title' => __('New ticket')]).'</a>';
|
||||
|
||||
switch ($active_tab) {
|
||||
case 'setup_tab':
|
||||
$setup_tab['active'] = true;
|
||||
$list_tab['active'] = false;
|
||||
$create_tab['active'] = false;
|
||||
break;
|
||||
|
||||
case 'list_tab':
|
||||
$setup_tab['active'] = false;
|
||||
$list_tab['active'] = true;
|
||||
$create_tab['active'] = false;
|
||||
break;
|
||||
|
||||
case 'create_tab':
|
||||
$setup_tab['active'] = false;
|
||||
$list_tab['active'] = false;
|
||||
$create_tab['active'] = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$setup_tab['active'] = false;
|
||||
$list_tab['active'] = false;
|
||||
$create_tab['active'] = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($view) {
|
||||
$create_tab['text'] = '<a href="'.$url_tabs.'configure_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/pencil.png', true, ['title' => __('Edit ticket')]).'</a>';
|
||||
$view_tab['text'] = '<a href="'.$url_tabs.'dashboard_detail_integriaims_incident&incident_id='.$view.'">'.html_print_image('images/operation.png', true, ['title' => __('View ticket')]).'</a>';
|
||||
// When the current page is the View page.
|
||||
if (!$active_tab) {
|
||||
$view_tab['active'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$onheader = [];
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IR') && $view) {
|
||||
$onheader['view'] = $view_tab;
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$onheader['configure'] = $setup_tab;
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IR')) {
|
||||
$onheader['list'] = $list_tab;
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||
$onheader['create'] = $create_tab;
|
||||
}
|
||||
|
||||
return $onheader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets all the details of Integria IMS API
|
||||
*
|
||||
* @param string $details Type of API call.
|
||||
* @param number $detail_index Send index if you want return the text.
|
||||
*
|
||||
* @return string or array with result of API call.
|
||||
*/
|
||||
function integriaims_get_details($details, $detail_index=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
switch ($details) {
|
||||
case 'status':
|
||||
$operation = 'get_incidents_status';
|
||||
break;
|
||||
|
||||
case 'group':
|
||||
$operation = 'get_groups';
|
||||
break;
|
||||
|
||||
case 'priority':
|
||||
$operation = 'get_incident_priorities';
|
||||
break;
|
||||
|
||||
case 'resolution':
|
||||
$operation = 'get_incidents_resolutions';
|
||||
break;
|
||||
|
||||
case 'type':
|
||||
$operation = 'get_types';
|
||||
break;
|
||||
|
||||
default:
|
||||
// code...
|
||||
break;
|
||||
}
|
||||
|
||||
$api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], $operation);
|
||||
$result = [];
|
||||
get_array_from_csv_data_pair($api_call, $result);
|
||||
|
||||
if ($detail_index !== false) {
|
||||
if ($result[$detail_index] == '' || $result[$detail_index] === null) {
|
||||
return __('None');
|
||||
} else {
|
||||
return $result[$detail_index];
|
||||
}
|
||||
} else {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform an API call to Integria IMS.
|
||||
*
|
||||
* @param string API host URL.
|
||||
* @param string User name.
|
||||
* @param string User password.
|
||||
* @param string API password.
|
||||
* @param string API Operation.
|
||||
* @param array Array with parameters required by the API function.
|
||||
*
|
||||
* @return boolean True if API request succeeded, false if API request failed.
|
||||
*/
|
||||
function integria_api_call($api_hostname, $user, $user_pass, $api_pass, $operation, $params_array=[], $show_credentials_error_msg=false)
|
||||
{
|
||||
$params_string = implode(',', $params_array);
|
||||
|
||||
$url_data = [
|
||||
'user' => $user,
|
||||
'user_pass' => $user_pass,
|
||||
'pass' => $api_pass,
|
||||
'op' => $operation,
|
||||
'params' => html_entity_decode($params_string),
|
||||
];
|
||||
|
||||
// Build URL for API request.
|
||||
$url = $api_hostname.'/integria/include/api.php';
|
||||
|
||||
// ob_start();
|
||||
// $out = fopen('php://output', 'w');
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $url_data);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||
curl_setopt($ch, CURLOPT_STDERR, $out);
|
||||
$result = curl_exec($ch);
|
||||
|
||||
// fclose($out);
|
||||
// $debug = ob_get_clean();
|
||||
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
$error = false;
|
||||
|
||||
if ($result === false) {
|
||||
$error = curl_error($ch);
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
if ($error === true || $http_status !== 200) {
|
||||
if ($show_credentials_error_msg === true) {
|
||||
ui_print_error_message(__('API request failed. Please check Integria IMS\' access credentials in Pandora setup.'));
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Parse CSV consisting of one or more lines of the form key-value pair into an array.
|
||||
function get_array_from_csv_data_pair($csv_data, &$array_values)
|
||||
{
|
||||
$csv_array = explode("\n", $csv_data);
|
||||
|
||||
foreach ($csv_array as $csv_value) {
|
||||
if (empty($csv_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$new_csv_value = str_getcsv($csv_value);
|
||||
|
||||
$array_values[$new_csv_value[0]] = $new_csv_value[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse CSV consisting of all lines into an array.
|
||||
*
|
||||
* @param string $csv_data Data returned of csv api call.
|
||||
* @param string $array_values Returned array.
|
||||
* @param array $index Array to create an associative index (opcional).
|
||||
*/
|
||||
function get_array_from_csv_data_all($csv_data, &$array_values, $index=false)
|
||||
{
|
||||
$csv_array = explode("\n", $csv_data);
|
||||
|
||||
foreach ($csv_array as $csv_value) {
|
||||
if (empty($csv_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$new_csv_value = str_getcsv($csv_value);
|
||||
|
||||
if ($index !== false) {
|
||||
foreach ($new_csv_value as $key => $value) {
|
||||
$new_csv_value_index[$index[$key]] = str_replace(':::', ',', $value);
|
||||
;
|
||||
}
|
||||
|
||||
$array_values[$new_csv_value[0]] = $new_csv_value_index;
|
||||
} else {
|
||||
$new_csv_value_comma = array_map(
|
||||
function ($item) {
|
||||
return str_replace(':::', ',', $item);
|
||||
},
|
||||
$new_csv_value
|
||||
);
|
||||
$array_values[$new_csv_value[0]] = $new_csv_value_comma;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print priority for Integria IMS with colors.
|
||||
*
|
||||
* @param string $priority value of priority in Integria IMS.
|
||||
* @param string $priority_label text shown in color box.
|
||||
*
|
||||
* @return HTML code to print the color box.
|
||||
*/
|
||||
function ui_print_integria_incident_priority($priority, $priority_label)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$output = '';
|
||||
switch ($priority) {
|
||||
case 0:
|
||||
$color = COL_UNKNOWN;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$color = COL_NORMAL;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
$color = COL_NOTINIT;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$color = COL_WARNING;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$color = COL_ALERTFIRED;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$color = COL_CRITICAL;
|
||||
break;
|
||||
}
|
||||
|
||||
$output = '<div class="priority" style="background: '.$color.'">';
|
||||
$output .= $priority_label;
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get tickets from Integria IMS.
|
||||
*
|
||||
* @param array $tickets_filters Filters to send to API.
|
||||
*
|
||||
* @return array Tickets returned by API call.
|
||||
*/
|
||||
function get_tickets_integriaims($tickets_filters)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Filters.
|
||||
$incident_text = $tickets_filters['incident_text'];
|
||||
$incident_status = $tickets_filters['incident_status'];
|
||||
$incident_group = $tickets_filters['incident_group'];
|
||||
$incident_owner = $tickets_filters['incident_owner'];
|
||||
$incident_creator = $tickets_filters['incident_creator'];
|
||||
$incident_priority = $tickets_filters['incident_priority'];
|
||||
$incident_resolution = $tickets_filters['incident_resolution'];
|
||||
$created_from = $tickets_filters['created_from'];
|
||||
$created_to = $tickets_filters['created_to'];
|
||||
|
||||
// API call.
|
||||
$result_api_call_list = integria_api_call(
|
||||
$config['integria_hostname'],
|
||||
$config['integria_user'],
|
||||
$config['integria_pass'],
|
||||
$config['integria_api_pass'],
|
||||
'get_incidents',
|
||||
[
|
||||
$incident_text,
|
||||
$incident_status,
|
||||
$incident_group,
|
||||
$incident_priority,
|
||||
'0',
|
||||
$incident_owner,
|
||||
$incident_creator,
|
||||
]
|
||||
);
|
||||
|
||||
// Return array of api call 'get_incidents'.
|
||||
$array_get_incidents = [];
|
||||
get_array_from_csv_data_all($result_api_call_list, $array_get_incidents);
|
||||
|
||||
// Modify $array_get_incidents if filter for resolution exists.
|
||||
$filter_resolution = [];
|
||||
foreach ($array_get_incidents as $key => $value) {
|
||||
if ($incident_resolution !== '' && ($array_get_incidents[$key][12] == $incident_resolution)) {
|
||||
$filter_resolution[$key] = $array_get_incidents[$key];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($incident_resolution !== '') {
|
||||
$array_get_incidents = $filter_resolution;
|
||||
}
|
||||
|
||||
// Modify $array_get_incidents if filter for date is selected.
|
||||
if ($created_from !== '' && $created_to !== '') {
|
||||
$date = [];
|
||||
$date_utimestamp = [];
|
||||
foreach ($array_get_incidents as $key => $value) {
|
||||
// Change format date / to -.
|
||||
$date[$key] = date('Y-m-d', strtotime($array_get_incidents[$key][9]));
|
||||
// Covert date to utimestamp.
|
||||
$date_utimestamp[$key] = strtotime($date[$key]);
|
||||
}
|
||||
|
||||
// Change format date / to -.
|
||||
$created_from_date = date('Y-m-d', strtotime($created_from));
|
||||
$created_to_date = date('Y-m-d', strtotime($created_to));
|
||||
|
||||
// Covert date to utimestamp.
|
||||
$created_from_timestamp = strtotime($created_from_date);
|
||||
$created_to_timestamp = strtotime($created_to_date);
|
||||
|
||||
// Dates within the selected period.
|
||||
$selected_period = array_filter(
|
||||
$date_utimestamp,
|
||||
function ($value) use ($created_from_timestamp, $created_to_timestamp) {
|
||||
return ($value >= $created_from_timestamp && $value <= $created_to_timestamp);
|
||||
}
|
||||
);
|
||||
|
||||
// Return incidents with the correct dates.
|
||||
$filter_date = [];
|
||||
foreach ($array_get_incidents as $key => $value) {
|
||||
foreach ($selected_period as $index => $value) {
|
||||
if ($array_get_incidents[$key][0] == $index) {
|
||||
$filter_date[$key] = $array_get_incidents[$key];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_get_incidents = $filter_date;
|
||||
}
|
||||
|
||||
return $array_get_incidents;
|
||||
}
|
|
@ -104,7 +104,7 @@ class gettext_reader {
|
|||
* @param boolean enable_cache Enable or disable caching of strings (default on)
|
||||
*/
|
||||
function gettext_reader($Reader, $enable_cache = true) {
|
||||
$machine = @shell_exec('uname -m');
|
||||
$machine = php_uname("m");
|
||||
|
||||
$enabled64Bits = false;
|
||||
if (preg_match('/64/', $machine)) {
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
/* --- Integria IMS --- */
|
||||
div.priority {
|
||||
width: 80px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Details view */
|
||||
div.integria_details {
|
||||
display: grid;
|
||||
grid-column-gap: 10px;
|
||||
grid-template-columns: repeat(3, minmax(min-content, auto));
|
||||
grid-auto-rows: 1fr;
|
||||
}
|
||||
|
||||
div.integria_details div.box-shadow.white_table_graph {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
div.integria_details div.priority {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
div.integriaims_details_row {
|
||||
display: grid;
|
||||
grid-gap: 10px;
|
||||
text-align: center;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
div.integriaims_details_titles {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.integria_details_row_five {
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
}
|
||||
|
||||
div.integria_details_row_three {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
div.integria_details_description {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.integria_details_description textarea {
|
||||
width: 100%;
|
||||
background-color: #fbfbfb;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.integriaims_details_box {
|
||||
display: grid;
|
||||
grid-column-gap: 10px;
|
||||
grid-row-gap: 5px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.integriaims_details_box_five {
|
||||
grid-template-rows: repeat(3, 1fr);
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
}
|
||||
|
||||
.integriaims_details_box_three {
|
||||
grid-template-rows: repeat(3, 1fr);
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
/* ui_toggles */
|
||||
.integria_details_shadow {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #e2e2e2;
|
||||
border-left: 1px solid #e2e2e2;
|
||||
border-top-left-radius: 5px;
|
||||
border-right: 1px solid #e2e2e2;
|
||||
border-top-right-radius: 5px;
|
||||
}
|
||||
|
||||
.integria_details_shadow .white_table_graph_header {
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.integria_details_content {
|
||||
border-bottom: none;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
/* Inputs type text shown as a black line */
|
||||
.integria_incidents_options input[type="text"] {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid #ccc;
|
||||
font-family: "lato-bolder", "Open Sans", sans-serif;
|
||||
font-size: 10pt;
|
||||
padding: 2px 5px;
|
||||
box-sizing: border-box;
|
||||
background-repeat: no-repeat;
|
||||
background-position: left bottom 2px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.integria_incident_options input[readonly] {
|
||||
color: #848484;
|
||||
}
|
||||
|
||||
.comment_title {
|
||||
padding: 5px 10px 5px 20px;
|
||||
background-color: rgba(130, 185, 46, 0.16);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.comment_body {
|
||||
padding: 15px 20px 15px 20px;
|
||||
}
|
|
@ -128,8 +128,8 @@
|
|||
</div>
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.738';
|
||||
$build = '190924';
|
||||
$version = '7.0NG.739';
|
||||
$build = '190927';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -0,0 +1,325 @@
|
|||
<?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.
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (!(check_acl($config['id_user'], 0, 'IW') && check_acl($config['id_user'], 0, 'IR'))) {
|
||||
// Doesn't have access to this page.
|
||||
db_pandora_audit('ACL Violation', 'Trying to access IntegriaIMS ticket creation');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once $config['homedir'].'/include/functions_integriaims.php';
|
||||
|
||||
$update = (isset($_GET['incident_id']) === true);
|
||||
|
||||
// Header tabs.
|
||||
$onheader = integriaims_tabs('create_tab', $_GET['incident_id']);
|
||||
if ($update) {
|
||||
ui_print_page_header(__('Update Integria IMS Ticket'), '', false, '', false, $onheader);
|
||||
} else {
|
||||
ui_print_page_header(__('Create Integria IMS Ticket'), '', false, '', false, $onheader);
|
||||
}
|
||||
|
||||
// Check if Integria integration enabled.
|
||||
if ($config['integria_enabled'] == 0) {
|
||||
ui_print_error_message(__('Integria integration must be enabled in Pandora setup'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check connection to Integria IMS API.
|
||||
$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []);
|
||||
|
||||
if ($has_connection === false) {
|
||||
ui_print_error_message(__('Integria IMS API is not reachable'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Styles.
|
||||
ui_require_css_file('integriaims');
|
||||
|
||||
// If everything OK, get parameters from Integria IMS API in order to populate combos.
|
||||
$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);
|
||||
|
||||
$event_id = (int) get_parameter('from_event');
|
||||
$incident_id_edit = (int) get_parameter('incident_id');
|
||||
$create_incident = (bool) get_parameter('create_incident', 0);
|
||||
$update_incident = (bool) get_parameter('update_incident', 0);
|
||||
$incident_group_id = (int) get_parameter('group');
|
||||
$incident_criticity_id = (int) get_parameter('criticity');
|
||||
$incident_owner = get_parameter('owner');
|
||||
$incident_type = (int) get_parameter('type');
|
||||
$incident_creator = get_parameter('creator');
|
||||
$incident_status = (int) get_parameter('status');
|
||||
$incident_title = events_get_field_value_by_event_id($event_id, get_parameter('incident_title'));
|
||||
$incident_content = events_get_field_value_by_event_id($event_id, get_parameter('incident_content'));
|
||||
|
||||
// Separator conversions.
|
||||
$incident_title = str_replace(',', ':::', $incident_title);
|
||||
$incident_content = str_replace(',', ':::', $incident_content);
|
||||
|
||||
// Perform action.
|
||||
if ($create_incident === true) {
|
||||
// Call Integria IMS API method to create an incident.
|
||||
$result_api_call = integria_api_call($config['integria_hostname'], $incident_creator, $config['integria_pass'], $config['integria_api_pass'], 'create_incident', [$incident_title, $incident_group_id, $incident_criticity_id, $incident_content, '', $incident_type, '', $incident_owner, '0', $incident_status]);
|
||||
|
||||
// Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value.
|
||||
$incident_created_ok = ($result_api_call != false) ? true : false;
|
||||
|
||||
ui_print_result_message(
|
||||
$incident_created_ok,
|
||||
__('Successfully created in Integria IMS'),
|
||||
__('Could not be created in Integria IMS')
|
||||
);
|
||||
} else if ($update_incident === true) {
|
||||
// Call Integria IMS API method to update an incident.
|
||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'update_incident', [$incident_id_edit, $incident_title, $incident_content, '', $incident_group_id, $incident_criticity_id, 0, $incident_status, $incident_owner, 0, $incident_type]);
|
||||
|
||||
// Necessary to explicitly set true if not false because function returns api call result in case of success instead of true value.
|
||||
$incident_updated_ok = ($result_api_call != false) ? true : false;
|
||||
|
||||
ui_print_result_message(
|
||||
$incident_updated_ok,
|
||||
__('Successfully updated in Integria IMS'),
|
||||
__('Could not be updated in Integria IMS')
|
||||
);
|
||||
}
|
||||
|
||||
// If incident id is specified, retrieve incident values from api to populate combos with such values.
|
||||
if ($update) {
|
||||
// Call Integria IMS API method to get details of an incident given its id.
|
||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_details', [$incident_id_edit]);
|
||||
|
||||
// API call does not return indexes, therefore future modifications of API function in Integria IMS may lead to inconsistencies when accessing resulting array in this file.
|
||||
$incident_details_separator = explode(',', $result_api_call);
|
||||
|
||||
$incident_details = array_map(
|
||||
function ($item) {
|
||||
return str_replace(':::', ',', $item);
|
||||
},
|
||||
$incident_details_separator
|
||||
);
|
||||
}
|
||||
|
||||
// Main table.
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->id = 'add_alert_table';
|
||||
$table->class = 'databox filters integria_incidents_options';
|
||||
$table->head = [];
|
||||
|
||||
$table->data = [];
|
||||
$table->size = [];
|
||||
$table->size = [];
|
||||
$table->style[0] = 'width: 33%; padding-right: 50px; padding-left: 100px;';
|
||||
$table->style[1] = 'width: 33%; padding-right: 50px; padding-left: 50px;';
|
||||
$table->style[2] = 'width: 33%; padding-right: 100px; padding-left: 50px;';
|
||||
$table->colspan[0][0] = 2;
|
||||
$table->colspan[3][0] = 3;
|
||||
|
||||
$help_macros = isset($_GET['from_event']) ? ui_print_help_icon('response_macros', true) : '';
|
||||
|
||||
if (isset($_GET['from_event'])) {
|
||||
if ($update) {
|
||||
$input_value_title = $incident_details[3];
|
||||
$input_value_type = $incident_details[17];
|
||||
$input_value_status = $incident_details[6];
|
||||
$input_value_group = $incident_details[8];
|
||||
$input_value_criticity = $incident_details[7];
|
||||
$input_value_owner = $incident_details[5];
|
||||
$input_value_content = $incident_details[4];
|
||||
} else if (isset($_GET['from_event'])) {
|
||||
$input_value_title = $config['cr_incident_title'];
|
||||
$input_value_type = $config['cr_incident_type'];
|
||||
$input_value_status = $config['cr_incident_status'];
|
||||
$input_value_group = $config['cr_default_group'];
|
||||
$input_value_criticity = $config['cr_default_criticity'];
|
||||
$input_value_owner = $config['cr_default_owner'];
|
||||
$input_value_content = $config['cr_incident_content'];
|
||||
} else {
|
||||
$input_value_title = '';
|
||||
$input_value_type = '';
|
||||
$input_value_status = '';
|
||||
$input_value_group = '';
|
||||
$input_value_criticity = '';
|
||||
$input_value_owner = '';
|
||||
$input_value_content = '';
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[0][0] = '<div class="label_select"><p class="input_label">'.__('Title').': '.$help_macros.'</p>';
|
||||
$table->data[0][0] .= '<div class="label_select_parent">'.html_print_input_text(
|
||||
'incident_title',
|
||||
$input_value_title,
|
||||
__('Name'),
|
||||
50,
|
||||
100,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
'w100p'
|
||||
).'</div>';
|
||||
|
||||
$table->data[0][2] = html_print_image('images/integria_logo_gray.png', true, ['style' => 'width: 70%; float: right;'], false);
|
||||
|
||||
$table->data[1][0] = '<div class="label_select"><p class="input_label">'.__('Type').': </p>';
|
||||
$table->data[1][0] .= '<div class="label_select_parent">'.html_print_select(
|
||||
$integria_types_values,
|
||||
'type',
|
||||
$input_value_type,
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 100%;'
|
||||
).'</div>';
|
||||
|
||||
$table->data[2][0] = '<div class="label_select"><p class="input_label">'.__('Status').': </p>';
|
||||
$table->data[2][0] .= '<div class="label_select_parent">'.html_print_select(
|
||||
$integria_status_values,
|
||||
'status',
|
||||
$input_value_status,
|
||||
'',
|
||||
__('Select'),
|
||||
1,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 100%;'
|
||||
).'</div>';
|
||||
|
||||
$table->data[1][1] = '<div class="label_select"><p class="input_label">'.__('Group').': </p>';
|
||||
$table->data[1][1] .= '<div class="label_select_parent">'.html_print_select(
|
||||
$integria_group_values,
|
||||
'group',
|
||||
$input_value_group,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 100%;'
|
||||
).'</div>';
|
||||
|
||||
$table->data[2][1] = '<div class="label_select"><p class="input_label">'.__('Creator').': </p>';
|
||||
$table->data[2][1] .= '<div class="label_select_parent">'.html_print_input_text(
|
||||
'creator',
|
||||
$config['integria_user'],
|
||||
'',
|
||||
'30',
|
||||
100,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
'w100p'
|
||||
).ui_print_help_tip(__('This field corresponds to the Integria IMS user specified in Integria IMS setup'), true).'</div>';
|
||||
|
||||
$table->data[1][2] = '<div class="label_select"><p class="input_label">'.__('Priority').': </p>';
|
||||
$table->data[1][2] .= '<div class="label_select_parent">'.html_print_select(
|
||||
$integria_criticity_values,
|
||||
'criticity',
|
||||
$input_value_criticity,
|
||||
'',
|
||||
__('Select'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 100%;'
|
||||
).'</div>';
|
||||
|
||||
$table->data[2][2] = '<div class="label_select"><p class="input_label">'.__('Owner').': </p>';
|
||||
|
||||
$table->data[2][2] .= '<div class="label_select_parent">'.html_print_autocomplete_users_from_integria(
|
||||
'owner',
|
||||
$input_value_owner,
|
||||
true
|
||||
).'</div>';
|
||||
|
||||
$table->data[3][0] = '<div class="label_select"><p class="input_label">'.__('Description').': '.$help_macros.'</p>';
|
||||
$table->data[3][0] .= '<div class="label_select_parent">'.html_print_textarea(
|
||||
'incident_content',
|
||||
3,
|
||||
20,
|
||||
$input_value_content,
|
||||
'',
|
||||
true
|
||||
).'</div>';
|
||||
|
||||
// Print forms and stuff.
|
||||
echo '<form id="create_integria_incident_form" name="create_integria_incident_form" method="POST">';
|
||||
html_print_table($table);
|
||||
|
||||
if (!$update) {
|
||||
html_print_input_hidden('create_incident', 1);
|
||||
} else {
|
||||
html_print_input_hidden('update_incident', 1);
|
||||
}
|
||||
|
||||
echo '</form>';
|
||||
|
||||
echo '<div style="width: 100%; text-align:right;">';
|
||||
if ($update) {
|
||||
html_print_submit_button(__('Update'), 'accion', false, 'form="create_integria_incident_form" class="sub wand"');
|
||||
} else {
|
||||
html_print_submit_button(__('Create'), 'accion', false, 'form="create_integria_incident_form" class="sub wand"');
|
||||
}
|
||||
|
||||
echo '</div>';
|
|
@ -0,0 +1,488 @@
|
|||
<?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.
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
require_once 'include/functions_integriaims.php';
|
||||
|
||||
check_login();
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'IR')) {
|
||||
// Doesn't have access to this page.
|
||||
db_pandora_audit('ACL Violation', 'Trying to access IntegriaIMS ticket creation');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check if Integria integration enabled.
|
||||
if ($config['integria_enabled'] == 0) {
|
||||
ui_print_error_message(__('Integria integration must be enabled in Pandora setup'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check connection to Integria IMS API.
|
||||
$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []);
|
||||
|
||||
if ($has_connection === false) {
|
||||
ui_print_error_message(__('Integria IMS API is not reachable'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Styles.
|
||||
ui_require_css_file('integriaims');
|
||||
|
||||
// Get id incident.
|
||||
$incident_id = (int) get_parameter('incident_id');
|
||||
// API call.
|
||||
$result_api_call_list = integria_api_call(
|
||||
$config['integria_hostname'],
|
||||
$config['integria_user'],
|
||||
$config['integria_pass'],
|
||||
$config['integria_api_pass'],
|
||||
'get_incident_details',
|
||||
[$incident_id]
|
||||
);
|
||||
|
||||
// Return array of api call 'get_incidents'.
|
||||
$array_get_incidents = [];
|
||||
get_array_from_csv_data_all($result_api_call_list, $array_get_incidents);
|
||||
// Remove index (id)
|
||||
$array_get_incidents = $array_get_incidents[$incident_id];
|
||||
|
||||
|
||||
// Header tabs.
|
||||
$onheader = integriaims_tabs(false, $incident_id);
|
||||
ui_print_page_header($array_get_incidents[3].' - '.__('Details'), '', false, '', false, $onheader);
|
||||
|
||||
|
||||
// Data.
|
||||
$status = $array_get_incidents[6];
|
||||
$resolution = $array_get_incidents[12];
|
||||
$group = $array_get_incidents[8];
|
||||
$priority = $array_get_incidents[7];
|
||||
$type = $array_get_incidents[17];
|
||||
$description = $array_get_incidents[4];
|
||||
$creator = $array_get_incidents[10];
|
||||
$owner = $array_get_incidents[5];
|
||||
$closed_by = $array_get_incidents[23];
|
||||
$created_at = $array_get_incidents[1];
|
||||
$updated_at = $array_get_incidents[9];
|
||||
$closed_at = $array_get_incidents[2];
|
||||
|
||||
if ($closed_at == '0000-00-00 00:00:00') {
|
||||
$closed_at = __('Not yet');
|
||||
}
|
||||
|
||||
if ($closed_by == '') {
|
||||
$closed_by = __('Not closed yet');
|
||||
}
|
||||
|
||||
|
||||
// API calls.
|
||||
$status_text = integriaims_get_details('status', $status);
|
||||
$group_text = integriaims_get_details('group', $group);
|
||||
$priority_text = integriaims_get_details('priority', $priority);
|
||||
$resolution_text = integriaims_get_details('resolution', $resolution);
|
||||
$type_text = integriaims_get_details('type', $type);
|
||||
|
||||
// Incident file management.
|
||||
$upload_file = get_parameter('upload_file');
|
||||
$delete_file_id = get_parameter('delete_file');
|
||||
$download_file_id = get_parameter('download_file');
|
||||
$download_file_name = get_parameter('download_file_name');
|
||||
|
||||
// Files section table.
|
||||
$table_files_section = new stdClass();
|
||||
$table_files_section->width = '100%';
|
||||
$table_files_section->id = 'files_section_table';
|
||||
$table_files_section->class = 'databox filters';
|
||||
$table_files_section->head = [];
|
||||
|
||||
$table_files_section->data = [];
|
||||
$table_files_section->size = [];
|
||||
$table_files_section->colspan[2][0] = 3;
|
||||
|
||||
// Files list table.
|
||||
$table_files = new stdClass();
|
||||
$table_files->width = '100%';
|
||||
$table_files->class = 'info_table';
|
||||
$table_files->head = [];
|
||||
|
||||
$table_files->head[0] = __('Filename');
|
||||
$table_files->head[1] = __('Timestamp');
|
||||
$table_files->head[2] = __('Description');
|
||||
$table_files->head[3] = __('User');
|
||||
$table_files->head[4] = __('Size');
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||
$table_files->head[5] = __('Delete');
|
||||
}
|
||||
|
||||
$table_files->data = [];
|
||||
|
||||
// Upload file.
|
||||
if ($upload_file && ($_FILES['userfile']['name'] != '')) {
|
||||
$filedescription = get_parameter('file_description', __('No description available'));
|
||||
|
||||
$filename = io_safe_input($_FILES['userfile']['name']);
|
||||
$filesize = io_safe_input($_FILES['userfile']['size']);
|
||||
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$invalid_extensions = '/^(bat|exe|cmd|sh|php|php1|php2|php3|php4|php5|pl|cgi|386|dll|com|torrent|js|app|jar|iso|
|
||||
pif|vb|vbscript|wsf|asp|cer|csr|jsp|drv|sys|ade|adp|bas|chm|cpl|crt|csh|fxp|hlp|hta|inf|ins|isp|jse|htaccess|
|
||||
htpasswd|ksh|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|ops|pcd|prg|reg|scr|sct|shb|shs|url|vbe|vbs|wsc|wsf|wsh)$/i';
|
||||
|
||||
if (!preg_match($invalid_extensions, $extension)) {
|
||||
// The following is if you have clamavlib installed.
|
||||
// (php5-clamavlib) and enabled in php.ini
|
||||
// http://www.howtoforge.com/scan_viruses_with_php_clamavlib
|
||||
if (extension_loaded('clamav')) {
|
||||
cl_setlimits(5, 1000, 200, 0, 10485760);
|
||||
$malware = cl_scanfile($_FILES['file']['tmp_name']);
|
||||
if ($malware) {
|
||||
$error = 'Malware detected: '.$malware.'<br>ClamAV version: '.clam_get_version();
|
||||
die($error);
|
||||
// On malware, we die because it's not good to handle it
|
||||
}
|
||||
}
|
||||
|
||||
$filecontent = base64_encode(file_get_contents($_FILES['userfile']['tmp_name']));
|
||||
|
||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'attach_file', [$incident_id, $filename, $filesize, $filedescription, $filecontent]);
|
||||
|
||||
// API method returns '0' string if success.
|
||||
$file_added = ($result_api_call === '0') ? true : false;
|
||||
|
||||
ui_print_result_message(
|
||||
$file_added,
|
||||
__('File successfully added'),
|
||||
__('File could not be added')
|
||||
);
|
||||
} else {
|
||||
ui_print_error_message(__('File has an invalid extension'));
|
||||
}
|
||||
}
|
||||
|
||||
// Delete file.
|
||||
if (isset($_GET['delete_file'])) {
|
||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'delete_file', [$delete_file_id]);
|
||||
|
||||
$file_deleted = false;
|
||||
|
||||
if ($result_api_call === '0') {
|
||||
$file_deleted = true;
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$file_deleted,
|
||||
__('File successfully deleted'),
|
||||
__('File could not be deleted')
|
||||
);
|
||||
}
|
||||
|
||||
// Download file.
|
||||
if (isset($_GET['download_file'])) {
|
||||
$file_base64 = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'download_file', [$download_file_id]);
|
||||
ob_end_clean();
|
||||
|
||||
$decoded = base64_decode($file_base64);
|
||||
|
||||
file_put_contents($download_file_name, $decoded);
|
||||
ob_end_clean();
|
||||
|
||||
if (file_exists($download_file_name)) {
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="'.basename($download_file_name).'"');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: '.filesize($download_file_name));
|
||||
ob_end_clean();
|
||||
readfile($download_file_name);
|
||||
unlink($download_file_name);
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Location: index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$incident_id);
|
||||
}
|
||||
|
||||
// Retrieve files belonging to incident and create list table.
|
||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_files', [$incident_id]);
|
||||
|
||||
if ($result_api_call != false && strlen($result_api_call) > 0) {
|
||||
$files = [];
|
||||
$csv_array = explode("\n", $result_api_call);
|
||||
|
||||
foreach ($csv_array as $csv_line) {
|
||||
if (!empty($csv_line)) {
|
||||
$files[] = explode(',', $csv_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ($files as $key => $value) {
|
||||
$table_files->data[$i][0] = '<a id="link_delete_file" href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$incident_id.'&download_file='.$value[0]).'&download_file_name='.$value[11].'">'.$value[11].'</a>';
|
||||
$table_files->data[$i][1] = $value[14];
|
||||
$table_files->data[$i][2] = $value[12];
|
||||
$table_files->data[$i][3] = $value[8];
|
||||
$table_files->data[$i][4] = $value[13];
|
||||
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||
$table_files->data[$i][5] .= '<a id="link_delete_file" href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$incident_id.'&delete_file='.$value[0]).'"
|
||||
onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||
$table_files->data[$i][5] .= html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||
}
|
||||
|
||||
$table_files->data[$i][5] .= '</a>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$table_files_section->data[0][0] = '<div class="label_select"><p class="input_label">'.__('File name').':</p>';
|
||||
$table_files_section->data[0][0] .= html_print_input_file('userfile', true);
|
||||
$table_files_section->data[1][0] = '<div class="label_select"><p class="input_label">'.__('Description').':</p>';
|
||||
$table_files_section->data[1][0] .= html_print_textarea(
|
||||
'file_description',
|
||||
3,
|
||||
20,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$table_files_section->data[2][0] .= '<div style="width: 100%; text-align:right;">'.html_print_submit_button(__('Upload'), 'accion', false, 'class="sub wand"', true).'</div>';
|
||||
|
||||
$upload_file_form = '<div>';
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||
$upload_file_form .= '<form method="post" id="file_control" enctype="multipart/form-data">'.'<h4>'.__('Add attachment').'</h4>'.html_print_table($table_files_section, true).html_print_input_hidden('upload_file', 1, true);
|
||||
}
|
||||
|
||||
$upload_file_form .= '<h4>'.__('Attached files').'</h4>'.html_print_table($table_files, true).'</form></div>';
|
||||
|
||||
// Incident comments management.
|
||||
$upload_comment = get_parameter('upload_comment');
|
||||
$comment_description = get_parameter('comment_description');
|
||||
|
||||
// Comments section table.
|
||||
$table_comments_section = new stdClass();
|
||||
$table_comments_section->width = '100%';
|
||||
$table_comments_section->id = 'files_section_table';
|
||||
$table_comments_section->class = 'databox filters';
|
||||
$table_comments_section->head = [];
|
||||
|
||||
$table_comments_section->data = [];
|
||||
$table_comments_section->size = [];
|
||||
|
||||
// Comments list table.
|
||||
$table_comments = new stdClass();
|
||||
$table_comments->width = '100%';
|
||||
$table_comments->class = 'info_table';
|
||||
$table_comments->head = [];
|
||||
|
||||
$table_comments->head[0] = __('Filename');
|
||||
$table_comments->head[1] = __('Timestamp');
|
||||
$table_comments->head[2] = __('Description');
|
||||
$table_comments->head[3] = __('User');
|
||||
$table_comments->head[4] = __('Size');
|
||||
$table_comments->head[5] = __('Delete');
|
||||
|
||||
$table_comments->data = [];
|
||||
|
||||
$comment_disabled = ($array_get_incidents[6] == 7);
|
||||
|
||||
if ($comment_disabled === true) {
|
||||
$attribute = 'disabled=disabled';
|
||||
}
|
||||
|
||||
$table_comments_section->data[0][0] = '<div class="label_select"><p class="input_label">'.__('Description').':</p>';
|
||||
$table_comments_section->data[0][0] .= html_print_textarea(
|
||||
'comment_description',
|
||||
3,
|
||||
20,
|
||||
'',
|
||||
$attribute,
|
||||
true
|
||||
);
|
||||
|
||||
$table_comments_section->data[1][1] .= '<div style="width: 100%; text-align:right;">'.html_print_submit_button(__('Add'), 'accion', $comment_disabled, 'class="sub wand"', true).'</div>';
|
||||
|
||||
// Upload comment. If ticket is closed, this action cannot be performed.
|
||||
if ($upload_comment && $array_get_incidents[6] != 7) {
|
||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'create_workunit', [$incident_id, $comment_description, '0.00', 0, 1, '0']);
|
||||
|
||||
// API method returns id of new comment if success.
|
||||
$comment_added = ($result_api_call >= '0') ? true : false;
|
||||
|
||||
ui_print_result_message(
|
||||
$comment_added,
|
||||
__('Comment successfully added'),
|
||||
__('Comment could not be added')
|
||||
);
|
||||
}
|
||||
|
||||
// Retrieve comments belonging to incident and create comments table.
|
||||
$result_api_call = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_incident_workunits', [$incident_id]);
|
||||
|
||||
if ($result_api_call != false && strlen($result_api_call) > 0) {
|
||||
$comments = [];
|
||||
$csv_array = explode("\n", $result_api_call);
|
||||
|
||||
foreach ($csv_array as $csv_line) {
|
||||
if (!empty($csv_line)) {
|
||||
$comments[] = explode(',', $csv_line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$comment_table = '';
|
||||
|
||||
if (!empty($comments)) {
|
||||
foreach ($comments as $key => $value) {
|
||||
$comment_table .= '<div class="comment_title">'.$value[3].'<span> said </span>'.$value[1].'<span style="float: right;">'.$value[2].' Hours</span></div>';
|
||||
$comment_table .= '<div class="comment_body">'.$value[4].'</div>';
|
||||
}
|
||||
} else {
|
||||
$comment_table = __('No comments found');
|
||||
}
|
||||
|
||||
$upload_comment_form = '<div>';
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||
$upload_comment_form .= '<form method="post" id="comment_form" enctype="multipart/form-data"><h4>'.__('Add comment').'</h4>'.html_print_table($table_comments_section, true).html_print_input_hidden('upload_comment', 1, true).'</form>';
|
||||
}
|
||||
|
||||
$upload_comment_form .= '<h4>'.__('Comments').'</h4>'.$comment_table.'</div>';
|
||||
|
||||
// Details box.
|
||||
$details_box = '<div class="integriaims_details_box integriaims_details_box_five">';
|
||||
$details_box .= '
|
||||
<div class="integriaims_details_titles">'.__('Status').'</div>
|
||||
<div class="integriaims_details_titles">'.__('Resolution').'</div>
|
||||
<div class="integriaims_details_titles">'.__('Group').'</div>
|
||||
<div class="integriaims_details_titles">'.__('Priority').'</div>
|
||||
<div class="integriaims_details_titles">'.__('Type').'</div>';
|
||||
$details_box .= '
|
||||
<div>'.html_print_image('images/heart.png', true).'</div>
|
||||
<div>'.html_print_image('images/builder.png', true).'</div>
|
||||
<div>'.html_print_image('images/user_green.png', true).'</div>
|
||||
<div>'.ui_print_integria_incident_priority($priority, $priority_text).'</div>
|
||||
<div>'.html_print_image('images/incidents.png', true).'</div>';
|
||||
$details_box .= '
|
||||
<div>'.$status_text.'</div>
|
||||
<div>'.$resolution_text.'</div>
|
||||
<div>'.$group_text.'</div>
|
||||
<div>'.$priority_text.'</div>
|
||||
<div>'.$type_text.'</div>';
|
||||
$details_box .= '</div>';
|
||||
|
||||
|
||||
// People box.
|
||||
$people_box = '<div class="integriaims_details_box integriaims_details_box_three">';
|
||||
$people_box .= '
|
||||
<div>'.html_print_image('images/header_user_green.png', true, ['width' => '21']).'</div>
|
||||
<div>'.html_print_image('images/header_user_green.png', true, ['width' => '21']).'</div>
|
||||
<div>'.html_print_image('images/header_user_green.png', true, ['width' => '21']).'</div>';
|
||||
$people_box .= '
|
||||
<div class="integriaims_details_titles">'.__('Created by').':</div>
|
||||
<div class="integriaims_details_titles">'.__('Owned by').':</div>
|
||||
<div class="integriaims_details_titles">'.__('Closed by').':</div>';
|
||||
$people_box .= '
|
||||
<div>'.$creator.'</div>
|
||||
<div>'.$owner.'</div>
|
||||
<div>'.$closed_by.'</div>';
|
||||
$people_box .= '</div>';
|
||||
|
||||
|
||||
// Dates box.
|
||||
$dates_box = '<div class="integriaims_details_box integriaims_details_box_three">';
|
||||
$dates_box .= '
|
||||
<div>'.html_print_image('images/tick.png', true).'</div>
|
||||
<div>'.html_print_image('images/update.png', true, ['width' => '21']).'</div>
|
||||
<div>'.html_print_image('images/mul.png', true).'</div>';
|
||||
$dates_box .= '
|
||||
<div class="integriaims_details_titles">'.__('Created at').':</div>
|
||||
<div class="integriaims_details_titles">'.__('Updated at').':</div>
|
||||
<div class="integriaims_details_titles">'.__('Closed at').':</div>';
|
||||
$dates_box .= '
|
||||
<div>'.$created_at.'</div>
|
||||
<div>'.$updated_at.'</div>
|
||||
<div>'.$closed_at.'</div>';
|
||||
$dates_box .= '</div>';
|
||||
|
||||
|
||||
// Show details, people and dates.
|
||||
echo '<div class="integria_details">';
|
||||
ui_toggle($details_box, __('Details'), '', 'details_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-shadow white_table_graph');
|
||||
ui_toggle($people_box, __('People'), '', 'people_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-shadow white_table_graph');
|
||||
ui_toggle($dates_box, __('Dates'), '', 'dates_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-shadow white_table_graph');
|
||||
echo '</div>';
|
||||
|
||||
// Show description.
|
||||
$description_box = '<div class="integria_details_description">'.html_print_textarea(
|
||||
'integria_details_description',
|
||||
3,
|
||||
0,
|
||||
$description,
|
||||
'disabled="disabled"',
|
||||
true
|
||||
).'</div>';
|
||||
ui_toggle($description_box, __('Description'), '', '', false);
|
||||
|
||||
echo '<div class="ui_toggle">';
|
||||
ui_toggle(
|
||||
$upload_file_form,
|
||||
__('Attached files'),
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'white_box white_box_opened',
|
||||
'no-border flex'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="ui_toggle">';
|
||||
ui_toggle(
|
||||
$upload_comment_form,
|
||||
__('Comments'),
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
'white_box white_box_opened',
|
||||
'no-border flex'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
|
||||
$('#details_box .white_table_graph_header').click(function(){
|
||||
$('div#details_box').toggleClass('integria_details_shadow');
|
||||
});
|
||||
|
||||
$('#people_box .white_table_graph_header').click(function(){
|
||||
$('div#people_box').toggleClass('integria_details_shadow');
|
||||
});
|
||||
|
||||
$('#dates_box .white_table_graph_header').click(function(){
|
||||
$('div#dates_box').toggleClass('integria_details_shadow');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,129 @@
|
|||
<?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 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.
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
require_once '../../include/config.php';
|
||||
require_once '../../include/functions.php';
|
||||
require_once '../../include/functions_integriaims.php';
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'IR') && ! check_acl($config['id_user'], 0, 'IW') && ! check_acl($config['id_user'], 0, 'IM')) {
|
||||
// Doesn't have access to this page.
|
||||
db_pandora_audit('ACL Violation', 'Trying to access IntegriaIMS ticket creation');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// API calls.
|
||||
$status_incident = integriaims_get_details('status');
|
||||
$group_incident = integriaims_get_details('group');
|
||||
$priority_incident = integriaims_get_details('priority');
|
||||
$resolution_incident = integriaims_get_details('resolution');
|
||||
|
||||
|
||||
// Get data to export.
|
||||
$tickets_filters = json_decode(
|
||||
base64_decode(
|
||||
get_parameter('tickets_filters', '')
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
$tickets_csv_array = get_tickets_integriaims($tickets_filters);
|
||||
|
||||
|
||||
// Build a new array to show only the fields in the table.
|
||||
$tickets_csv_array_filter = [];
|
||||
foreach ($tickets_csv_array as $key => $value) {
|
||||
// Status.
|
||||
if ($tickets_csv_array[$key][6] == 0) {
|
||||
$tickets_csv_array[$key][6] = 'None';
|
||||
} else {
|
||||
$tickets_csv_array[$key][6] = $status_incident[$tickets_csv_array[$key][6]];
|
||||
}
|
||||
|
||||
// Priority.
|
||||
$tickets_csv_array[$key][7] = $priority_incident[$tickets_csv_array[$key][7]];
|
||||
|
||||
// Group.
|
||||
$tickets_csv_array[$key][8] = $group_incident[$tickets_csv_array[$key][8]];
|
||||
|
||||
// Resolution.
|
||||
if ($tickets_csv_array[$key][12] == 0) {
|
||||
$tickets_csv_array[$key][12] = 'None';
|
||||
} else {
|
||||
$tickets_csv_array[$key][12] = $resolution_incident[$tickets_csv_array[$key][12]];
|
||||
}
|
||||
|
||||
$tickets_csv_array_filter[$key] = [
|
||||
'id_incidencia' => $tickets_csv_array[$key][0],
|
||||
'titulo' => $tickets_csv_array[$key][3],
|
||||
'id_grupo' => $tickets_csv_array[$key][8],
|
||||
'estado' => $tickets_csv_array[$key][6],
|
||||
'resolution' => $tickets_csv_array[$key][12],
|
||||
'prioridad' => $tickets_csv_array[$key][7],
|
||||
'actualizacion' => $tickets_csv_array[$key][9],
|
||||
'inicio' => $tickets_csv_array[$key][1],
|
||||
'id_creator' => $tickets_csv_array[$key][10],
|
||||
'owner' => $tickets_csv_array[$key][5],
|
||||
];
|
||||
}
|
||||
|
||||
// Header for CSV file.
|
||||
$header = [
|
||||
__('ID Ticket'),
|
||||
__('Title'),
|
||||
__('Group/Company'),
|
||||
__('Status'),
|
||||
__('Resolution'),
|
||||
__('Priority'),
|
||||
__('Updated'),
|
||||
__('Started'),
|
||||
__('Creator'),
|
||||
__('Owner'),
|
||||
];
|
||||
|
||||
$header_csv = '';
|
||||
foreach ($header as $key => $value) {
|
||||
$header_csv .= $value.',';
|
||||
}
|
||||
|
||||
$header_csv = io_safe_output($header_csv).PHP_EOL;
|
||||
|
||||
|
||||
// Join header and content.
|
||||
$tickets_csv = '';
|
||||
foreach ($tickets_csv_array_filter as $key => $value) {
|
||||
$tickets_csv .= implode(',', $tickets_csv_array_filter[$key]).PHP_EOL;
|
||||
}
|
||||
|
||||
$tickets_csv = $header_csv.$tickets_csv;
|
||||
|
||||
|
||||
// Create csv file.
|
||||
$filename = 'tickets_export-'.date('Ymd').'-'.date('His').'.csv';
|
||||
|
||||
ob_clean();
|
||||
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename='.$filename);
|
||||
|
||||
// BOM.
|
||||
echo pack('C*', 0xEF, 0xBB, 0xBF);
|
||||
|
||||
// CSV file.
|
||||
echo io_safe_output($tickets_csv);
|
|
@ -0,0 +1,335 @@
|
|||
<?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.
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
require_once 'include/functions_integriaims.php';
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'IR')) {
|
||||
// Doesn't have access to this page.
|
||||
db_pandora_audit('ACL Violation', 'Trying to access IntegriaIMS ticket creation');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Header tabs.
|
||||
$onheader = integriaims_tabs('list_tab');
|
||||
ui_print_page_header(__('Integria IMS Tickets'), '', false, '', false, $onheader);
|
||||
|
||||
// Check if Integria integration enabled.
|
||||
if ($config['integria_enabled'] == 0) {
|
||||
ui_print_error_message(__('Integria integration must be enabled in Pandora setup'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check connection to Integria IMS API.
|
||||
$has_connection = integria_api_call($config['integria_hostname'], $config['integria_user'], $config['integria_pass'], $config['integria_api_pass'], 'get_login', []);
|
||||
|
||||
if ($has_connection === false) {
|
||||
ui_print_error_message(__('Integria IMS API is not reachable'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Styles.
|
||||
ui_require_css_file('integriaims');
|
||||
|
||||
// Get parameters for filters.
|
||||
$incident_text = (string) get_parameter('incident_text', '');
|
||||
$incident_status = (int) get_parameter('incident_status', 0);
|
||||
$incident_group = (int) get_parameter('incident_group', 1);
|
||||
$incident_owner = (string) get_parameter('incident_owner', '');
|
||||
$incident_creator = (string) get_parameter('incident_creator', '');
|
||||
$incident_priority = (int) get_parameter('incident_priority', -1);
|
||||
$incident_resolution = (string) get_parameter('incident_resolution', '');
|
||||
$created_from = (string) get_parameter('created_from', '');
|
||||
$created_to = (string) get_parameter('created_to', '');
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
|
||||
$delete_incident = get_parameter('delete_incident');
|
||||
if ($delete_incident) {
|
||||
// Call Integria IMS API method to delete an incident.
|
||||
$result_api_call_delete = integria_api_call(
|
||||
$config['integria_hostname'],
|
||||
$config['integria_user'],
|
||||
$config['integria_pass'],
|
||||
$config['integria_api_pass'],
|
||||
'delete_incident',
|
||||
[$delete_incident]
|
||||
);
|
||||
|
||||
$incident_deleted_ok = ($result_api_call_delete !== false) ? true : false;
|
||||
|
||||
ui_print_result_message(
|
||||
$incident_deleted_ok,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted')
|
||||
);
|
||||
}
|
||||
|
||||
// Full url with all filters.
|
||||
$url = ui_get_full_url(
|
||||
'index.php?sec=incident&sec2=operation/incidents/list_integriaims_incidents&incident_text='.$incident_text.'&incident_status='.$incident_status.'&incident_group='.$incident_group.'&incident_owner='.$incident_owner.'&incident_creator='.$incident_creator.'&incident_priority='.$incident_priority.'&incident_resolution='.$incident_resolution.'&created_from='.$created_from.'&created_to='.$created_to.'&offset='.$offset
|
||||
);
|
||||
|
||||
|
||||
// ---- FILTERS ----
|
||||
// API calls to fill the filters.
|
||||
$status_incident = integriaims_get_details('status');
|
||||
$group_incident = integriaims_get_details('group');
|
||||
$priority_incident = integriaims_get_details('priority');
|
||||
$resolution_incident = integriaims_get_details('resolution');
|
||||
|
||||
|
||||
// TABLE FILTERS.
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->styleTable = 'margin-bottom:0px';
|
||||
$table->cellpadding = '0';
|
||||
$table->cellspacing = '0';
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = __('Text filter');
|
||||
$table->data[0][1] = html_print_input_text('incident_text', $incident_text, '', 30, 100, true);
|
||||
|
||||
$table->data[0][2] = __('Status');
|
||||
$table->data[0][3] = html_print_select(
|
||||
$status_incident,
|
||||
'incident_status',
|
||||
$incident_status,
|
||||
'',
|
||||
__('All'),
|
||||
0,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[0][4] = __('Group');
|
||||
$table->data[0][5] = html_print_select(
|
||||
$group_incident,
|
||||
'incident_group',
|
||||
$incident_group,
|
||||
'',
|
||||
__('All'),
|
||||
1,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][0] = __('Owner');
|
||||
$table->data[1][1] = html_print_autocomplete_users_from_integria('incident_owner', $incident_owner, true);
|
||||
|
||||
$table->data[1][2] = __('Creator');
|
||||
$table->data[1][3] = html_print_autocomplete_users_from_integria('incident_creator', $incident_creator, true);
|
||||
|
||||
$table->data[1][4] = __('Priority');
|
||||
$table->data[1][5] = html_print_select(
|
||||
$priority_incident,
|
||||
'incident_priority',
|
||||
$incident_priority,
|
||||
'',
|
||||
__('All'),
|
||||
-1,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[2][0] = __('Resolution');
|
||||
$table->data[2][1] = html_print_select(
|
||||
$resolution_incident,
|
||||
'incident_resolution',
|
||||
$incident_resolution,
|
||||
'',
|
||||
__('All'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
// TODO: field type date.
|
||||
$table->data[2][2] = __('Date');
|
||||
$table->data[2][3] = html_print_input_text_extended(
|
||||
'created_from',
|
||||
$created_from,
|
||||
'created_from',
|
||||
'',
|
||||
12,
|
||||
50,
|
||||
false,
|
||||
'',
|
||||
'placeholder="'.__('Created from').'"',
|
||||
true
|
||||
);
|
||||
$table->data[2][3] .= html_print_input_text_extended(
|
||||
'created_to',
|
||||
$created_to,
|
||||
'created_to',
|
||||
'',
|
||||
12,
|
||||
50,
|
||||
false,
|
||||
'',
|
||||
'style="margin-left:5px;" placeholder="'.__('Created to').'"',
|
||||
true
|
||||
);
|
||||
|
||||
// TODO: image of Integria IMS.
|
||||
$table->data[2][4] = '';
|
||||
$table->data[2][5] = '';
|
||||
|
||||
|
||||
// Send filters to get_tickets_integriaims().
|
||||
$tickets_filters = [
|
||||
'incident_text' => $incident_text,
|
||||
'incident_status' => $incident_status,
|
||||
'incident_group' => $incident_group,
|
||||
'incident_owner' => $incident_owner,
|
||||
'incident_creator' => $incident_creator,
|
||||
'incident_priority' => $incident_priority,
|
||||
'incident_resolution' => $incident_resolution,
|
||||
'created_from' => $created_from,
|
||||
'created_to' => $created_to,
|
||||
];
|
||||
|
||||
// Data to export to csv file.
|
||||
$decode_csv = base64_encode(json_encode($tickets_filters));
|
||||
|
||||
|
||||
// ---- PRINT TABLE FILTERS ----
|
||||
$integria_incidents_form = '<form method="post" action="'.$url.'" style="padding:0px;">';
|
||||
$integria_incidents_form .= html_print_table($table, true);
|
||||
$integria_incidents_form .= '<div style="width:100%; text-align:right;">';
|
||||
$integria_incidents_form .= '<div style="float:right; margin-left: 5px;">'.html_print_button(
|
||||
__('Export to CSV'),
|
||||
'csv_export',
|
||||
false,
|
||||
"location.href='operation/incidents/integriaims_export_csv.php?tickets_filters=$decode_csv'",
|
||||
'class="sub next"',
|
||||
true
|
||||
).'</div>';
|
||||
$integria_incidents_form .= '<div>'.html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub filter"', true).'</div>';
|
||||
$integria_incidents_form .= '</div>';
|
||||
$integria_incidents_form .= '</form>';
|
||||
|
||||
ui_toggle($integria_incidents_form, __('Filter'), '', '', false);
|
||||
|
||||
/*
|
||||
* Order api call 'get_incidents'.
|
||||
*
|
||||
* resolution = $array_get_incidents[$key][12]
|
||||
* id_incidencia = $array_get_incidents[$key][0]
|
||||
* titulo = $array_get_incidents[$key][3]
|
||||
* id_grupo = $array_get_incidents[$key][8]
|
||||
* estado = $array_get_incidents[$key][6]
|
||||
* prioridad = $array_get_incidents[$key][7]
|
||||
* actualizacion = $array_get_incidents[$key][9]
|
||||
* id_creator = $array_get_incidents[$key][10]
|
||||
*
|
||||
*/
|
||||
|
||||
// ---- LIST OF INCIDENTS ----
|
||||
// Get list of incidents.
|
||||
$array_get_incidents = get_tickets_integriaims($tickets_filters);
|
||||
|
||||
// Prepare pagination.
|
||||
$incidents_limit = $config['block_size'];
|
||||
$incidents_paginated = array_slice($array_get_incidents, $offset, $incidents_limit, true);
|
||||
|
||||
// TABLE INCIDENTS.
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->head = [];
|
||||
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Ticket');
|
||||
$table->head[2] = __('Group/Company');
|
||||
$table->head[3] = __('Status/Resolution');
|
||||
$table->head[4] = __('Prior');
|
||||
$table->head[5] = __('Updated/Started');
|
||||
$table->head[6] = __('Creator');
|
||||
$table->head[7] = __('Owner');
|
||||
if (check_acl($config['id_user'], 0, 'IW') || check_acl($config['id_user'], 0, 'IM')) {
|
||||
$table->head[8] = '';
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
$i = 0;
|
||||
|
||||
foreach ($incidents_paginated as $key => $value) {
|
||||
if ($array_get_incidents[$key][6] == 0) {
|
||||
$status_incident[$array_get_incidents[$key][6]] = __('None');
|
||||
}
|
||||
|
||||
if ($array_get_incidents[$key][12] == 0) {
|
||||
$resolution_incident[$array_get_incidents[$key][12]] = __('None');
|
||||
}
|
||||
|
||||
$table->data[$i][0] = '#'.$array_get_incidents[$key][0];
|
||||
$table->data[$i][1] = '<a href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/dashboard_detail_integriaims_incident&incident_id='.$array_get_incidents[$key][0]).'">';
|
||||
$table->data[$i][1] .= $array_get_incidents[$key][3];
|
||||
$table->data[$i][1] .= '</a>';
|
||||
$table->data[$i][2] = $group_incident[$array_get_incidents[$key][8]];
|
||||
$table->data[$i][3] = $status_incident[$array_get_incidents[$key][6]].' / '.$resolution_incident[$array_get_incidents[$key][12]];
|
||||
$table->data[$i][4] = ui_print_integria_incident_priority($array_get_incidents[$key][7], $priority_incident[$array_get_incidents[$key][7]]);
|
||||
$table->data[$i][5] = $array_get_incidents[$key][9].' / '.$array_get_incidents[$key][1];
|
||||
$table->data[$i][6] = $array_get_incidents[$key][10];
|
||||
$table->data[$i][7] = $array_get_incidents[$key][5];
|
||||
$table->data[$i][8] = '';
|
||||
$table->cellclass[$i][8] = 'action_buttons';
|
||||
if (check_acl($config['id_user'], 0, 'IW')) {
|
||||
$table->data[$i][8] .= '<a href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/configure_integriaims_incident&incident_id='.$array_get_incidents[$key][0]).'">';
|
||||
$table->data[$i][8] .= html_print_image('images/config.png', true, ['title' => __('Edit')]);
|
||||
$table->data[$i][8] .= '</a>';
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'IM')) {
|
||||
$table->data[$i][8] .= '<a id="link_delete_incident" href="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/list_integriaims_incidents&delete_incident='.$array_get_incidents[$key][0]).'"
|
||||
onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||
$table->data[$i][8] .= html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||
$table->data[$i][8] .= '</a>';
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show table incidents.
|
||||
ui_pagination(count($array_get_incidents), $url, $offset);
|
||||
if (empty($table->data) === true) {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No tickets to show').'.' ]);
|
||||
} else {
|
||||
html_print_table($table);
|
||||
ui_pagination(count($array_get_incidents), $url, $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
}
|
||||
|
||||
// Show button to create incident.
|
||||
if (check_acl($config['id_user'], 0, 'IR')) {
|
||||
echo '<form method="POST" action="'.ui_get_full_url('index.php?sec=incident&sec2=operation/incidents/configure_integriaims_incident').'">';
|
||||
echo '<div style="width: 100%; text-align:right;">';
|
||||
html_print_submit_button(__('Create'), 'create_new_incident', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
// Datapicker library for show calendar.
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
|
||||
?>
|
||||
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready( function() {
|
||||
$("#created_from, #created_to").datepicker({
|
||||
dateFormat: "<?php echo DATE_FORMAT_JS; ?>"
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -479,6 +479,7 @@ if (check_acl($config['id_user'], 0, 'IR')
|
|||
$sub2 = [];
|
||||
$sub2['operation/incidents/incident']['text'] = __('List of Incidents');
|
||||
$sub2[$sec2sub]['text'] = __('Statistics');
|
||||
$sub2['operation/incidents/list_integriaims_incidents']['text'] = __('Integria IMS Tickets');
|
||||
|
||||
$sub[$sec2]['sub2'] = $sub2;
|
||||
$sec2 = $temp_sec2;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.738
|
||||
%define release 190924
|
||||
%define version 7.0NG.739
|
||||
%define release 190927
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.738
|
||||
%define release 190924
|
||||
%define version 7.0NG.739
|
||||
%define release 190927
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Console
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.738
|
||||
%define release 190924
|
||||
%define version 7.0NG.739
|
||||
%define release 190927
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.738"
|
||||
PI_VERSION="7.0NG.739"
|
||||
FORCE=0
|
||||
DESTDIR=""
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
|
|
@ -109,14 +109,36 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 31),
|
||||
('MR', 32),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '738'),
|
||||
('current_package_enterprise', '739'),
|
||||
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
|
||||
('custom_docs_logo', 'default_docs.png'),
|
||||
('custom_support_logo', 'default_support.png'),
|
||||
('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png'),
|
||||
('integria_enabled', 0),
|
||||
('integria_user', ''),
|
||||
('integria_pass', ''),
|
||||
('integria_hostname', ''),
|
||||
('integria_api_pass', ''),
|
||||
('integria_req_timeout', 5),
|
||||
('default_group', ''),
|
||||
('default_criticity', ''),
|
||||
('default_creator', ''),
|
||||
('default_owner', ''),
|
||||
('incident_type', ''),
|
||||
('incident_status', ''),
|
||||
('incident_title', ''),
|
||||
('incident_content', ''),
|
||||
('cr_default_group', ''),
|
||||
('cr_default_criticity', ''),
|
||||
('cr_default_creator', ''),
|
||||
('cr_default_owner', ''),
|
||||
('cr_incident_type', ''),
|
||||
('cr_incident_status', ''),
|
||||
('cr_incident_title', ''),
|
||||
('cr_incident_content', '');
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.738-190924
|
||||
Version: 7.0NG.739-190927
|
||||
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-190924"
|
||||
pandora_version="7.0NG.739-190927"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#############################################################################
|
||||
# Pandora FMS Server Parameters
|
||||
# Pandora FMS, the Flexible Monitoring System.
|
||||
# Version 7.0NG.738
|
||||
# Version 7.0NG.739
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2017 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -44,8 +44,8 @@ our @EXPORT = qw(
|
|||
);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.738";
|
||||
my $pandora_build = "190924";
|
||||
my $pandora_version = "7.0NG.739";
|
||||
my $pandora_build = "190927";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -357,7 +357,15 @@ sub pandora_load_config {
|
|||
# Xprobe2 for recon OS fingerprinting and tcpscan (optional)
|
||||
$pa_config->{"xprobe2"} = "/usr/bin/xprobe2";
|
||||
|
||||
# Winexe allows to exec commands on remote windows systems (optional)
|
||||
$pa_config->{"winexe"} = "/usr/bin/winexe";
|
||||
|
||||
# PsExec allows to exec commands on remote windows systems from windows servers (optional)
|
||||
$pa_config->{"psexec"} = 'C:\PandoraFMS\Pandora_Server\bin\PsExec.exe';
|
||||
|
||||
# plink allows to exec commands on remote linux systems from windows servers (optional)
|
||||
$pa_config->{"plink"} = 'C:\PandoraFMS\Pandora_Server\bin\plink.exe';
|
||||
|
||||
# Snmpget for snmpget system command (optional)
|
||||
$pa_config->{"snmpget"} = "/usr/bin/snmpget";
|
||||
|
||||
|
@ -838,6 +846,15 @@ sub pandora_load_config {
|
|||
elsif ($parametro =~ m/^xprobe2\s(.*)/i) {
|
||||
$pa_config->{'xprobe2'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^winexe\s(.*)/i) {
|
||||
$pa_config->{'winexe'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^psexec\s(.*)/i) {
|
||||
$pa_config->{'psexec'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^plink\s(.*)/i) {
|
||||
$pa_config->{'plink'}= clean_blank($1);
|
||||
}
|
||||
elsif ($parametro =~ m/^snmpget\s(.*)/i) {
|
||||
$pa_config->{'snmpget'}= clean_blank($1);
|
||||
}
|
||||
|
|
|
@ -1137,7 +1137,9 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
load_module_macros ($module->{'module_macros'}, \%macros);
|
||||
}
|
||||
|
||||
# User defined alerts
|
||||
|
||||
#logger($pa_config, "Clean name ".$clean_name, 10);
|
||||
# User defined alert
|
||||
if ($action->{'internal'} == 0) {
|
||||
$macros{_field1_} = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$macros{_field2_} = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
|
@ -1442,55 +1444,70 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
|
||||
# Integria IMS Ticket
|
||||
} elsif ($clean_name eq "Integria IMS Ticket") {
|
||||
my $config_api_path = pandora_get_tconfig_token ($dbh, 'integria_hostname', '');
|
||||
my $config_api_pass = pandora_get_tconfig_token ($dbh, 'integria_api_pass', '');
|
||||
my $config_integria_user = pandora_get_tconfig_token ($dbh, 'integria_user', '');
|
||||
my $config_integria_user_pass = pandora_get_tconfig_token ($dbh, 'integria_pass', '');
|
||||
$field1 = subst_alert_macros ($field1, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field5 = subst_alert_macros ($field5, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field6 = subst_alert_macros ($field6, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field7 = subst_alert_macros ($field7, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field8 = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field9 = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
$field10 = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
|
||||
|
||||
# Field 1 (Integria IMS API path)
|
||||
my $api_path = $field1;
|
||||
my $api_path = $config_api_path . "/integria/include/api.php";
|
||||
|
||||
# Field 2 (Integria IMS API pass)
|
||||
my $api_pass = $field2;
|
||||
my $api_pass = $config_api_pass;
|
||||
|
||||
# Field 3 (Integria IMS user)
|
||||
my $integria_user = $field3;
|
||||
my $integria_user = $config_integria_user;
|
||||
|
||||
# Field 4 (Integria IMS user password)
|
||||
my $integria_user_pass = $field4;
|
||||
my $integria_user_pass = $config_integria_user_pass;
|
||||
|
||||
# Field 5 (Ticket name)
|
||||
my $ticket_name = $field5;
|
||||
# Field 1 (Ticket name)
|
||||
my $ticket_name = safe_output($field1);
|
||||
if ($ticket_name eq "") {
|
||||
$ticket_name = $pa_config->{'rb_product_name'} . " alert action created by API";
|
||||
}
|
||||
|
||||
# Field 6 (Ticket group ID)
|
||||
my $ticket_group_id = $field6;
|
||||
# Field 2 (Ticket group ID)
|
||||
my $ticket_group_id = $field2;
|
||||
if ($ticket_group_id eq '') {
|
||||
$ticket_group_id = 0;
|
||||
}
|
||||
|
||||
# Field 7 (Ticket priority);
|
||||
my $ticket_priority = $field7;
|
||||
if ($ticket_priority eq '') {
|
||||
$ticket_priority = 0;
|
||||
# Field 3 (Ticket priority);
|
||||
my $ticket_priority = $field3;
|
||||
if ($ticket_priority eq '0') {
|
||||
$ticket_priority = 1;
|
||||
}
|
||||
|
||||
# Field 4 (Ticket owner)
|
||||
my $ticket_owner = $field4;
|
||||
if ($ticket_owner eq '') {
|
||||
$ticket_owner = 'admin';
|
||||
}
|
||||
|
||||
# Field 8 (Ticket email)
|
||||
my $ticket_email = $field8;
|
||||
|
||||
# Field 9 (Ticket owner)
|
||||
my $ticket_owner = $field9;
|
||||
|
||||
# Field 10 (Ticket description);
|
||||
my $ticket_description = $field10;
|
||||
# Field 5 (Ticket type)
|
||||
my $ticket_type = $field5;
|
||||
if ($ticket_type eq '') {
|
||||
$ticket_type = 0;
|
||||
}
|
||||
|
||||
pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_email, $ticket_owner, $ticket_description);
|
||||
# Field 6 (Ticket status)
|
||||
my $ticket_status = $field6;
|
||||
if ($ticket_status eq '0') {
|
||||
$ticket_status = 1;
|
||||
}
|
||||
|
||||
# Field 7 (Ticket description);
|
||||
my $ticket_description = safe_output($field7);
|
||||
|
||||
pandora_create_integria_ticket($pa_config, $api_path, $api_pass, $integria_user, $integria_user_pass, $ticket_name, $ticket_group_id, $ticket_priority, $ticket_owner, $ticket_type, $ticket_status, $ticket_description);
|
||||
|
||||
# Generate notification
|
||||
} elsif ($clean_name eq "Generate Notification") {
|
||||
|
@ -5849,55 +5866,21 @@ sub pandora_edit_custom_graph ($$$$$$$$$$$) {
|
|||
}
|
||||
|
||||
sub pandora_create_integria_ticket ($$$$$$$$$$$) {
|
||||
my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$ticket_name,$group_id,$ticket_priority,$ticket_email,$ticket_owner,$ticket_description) = @_;
|
||||
|
||||
my ($pa_config,$api_path,$api_pass,$integria_user,$user_pass,$ticket_name,$ticket_group_id,$ticket_priority,$ticket_owner,$ticket_type,$ticket_status,$ticket_description) = @_;
|
||||
|
||||
my $data_ticket;
|
||||
my $call_api;
|
||||
|
||||
if ($api_path eq "") {
|
||||
return 0;
|
||||
}
|
||||
if ($user_pass eq "") {
|
||||
return 0;
|
||||
}
|
||||
if ($integria_user eq "") {
|
||||
$integria_user = "admin";
|
||||
}
|
||||
if ($ticket_name eq "") {
|
||||
$ticket_name = "Ticket created by " . $pa_config->{'rb_product_name'};
|
||||
}
|
||||
if ($group_id eq "") {
|
||||
$group_id = 1;
|
||||
}
|
||||
if ($ticket_priority eq "") {
|
||||
$ticket_priority = 1;
|
||||
}
|
||||
if ($ticket_owner eq "") {
|
||||
$ticket_owner = "admin";
|
||||
}
|
||||
|
||||
#~ $data_ticket = $ticket_name .
|
||||
#~ "|;|" . $group_id .
|
||||
#~ "|;|" . $ticket_priority .
|
||||
#~ "|;|" . $ticket_description .
|
||||
#~ "|;|" . #Id inventory
|
||||
#~ "|;|" . #Id incident type
|
||||
#~ "|;|" . $ticket_email .
|
||||
#~ "|;|" . $ticket_owner .
|
||||
#~ "|;|" . #Father ticket id
|
||||
#~ "|;|" . #Status
|
||||
#~ "|;|" . #Extra info
|
||||
#~ "|;|"; #Resolution
|
||||
$data_ticket = $ticket_name .
|
||||
"|;|" . $group_id .
|
||||
"|;|" . $ticket_group_id .
|
||||
"|;|" . $ticket_priority .
|
||||
"|;|" . $ticket_description .
|
||||
"|;|" .
|
||||
"|;|" .
|
||||
"|;|" . $ticket_email .
|
||||
"|;|" . $ticket_type .
|
||||
"|;|" .
|
||||
"|;|" . $ticket_owner .
|
||||
"|;|" .
|
||||
"|;|" . '1' .
|
||||
"|;|" . $ticket_status .
|
||||
"|;|" .
|
||||
"|;|";
|
||||
|
||||
|
@ -5908,9 +5891,9 @@ sub pandora_create_integria_ticket ($$$$$$$$$$$) {
|
|||
'op=create_incident&' .
|
||||
'params=' . $data_ticket .'&' .
|
||||
'token=|;|';
|
||||
logger($pa_config, "Integria ticket call:" . $call_api . "", 3);
|
||||
|
||||
my $content = get($call_api);
|
||||
logger($pa_config, "Integria ticket res:" . $content . "", 3);
|
||||
|
||||
if (is_numeric($content) && $content ne "-1") {
|
||||
return $content;
|
||||
}
|
||||
|
|
|
@ -343,6 +343,9 @@ sub exec_recon_script ($$$) {
|
|||
sub PandoraFMS::Recon::Base::guess_os($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
$DEVNULL = '/dev/null' if (!defined($DEVNULL));
|
||||
$DEVNULL = '/NUL' if ($^O =~ /win/i && !defined($DEVNULL));
|
||||
|
||||
# OS detection disabled. Use the device type.
|
||||
if ($self->{'os_detection'} == 0) {
|
||||
my $device_type = $self->get_device_type($device);
|
||||
|
@ -354,17 +357,20 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
|
|||
}
|
||||
|
||||
# Use xprobe2 if available
|
||||
if (-e $self->{pa_config}->{xprobe2}) {
|
||||
my $output = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL | grep 'Running OS' | head -1`;
|
||||
if (-x $self->{'pa_config'}->{'xprobe2'}) {
|
||||
my $return = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL`;
|
||||
if ($? == 0) {
|
||||
my ($output) = $a =~ /Running OS:(.*)/;
|
||||
return pandora_get_os($self->{'dbh'}, $output);
|
||||
}
|
||||
}
|
||||
|
||||
# Use nmap by default
|
||||
if (-e $self->{pa_config}->{nmap}) {
|
||||
my $output = `"$self->{pa_config}->{nmap}" -F -O $device 2>$DEVNULL | grep 'Aggressive OS guesses'`;
|
||||
if (-x $self->{'pa_config'}->{'nmap'}) {
|
||||
my $return = `"$self->{pa_config}->{nmap}" -F -O $device 2>$DEVNULL`;
|
||||
return OS_OTHER if ($? != 0);
|
||||
|
||||
my ($output) = $return =~ /Aggressive OS guesses:\s*(.*)/;
|
||||
return pandora_get_os($self->{'dbh'}, $output);
|
||||
}
|
||||
|
||||
|
@ -377,7 +383,11 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
|
|||
sub PandoraFMS::Recon::Base::tcp_scan ($$) {
|
||||
my ($self, $host) = @_;
|
||||
|
||||
my $open_ports = `"$self->{pa_config}->{nmap}" -p$self->{recon_ports} $host | grep open | wc -l`;
|
||||
my $r = `"$self->{pa_config}->{nmap}" -p$self->{recon_ports} $host`;
|
||||
|
||||
# Same as ""| grep open | wc -l" but multi-OS;
|
||||
my $open_ports = () = $r =~ /open/gm;
|
||||
|
||||
return $open_ports;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ use base 'Exporter';
|
|||
our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.738";
|
||||
my $pandora_build = "190924";
|
||||
my $pandora_version = "7.0NG.739";
|
||||
my $pandora_build = "190927";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -36,7 +36,7 @@ use constant {
|
|||
DISCOVERY_DEPLOY_AGENTS => 9,
|
||||
};
|
||||
|
||||
# /dev/null
|
||||
# $DEVNULL
|
||||
my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
||||
|
||||
# Some useful OIDs.
|
||||
|
@ -852,7 +852,7 @@ sub get_routes($) {
|
|||
$self->{'routes'} = [];
|
||||
|
||||
# Parse route's output.
|
||||
my @output = `route -n 2>/dev/null`;
|
||||
my @output = `route -n 2>$DEVNULL`;
|
||||
foreach my $line (@output) {
|
||||
chomp($line);
|
||||
if ($line =~ /^0\.0\.0\.0\s+(\d+\.\d+\.\d+\.\d+).*/) {
|
||||
|
@ -1220,7 +1220,7 @@ sub snmp_responds_v3($$) {
|
|||
sub local_arp($) {
|
||||
my ($self) = @_;
|
||||
|
||||
my @output = `arp -an 2>/dev/null`;
|
||||
my @output = `arp -an 2>$DEVNULL`;
|
||||
foreach my $line (@output) {
|
||||
next unless ($line =~ m/\((\S+)\) at ([0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+)/);
|
||||
$self->add_mac(parse_mac($2), $1);
|
||||
|
@ -1286,7 +1286,7 @@ sub ping ($$$) {
|
|||
for (my $i = 0; $i < $retries; $i++) {
|
||||
|
||||
# Note: There is no timeout option.
|
||||
`$ping_command -s -n $host 56 $packets >/dev/null 2>&1`;
|
||||
`$ping_command -s -n $host 56 $packets >$DEVNULL 2>&1`;
|
||||
return 1 if ($? == 0);
|
||||
}
|
||||
|
||||
|
@ -1299,7 +1299,7 @@ sub ping ($$$) {
|
|||
for (my $i = 0; $i < $retries; $i++) {
|
||||
|
||||
# Note: There is no timeout option for ping6.
|
||||
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
|
||||
`$ping_command -q -n -c $packets $host >$DEVNULL 2>&1`;
|
||||
return 1 if ($? == 0);
|
||||
}
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ sub ping ($$$) {
|
|||
for (my $i = 0; $i < $retries; $i++) {
|
||||
|
||||
# Note: There is no timeout option for ping6.
|
||||
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
|
||||
`$ping_command -q -n -c $packets $host >$DEVNULL 2>&1`;
|
||||
if ($? == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -1324,7 +1324,7 @@ sub ping ($$$) {
|
|||
# Assume Linux by default.
|
||||
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping";
|
||||
for (my $i = 0; $i < $retries; $i++) {
|
||||
`$ping_command -q -W $timeout -n -c $packets $host >/dev/null 2>&1`;
|
||||
`$ping_command -q -W $timeout -n -c $packets $host >$DEVNULL 2>&1`;
|
||||
return 1 if ($? == 0);
|
||||
}
|
||||
|
||||
|
@ -1529,99 +1529,101 @@ sub app_scan($) {
|
|||
$self->{'task_data'}
|
||||
);
|
||||
|
||||
if (!$dbObj->is_connected()) {
|
||||
call('message', 'Cannot connect to target ' . $target, 3);
|
||||
$global_percent += $global_step;
|
||||
$self->{'c_network_percent'} = 90;
|
||||
# Update progress
|
||||
$self->call('update_progress', $global_percent + (90 / (scalar @targets)));
|
||||
$self->{'summary'}->{'not_alive'} += 1;
|
||||
push @modules, {
|
||||
name => $type . ' connection',
|
||||
type => 'generic_proc',
|
||||
data => 0,
|
||||
description => $type . ' availability'
|
||||
};
|
||||
if (defined($dbObj)) {
|
||||
if (!$dbObj->is_connected()) {
|
||||
call('message', 'Cannot connect to target ' . $target, 3);
|
||||
$global_percent += $global_step;
|
||||
$self->{'c_network_percent'} = 90;
|
||||
# Update progress
|
||||
$self->call('update_progress', $global_percent + (90 / (scalar @targets)));
|
||||
$self->{'summary'}->{'not_alive'} += 1;
|
||||
push @modules, {
|
||||
name => $type . ' connection',
|
||||
type => 'generic_proc',
|
||||
data => 0,
|
||||
description => $type . ' availability'
|
||||
};
|
||||
|
||||
} else {
|
||||
my $dbObjCfg = $dbObj->get_config();
|
||||
} else {
|
||||
my $dbObjCfg = $dbObj->get_config();
|
||||
|
||||
$self->{'summary'}->{'discovered'} += 1;
|
||||
$self->{'summary'}->{'alive'} += 1;
|
||||
$self->{'summary'}->{'discovered'} += 1;
|
||||
$self->{'summary'}->{'alive'} += 1;
|
||||
|
||||
push @modules, {
|
||||
name => $type . ' connection',
|
||||
type => 'generic_proc',
|
||||
data => 1,
|
||||
description => $type . ' availability'
|
||||
};
|
||||
push @modules, {
|
||||
name => $type . ' connection',
|
||||
type => 'generic_proc',
|
||||
data => 1,
|
||||
description => $type . ' availability'
|
||||
};
|
||||
|
||||
# Analyze.
|
||||
$self->{'step'} = STEP_STATISTICS;
|
||||
$self->{'c_network_percent'} = 30;
|
||||
$self->call('update_progress', $global_percent + (30 / (scalar @targets)));
|
||||
$self->{'c_network_name'} = $dbObj->get_host();
|
||||
# Analyze.
|
||||
$self->{'step'} = STEP_STATISTICS;
|
||||
$self->{'c_network_percent'} = 30;
|
||||
$self->call('update_progress', $global_percent + (30 / (scalar @targets)));
|
||||
$self->{'c_network_name'} = $dbObj->get_host();
|
||||
|
||||
# Retrieve connection statistics.
|
||||
# Retrieve uptime statistics
|
||||
# Retrieve query stats
|
||||
# Retrieve connections
|
||||
# Retrieve innodb
|
||||
# Retrieve cache
|
||||
$self->{'c_network_percent'} = 50;
|
||||
$self->call('update_progress', $global_percent + (50 / (scalar @targets)));
|
||||
push @modules, $dbObj->get_statistics();
|
||||
# Retrieve connection statistics.
|
||||
# Retrieve uptime statistics
|
||||
# Retrieve query stats
|
||||
# Retrieve connections
|
||||
# Retrieve innodb
|
||||
# Retrieve cache
|
||||
$self->{'c_network_percent'} = 50;
|
||||
$self->call('update_progress', $global_percent + (50 / (scalar @targets)));
|
||||
push @modules, $dbObj->get_statistics();
|
||||
|
||||
# Custom queries.
|
||||
$self->{'step'} = STEP_CUSTOM_QUERIES;
|
||||
$self->{'c_network_percent'} = 80;
|
||||
$self->call('update_progress', $global_percent + (80 / (scalar @targets)));
|
||||
push @modules, $dbObj->execute_custom_queries();
|
||||
# Custom queries.
|
||||
$self->{'step'} = STEP_CUSTOM_QUERIES;
|
||||
$self->{'c_network_percent'} = 80;
|
||||
$self->call('update_progress', $global_percent + (80 / (scalar @targets)));
|
||||
push @modules, $dbObj->execute_custom_queries();
|
||||
|
||||
if (defined($dbObjCfg->{'scan_databases'})
|
||||
&& $dbObjCfg->{'scan_databases'} == 1) {
|
||||
# Skip database scan in Oracle tasks
|
||||
next if $self->{'type'} == DISCOVERY_APP_ORACLE;
|
||||
if (defined($dbObjCfg->{'scan_databases'})
|
||||
&& "$dbObjCfg->{'scan_databases'}" eq "1") {
|
||||
# Skip database scan in Oracle tasks
|
||||
next if $self->{'type'} == DISCOVERY_APP_ORACLE;
|
||||
|
||||
my $__data = $dbObj->scan_databases();
|
||||
my $__data = $dbObj->scan_databases();
|
||||
|
||||
if (ref($__data) eq "ARRAY") {
|
||||
if (defined($dbObjCfg->{'agent_per_database'})
|
||||
&& $dbObjCfg->{'agent_per_database'} == 1) {
|
||||
# Agent per database detected.
|
||||
push @data, @{$__data};
|
||||
} else {
|
||||
# Merge modules into engine agent.
|
||||
my @_modules = map {
|
||||
map { $_ } @{$_->{'module_data'}}
|
||||
} @{$__data};
|
||||
if (ref($__data) eq "ARRAY") {
|
||||
if (defined($dbObjCfg->{'agent_per_database'})
|
||||
&& $dbObjCfg->{'agent_per_database'} == 1) {
|
||||
# Agent per database detected.
|
||||
push @data, @{$__data};
|
||||
} else {
|
||||
# Merge modules into engine agent.
|
||||
my @_modules = map {
|
||||
map { $_ } @{$_->{'module_data'}}
|
||||
} @{$__data};
|
||||
|
||||
push @modules, @_modules;
|
||||
push @modules, @_modules;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Put engine agent at the beginning of the list.
|
||||
my $version = $dbObj->get_version();
|
||||
unshift @data,{
|
||||
'agent_data' => {
|
||||
'agent_name' => $dbObj->get_agent_name(),
|
||||
'os' => $type,
|
||||
'os_version' => (defined($version) ? $version : 'Discovery'),
|
||||
'interval' => $self->{'task_data'}->{'interval_sweep'},
|
||||
'id_group' => $self->{'task_data'}->{'id_group'},
|
||||
'address' => $dbObj->get_host(),
|
||||
'description' => '',
|
||||
},
|
||||
'module_data' => \@modules,
|
||||
};
|
||||
|
||||
$self->call('create_agents', \@data);
|
||||
|
||||
# Destroy item.
|
||||
undef($dbObj);
|
||||
}
|
||||
|
||||
# Put engine agent at the beginning of the list.
|
||||
my $version = $dbObj->get_version();
|
||||
unshift @data,{
|
||||
'agent_data' => {
|
||||
'agent_name' => $dbObj->get_agent_name(),
|
||||
'os' => $type,
|
||||
'os_version' => (defined($version) ? $version : 'Discovery'),
|
||||
'interval' => $self->{'task_data'}->{'interval_sweep'},
|
||||
'id_group' => $self->{'task_data'}->{'id_group'},
|
||||
'address' => $dbObj->get_host(),
|
||||
'description' => '',
|
||||
},
|
||||
'module_data' => \@modules,
|
||||
};
|
||||
|
||||
$self->call('create_agents', \@data);
|
||||
|
||||
# Destroy item.
|
||||
undef($dbObj);
|
||||
|
||||
$global_percent += $global_step;
|
||||
$self->{'c_network_percent'} = 100;
|
||||
$self->call('update_progress', $global_percent);
|
||||
|
@ -1674,7 +1676,7 @@ sub deploy_scan($) {
|
|||
##########################################################################
|
||||
sub scan($) {
|
||||
my ($self) = @_;
|
||||
my ($progress, $step);
|
||||
my ($progress, $step) = 1, 0;
|
||||
|
||||
# 1%
|
||||
$self->call('update_progress', 1);
|
||||
|
@ -1697,7 +1699,7 @@ sub scan($) {
|
|||
}
|
||||
|
||||
# Find devices.
|
||||
$self->call('message', "[1/5] Scanning the network...", 3);
|
||||
$self->call('message', "[1/4] Scanning the network...", 3);
|
||||
$self->{'step'} = STEP_SCANNING;
|
||||
$self->call('update_progress', $progress);
|
||||
$self->scan_subnet();
|
||||
|
@ -1713,7 +1715,7 @@ sub scan($) {
|
|||
$self->call('delete_connections');
|
||||
|
||||
# Connectivity from address forwarding tables.
|
||||
$self->call('message', "[1/4] Finding address forwarding table connectivity...", 3);
|
||||
$self->call('message', "[2/4] Finding address forwarding table connectivity...", 3);
|
||||
$self->{'step'} = STEP_AFT;
|
||||
($progress, $step) = (50, 20.0 / scalar(@hosts)); # From 50% to 70%.
|
||||
for (my $i = 0; defined($hosts[$i]); $i++) {
|
||||
|
@ -1831,7 +1833,7 @@ sub snmp_get_command {
|
|||
my ($self, $device, $oid, $community, $vlan) = @_;
|
||||
$vlan = defined($vlan) ? "\@" . $vlan : '';
|
||||
|
||||
my $command = "snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v$self->{'snmp_version'} -On -Oe ";
|
||||
my $command = "snmpwalk -M$DEVNULL -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v$self->{'snmp_version'} -On -Oe ";
|
||||
if ($self->{'snmp_version'} eq "3") {
|
||||
if ($self->{'community'}) { # Context
|
||||
$command .= " -N $self->{'community'} ";
|
||||
|
@ -1847,7 +1849,7 @@ sub snmp_get_command {
|
|||
$command .= " -c$community$vlan ";
|
||||
}
|
||||
|
||||
return "$command $device $oid 2>/dev/null";
|
||||
return "$command $device $oid 2>$DEVNULL";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -994,7 +994,8 @@ sub load_average {
|
|||
$load_average = ((split(/\s+/, `/sbin/sysctl -n vm.loadavg`))[1]);
|
||||
} elsif ($OSNAME eq "MSWin32") {
|
||||
# Windows hasn't got load average.
|
||||
$load_average = undef;
|
||||
$load_average = `powershell "(Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average).average"`;
|
||||
chop($load_average);
|
||||
}
|
||||
# by default LINUX calls
|
||||
else {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.738
|
||||
%define release 190924
|
||||
%define version 7.0NG.739
|
||||
%define release 190927
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# Pandora FMS Server
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.738
|
||||
%define release 190924
|
||||
%define version 7.0NG.739
|
||||
%define release 190927
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.738"
|
||||
PI_BUILD="190924"
|
||||
PI_VERSION="7.0NG.739"
|
||||
PI_BUILD="190927"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -38,6 +38,7 @@ Where options:
|
|||
Optional parameters:
|
||||
|
||||
[-priority <priority>] : 10 Maintance, 0 Informative, 1 Low, 2 Medium, 3 Serious, 4 Very serious
|
||||
[-owner <owner>] : Free text
|
||||
[-desc <description>] : Free text
|
||||
[-type <ticket_type>] : Type ID (must exist in Integria IMS)
|
||||
[-inventory <inventory_id>] : Inventory ID (must exist in Integria IMS)
|
||||
|
@ -94,6 +95,7 @@ sub tool_api_main () {
|
|||
my $ticket_name = "";
|
||||
my $group_id = -1;
|
||||
my $ticket_priority = 0;
|
||||
my $ticket_owner = '';
|
||||
my $ticket_description = '';
|
||||
my $ticket_type = '';
|
||||
my $ticket_inventory = '';
|
||||
|
@ -155,6 +157,9 @@ sub tool_api_main () {
|
|||
if ($line eq '-priority') {
|
||||
$ticket_priority = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-owner') {
|
||||
$ticket_owner = $ARGV[$i + 1];
|
||||
}
|
||||
if ($line eq '-desc') {
|
||||
$ticket_description = $ARGV[$i + 1];
|
||||
}
|
||||
|
@ -193,6 +198,7 @@ sub tool_api_main () {
|
|||
$data_ticket = $ticket_name .
|
||||
"|;|" . $group_id .
|
||||
"|;|" . $ticket_priority .
|
||||
"|;|" . $ticket_owner .
|
||||
"|;|" . $ticket_description .
|
||||
"|;|" . $ticket_inventory .
|
||||
"|;|" . $ticket_type .
|
||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.738 PS190924";
|
||||
my $version = "7.0NG.739 PS190927";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.738 PS190924";
|
||||
my $version = "7.0NG.739 PS190927";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue