mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
Merge branch 'ent-3733-Crear-modelos-de-los-distintos-recursos-de-la-Consola-Visual' into 'visual-console-refactor'
created item class and test See merge request artica/pandorafms!2277 Former-commit-id: db7ad849637af4fb2839625078b51c511a4b564f
This commit is contained in:
commit
73a7842ac1
@ -54,7 +54,8 @@ AGENT_WIN_FILE="$CODEHOME/pandora_agents/win32/pandora.cc"
|
||||
AGENT_WIN_MPI_FILE="$CODEHOME/pandora_agents/win32/installer/pandora.mpi"
|
||||
AGENT_WIN_RC_FILE="$CODEHOME/pandora_agents/win32/versioninfo.rc"
|
||||
SATELLITE_FILE="$PANDHOME_ENT/satellite_server/satellite_server.pl"
|
||||
PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_server/util/plugin/vmware-plugin.pl \
|
||||
PERL_PLUGIN_FILES="$PANDHOME_ENT/pandora_server/util/recon_script/vmware-plugin.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/recon_script/pcm_client.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/NGINX/nginx_requests_queued.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Sybase/sybase_plugin.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/SNMP/dynamic_snmp.pl \
|
||||
@ -171,8 +172,8 @@ echo "Updating Pandora Console version..."
|
||||
sed -i -e "s/\s*\$pandora_version\s*=.*/\$pandora_version = 'v$VERSION';/" "$CONSOLE_FILE"
|
||||
sed -i -e "s/\s*\$build_version\s*=.*/\$build_version = 'PC$BUILD';/" "$CONSOLE_FILE"
|
||||
echo "Updating Pandora Console installer version..."
|
||||
sed -i -e "s/\s*\$version\s*=.*/\$version = '$VERSION';/" "$CONSOLE_INSTALL_FILE"
|
||||
sed -i -e "s/\s*\$build\s*=.*/\$build = '$BUILD';/" "$CONSOLE_INSTALL_FILE"
|
||||
sed -i -e "s/\(\s*\$version\s*=\s\).*/\1'$VERSION';/" "$CONSOLE_INSTALL_FILE"
|
||||
sed -i -e "s/\(\s*\$build\s*=\s\).*/\1'$BUILD';/" "$CONSOLE_INSTALL_FILE"
|
||||
echo "Setting develop_bypass to 0..."
|
||||
sed -i -e "s/\s*if\s*(\s*[!]\s*isset\s*(\s*$develop_bypass\s*)\s*)\s*$develop_bypass\s*=.*/if ([!]isset($develop_bypass)) $develop_bypass = 0;/" "$CONSOLE_FILE"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, AIX version
|
||||
# Version 7.0NG.733, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,10 +1,10 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 4.0.1
|
||||
Version: 7.0
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 260
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Maintainer: ÁRTICA ST <info@artica.es>
|
||||
Homepage: https://pandorafms.org/
|
||||
Depends: coreutils, perl, unzip
|
||||
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, FreeBSD Version
|
||||
# Version 7.0NG.733, 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.731, HP-UX Version
|
||||
# Version 7.0NG.733, 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.731, GNU/Linux
|
||||
# Version 7.0NG.733, 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.731, GNU/Linux
|
||||
# Version 7.0NG.733, 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.731, Solaris Version
|
||||
# Version 7.0NG.733, 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.731
|
||||
# Version 7.0NG.733
|
||||
|
||||
# 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.731, AIX version
|
||||
# Version 7.0NG.733, 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.731
|
||||
# Version 7.0NG.733
|
||||
# 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.731, HPUX Version
|
||||
# Version 7.0NG.733, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,10 +1,10 @@
|
||||
package: pandorafms-agent
|
||||
Version: 4.0
|
||||
Version: 7.0
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 260
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Maintainer: ÁRTICA ST <info@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: coreutils, perl
|
||||
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731
|
||||
# Version 7.0NG.733
|
||||
# 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.731
|
||||
# Version 7.0NG.733
|
||||
# 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.731
|
||||
# Version 7.0NG.733
|
||||
# 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.731, Solaris version
|
||||
# Version 7.0NG.733, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.731, AIX version
|
||||
# Version 7.0NG.733, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -1,10 +1,10 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.731-190211
|
||||
Version: 7.0NG.733-190328
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 260
|
||||
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
|
||||
Maintainer: ÁRTICA ST <info@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: coreutils, perl, unzip
|
||||
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. It’s possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.731-190211"
|
||||
pandora_version="7.0NG.733-190328"
|
||||
|
||||
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.731, GNU/Linux
|
||||
# Version 7.0NG.733, 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.731, FreeBSD Version
|
||||
# Version 7.0NG.733, 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.731, HP-UX Version
|
||||
# Version 7.0NG.733, 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.731, GNU/Linux
|
||||
# Version 7.0NG.733, 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.731, GNU/Linux
|
||||
# Version 7.0NG.733, 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.731, NetBSD Version
|
||||
# Version 7.0NG.733, 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.731, Solaris Version
|
||||
# Version 7.0NG.733, 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.731';
|
||||
use constant AGENT_BUILD => '190211';
|
||||
use constant AGENT_VERSION => '7.0NG.733';
|
||||
use constant AGENT_BUILD => '190328';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.731
|
||||
%define release 190211
|
||||
%define version 7.0NG.733
|
||||
%define release 190328
|
||||
|
||||
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.731
|
||||
%define release 190211
|
||||
%define version 7.0NG.733
|
||||
%define release 190328
|
||||
|
||||
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.731"
|
||||
PI_BUILD="190211"
|
||||
PI_VERSION="7.0NG.733"
|
||||
PI_BUILD="190328"
|
||||
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.731
|
||||
# Version 7.0NG.733
|
||||
|
||||
# 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.731}
|
||||
{Pandora FMS Windows Agent v7.0NG.733}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{190211}
|
||||
{190328}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.731(Build 190211)")
|
||||
#define PANDORA_VERSION ("7.0NG.733(Build 190328)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.731(Build 190211))"
|
||||
VALUE "ProductVersion", "(7.0NG.733(Build 190328))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.731-190211
|
||||
Version: 7.0NG.733-190328
|
||||
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.731-190211"
|
||||
pandora_version="7.0NG.733-190328"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
@ -149,7 +149,7 @@ if [ $package_pear -eq 1 ]
|
||||
then
|
||||
echo "Make the package \"php-xml-rpc\"."
|
||||
cd temp_package
|
||||
dh-make-pear --maintainer "Miguel de Dios <miguel.dedios@artica.es>" XML_RPC
|
||||
dh-make-pear --maintainer "ÁRTICA ST <info@artica.es>" XML_RPC
|
||||
cd php-xml-rpc-*
|
||||
dpkg-buildpackage -rfakeroot
|
||||
cd ..
|
||||
|
@ -661,7 +661,7 @@ $ignored_params['refresh'] = '';
|
||||
else {
|
||||
|
||||
var agentes_id = $("#id_agents2").val();
|
||||
var id_agentes = $.get("full_agents_id");
|
||||
var id_agentes = getQueryParam("full_agents_id");
|
||||
if (agentes_id === null && id_agentes !== null) {
|
||||
id_agentes = id_agentes.split(";")
|
||||
id_agentes.forEach(function(element) {
|
||||
@ -799,7 +799,7 @@ $ignored_params['refresh'] = '';
|
||||
$("#module").append (option);
|
||||
});
|
||||
|
||||
var id_modules = $.get("full_modules_selected");
|
||||
var id_modules = getQueryParam("full_modules_selected");
|
||||
if(id_modules !== null) {
|
||||
id_modules = id_modules.split(";");
|
||||
id_modules.forEach(function(element) {
|
||||
@ -812,20 +812,18 @@ $ignored_params['refresh'] = '';
|
||||
);
|
||||
}
|
||||
|
||||
(function($) {
|
||||
$.get = function(key) {
|
||||
key = key.replace(/[[]/, '[');
|
||||
key = key.replace(/[]]/, ']');
|
||||
var pattern = "[?&]" + key + "=([^&#]*)";
|
||||
var regex = new RegExp(pattern);
|
||||
var url = unescape(window.location.href);
|
||||
var results = regex.exec(url);
|
||||
if (results === null) {
|
||||
return null;
|
||||
} else {
|
||||
return results[1];
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
function getQueryParam (key) {
|
||||
key = key.replace(/[[]/, '[');
|
||||
key = key.replace(/[]]/, ']');
|
||||
var pattern = "[?&]" + key + "=([^&#]*)";
|
||||
var regex = new RegExp(pattern);
|
||||
var url = unescape(window.location.href);
|
||||
var results = regex.exec(url);
|
||||
if (results === null) {
|
||||
return null;
|
||||
} else {
|
||||
return results[1];
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
@ -328,4 +328,3 @@ function mainModuleGroups()
|
||||
|
||||
extensions_add_operation_menu_option(__('Module groups'), 'estado', 'module_groups/brick.png', 'v1r1', 'view');
|
||||
extensions_add_main_function('mainModuleGroups');
|
||||
|
||||
|
0
pandora_console/extras/delete_files/.gitignore
vendored
Normal file
0
pandora_console/extras/delete_files/.gitignore
vendored
Normal file
3
pandora_console/extras/delete_files/delete_files.txt
Normal file
3
pandora_console/extras/delete_files/delete_files.txt
Normal file
@ -0,0 +1,3 @@
|
||||
/godmode/servers/recon_script.php
|
||||
/godmode/servers/manage_recontask_form.php
|
||||
/godmode/servers/manage_recontask.php
|
147
pandora_console/extras/mr/25.sql
Normal file
147
pandora_console/extras/mr/25.sql
Normal file
@ -0,0 +1,147 @@
|
||||
START TRANSACTION;
|
||||
|
||||
UPDATE `twidget` SET `unique_name`='example' WHERE `class_name` LIKE 'WelcomeWidget';
|
||||
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `auth_strings` text;
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
||||
|
||||
|
||||
INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Discovery.Application.VMware', 'Discovery Application script to monitor VMware technologies (ESXi, VCenter, VSphere)', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Discovery.Cloud', 'Discovery Cloud script to monitor Cloud technologies (AWS.EC2, AWS.S3, AWS.RDS, RDS,ȊWS.EKS)', '/usr/share/pandora_server/util/recon_scripts/pcm_client.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tevent_extended` (
|
||||
`id` serial PRIMARY KEY,
|
||||
`id_evento` bigint(20) unsigned NOT NULL,
|
||||
`external_id` bigint(20) unsigned,
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
`description` text,
|
||||
FOREIGN KEY `tevent_ext_fk`(`id_evento`) REFERENCES `tevento`(`id_evento`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `tnotification_source` (
|
||||
`id` serial,
|
||||
`description` VARCHAR(255) DEFAULT NULL,
|
||||
`icon` text,
|
||||
`max_postpone_time` int(11) DEFAULT NULL,
|
||||
`enabled` int(1) DEFAULT NULL,
|
||||
`user_editable` int(1) DEFAULT NULL,
|
||||
`also_mail` int(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tnotification_source`
|
||||
--
|
||||
INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, `enabled`, `user_editable`, `also_mail`) VALUES
|
||||
("System status", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Message", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Pending task", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Advertisement", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Official communication", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Sugerence", "icono_info_mr.png", 86400, 1, 1, 0);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tmensajes`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `url` TEXT;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `response_mode` VARCHAR(200) DEFAULT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `citicity` INT(10) UNSIGNED DEFAULT '0';
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `id_source` BIGINT(20) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `subtype` VARCHAR(255) DEFAULT '';
|
||||
ALTER TABLE `tmensajes` ADD INDEX (`id_source`);
|
||||
UPDATE `tmensajes` SET `id_source`=(SELECT `id` FROM `tnotification_source` WHERE `description` = "Message");
|
||||
ALTER TABLE `tmensajes` ADD CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_user` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60) NOT NULL,
|
||||
`utimestamp_read` BIGINT(20),
|
||||
`utimestamp_erased` BIGINT(20),
|
||||
`postpone` INT,
|
||||
PRIMARY KEY (`id_mensaje`,`id_user`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_group` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_mensaje`,`id_group`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_source_user` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_source_group` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_group`),
|
||||
INDEX (`id_group`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnotification_source_group_user`(
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_group`) REFERENCES `tnotification_source_group`(`id_group`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES ('Generate Notification','Internal type','This command allows you to send an internal notification to any user or group.',1,'[\"Destination user\",\"Destination group\",\"Title\",\"Message\",\"Link\",\"Criticity\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
|
||||
|
||||
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0);
|
||||
INSERT INTO `tnotification_source_group` SELECT `id`,0 FROM `tnotification_source` WHERE `description`="Message";
|
||||
INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != '';
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Apache accesses per client and status',
|
||||
'(.*?)\ -.*1.1"\ (\d+)\ \d+',
|
||||
'host,status', 1);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Apache time per requester and html code',
|
||||
'(.*?)\ -.*1.1"\ (\d+)\ (\d+)',
|
||||
'origin,respose,_time_', 1);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Count output',
|
||||
'.*',
|
||||
'Coincidences', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Events replicated to metaconsole',
|
||||
'.* (.*?) .* (\d+) events replicated to metaconsole',
|
||||
'server,_events_', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Pages with warnings',
|
||||
'PHP Warning:.*in (.*?) on',
|
||||
'page', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models (`title`,`regexp`,`fields`,`average`) VALUES ('Users login',
|
||||
'Starting Session \d+\ of user (.*)',
|
||||
'user', 0);
|
||||
|
||||
COMMIT;
|
24
pandora_console/extras/mr/26.sql
Normal file
24
pandora_console/extras/mr/26.sql
Normal file
@ -0,0 +1,24 @@
|
||||
START TRANSACTION;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`source` varchar(60) default '',
|
||||
`destination` varchar(60) default '',
|
||||
`utimestamp` bigint(20) default 0,
|
||||
`bytes` int(18) unsigned default 0,
|
||||
`pkts` int(18) unsigned default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE (`source`, `destination`, `utimestamp`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
||||
|
||||
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';
|
||||
|
||||
UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
|
||||
|
||||
UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport");
|
||||
|
||||
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `summary` text;
|
||||
|
||||
COMMIT;
|
@ -106,7 +106,9 @@ function get_value_sum($arr)
|
||||
{
|
||||
foreach ($arr as $clave) {
|
||||
foreach ($clave as $valor) {
|
||||
$result += $valor;
|
||||
if (is_numeric($valor) === true) {
|
||||
$result += $valor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,8 +139,8 @@ function get_logs_size($file)
|
||||
function get_status_logs($path)
|
||||
{
|
||||
$status_server_log = '';
|
||||
$size_server_log = get_logs_size($path);
|
||||
if ($size_server_log <= 10240) {
|
||||
$size_server_log = number_format(get_logs_size($path));
|
||||
if ($size_server_log <= 1048576) {
|
||||
$status_server_log = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   You have less than 10 MB of logs</a>";
|
||||
} else {
|
||||
$status_server_log = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   You have more than 10 MB of logs</a>";
|
||||
@ -412,11 +414,7 @@ render_info_data(
|
||||
render_info_data('SELECT COUNT(*) FROM tagente_modulo', 'Total modules');
|
||||
render_info_data('SELECT COUNT(*) FROM tgrupo', 'Total groups');
|
||||
render_info_data('SELECT COUNT(*) FROM tagente_datos', 'Total module data records');
|
||||
// render_info_data ("SELECT COUNT(*) FROM tagente_datos_string","Total module string data records");
|
||||
// render_info_data ("SELECT COUNT(*) FROM tagente_datos_log4x","Total module log4x data records");
|
||||
render_info_data('SELECT COUNT(*) FROM tagent_access', 'Total agent access record');
|
||||
// render_info ("tagente_estado");
|
||||
// render_info ("talert_template_modules");
|
||||
render_info_data('SELECT COUNT(*) FROM tevento', 'Total events');
|
||||
|
||||
if ($config['enterprise_installed']) {
|
||||
@ -700,7 +698,7 @@ render_info_data(
|
||||
render_row(status_values($read_rnd_buffer_size_min_rec_value, $read_rnd_buffer_size), 'Read rnd-buffer size ', 'Read rnd-buffer size ');
|
||||
render_row(status_values($query_cache_min_res_unit_min_rec_value, $query_cache_min_res_unit), 'Query cache min-res-unit ', 'Query cache min-res-unit ');
|
||||
render_row(status_values($innodb_file_per_table_min_rec_value, $innodb_file_per_table), 'InnoDB file per table ', 'InnoDB file per table ');
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Tables fragmentation in the PandoraFMS database').'</th></tr>';
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Tables fragmentation in the Pandora FMS database').'</th></tr>';
|
||||
|
||||
|
||||
|
||||
@ -708,14 +706,14 @@ render_info_data(
|
||||
render_row(number_format($tables_fragmentation, 2).'%', 'Tables fragmentation (current value)');
|
||||
render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Status fragmentation tables');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' PandoraFMS logs dates').'</th></tr>';
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Pandora FMS logs dates').'</th></tr>';
|
||||
|
||||
render_row(number_format((get_logs_size($path_server_logs) / 1024), 2).'M', 'Size server logs (current value)');
|
||||
render_row(number_format((get_logs_size($path_server_logs) / 1048576), 3).'M', 'Size server logs (current value)');
|
||||
render_row(get_status_logs($path_server_logs), 'Status server logs');
|
||||
render_row(number_format((get_logs_size($path_console_logs) / 1024), 2).'M', 'Size console logs (current value)');
|
||||
render_row(number_format((get_logs_size($path_console_logs) / 1048576), 3).'M', 'Size console logs (current value)');
|
||||
render_row(get_status_logs($path_console_logs), 'Status console logs');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' PandoraFMS Licence Information').'</th></tr>';
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Pandora FMS Licence Information').'</th></tr>';
|
||||
|
||||
render_row(html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true), 'Customer key');
|
||||
render_row($license['expiry_date'], 'Expires');
|
||||
|
@ -1199,13 +1199,14 @@ 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', 24);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 26);
|
||||
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', '731');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '733');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
@ -1354,6 +1355,7 @@ ALTER TABLE tgraph ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL default '
|
||||
-- Table `tnetflow_filter`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tnetflow_filter ADD COLUMN `router_ip` TEXT NOT NULL DEFAULT "";
|
||||
UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport");
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `treport_custom_sql`
|
||||
@ -1375,6 +1377,8 @@ ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300';
|
||||
ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content ADD COLUMN `hide_no_data` tinyint(1) default '0';
|
||||
ALTER TABLE treport_content ADD COLUMN `recursion` tinyint(1) default NULL;
|
||||
ALTER TABLE treport_content ADD COLUMN `show_extended_events` tinyint(1) default '0';
|
||||
UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics";
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmodule_relationship`
|
||||
@ -1406,12 +1410,17 @@ ALTER TABLE twidget_dashboard MODIFY options LONGTEXT NOT NULL default "";
|
||||
ALTER TABLE trecon_task ADD `alias_as_name` int(2) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `snmp_enabled` int(2) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0';
|
||||
ALTER TABLE trecon_task ADD `auth_strings` text;
|
||||
ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE trecon_task ADD `summary` text;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `twidget` AND Table `twidget_dashboard`
|
||||
-- ---------------------------------------------------------------------
|
||||
UPDATE twidget_dashboard SET id_widget = (SELECT id FROM twidget WHERE unique_name = 'graph_module_histogram') WHERE id_widget = (SELECT id FROM twidget WHERE unique_name = 'graph_availability');
|
||||
DELETE FROM twidget WHERE unique_name = 'graph_availability';
|
||||
UPDATE `twidget` SET `unique_name`='example' WHERE `class_name` LIKE 'WelcomeWidget';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tbackup` (Extension table. Modify only if exists)
|
||||
@ -1816,7 +1825,30 @@ CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (2, 'Apache accesses per client and status',
|
||||
'(.*?)\ -.*1.1"\ (\d+)\ \d+',
|
||||
'host,status', 1);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (3, 'Apache time per requester and html code',
|
||||
'(.*?)\ -.*1.1"\ (\d+)\ (\d+)',
|
||||
'origin,respose,_time_', 1);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (4, 'Count output',
|
||||
'.*',
|
||||
'Coincidences', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (5, 'Events replicated to metaconsole',
|
||||
'.* (.*?) .* (\d+) events replicated to metaconsole',
|
||||
'server,_events_', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (6, 'Pages with warnings',
|
||||
'PHP Warning:.*in (.*?) on',
|
||||
'page', 0);
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (7, 'Users login',
|
||||
'Starting Session \d+\ of user (.*)',
|
||||
'user', 0);
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
@ -1856,15 +1888,173 @@ ALTER TABLE `tevento` ADD COLUMN `data` double(22,5) default NULL;
|
||||
|
||||
ALTER TABLE `tevento` ADD COLUMN `module_status` int(4) NOT NULL default '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tevent_extended`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tevent_extended` (
|
||||
`id` serial PRIMARY KEY,
|
||||
`id_evento` bigint(20) unsigned NOT NULL,
|
||||
`external_id` bigint(20) unsigned,
|
||||
`utimestamp` bigint(20) NOT NULL default '0',
|
||||
`description` text,
|
||||
FOREIGN KEY `tevent_ext_fk`(`id_evento`) REFERENCES `tevento`(`id_evento`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgis_map_layer_groups`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
|
||||
`layer_id` INT NOT NULL,
|
||||
`group_id` MEDIUMINT(4) UNSIGNED NOT NULL,
|
||||
`agent_id` INT(10) UNSIGNED NOT NULL COMMENT 'Used to link the position to the group',
|
||||
PRIMARY KEY (`layer_id`, `group_id`),
|
||||
FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
|
||||
CREATE TABLE `tgis_map_layer_groups` (
|
||||
`layer_id` int(11) NOT NULL,
|
||||
`group_id` mediumint(4) unsigned NOT NULL,
|
||||
`agent_id` int(10) unsigned NOT NULL COMMENT 'Used to link the position to the group',
|
||||
PRIMARY KEY (`layer_id`,`group_id`),
|
||||
KEY `group_id` (`group_id`),
|
||||
KEY `agent_id` (`agent_id`),
|
||||
CONSTRAINT `tgis_map_layer_groups_ibfk_1` FOREIGN KEY (`layer_id`) REFERENCES `tgis_map_layer` (`id_tmap_layer`) ON DELETE CASCADE,
|
||||
CONSTRAINT `tgis_map_layer_groups_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
|
||||
CONSTRAINT `tgis_map_layer_groups_ibfk_3` FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tnetwork_matrix`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tnetwork_matrix` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`source` varchar(60) default '',
|
||||
`destination` varchar(60) default '',
|
||||
`utimestamp` bigint(20) default 0,
|
||||
`bytes` int(18) unsigned default 0,
|
||||
`pkts` int(18) unsigned default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE (`source`, `destination`, `utimestamp`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tnotification_source`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE `tnotification_source` (
|
||||
`id` serial,
|
||||
`description` VARCHAR(255) DEFAULT NULL,
|
||||
`icon` text,
|
||||
`max_postpone_time` int(11) DEFAULT NULL,
|
||||
`enabled` int(1) DEFAULT NULL,
|
||||
`user_editable` int(1) DEFAULT NULL,
|
||||
`also_mail` int(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tnotification_source`
|
||||
--
|
||||
INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, `enabled`, `user_editable`, `also_mail`) VALUES
|
||||
("System status", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Message", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Pending task", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Advertisement", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Official communication", "icono_info_mr.png", 86400, 1, 1, 0),
|
||||
("Sugerence", "icono_info_mr.png", 86400, 1, 1, 0);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tmensajes`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `url` TEXT;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `response_mode` VARCHAR(200) DEFAULT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `citicity` INT(10) UNSIGNED DEFAULT '0';
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `id_source` BIGINT(20) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `subtype` VARCHAR(255) DEFAULT '';
|
||||
ALTER TABLE `tmensajes` ADD CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_user` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60) NOT NULL,
|
||||
`utimestamp_read` BIGINT(20),
|
||||
`utimestamp_erased` BIGINT(20),
|
||||
`postpone` INT,
|
||||
PRIMARY KEY (`id_mensaje`,`id_user`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_group` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_mensaje`,`id_group`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_user` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_group` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_group`),
|
||||
INDEX (`id_group`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_group_user` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_group`) REFERENCES `tnotification_source_group`(`id_group`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Add alert command 'Generate notification'
|
||||
-- ----------------------------------------------------------------------
|
||||
INSERT INTO `talert_commands` (`name`, `command`, `description`, `internal`, `fields_descriptions`, `fields_values`) VALUES ('Generate Notification','Internal type','This command allows you to send an internal notification to any user or group.',1,'[\"Destination user\",\"Destination group\",\"Title\",\"Message\",\"Link\",\"Criticity\",\"\",\"\",\"\",\"\",\"\"]','[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]');
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Update message references and pre-configure notifications
|
||||
-- ----------------------------------------------------------------------
|
||||
INSERT INTO `tnotification_source_user` (`id_source`, `id_user`, `enabled`, `also_mail`) VALUES ((SELECT `id` FROM `tnotification_source` WHERE `description`="System status"), "admin", 1, 0);
|
||||
INSERT INTO `tnotification_source_group` SELECT `id`,0 FROM `tnotification_source` WHERE `description`="Message";
|
||||
INSERT INTO `tnotification_user` (`id_mensaje`, `id_user`) SELECT `id_mensaje`, `id_usuario_destino` FROM `tmensajes` WHERE `id_usuario_destino` != '';
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Add custom internal recon scripts
|
||||
-- ----------------------------------------------------------------------
|
||||
INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Discovery.Application.VMware', 'Discovery Application script to monitor VMware technologies (ESXi, VCenter, VSphere)', '/usr/share/pandora_server/util/recon_scripts/vmware-plugin.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
INSERT INTO `trecon_script` (`name`,`description`,`script`,`macros`) VALUES ('Discovery.Cloud', 'Discovery Cloud script to monitor Cloud technologies (AWS.EC2, AWS.S3, AWS.RDS, RDS,ȊWS.EKS)', '/usr/share/pandora_server/util/recon_scripts/pcm_client.pl', '{"1":{"macro":"_field1_","desc":"Configuration file","help":"","value":"","hide":""}}');
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Add column in table `tagent_custom_fields`
|
||||
-- ----------------------------------------------------------------------
|
||||
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
|
||||
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||
<?php echo html_print_image('images/icono_grande_reconserver.png', true, ['title' => __('Collections')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Collections'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Collections'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"A file collection is a group of files (e.g. scripts or executables) which are
|
||||
|
@ -24,7 +24,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Custom Fields')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Custom Fields'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Custom Fields'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"Custom fields are an easy way to personalized agent's information.
|
||||
|
@ -24,7 +24,7 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_custom_reporting.png', true, ['title' => __('Custom Graphs')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Custom Graph'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Custom Graph'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"Graphs are designed to show the data collected by %s in a temporary scale defined by the user.
|
||||
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Fields Manager')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Fields Manager'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Fields Manager'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"Custom fields are an easy way to personalized agent's information.
|
||||
|
@ -28,7 +28,7 @@ if ($incident_w || $incident_m) {
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_incidencia.png', true, ['title' => __('Incidents')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Incidents'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Incidents'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"Besides receiving and processing data to monitor systems or applications,
|
||||
|
@ -31,7 +31,7 @@ if ($vconsoles_write || $vconsoles_manage) {
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Visual Console')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Visual Console'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Visual Console'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
'%s allows users to create visual maps on which each user is able to create his or her '.'own monitoring map. The new visual console editor is much more practical, although the prior '."visual console editor had its advantages. On the new visual console, we've been successful in "."imitating the sensation and touch of a drawing application like GIMP. We've also simplified the "."editor by dividing it into several subject-divided tabs named 'Data', 'Preview', 'Wizard', 'List of "."Elements' and 'Editor'. The items the %s Visual Map was designed to handle are "."'static images', 'percentage bars', 'module graphs' and 'simple values'.",
|
||||
|
@ -26,7 +26,7 @@ $networkmap_types = networkmap_get_types($strict_user);
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Network Map')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Network Map'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Network Map'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
'There is also an open-source version of the network map.
|
||||
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_visualconsole.png', true, ['title' => __('Planned Downtime')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Planned Downtime'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Planned Downtime'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"%s contains a scheduled downtime management system.
|
||||
|
@ -15,17 +15,17 @@ global $config;
|
||||
check_login();
|
||||
ui_require_css_file('firts_task');
|
||||
?>
|
||||
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no recon task defined yet.') ]); ?>
|
||||
<?php ui_print_info_message(['no_close' => true, 'message' => __('There are no discovery tasks defined yet.') ]); ?>
|
||||
|
||||
<div class="new_task">
|
||||
<div class="image_task">
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Recon server')]); ?>
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('Discovery server')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Recon Task'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Discovery Task'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
'The Recon Task definition of Pandora FMS is used to find new elements in the network.
|
||||
'Discovery Task are used to find new elements in the network.
|
||||
If it detects any item, it will add that item to the monitoring, and if that item it is already being monitored, then it will
|
||||
ignore it or will update its information.There are three types of detection: Based on <strong id="fuerte"> ICMP </strong>(pings),
|
||||
<strong id="fuerte">SNMP</strong> (detecting the topology of networks and their interfaces), and other <strong id="fuerte"> customized </strong>
|
||||
@ -33,8 +33,8 @@ ui_require_css_file('firts_task');
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<form action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Create Recon Task'); ?>" />
|
||||
<form action="index.php?sec=gservers&sec2=godmode/servers/discovery" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Discover'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -25,7 +25,7 @@ ui_require_css_file('firts_task');
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, ['title' => __('Services')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Services'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Services'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"A service is a way to group your IT resources based on their functionalities.
|
||||
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_reconserver.png', true, ['title' => __('SNMP Filter')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create SNMP Filter'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create SNMP Filter'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"Some systems receive a high number of traps.
|
||||
|
@ -22,7 +22,7 @@ ui_require_css_file('firts_task');
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_gestiondetags.png', true, ['title' => __('Tags')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Tags'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Tags'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
"Access to modules can be configured by a tagging system.
|
||||
|
@ -28,7 +28,7 @@ if ($networkmaps_write || $networkmaps_manage) {
|
||||
<?php echo html_print_image('images/firts_task/icono_grande_topology.png', true, ['title' => __('Transactions')]); ?>
|
||||
</div>
|
||||
<div class="text_task">
|
||||
<h3> <?php echo __('Create Transactions'); ?> <p id="description_task">
|
||||
<h3> <?php echo __('Create Transactions'); ?></h3><p id="description_task">
|
||||
<?php
|
||||
echo __(
|
||||
'The new transactional server allows you to execute tasks dependent on the others following a user-defined design. This means that it is possible to coordinate several executions to check a target at a given time.
|
||||
|
@ -1,16 +1,19 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
/**
|
||||
* Pandora FMS - http://pandorafms.com
|
||||
* ==================================================
|
||||
* Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU 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.
|
||||
*/
|
||||
|
||||
if (isset($_SERVER['REQUEST_TIME'])) {
|
||||
$time = $_SERVER['REQUEST_TIME'];
|
||||
} else {
|
||||
@ -26,7 +29,7 @@ if (!$config['MR']) {
|
||||
$config['MR'] = 0;
|
||||
}
|
||||
|
||||
echo '<a class="white_bold footer" target="_blank" href="'.$config['homeurl'].$license_file.'">';
|
||||
echo '<a class="footer" target="_blank" href="'.$config['homeurl'].$license_file.'">';
|
||||
|
||||
require_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
|
||||
@ -40,9 +43,7 @@ if ($current_package == 0) {
|
||||
|
||||
echo sprintf(__('%s %s - Build %s - MR %s', get_product_name(), $pandora_version, $build_package_version, $config['MR']));
|
||||
|
||||
echo '</a><br />';
|
||||
echo '<a class="white footer">'.__('Page generated at').' '.date($config['date_format']);
|
||||
echo '</a><br /><span style="color:#eff">® '.get_copyright_notice().'</span>';
|
||||
echo '</a> ';
|
||||
|
||||
if (isset($config['debug'])) {
|
||||
$cache_info = [];
|
||||
|
@ -1,8 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// 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
|
||||
@ -13,365 +12,335 @@
|
||||
// GNU General Public License for more details.
|
||||
require_once 'include/functions_messages.php';
|
||||
require_once 'include/functions_servers.php';
|
||||
require_once 'include/functions_notifications.php';
|
||||
|
||||
// Check permissions
|
||||
// Global errors/warnings checking.
|
||||
config_check();
|
||||
config_check();
|
||||
|
||||
|
||||
if ($config['menu_type'] == 'classic') {
|
||||
echo '<div id="header_table" class="header_table_classic">';
|
||||
} else {
|
||||
echo '<div id="header_table" class="header_table_collapsed">';
|
||||
}
|
||||
?>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; margin-top: 0px; height: 100%" border="0">
|
||||
<tr>
|
||||
<td style="width:90%;">
|
||||
<a href="index.php?sec=main">
|
||||
<?php
|
||||
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
|
||||
<div id="header_table_inner">
|
||||
<?php
|
||||
// ======= Notifications Discovery ===============================================
|
||||
$notifications_numbers = notifications_get_counters();
|
||||
$header_discovery = '<div id="header_discovery">'.notifications_print_ball(
|
||||
$notifications_numbers['notifications'],
|
||||
$notifications_numbers['last_id']
|
||||
).'</div>';
|
||||
|
||||
if (!defined('PANDORA_ENTERPRISE')) {
|
||||
$logo_title = get_product_name().' Opensource';
|
||||
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
|
||||
} else {
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
|
||||
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
|
||||
}
|
||||
|
||||
$logo_title = get_product_name().' Enterprise';
|
||||
}
|
||||
|
||||
echo html_print_image(
|
||||
$custom_logo,
|
||||
true,
|
||||
[
|
||||
'alt' => $logo_title,
|
||||
'border' => '0',
|
||||
]
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
</td>
|
||||
<td style="min-width:200px;">
|
||||
<?php
|
||||
$table = new stdClass();
|
||||
$table->id = 'header_table';
|
||||
$table->class = 'none';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->style[0] = $table->style['clippy'] = $table->style[1] = $table->style[3] = $table->style[4] = $table->style[5] = $table->style[6] = $table->style[8] = $table->style[9] = $table->style['qr'] = 'width: 22px; text-align:center; height: 22px; padding-right: 9px;padding-left: 9px;';
|
||||
$table->style[7] = 'width: 20px; padding-right: 9px;';
|
||||
$table->style['searchbar'] = 'width: 180px; min-width: 180px;';
|
||||
$table->style[11] = 'padding-left: 10px; padding-right: 5px;width: 16px;';
|
||||
$table->width = '100%';
|
||||
$table->styleTable = 'margin: auto; margin-top: 0px;';
|
||||
$table->rowclass[0] = '';
|
||||
|
||||
$acl_head_search = true;
|
||||
if ($config['acl_enterprise'] == 1 && !users_is_admin()) {
|
||||
$acl_head_search = db_get_sql(
|
||||
"SELECT sec FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario.id_user = tusuario_perfil.id_usuario
|
||||
INNER JOIN tprofile_view ON tprofile_view.id_profile = tusuario_perfil.id_perfil
|
||||
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')"
|
||||
);
|
||||
// ======= Servers List ===============================================
|
||||
$servers_list = '<div id="servers_list">';
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
if ($servers['all'] != 0) {
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['up'] == 0) {
|
||||
// All Servers down or no servers at all.
|
||||
$servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
|
||||
} else if ($servers['down'] != 0) {
|
||||
// Some servers down.
|
||||
$servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
|
||||
} else {
|
||||
// All servers up.
|
||||
$servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
|
||||
}
|
||||
|
||||
if ($acl_head_search) {
|
||||
$table->data[0][11] = ui_print_help_tip(__('Blank characters are used as AND conditions'), true);
|
||||
unset($servers);
|
||||
// Since this is the header, we don't like to trickle down variables.
|
||||
$servers_check_img_link = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
||||
$servers_check_img_link .= $servers_check_img;
|
||||
$servers_check_img_link .= '</a>';
|
||||
};
|
||||
$servers_list .= $servers_check_img_link.'</div>';
|
||||
|
||||
// Search bar
|
||||
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
|
||||
|
||||
// ======= Alerts ===============================================
|
||||
$check_minor_release_available = false;
|
||||
$pandora_management = check_acl($config['id_user'], 0, 'PM');
|
||||
|
||||
$check_minor_release_available = db_check_minor_relase_available();
|
||||
|
||||
if ($check_minor_release_available) {
|
||||
if (users_is_admin($config['id_user'])) {
|
||||
if ($config['language'] == 'es') {
|
||||
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
|
||||
} else {
|
||||
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29">'.__('About minor release update').'</a>', 'minor release/s available');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Chat messages.
|
||||
$header_chat = "<div id='header_chat'><span id='icon_new_messages_chat' style='display: none;'>";
|
||||
$header_chat .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
|
||||
$header_chat .= html_print_image('images/header_chat_gray.png', true, ['title' => __('New chat message')]);
|
||||
$header_chat .= '</a></span></div>';
|
||||
|
||||
|
||||
// Search.
|
||||
$acl_head_search = true;
|
||||
if ($config['acl_enterprise'] == 1 && !users_is_admin()) {
|
||||
$acl_head_search = db_get_sql(
|
||||
"SELECT sec FROM tusuario
|
||||
INNER JOIN tusuario_perfil ON tusuario.id_user = tusuario_perfil.id_usuario
|
||||
INNER JOIN tprofile_view ON tprofile_view.id_profile = tusuario_perfil.id_perfil
|
||||
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')"
|
||||
);
|
||||
}
|
||||
|
||||
if ($acl_head_search) {
|
||||
// Search bar.
|
||||
$search_bar = '<form method="get" style="display: inline;" name="quicksearch" action="">';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
} else {
|
||||
if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
} else {
|
||||
if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = true; </script>';
|
||||
} else {
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
|
||||
}
|
||||
$search_bar .= '<script type="text/javascript"> var fieldKeyWordEmpty = false; </script>';
|
||||
}
|
||||
}
|
||||
|
||||
$search_bar .= '<input type="text" id="keywords" name="keywords"';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else {
|
||||
$search_bar .= "value='".$config['search_keywords']."'";
|
||||
$search_bar .= '<input type="text" id="keywords" name="keywords"';
|
||||
if (!isset($config['search_keywords'])) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else if (strlen($config['search_keywords']) == 0) {
|
||||
$search_bar .= "value='".__('Enter keywords to search')."'";
|
||||
} else {
|
||||
$search_bar .= "value='".$config['search_keywords']."'";
|
||||
}
|
||||
|
||||
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
||||
onkeyup="javascript: fieldKeyWordEmpty = false;" class="search_input" />';
|
||||
|
||||
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
||||
$search_bar .= '</form>';
|
||||
|
||||
$header_searchbar = '<div id="header_searchbar">'.$search_bar.'</div>';
|
||||
}
|
||||
|
||||
|
||||
// ======= Autorefresh code =============================
|
||||
$autorefresh_txt = '';
|
||||
$autorefresh_additional = '';
|
||||
|
||||
$ignored_params = [
|
||||
'agent_config' => false,
|
||||
'code' => false,
|
||||
];
|
||||
|
||||
if (!isset($_GET['sec2'])) {
|
||||
$_GET['sec2'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_GET['refr'])) {
|
||||
$_GET['refr'] = null;
|
||||
}
|
||||
|
||||
$select = db_process_sql(
|
||||
"SELECT autorefresh_white_list,time_autorefresh
|
||||
FROM tusuario
|
||||
WHERE id_user = '".$config['id_user']."'"
|
||||
);
|
||||
|
||||
$autorefresh_list = json_decode(
|
||||
$select[0]['autorefresh_white_list']
|
||||
);
|
||||
|
||||
if ($autorefresh_list !== null
|
||||
&& array_search($_GET['sec2'], $autorefresh_list) !== false
|
||||
) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
|
||||
$search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');"
|
||||
onkeyup="javascript: fieldKeyWordEmpty = false;"
|
||||
style="margin-top:5px;" class="search_input" />';
|
||||
|
||||
// $search_bar .= 'onClick="javascript: document.quicksearch.submit()"';
|
||||
$search_bar .= "<input type='hidden' name='head_search_keywords' value='abc' />";
|
||||
$search_bar .= '</form>';
|
||||
|
||||
$table->data[0]['searchbar'] = $search_bar;
|
||||
}
|
||||
|
||||
// Servers check
|
||||
$servers = [];
|
||||
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
|
||||
$servers['up'] = (int) servers_check_status();
|
||||
$servers['down'] = ($servers['all'] - $servers['up']);
|
||||
if ($servers['up'] == 0) {
|
||||
// All Servers down or no servers at all
|
||||
$servers_check_img = html_print_image('images/header_down.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
|
||||
} else if ($servers['down'] != 0) {
|
||||
// Some servers down
|
||||
$servers_check_img = html_print_image('images/header_warning.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
|
||||
} else {
|
||||
// All servers up
|
||||
$servers_check_img = html_print_image('images/header_ready.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
|
||||
}
|
||||
|
||||
unset($servers);
|
||||
// Since this is the header, we don't like to trickle down variables.
|
||||
$servers_link_open = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
||||
$servers_link_close = '</a>';
|
||||
|
||||
if ($config['show_qr_code_header'] == 0) {
|
||||
$show_qr_code_header = 'display: none;';
|
||||
} else {
|
||||
$show_qr_code_header = 'display: inline;';
|
||||
}
|
||||
|
||||
$table->data[0]['qr'] = '<div style="'.$show_qr_code_header.'" id="qr_code_container" style="">'.'<a href="javascript: show_dialog_qrcode();">'.html_print_image(
|
||||
'images/qrcode_icon.png',
|
||||
if ($do_refresh) {
|
||||
$autorefresh_img = html_print_image(
|
||||
'images/header_refresh_gray.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('QR Code of the page'),
|
||||
'title' => __('QR Code of the page'),
|
||||
'class' => 'bot',
|
||||
'alt' => 'lightning',
|
||||
'title' => __('Configure autorefresh'),
|
||||
]
|
||||
).'</a>'.'</div>';
|
||||
);
|
||||
|
||||
echo "<div style='display: none;' id='qrcode_container' title='".__('QR code of the page')."'>";
|
||||
echo "<div id='qrcode_container_image'></div>";
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function() {
|
||||
$( "#qrcode_container" ).dialog({
|
||||
autoOpen: false,
|
||||
modal: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
if ($config['tutorial_mode'] !== 'expert' && !$config['disable_help']) {
|
||||
$table->data[0]['clippy'] = '<a href="javascript: show_clippy();">'.html_print_image(
|
||||
'images/clippy_icon.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'clippy',
|
||||
'class' => 'clippy',
|
||||
'alt' => __('%s assistant', get_product_name()),
|
||||
'title' => __(
|
||||
'%s assistant',
|
||||
get_product_name()
|
||||
),
|
||||
]
|
||||
).'</a>';
|
||||
if ((isset($select[0]['time_autorefresh']) === true)
|
||||
&& $select[0]['time_autorefresh'] !== 0
|
||||
&& $config['refr'] === null
|
||||
) {
|
||||
$config['refr'] = $select[0]['time_autorefresh'];
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">';
|
||||
$autorefresh_txt .= date(
|
||||
'i:s',
|
||||
$config['refr']
|
||||
);
|
||||
$autorefresh_txt .= '</span>)';
|
||||
} else if ($_GET['refr']) {
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">';
|
||||
$autorefresh_txt .= date('i:s', $config['refr']);
|
||||
$autorefresh_txt .= '</span>)';
|
||||
}
|
||||
|
||||
$ignored_params['refr'] = '';
|
||||
$values = get_refresh_time_array();
|
||||
|
||||
$table->data[0][0] = $servers_link_open.$servers_check_img.$servers_link_close;
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
|
||||
$autorefresh_additional .= html_print_select(
|
||||
$values,
|
||||
'ref',
|
||||
'',
|
||||
'',
|
||||
__('Select'),
|
||||
'0',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset($values);
|
||||
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
|
||||
|
||||
|
||||
// ======= Autorefresh code =============================
|
||||
$autorefresh_txt = '';
|
||||
$autorefresh_additional = '';
|
||||
|
||||
$ignored_params = [
|
||||
'agent_config' => false,
|
||||
'code' => false,
|
||||
];
|
||||
|
||||
if (!isset($_GET['sec2'])) {
|
||||
$_GET['sec2'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_GET['refr'])) {
|
||||
$_GET['refr'] = null;
|
||||
}
|
||||
|
||||
$select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '".$config['id_user']."'");
|
||||
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
|
||||
|
||||
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
$autorefresh_img = html_print_image('images/header_refresh.png', true, ['class' => 'bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh')]);
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_txt .= ' (<span id="refrcounter">'.date('i:s', $config['refr']).'</span>)';
|
||||
}
|
||||
|
||||
$ignored_params['refr'] = '';
|
||||
$values = get_refresh_time_array();
|
||||
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
|
||||
$autorefresh_additional .= html_print_select($values, 'ref', '', '', __('Select'), '0', true, false, false);
|
||||
$autorefresh_additional .= '</span>';
|
||||
unset($values);
|
||||
|
||||
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
|
||||
if ($_GET['refr']) {
|
||||
$autorefresh_link_open_txt = '<a class="white autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
} else {
|
||||
$autorefresh_link_open_txt = '<a>';
|
||||
}
|
||||
|
||||
$autorefresh_link_close = '</a>';
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
}
|
||||
if ($_GET['refr']
|
||||
|| ((isset($select[0]['time_autorefresh']) === true)
|
||||
&& $select[0]['time_autorefresh'] !== 0)
|
||||
) {
|
||||
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
$autorefresh_link_open_txt = '<a>';
|
||||
}
|
||||
|
||||
$table->data[0][1] = $autorefresh_link_open_img.$autorefresh_img.$autorefresh_link_close;
|
||||
$table->data[0][2] = $autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional;
|
||||
// ======================================================
|
||||
$check_minor_release_available = false;
|
||||
$pandora_management = check_acl($config['id_user'], 0, 'PM');
|
||||
$autorefresh_link_close = '</a>';
|
||||
$display_counter = 'display:block';
|
||||
} else {
|
||||
$autorefresh_img = html_print_image('images/header_refresh_disabled_gray.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]);
|
||||
|
||||
$check_minor_release_available = db_check_minor_relase_available();
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
if ($check_minor_release_available) {
|
||||
if (users_is_admin($config['id_user'])) {
|
||||
if ($config['language'] == 'es') {
|
||||
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
|
||||
} else {
|
||||
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29">'.__('About minor release update').'</a>', 'minor release/s available');
|
||||
}
|
||||
}
|
||||
}
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
|
||||
echo '<div id="alert_messages" style="display: none"></div>';
|
||||
|
||||
if ($config['alert_cnt'] > 0) {
|
||||
$maintenance_link = 'javascript:';
|
||||
$maintenance_title = __('System alerts detected - Please fix as soon as possible');
|
||||
$maintenance_class = $maintenance_id = 'show_systemalert_dialog white';
|
||||
|
||||
$maintenance_link_open_txt = '<a href="'.$maintenance_link.'" title="'.$maintenance_title.'" class="'.$maintenance_class.'" id="show_systemalert_dialog">';
|
||||
$maintenance_link_open_img = '<a href="'.$maintenance_link.'" title="'.$maintenance_title.'" class="'.$maintenance_class.'">';
|
||||
$maintenance_link_close = '</a>';
|
||||
if (!$pandora_management) {
|
||||
$maintenance_img = '';
|
||||
} else {
|
||||
$maintenance_img = $maintenance_link_open_img.html_print_image(
|
||||
'images/header_yellow.png',
|
||||
true,
|
||||
[
|
||||
'title' => __(
|
||||
'You have %d warning(s)',
|
||||
$config['alert_cnt']
|
||||
),
|
||||
'id' => 'yougotalert',
|
||||
'class' => 'bot',
|
||||
]
|
||||
).$maintenance_link_close;
|
||||
}
|
||||
} else {
|
||||
if (!$pandora_management) {
|
||||
$maintenance_img = '';
|
||||
} else {
|
||||
$maintenance_img = html_print_image('images/header_ready.png', true, ['title' => __('There are not warnings'), 'id' => 'yougotalert', 'class' => 'bot']);
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[0][3] = $maintenance_img;
|
||||
|
||||
// Main help icon
|
||||
if (!$config['disable_help']) {
|
||||
$table->data[0][4] = '<a href="#" class="modalpopup" id="helpmodal">'.html_print_image(
|
||||
'images/header_help.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Main help'),
|
||||
'id' => 'helpmodal',
|
||||
'class' => 'modalpopup',
|
||||
]
|
||||
).'</a>';
|
||||
}
|
||||
|
||||
// Logout
|
||||
$table->data[0][5] = '<a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
|
||||
$table->data[0][5] .= html_print_image('images/header_logout.png', true, ['alt' => __('Logout'), 'class' => 'bot', 'title' => __('Logout')]);
|
||||
$table->data[0][5] .= '</a>';
|
||||
|
||||
// User
|
||||
if (is_user_admin($config['id_user']) == 1) {
|
||||
$table->data[0][6] = html_print_image('images/header_user_admin.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
|
||||
} else {
|
||||
$table->data[0][6] = html_print_image('images/header_user.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
|
||||
}
|
||||
|
||||
$table->data[0][6] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$table->data[0][6].'</a>';
|
||||
|
||||
$table->data[0][7] = '<a href="index.php?sec=workspace&sec2=operation/users/user_edit" class="white_bold"> ('.$config['id_user'].')</a>';
|
||||
|
||||
// Chat messages
|
||||
$table->data[0][8] = "<span id='icon_new_messages_chat' style='display: none;'>";
|
||||
$table->data[0][8] .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
|
||||
$table->data[0][8] .= html_print_image('images/header_chat.png', true, ['title' => __('New chat message')]);
|
||||
$table->data[0][8] .= '</a>';
|
||||
$table->data[0][8] .= '</span>';
|
||||
|
||||
// Messages
|
||||
$msg_cnt = messages_get_count($config['id_user']);
|
||||
if ($msg_cnt > 0) {
|
||||
echo '<div id="dialog_messages" style="display: none"></div>';
|
||||
|
||||
$table->data[0][9] = '<a href="ajax.php?page=operation/messages/message_list" title="'.__('Message overview').'" id="show_messages_dialog">';
|
||||
$table->data[0][9] .= html_print_image('images/header_email.png', true, ['title' => __('You have %d unread message(s)', $msg_cnt), 'id' => 'yougotmail', 'class' => 'bot', 'style' => 'width:24px;']);
|
||||
$table->data[0][9] .= '</a>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
unset($table);
|
||||
?>
|
||||
</td>
|
||||
<!--
|
||||
<td style="text-align:center">
|
||||
<?php
|
||||
echo "<a href='index.php?sec=main'>";
|
||||
if (isset($config['custom_logo'])) {
|
||||
echo html_print_image('images/custom_logo/'.$config['custom_logo'], true, ['height' => '60', 'width' => '139', 'alt' => 'Logo']);
|
||||
$display_counter = 'display:none';
|
||||
}
|
||||
} else {
|
||||
$autorefresh_img = html_print_image(
|
||||
'images/header_refresh_disabled_gray.png',
|
||||
true,
|
||||
[
|
||||
'class' => 'bot autorefresh_disabled',
|
||||
'alt' => 'lightning',
|
||||
'title' => __('Disabled autorefresh'),
|
||||
]
|
||||
);
|
||||
|
||||
echo '</a>';
|
||||
?>
|
||||
</td>
|
||||
-->
|
||||
</tr>
|
||||
</table>
|
||||
$ignored_params['refr'] = false;
|
||||
|
||||
$autorefresh_link_open_img = '';
|
||||
$autorefresh_link_open_txt = '';
|
||||
$autorefresh_link_close = '';
|
||||
|
||||
$display_counter = 'display:none';
|
||||
}
|
||||
|
||||
$header_autorefresh = '<div id="header_autorefresh">';
|
||||
$header_autorefresh .= $autorefresh_link_open_img;
|
||||
$header_autorefresh .= $autorefresh_img;
|
||||
$header_autorefresh .= $autorefresh_link_close;
|
||||
$header_autorefresh .= '</div>';
|
||||
|
||||
$header_autorefresh_counter = '<div id="header_autorefresh_counter" style="'.$display_counter.'">';
|
||||
$header_autorefresh_counter .= $autorefresh_link_open_txt;
|
||||
$header_autorefresh_counter .= $autorefresh_txt;
|
||||
$header_autorefresh_counter .= $autorefresh_link_close;
|
||||
$header_autorefresh_counter .= $autorefresh_additional;
|
||||
$header_autorefresh_counter .= '</div>';
|
||||
|
||||
|
||||
// Support.
|
||||
if (defined('PANDORA_ENTERPRISE')) {
|
||||
$header_support_link = 'https://support.artica.es/';
|
||||
} else {
|
||||
$header_support_link = 'https://pandorafms.com/forums/';
|
||||
}
|
||||
|
||||
$header_support = '<div id="header_support">';
|
||||
$header_support .= '<a href="'.$header_support_link.'" target="_blank">';
|
||||
$header_support .= html_print_image('/images/header_support.png', true, ['title' => __('Go to support'), 'class' => 'bot', 'alt' => 'user']);
|
||||
$header_support .= '</a></div>';
|
||||
|
||||
// Documentation.
|
||||
$header_docu = '<div id="header_support">';
|
||||
$header_docu .= '<a href="https://wiki.pandorafms.com/index.php?title=Main_Page" target="_blank">';
|
||||
$header_docu .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']);
|
||||
$header_docu .= '</a></div>';
|
||||
|
||||
|
||||
// User.
|
||||
if (is_user_admin($config['id_user']) == 1) {
|
||||
$header_user = html_print_image(
|
||||
'images/header_user_admin_green.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Edit my user'),
|
||||
'class' => 'bot',
|
||||
'alt' => 'user',
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$header_user = html_print_image(
|
||||
'images/header_user_green.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Edit my user'),
|
||||
'class' => 'bot',
|
||||
'alt' => 'user',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$header_user = '<div id="header_user"><a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$header_user.'<span> ('.$config['id_user'].')</span></a></div>';
|
||||
|
||||
// Logout.
|
||||
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
|
||||
$header_logout .= html_print_image(
|
||||
'images/header_logout_gray.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Logout'),
|
||||
'class' => 'bot',
|
||||
'title' => __('Logout'),
|
||||
]
|
||||
);
|
||||
$header_logout .= '</a></div>';
|
||||
|
||||
echo '<div class="header_left"><span class="header_title">'.$config['custom_title_header'].'</span><span class="header_subtitle">'.$config['custom_subtitle_header'].'</span></div>
|
||||
<div class="header_center">'.$header_searchbar.'</div>
|
||||
<div class="header_right">'.$header_chat, $header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||
?>
|
||||
</div> <!-- Closes #table_header_inner -->
|
||||
</div> <!-- Closes #table_header -->
|
||||
|
||||
|
||||
<!-- Notifications content wrapper-->
|
||||
<div id='notification-content' style='display:none;' /></div>
|
||||
|
||||
<!-- Old style div wrapper -->
|
||||
<div id="alert_messages" style="display: none"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
@ -381,14 +350,230 @@ config_check();
|
||||
if (isset($config['fixed_header'])) {
|
||||
$config_fixed_header = $config['fixed_header'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
function addNotifications(event) {
|
||||
var element = document.getElementById("notification-content");
|
||||
if (!element) {
|
||||
console.error('Cannot locate the notification content element.');
|
||||
return;
|
||||
}
|
||||
// If notification-content is empty, retrieve the notifications.
|
||||
if (!element.firstChild) {
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/setup/setup_notifications",
|
||||
"get_notifications_dropdown" : 1,
|
||||
},
|
||||
function (data, status) {
|
||||
// Apppend data
|
||||
element.innerHTML = data;
|
||||
// Show the content
|
||||
element.style.display = "block";
|
||||
attatch_to_image();
|
||||
},
|
||||
"html"
|
||||
);
|
||||
} else {
|
||||
// If there is some notifications retrieved, only show it.
|
||||
element.style.display = "block";
|
||||
attatch_to_image();
|
||||
}
|
||||
}
|
||||
|
||||
function attatch_to_image() {
|
||||
var notification_elem = document.getElementById("notification-wrapper");
|
||||
if (!notification_elem) return;
|
||||
var image_attached =
|
||||
document.getElementById("notification-ball-header")
|
||||
.getBoundingClientRect()
|
||||
.left
|
||||
;
|
||||
notification_elem.style.left = image_attached - 300 + "px";
|
||||
}
|
||||
|
||||
function notifications_clean_ui(action, self_id) {
|
||||
switch(action) {
|
||||
case 'item':
|
||||
// Recalculate the notification ball.
|
||||
check_new_notifications();
|
||||
break;
|
||||
case 'toast':
|
||||
// Only remove the toast element.
|
||||
document.getElementById(self_id).remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function notifications_hide() {
|
||||
var element = document.getElementById("notification-content");
|
||||
element.style.display = "none"
|
||||
}
|
||||
|
||||
function click_on_notification_toast(event) {
|
||||
var match = /notification-(.*)-id-([0-9]+)/.exec(event.target.id);
|
||||
if (!match) {
|
||||
console.error(
|
||||
"Cannot handle toast click event. Id not valid: ",
|
||||
event.target.id
|
||||
);
|
||||
return;
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/setup/setup_notifications",
|
||||
"mark_notification_as_read" : 1,
|
||||
"message": match[2]
|
||||
},
|
||||
function (data, status) {
|
||||
if (!data.result) {
|
||||
console.error("Cannot redirect to URL.");
|
||||
return;
|
||||
}
|
||||
notifications_clean_ui(match[1], event.target.id);
|
||||
},
|
||||
"json"
|
||||
)
|
||||
.fail(function(xhr, textStatus, errorThrown){
|
||||
console.error(
|
||||
"Failed onclik event on toast. Error: ",
|
||||
xhr.responseText
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function print_toast(title, subtitle, severity, url, id, onclick) {
|
||||
// TODO severity.
|
||||
severity = '';
|
||||
|
||||
// Start the toast.
|
||||
var toast = document.createElement('a');
|
||||
toast.setAttribute('onclick', onclick);
|
||||
toast.setAttribute('href', url);
|
||||
toast.setAttribute('target', '_blank');
|
||||
|
||||
// Fill toast.
|
||||
var toast_div = document.createElement('div');
|
||||
toast_div.className = 'snackbar ' + severity;
|
||||
toast_div.id = id;
|
||||
var toast_title = document.createElement('h3');
|
||||
var toast_text = document.createElement('p');
|
||||
toast_title.innerHTML = title;
|
||||
toast_text.innerHTML = subtitle;
|
||||
toast_div.appendChild(toast_title);
|
||||
toast_div.appendChild(toast_text);
|
||||
toast.appendChild(toast_div);
|
||||
|
||||
// Show and program the hide event.
|
||||
toast_div.className = toast_div.className + ' show';
|
||||
setTimeout(function(){
|
||||
toast_div.className = toast_div.className.replace("show", "");
|
||||
}, 8000);
|
||||
|
||||
return toast;
|
||||
}
|
||||
|
||||
function check_new_notifications() {
|
||||
var last_id = document.getElementById('notification-ball-header')
|
||||
.getAttribute('last_id');
|
||||
if (last_id === null) {
|
||||
console.error('Cannot retrieve notifications ball last_id.');
|
||||
return;
|
||||
}
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/setup/setup_notifications",
|
||||
"check_new_notifications" : 1,
|
||||
"last_id": last_id
|
||||
},
|
||||
function (data, status) {
|
||||
// Clean the toasts wrapper at first.
|
||||
var toast_wrapper = document.getElementById(
|
||||
'notifications-toasts-wrapper'
|
||||
);
|
||||
if (toast_wrapper === null) {
|
||||
console.error('Cannot place toast notifications.');
|
||||
return;
|
||||
}
|
||||
while (toast_wrapper.firstChild) {
|
||||
toast_wrapper.removeChild(toast_wrapper.firstChild);
|
||||
}
|
||||
|
||||
// Return if no new notification.
|
||||
if(!data.has_new_notifications) return;
|
||||
|
||||
// Substitute the ball
|
||||
var new_ball = atob(data.new_ball);
|
||||
var ball_wrapper = document
|
||||
.getElementById('notification-ball-header')
|
||||
.parentElement;
|
||||
if (ball_wrapper === null) {
|
||||
console.error('Cannot update notification ball');
|
||||
return;
|
||||
}
|
||||
// Print the new ball and clean old notifications
|
||||
ball_wrapper.innerHTML = new_ball;
|
||||
var not_drop = document.getElementById('notification-content');
|
||||
while (not_drop.firstChild && not_drop) {
|
||||
not_drop.removeChild(not_drop.firstChild);
|
||||
}
|
||||
|
||||
// Add the new toasts.
|
||||
if (Array.isArray(data.new_notifications)) {
|
||||
data.new_notifications.forEach(function(ele) {
|
||||
toast_wrapper.appendChild(
|
||||
print_toast(
|
||||
ele.subject,
|
||||
ele.mensaje,
|
||||
ele.criticity,
|
||||
ele.full_url,
|
||||
'notification-toast-id-' + ele.id_mensaje,
|
||||
'click_on_notification_toast(event)'
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
.fail(function(xhr, textStatus, errorThrown){
|
||||
console.error(
|
||||
"Cannot get new notifications. Error: ",
|
||||
xhr.responseText
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Resize event
|
||||
window.addEventListener("resize", function() {
|
||||
attatch_to_image();
|
||||
});
|
||||
|
||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||
|
||||
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
|
||||
$(document).ready (function () {
|
||||
|
||||
// Check new notifications on a periodic way
|
||||
setInterval(check_new_notifications, 10000);
|
||||
|
||||
// Print the wrapper for notifications
|
||||
var notifications_toasts_wrapper = document.createElement('div');
|
||||
notifications_toasts_wrapper.id = 'notifications-toasts-wrapper';
|
||||
document.body.insertBefore(
|
||||
notifications_toasts_wrapper,
|
||||
document.body.firstChild
|
||||
);
|
||||
|
||||
<?php
|
||||
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET['refr']))) {
|
||||
if (($autorefresh_list !== null)
|
||||
&& (array_search(
|
||||
$_GET['sec2'],
|
||||
$autorefresh_list
|
||||
) !== false) && (!isset($_GET['refr']))
|
||||
) {
|
||||
$do_refresh = true;
|
||||
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
|
||||
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
|
||||
@ -401,24 +586,6 @@ config_check();
|
||||
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
|
||||
if ($do_refresh) {
|
||||
?>
|
||||
$("a.autorefresh_txt").toggle ();
|
||||
$("#combo_refr").toggle ();
|
||||
$("#combo_refr").css('padding-right', '9px');
|
||||
href = $("a.autorefresh").attr ("href");
|
||||
<?php
|
||||
if ($select[0]['time_autorefresh']) {
|
||||
?>
|
||||
var refresh = '<?php echo $select[0]['time_autorefresh']; ?>';
|
||||
$(document).attr ("location", href + refresh);
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -439,41 +606,21 @@ config_check();
|
||||
$("#agent_access").css("display","");
|
||||
});
|
||||
|
||||
function blinkmail(){
|
||||
$("#yougotmail").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkmail);
|
||||
}
|
||||
function blinkalert(){
|
||||
$("#yougotalert").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkalert);
|
||||
}
|
||||
function blinkpubli(){
|
||||
$(".publienterprise").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkpubli);
|
||||
}
|
||||
<?php
|
||||
if ($msg_cnt > 0) {
|
||||
?>
|
||||
blinkmail();
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if ($config['alert_cnt'] > 0) {
|
||||
?>
|
||||
blinkalert();
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
blinkpubli();
|
||||
|
||||
blinkpubli();
|
||||
|
||||
<?php
|
||||
if ($_GET['refr']) {
|
||||
if ($_GET['refr'] || $do_refresh === true) {
|
||||
?>
|
||||
$("#header_autorefresh").css('padding-right', '5px');
|
||||
var refr_time = <?php echo (int) get_parameter('refr', 0); ?>;
|
||||
var t = new Date();
|
||||
t.setTime (t.getTime () +
|
||||
parseInt(<?php echo ($config['refr'] * 1000); ?>));
|
||||
$("#refrcounter").countdown ({until: t,
|
||||
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
|
||||
$("#refrcounter").countdown ({
|
||||
until: t,
|
||||
layout: '%M%nn%M:%S%nn%S',
|
||||
labels: ['', '', '', '', '', '', ''],
|
||||
onExpiry: function () {
|
||||
@ -489,7 +636,6 @@ config_check();
|
||||
$("a.autorefresh").click (function () {
|
||||
$("a.autorefresh_txt").toggle ();
|
||||
$("#combo_refr").toggle ();
|
||||
$("#combo_refr").css('padding-right', '9px');
|
||||
$("select#ref").change (function () {
|
||||
href = $("a.autorefresh").attr ("href");
|
||||
$(document).attr ("location", href + this.value);
|
||||
|
@ -82,42 +82,30 @@ if (!empty($page) && !empty($sec)) {
|
||||
}
|
||||
|
||||
$login_body_style = '';
|
||||
// Overrides the default background with the defined by the user
|
||||
// Overrides the default background with the defined by the user.
|
||||
if (!empty($config['login_background'])) {
|
||||
$background_url = 'images/backgrounds/'.$config['login_background'];
|
||||
$login_body_style = "style=\"background-image: url('$background_url');\"";
|
||||
$login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\"";
|
||||
}
|
||||
|
||||
// Get the custom icons
|
||||
// Get the custom icons.
|
||||
$docs_logo = ui_get_docs_logo();
|
||||
$support_logo = ui_get_support_logo();
|
||||
echo '<div id="login_body" '.$login_body_style.'>';
|
||||
echo '<div id="header_login">';
|
||||
echo '<div id="icon_custom_pandora">';
|
||||
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
if (isset($config['custom_logo'])) {
|
||||
echo '<img src="enterprise/images/custom_logo/'.$config['custom_logo'].'" alt="monitoring_console">';
|
||||
} else {
|
||||
echo '<img src="images/custom_logo/pandora_logo_head_4.png" alt="monitoring_console">';
|
||||
}
|
||||
} else {
|
||||
echo '<img src="images/custom_logo/pandora_logo_head_3.png" alt="monitoring_console">';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '<div id="list_icon_docs_support"><ul style="line-height: 36px;">';
|
||||
echo '<div id="list_icon_docs_support"><ul>';
|
||||
if ($docs_logo !== false) {
|
||||
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
||||
}
|
||||
|
||||
echo '<li><a style="color: white; font-size:inherit;" href="'.$config['custom_docs_url'].'" target="_blank">'.__('Docs').'</li>';
|
||||
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank">'.__('Docs').'</li>';
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
if ($support_logo !== false) {
|
||||
echo '<li id="li_margin_left"><a href="'.$config['custom_support_url'].'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
}
|
||||
|
||||
echo '<li><a style="color: white; font-size:inherit;" href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
|
||||
echo '<li><a href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
|
||||
} else {
|
||||
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
echo '<li>'.__('Support').'</li>';
|
||||
@ -151,7 +139,8 @@ if (defined('METACONSOLE')) {
|
||||
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
}
|
||||
|
||||
echo "<br><span style='font-size:120%;color:white;top:10px;position:relative;'>Community edition</span>";
|
||||
// I comment this in case in the future we put a logo without text.
|
||||
// echo "<br><span style='font-size:120%;color:white;top:10px;position:relative;'>Community edition</span>";.
|
||||
}
|
||||
|
||||
echo '</a></div>';
|
||||
@ -167,9 +156,6 @@ switch ($login_screen) {
|
||||
|
||||
if ($config['auth'] == 'saml') {
|
||||
echo '<div id="log_nick" class="login_nick" style="display: none;">';
|
||||
echo '<div>';
|
||||
html_print_image('/images/usuario_login.png', false);
|
||||
echo '</div>';
|
||||
html_print_input_text_extended(
|
||||
'nick',
|
||||
'',
|
||||
@ -184,9 +170,6 @@ switch ($login_screen) {
|
||||
echo '</div>';
|
||||
|
||||
echo '<div id="log_pass" class="login_pass" style="display: none;">';
|
||||
echo '<div>';
|
||||
html_print_image('/images/candado_login.png', false);
|
||||
echo '</div>';
|
||||
html_print_input_text_extended(
|
||||
'pass',
|
||||
'',
|
||||
@ -202,54 +185,48 @@ switch ($login_screen) {
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
echo '<div id="log_button" class="login_button" style="display: none; margin-bottom: 20px;">';
|
||||
echo '<div id="log_button" class="login_button" style="display: none;">';
|
||||
html_print_submit_button(__('Login as admin'), 'login_button', false, 'class="sub next_login"');
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="login_button" id="remove_button" style="margin-bottom: 20px;">';
|
||||
echo '<div class="login_button" id="remove_button">';
|
||||
echo '<input type="button" id="input_saml" value="Login as admin" onclick="show_normal_menu()">';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div class="login_button">';
|
||||
echo '<div class="login_button login_button_saml">';
|
||||
html_print_submit_button(__('Login with SAML'), 'login_button_saml', false, '');
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '<div class="login_nick">';
|
||||
echo '<div>';
|
||||
html_print_image('/images/usuario_login.png', false);
|
||||
echo '</div>';
|
||||
html_print_input_text_extended(
|
||||
'nick',
|
||||
'',
|
||||
'nick',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'autocomplete="off" placeholder="'.__('User').'"'
|
||||
);
|
||||
html_print_input_text_extended(
|
||||
'nick',
|
||||
'',
|
||||
'nick',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'autocomplete="off" placeholder="'.__('User').'"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '<div class="login_pass">';
|
||||
echo '<div>';
|
||||
html_print_image('/images/candado_login.png', false);
|
||||
echo '</div>';
|
||||
html_print_input_text_extended(
|
||||
'pass',
|
||||
'',
|
||||
'pass',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'autocomplete="off" placeholder="'.__('Password').'"',
|
||||
false,
|
||||
true
|
||||
);
|
||||
html_print_input_text_extended(
|
||||
'pass',
|
||||
'',
|
||||
'pass',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'autocomplete="off" placeholder="'.__('Password').'"',
|
||||
false,
|
||||
true
|
||||
);
|
||||
echo '</div>';
|
||||
echo '<div class="login_button">';
|
||||
html_print_submit_button(__('Login'), 'login_button', false, 'class="sub next_login"');
|
||||
html_print_submit_button(__('Login'), 'login_button', false, 'class="sub next_login"');
|
||||
echo '</div>';
|
||||
}
|
||||
break;
|
||||
@ -289,9 +266,9 @@ switch ($login_screen) {
|
||||
if ($config['enterprise_installed']) {
|
||||
if ($config['reset_pass_option']) {
|
||||
$reset_pass_link = 'reset_pass.php';
|
||||
// Reset password link
|
||||
echo '<div style="width:70%; height:40px; margin-right:auto; margin-left:auto; margin-top:20px; text-align:center;">';
|
||||
echo '<a style="color: white !important;" href="index.php?reset=true&first=true">'.__('Forgot your password?');
|
||||
// Reset password link.
|
||||
echo '<div class="reset_password">';
|
||||
echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?');
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
@ -328,12 +305,12 @@ if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
echo '<div class ="img_banner_login">';
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
if (isset($config['custom_splash_login'])) {
|
||||
html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0, 'title' => $splash_title], false, true);
|
||||
html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0], false, true);
|
||||
} else {
|
||||
html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true);
|
||||
html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);
|
||||
}
|
||||
} else {
|
||||
html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true);
|
||||
html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true);
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
@ -544,7 +521,7 @@ ui_require_jquery_file('jquery-ui.min');
|
||||
?>
|
||||
|
||||
<?php
|
||||
// Hidden div to forced title
|
||||
// Hidden div to forced title.
|
||||
html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', 'hidden' => true]);
|
||||
|
||||
// html_print_div(array('id' => 'modal_alert', 'hidden' => true));
|
||||
|
@ -1,26 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to self monitor Pandora FMS Console
|
||||
*
|
||||
* @category Main page
|
||||
* @package Pandora FMS
|
||||
* @subpackage Introduction
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU 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.
|
||||
// Config functions.
|
||||
require_once 'include/config.php';
|
||||
|
||||
// This solves problems in enterprise load
|
||||
// This solves problems in enterprise load.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
/*
|
||||
Call all extensions login function */
|
||||
// extensions_call_login_function ();
|
||||
require_once 'include/functions_reporting.php';
|
||||
require_once 'include/functions_tactical.php';
|
||||
require_once $config['homedir'].'/include/functions_graph.php';
|
||||
@ -29,8 +42,18 @@ if (tags_has_user_acl_tags()) {
|
||||
ui_print_tags_warning();
|
||||
}
|
||||
|
||||
$user_strict = (bool) db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
|
||||
$all_data = tactical_status_modules_agents($config['id_user'], $user_strict, 'AR', $user_strict);
|
||||
$user_strict = (bool) db_get_value(
|
||||
'strict_acl',
|
||||
'tusuario',
|
||||
'id_user',
|
||||
$config['id_user']
|
||||
);
|
||||
$all_data = tactical_status_modules_agents(
|
||||
$config['id_user'],
|
||||
$user_strict,
|
||||
'AR',
|
||||
$user_strict
|
||||
);
|
||||
$data = [];
|
||||
|
||||
$data['monitor_not_init'] = (int) $all_data['_monitors_not_init_'];
|
||||
@ -79,8 +102,10 @@ if (!empty($all_data)) {
|
||||
|
||||
$data['server_sanity'] = format_numeric((100 - $data['module_sanity']), 1);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<table border="0" width="100%">
|
||||
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
|
||||
<td width="25%" style="padding-right: 20px;" valign="top">
|
||||
@ -88,7 +113,7 @@ if (!empty($all_data)) {
|
||||
|
||||
<?php
|
||||
//
|
||||
// Overview Table
|
||||
// Overview Table.
|
||||
//
|
||||
$table = new stdClass();
|
||||
$table->class = 'databox';
|
||||
@ -101,12 +126,12 @@ if (!empty($all_data)) {
|
||||
$table->head[0] = '<span>'.__('%s Overview', get_product_name()).'</span>';
|
||||
$table->head_colspan[0] = 4;
|
||||
|
||||
// Indicators
|
||||
// Indicators.
|
||||
$tdata = [];
|
||||
$stats = reporting_get_stats_indicators($data, 120, 10, false);
|
||||
$status = '<table class="status_tactical">';
|
||||
foreach ($stats as $stat) {
|
||||
$status .= '<tr><td><b>'.$stat['title'].'</b>'.'</td><td>'.$stat['graph'].'</td></tr>';
|
||||
$status .= '<tr><td><b>'.$stat['title'].'</b></td><td>'.$stat['graph'].'</td></tr>';
|
||||
}
|
||||
|
||||
$status .= '</table>';
|
||||
@ -115,25 +140,25 @@ if (!empty($all_data)) {
|
||||
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Alerts
|
||||
// Alerts.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_alerts($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Modules by status
|
||||
// Modules by status.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_modules_status($data, 180, 100);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Total agents and modules
|
||||
// Total agents and modules.
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_agents_monitors($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Users
|
||||
// Users.
|
||||
if (users_is_admin()) {
|
||||
$tdata = [];
|
||||
$tdata[0] = reporting_get_stats_users($data);
|
||||
@ -160,7 +185,7 @@ if (!empty($all_data)) {
|
||||
|
||||
|
||||
if (!empty($news)) {
|
||||
// NEWS BOARD/////////////////////////////
|
||||
// NEWS BOARD.
|
||||
echo '<div id="news_board">';
|
||||
|
||||
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
|
||||
@ -184,20 +209,72 @@ if (!empty($all_data)) {
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
// News board
|
||||
// News board.
|
||||
echo '<br><br>';
|
||||
|
||||
// END OF NEWS BOARD/////////////////////////////
|
||||
// END OF NEWS BOARD.
|
||||
}
|
||||
|
||||
// LAST ACTIVITY/////////////////////////////
|
||||
// Show last activity from this user
|
||||
$nots = messages_get_overview('utimestamp', 'DESC', false);
|
||||
if (!empty($nots)) {
|
||||
// Notifications board.
|
||||
echo '<div id="notifications_board">';
|
||||
|
||||
echo '<table cellpadding="0" width=100% cellspacing="0" class="databox filters">';
|
||||
echo '<tr><th style="text-align:center;"><span >'.__('Pending notifications').'</span></th></tr>';
|
||||
if ($config['prominent_time'] == 'timestamp') {
|
||||
$comparation_suffix = '';
|
||||
} else {
|
||||
$comparation_suffix = __('ago');
|
||||
}
|
||||
|
||||
foreach ($nots as $msg) {
|
||||
$conversation = io_safe_output(
|
||||
messages_get_conversation($msg)
|
||||
);
|
||||
|
||||
if (is_array($conversation)) {
|
||||
$text = array_pop($conversation)['message'];
|
||||
} else {
|
||||
// Skip empty message.
|
||||
continue;
|
||||
}
|
||||
|
||||
$url = ui_get_full_url(
|
||||
'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$msg['id_mensaje']
|
||||
);
|
||||
if ($msg['url'] != '') {
|
||||
$url = $msg['url'];
|
||||
}
|
||||
|
||||
echo '<tr><th class="green_title">'.$msg['subject'].'</th></tr>';
|
||||
echo '<tr><td><a href="'.$url.'">';
|
||||
if ($msg['id_usuario_origen'] != '') {
|
||||
echo '<b>'.get_user_fullname($msg['id_usuario_origen']).'</b> ';
|
||||
}
|
||||
|
||||
echo '<i>'.ui_print_timestamp($msg['timestamp'], true).'</i> '.$comparation_suffix.'</a></td></tr>';
|
||||
echo '<tr><td class="datos">';
|
||||
echo nl2br($text);
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<br><br>';
|
||||
|
||||
// EO Notifications board.
|
||||
}
|
||||
|
||||
// LAST ACTIVITY.
|
||||
// Show last activity from this user.
|
||||
echo '<div id="activity">';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->class = 'databox data';
|
||||
$table->width = '100%';
|
||||
// Don't specify px
|
||||
// Don't specify px.
|
||||
$table->data = [];
|
||||
$table->size = [];
|
||||
$table->size[0] = '5%';
|
||||
@ -212,38 +289,14 @@ if (!empty($all_data)) {
|
||||
$table->head[3] = __('Source IP');
|
||||
$table->head[4] = __('Comments');
|
||||
$table->title = '<span>'.__('This is your last activity performed on the %s console', get_product_name()).'</span>';
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = sprintf(
|
||||
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
|
||||
$sql = sprintf(
|
||||
'SELECT id_usuario,accion, ip_origen,descripcion,utimestamp
|
||||
FROM tsesion
|
||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.")
|
||||
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10",
|
||||
$config['id_user']
|
||||
);
|
||||
break;
|
||||
$config['id_user']
|
||||
);
|
||||
|
||||
case 'postgresql':
|
||||
$sql = sprintf(
|
||||
"SELECT \"id_usuario\", accion, \"ip_origen\", descripcion, utimestamp
|
||||
FROM tsesion
|
||||
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_1WEEK.")
|
||||
AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10",
|
||||
$config['id_user']
|
||||
);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$sql = sprintf(
|
||||
"SELECT id_usuario, accion, ip_origen, descripcion, utimestamp
|
||||
FROM tsesion
|
||||
WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_1WEEK.")
|
||||
AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC",
|
||||
$config['id_user']
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$sessions = db_get_all_rows_sql($sql);
|
||||
|
||||
@ -253,24 +306,17 @@ if (!empty($all_data)) {
|
||||
|
||||
foreach ($sessions as $session) {
|
||||
$data = [];
|
||||
$session_id_usuario = $session['id_usuario'];
|
||||
$session_ip_origen = $session['ip_origen'];
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'oracle':
|
||||
$session_id_usuario = $session['id_usuario'];
|
||||
$session_ip_origen = $session['ip_origen'];
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$session_id_usuario = $session['id_usuario'];
|
||||
$session_ip_origen = $session['ip_origen'];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$data[0] = '<strong>'.$session_id_usuario.'</strong>';
|
||||
$data[1] = ui_print_session_action_icon($session['accion'], true).' '.$session['accion'];
|
||||
$data[2] = ui_print_help_tip(date($config['date_format'], $session['utimestamp']), true).human_time_comparation($session['utimestamp'], 'tiny');
|
||||
$data[2] = ui_print_help_tip(
|
||||
date($config['date_format'], $session['utimestamp']),
|
||||
true
|
||||
).human_time_comparation($session['utimestamp'], 'tiny');
|
||||
$data[3] = $session_ip_origen;
|
||||
$description = str_replace([',', ', '], ', ', $session['descripcion']);
|
||||
if (strlen($description) > 100) {
|
||||
@ -287,8 +333,7 @@ if (!empty($all_data)) {
|
||||
unset($table);
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
// activity
|
||||
// END OF LAST ACTIVIYY/////////////////////////////
|
||||
// END OF LAST ACTIVIYY.
|
||||
?>
|
||||
|
||||
|
||||
|
@ -16,16 +16,74 @@ if (! isset($config['id_user'])) {
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
var menuType_value = "<?php echo $config['menu_type']; ?>";
|
||||
|
||||
if (menuType_value == 'classic') {
|
||||
$('ul.submenu').css('left', '214px');
|
||||
}
|
||||
else{
|
||||
$('ul.submenu').css('left', '59px');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Set the height of the menu.
|
||||
$(window).on('load', function (){
|
||||
$("#menu_full").height($("#container").height());
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
$autohidden_menu = 0;
|
||||
|
||||
if (isset($config['autohidden_menu']) && $config['autohidden_menu']) {
|
||||
$autohidden_menu = 1;
|
||||
}
|
||||
|
||||
$menu_container_id = '';
|
||||
|
||||
// Menu container prepared to autohide menu
|
||||
echo '<div id="'.$menu_container_id.'">';
|
||||
if ($config['menu_type'] == 'classic') {
|
||||
echo '<div id="menu_full" class="menu_full_classic">';
|
||||
} else {
|
||||
echo '<div id="menu_full" class="menu_full_collapsed">';
|
||||
}
|
||||
|
||||
$custom_logo = 'images/custom_logo/'.$config['custom_logo'];
|
||||
$custom_logo_collapsed = 'images/custom_logo/'.$config['custom_logo_collapsed'];
|
||||
|
||||
if (!defined('PANDORA_ENTERPRISE')) {
|
||||
$logo_title = get_product_name().' Opensource';
|
||||
$custom_logo = 'images/custom_logo/pandora_logo_head_3.png';
|
||||
$custom_logo_collapsed = 'images/custom_logo/pandora_logo_green_collapsed.png';
|
||||
} else {
|
||||
if (file_exists(ENTERPRISE_DIR.'/'.$custom_logo)) {
|
||||
$custom_logo = ENTERPRISE_DIR.'/'.$custom_logo;
|
||||
}
|
||||
|
||||
$logo_title = get_product_name().' Enterprise';
|
||||
}
|
||||
|
||||
echo '<div class="logo_green"><a href="index.php?sec=main">';
|
||||
if (isset($config['custom_logo'])) {
|
||||
if ($config['menu_type'] == 'classic') {
|
||||
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:block']);
|
||||
} else {
|
||||
echo html_print_image($custom_logo, true, ['border' => '0', 'width' => '215', 'alt' => $logo_title, 'class' => 'logo_full', 'style' => 'display:none']);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['custom_logo_collapsed'])) {
|
||||
if ($config['menu_type'] == 'classic') {
|
||||
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:none']);
|
||||
} else {
|
||||
echo html_print_image($custom_logo_collapsed, true, ['border' => '0', 'width' => '60', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => 'display:block']);
|
||||
}
|
||||
}
|
||||
|
||||
echo '</a></div>';
|
||||
|
||||
// echo '<div class="tit bg titop">:: '.__('Operation').' ::</div>';
|
||||
require 'operation/menu.php';
|
||||
@ -45,16 +103,17 @@ if (check_acl($config['id_user'], 0, 'AW')
|
||||
|
||||
require 'godmode/menu.php';
|
||||
|
||||
if ($config['menu_type'] == 'classic') {
|
||||
echo '<div id="button_collapse" class="button_classic button_collapse"></div>';
|
||||
} else {
|
||||
echo '<div id="button_collapse" class="button_collapsed button_collapse"></div>';
|
||||
}
|
||||
|
||||
// require ("links_menu.php");
|
||||
echo '</div>';
|
||||
// menu_container
|
||||
ui_require_jquery_file('cookie');
|
||||
|
||||
$config_fixed_menu = false;
|
||||
if (isset($config['fixed_menu'])) {
|
||||
$config_fixed_menu = $config['fixed_menu'];
|
||||
}
|
||||
|
||||
$config_fixed_header = false;
|
||||
if (isset($config['fixed_header'])) {
|
||||
$config_fixed_header = $config['fixed_header'];
|
||||
@ -64,25 +123,55 @@ if (isset($config['fixed_header'])) {
|
||||
<script type="text/javascript" language="javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
$('#button_collapse').on('click', function() {
|
||||
|
||||
if($('#menu_full').hasClass('menu_full_classic')){
|
||||
localStorage.setItem("menuType", "collapsed");
|
||||
$('ul.submenu').css('left', '59px');
|
||||
var menuType_val = localStorage.getItem("menuType");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
menuType: menuType_val,
|
||||
page: "include/functions_menu"
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
}
|
||||
else if($('#menu_full').hasClass('menu_full_collapsed')){
|
||||
localStorage.setItem("menuType", "classic");
|
||||
$('ul.submenu').css('left', '214px');
|
||||
var menuType_val = localStorage.getItem("menuType");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
menuType: menuType_val,
|
||||
page: "include/functions_menu"
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
}
|
||||
|
||||
$('.logo_full').toggle();
|
||||
$('.logo_icon').toggle();
|
||||
$('#menu_full').toggleClass('menu_full_classic menu_full_collapsed');
|
||||
$('#button_collapse').toggleClass('button_classic button_collapsed');
|
||||
$('div#title_menu').toggleClass('title_menu_classic title_menu_collapsed');
|
||||
$('div#page').toggleClass('page_classic page_collapsed');
|
||||
$('#header_table').toggleClass('header_table_classic header_table_collapsed');
|
||||
$('li.menu_icon').toggleClass("no_hidden_menu menu_icon_collapsed");
|
||||
});
|
||||
|
||||
|
||||
var autohidden_menu = <?php echo $autohidden_menu; ?>;
|
||||
var fixed_menu = <?php echo json_encode((bool) $config_fixed_menu); ?>;
|
||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||
var id_user = "<?php echo $config['id_user']; ?>";
|
||||
var cookie_name = id_user + '-pandora_menu_state';
|
||||
var cookie_name_encoded = btoa(cookie_name);
|
||||
var click_display = "<?php echo $config['click_display']; ?>";
|
||||
var classic_menu = parseInt("<?php echo $config['classic_menu']; ?>");
|
||||
|
||||
if ((isNaN(classic_menu)) || (classic_menu == 0)) {
|
||||
classic_menu = false;
|
||||
}
|
||||
else {
|
||||
classic_menu = true;
|
||||
}
|
||||
|
||||
if (classic_menu) {
|
||||
autohidden_menu = 1;
|
||||
}
|
||||
|
||||
var menuState = $.cookie(cookie_name_encoded);
|
||||
if (!menuState) {
|
||||
@ -109,236 +198,7 @@ function close_submenus () {
|
||||
$('div.menu>ul>li.selected>ul').addClass('invisible');
|
||||
}
|
||||
|
||||
$(document).ready( function() {
|
||||
//Daniel maya 02/06/2016 Fixed menu position--INI
|
||||
if (fixed_menu) {
|
||||
$('div#menu')
|
||||
.css('position', 'fixed')
|
||||
.css('z-index', '9000')
|
||||
.css('top','80px')
|
||||
}else{
|
||||
$('div#menu')
|
||||
.css('z-index', '9000')
|
||||
}
|
||||
if (fixed_header) {
|
||||
$('div#menu')
|
||||
.css('position', 'fixed')
|
||||
.css('z-index', '9000')
|
||||
.css('top','80px')
|
||||
$('#menu_tab_frame_view').css('margin-top','20px')
|
||||
}
|
||||
//Daniel maya 02/06/2016 Fixed menu position--END
|
||||
/*
|
||||
$("img.toggle").click (function (e) {
|
||||
//In case the links gets activated, we don't want to follow link
|
||||
e.preventDefault();
|
||||
|
||||
var menuItem = $(this).parent();
|
||||
var submenu = menuItem.children("ul");
|
||||
|
||||
if (submenu.is(":visible")) {
|
||||
submenu.slideUp();
|
||||
|
||||
if (typeof menuState[menuItem.attr('id')] != 'undefined')
|
||||
delete menuState[menuItem.attr('id')];
|
||||
}
|
||||
else {
|
||||
submenu.slideDown();
|
||||
|
||||
menuState[menuItem.attr('id')] = 1;
|
||||
}
|
||||
|
||||
$.cookie(cookie_name_encoded, JSON.stringify(menuState), {expires: 7});
|
||||
});
|
||||
//Cerrar aqui los comentarios cuando esté el menu terminado
|
||||
if (fixed_menu) {
|
||||
$('div#menu')
|
||||
.css('position', 'fixed')
|
||||
.css('z-index', '9000')
|
||||
.css('left', '0')
|
||||
.css('top', $('div#head').innerHeight() + 'px')
|
||||
.css('height', '100%')
|
||||
.css('overflow', 'hidden')
|
||||
.hover(function (e) {
|
||||
if (!autohidden_menu) {
|
||||
$(this).css('overflow', 'auto').children('div').css('width', 'auto');
|
||||
}
|
||||
}, function (e) {
|
||||
if (!autohidden_menu) {
|
||||
$(this).css('overflow', 'hidden').children('div').css('width', '100%');
|
||||
}
|
||||
})
|
||||
.children('div')
|
||||
.css('margin-bottom', $('div#head').innerHeight() + 'px');
|
||||
|
||||
if (!fixed_header) {
|
||||
$(window).scroll(function () {
|
||||
if ($(this).scrollTop() <= $('div#head').innerHeight()) {
|
||||
$('div#menu').css('top', $('div#head').innerHeight() - $(this).scrollTop() + 'px' );
|
||||
} else {
|
||||
$('div#menu').css('top', '0');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function show_menu () {
|
||||
$('#menu_container').animate({"left": "+=80px"}, 200, function () {
|
||||
if (fixed_menu) {
|
||||
$('#menu_container').parent().css('overflow', 'auto');
|
||||
}
|
||||
});
|
||||
//show_menu_pretty();
|
||||
}
|
||||
|
||||
function show_menu_pretty() {
|
||||
open_submenus();
|
||||
$('div.menu ul li').css('background-position', '');
|
||||
$('ul.submenu li a, li.menu_icon a, li.links a, div.menu>ul>li>img.toggle').show();
|
||||
$('.titop').css('color', 'white');
|
||||
$('.bg3').css('color', 'white');
|
||||
$('.bg4').css('color', 'white');
|
||||
}
|
||||
|
||||
function hide_menu () {
|
||||
if (fixed_menu) {
|
||||
$('#menu_container').parent().css('overflow', 'hidden');
|
||||
}
|
||||
$('#menu_container').animate({"left": "-=80px"}, 100);
|
||||
//hide_menu_pretty();
|
||||
}
|
||||
|
||||
function hide_menu_pretty() {
|
||||
close_submenus();
|
||||
$('div.menu li').css('background-position', '85px 5px');
|
||||
$('ul.submenu li a, li.menu_icon a, li.links a, div.menu>ul>li>img.toggle').hide();
|
||||
$('.titop').css('color', $('.titop').css('background-color'));
|
||||
$('.bg3').css('color', $('.bg3').css('background-color'));
|
||||
$('.bg4').css('color', $('.bg4').css('background-color'));
|
||||
}
|
||||
*/
|
||||
if (autohidden_menu) {
|
||||
|
||||
//handlerIn, handlerOut);
|
||||
//openTime = 0;
|
||||
//handsIn = 0;
|
||||
|
||||
//$('#main').css('margin-left', '50px');
|
||||
//hide_menu_pretty();
|
||||
/*
|
||||
$('#menu').hover(function() {
|
||||
handsIn = 1;
|
||||
if (openTime == 0) {
|
||||
show_menu();
|
||||
openTime = new Date().getTime();
|
||||
}
|
||||
}).mouseleave(function() {
|
||||
handsIn = 0;
|
||||
setTimeout(function() {
|
||||
openedTime = new Date().getTime() - openTime;
|
||||
if(openedTime > 3000 && handsIn == 0) {
|
||||
hide_menu();
|
||||
openTime = 0;
|
||||
}
|
||||
}, 3500);
|
||||
});
|
||||
*/
|
||||
handsInMenu = 0;
|
||||
openTimeMenu = 0;
|
||||
if (classic_menu) {
|
||||
$('div#title_menu').show();
|
||||
handsInMenu = 1;
|
||||
openTimeMenu = new Date().getTime();
|
||||
$('#menu').css('width', '145px');
|
||||
$('#menu').css('position', 'block');
|
||||
$('div#menu').css('top', '80px');
|
||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '144px');
|
||||
|
||||
$('#menu').mouseleave(function() {
|
||||
handsInMenu = 0;
|
||||
setTimeout(function() {
|
||||
openedMenu = new Date().getTime() - openTimeMenu;
|
||||
if(openedMenu > 1000 && handsInMenu == 0) {
|
||||
$('#menu').css('width', '145px');
|
||||
$('#menu').css('position', 'block');
|
||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '144px');
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
}
|
||||
else {
|
||||
if(!click_display){
|
||||
$('#menu').mouseenter(function() {
|
||||
$('div#title_menu').show();
|
||||
handsInMenu = 1;
|
||||
openTimeMenu = new Date().getTime();
|
||||
$('#menu').css('width', '145px');
|
||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||
$('li.menu_icon').find('li').addClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '144px');
|
||||
}).mouseleave(function() {
|
||||
handsInMenu = 0;
|
||||
setTimeout(function() {
|
||||
openedMenu = new Date().getTime() - openTimeMenu;
|
||||
if(openedMenu > 1000 && handsInMenu == 0) {
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('li.menu_icon').find('li').removeClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
}else{
|
||||
$(document).ready(function() {
|
||||
$('#menu').on("click", function() {
|
||||
$('div#title_menu').show();
|
||||
handsInMenu = 1;
|
||||
openTimeMenu = new Date().getTime();
|
||||
$('#menu').css('width', '145px');
|
||||
$('li.menu_icon').addClass( " no_hidden_menu" );
|
||||
$('li.menu_icon').find('li').addClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '144px');
|
||||
}).mouseleave(function() {
|
||||
handsInMenu = 0;
|
||||
setTimeout(function() {
|
||||
openedMenu = new Date().getTime() - openTimeMenu;
|
||||
if(openedMenu > 1000 && handsInMenu == 0) {
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('li.menu_icon').find('li').removeClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
}
|
||||
}, 5500);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$('div#title_menu').hide();
|
||||
if(!click_display){
|
||||
$('#menu').mouseenter(function() {
|
||||
handsInMenu = 1;
|
||||
openTimeMenu = new Date().getTime();
|
||||
$('ul.submenu').css('left', '44px');
|
||||
}).mouseleave(function() {
|
||||
handsInMenu = 0;
|
||||
setTimeout(function() {
|
||||
openedMenu = new Date().getTime() - openTimeMenu;
|
||||
if(openedMenu > 1000 && handsInMenu == 0) {
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('li.menu_icon').find('li').removeClass( " no_hidden_menu" );
|
||||
$('ul.submenu').css('left', '44px');
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
||||
@ -348,182 +208,199 @@ $(document).ready( function() {
|
||||
handsIn = 0;
|
||||
handsIn2 = 0;
|
||||
|
||||
if(!click_display){
|
||||
$('.menu_icon').mouseenter(function() {
|
||||
|
||||
/**
|
||||
* Positionate the submenu elements. Add a negative top.
|
||||
*
|
||||
* @param int index It is the position of li.menu_icon in the ul.
|
||||
* @param string id_submenu It is the id of first level submenu.
|
||||
* @param string id_submenu2 It is the id of second level submenu.
|
||||
* @param int item_height It is the height of a menu item (28 o 35).
|
||||
*
|
||||
* @return (int) The position (in px).
|
||||
*/
|
||||
function menu_calculate_top(index, id_submenu, id_submenu2, item_height){
|
||||
|
||||
var level1 = index;
|
||||
var level2 = $('#'+id_submenu+' ul.submenu > li').length;
|
||||
var level3 = $('#'+id_submenu2+' > li.sub_subMenu').length;
|
||||
var item_height = item_height;
|
||||
|
||||
level2--;
|
||||
if (id_submenu2 !== false) {
|
||||
// If level3 is set, the position is calculated like box is in the center.
|
||||
// wiouth considering level2 box can be moved.
|
||||
level3--;
|
||||
total = (level1 + level3);
|
||||
comp = level3;
|
||||
} else {
|
||||
total = (level1 + level2);
|
||||
comp = level2;
|
||||
}
|
||||
|
||||
// Positionate in the middle
|
||||
if (total > 12 && ((total < 18) || ((level1 - comp) <= 4))) {
|
||||
return - ( Math.floor(comp / 2) * item_height);
|
||||
}
|
||||
|
||||
// Positionate in the bottom
|
||||
if (total >= 18) {
|
||||
return (- comp * item_height);
|
||||
}
|
||||
|
||||
// return 0 by default
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the menu items to be positioned.
|
||||
*
|
||||
* @param string item It is the selector of the current element.
|
||||
*
|
||||
* @return Add the top position in a inline style.
|
||||
*/
|
||||
function get_menu_items(item){
|
||||
var item_height = parseInt(item.css('min-height'));
|
||||
var id_submenu = item.attr('id');
|
||||
var id_submenu2 = false;
|
||||
var index = item.index();
|
||||
|
||||
if(item.parent().hasClass('godmode')){
|
||||
index = index+6; // This is because the menu has divided in two parts.
|
||||
}
|
||||
var top_submenu = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
|
||||
top_submenu = top_submenu+'px';
|
||||
$('#'+id_submenu+' ul.submenu').css('top', top_submenu);
|
||||
|
||||
$('.has_submenu').mouseenter(function() {
|
||||
id_submenu2 = item.attr('id');
|
||||
id_submenu2 = $('#'+id_submenu2+' ul.submenu2').attr('id');
|
||||
var top_submenu2 = menu_calculate_top(index, id_submenu, id_submenu2, item_height);
|
||||
top_submenu2 = top_submenu2+'px';
|
||||
$('#'+id_submenu2).css('top', top_submenu2);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Show and hide submenus
|
||||
*/
|
||||
if(!click_display){
|
||||
$('.menu_icon').mouseenter(function() {
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
get_menu_items(table_hover);
|
||||
if( typeof(table_noHover) != 'undefined')
|
||||
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
}).mouseleave(function() {
|
||||
table_noHover = $(this);
|
||||
handsIn = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime;
|
||||
if(opened > 3000 && handsIn == 0) {
|
||||
openTime = 4000;
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
}
|
||||
}, 2500);
|
||||
});
|
||||
}else{
|
||||
$(document).ready(function() {
|
||||
if (autohidden_menu) {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
if( typeof(table_noHover) != 'undefined')
|
||||
if ( "ul#sub"+table_hover[0].id != "ul#sub"+table_noHover[0].id )
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
get_menu_items(table_hover);
|
||||
}).mouseleave(function() {
|
||||
table_noHover = $(this);
|
||||
handsIn = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime;
|
||||
if(opened > 3000 && handsIn == 0) {
|
||||
openTime = 4000;
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if(opened > 5000 && handsIn == 0) {
|
||||
openTime = 6000;
|
||||
$("ul#sub"+table_noHover[0].id).hide();
|
||||
}
|
||||
}, 2500);
|
||||
}, 5500);
|
||||
});
|
||||
} else {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
get_menu_items(table_hover);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.has_submenu').mouseenter(function() {
|
||||
table_hover2 = $(this);
|
||||
handsIn2 = 1;
|
||||
openTime2 = new Date().getTime();
|
||||
$("#sub"+table_hover2[0].id).show();
|
||||
if( typeof(table_noHover2) != 'undefined')
|
||||
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
|
||||
$("ul#sub"+table_noHover2[0].id).hide();
|
||||
}).mouseleave(function() {
|
||||
table_noHover2 = table_hover2;
|
||||
handsIn2 = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime2;
|
||||
if(opened >= 3000 && handsIn2 == 0) {
|
||||
openTime2 = 4000;
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
}
|
||||
}, 3500);
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
if(!click_display){
|
||||
$('#container').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
}else{
|
||||
$(document).ready(function() {
|
||||
if (autohidden_menu) {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
}).mouseleave(function() {
|
||||
table_noHover = $(this);
|
||||
handsIn = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime;
|
||||
if(opened > 5000 && handsIn == 0) {
|
||||
openTime = 6000;
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
}, 5500);
|
||||
});
|
||||
} else {
|
||||
$('.menu_icon').on("click", function() {
|
||||
if( typeof(table_hover) != 'undefined'){
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
}
|
||||
table_hover = $(this);
|
||||
handsIn = 1;
|
||||
openTime = new Date().getTime();
|
||||
$("ul#sub"+table_hover[0].id).show();
|
||||
});
|
||||
}
|
||||
$('#main').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
}
|
||||
|
||||
- $('.has_submenu').mouseenter(function() {
|
||||
table_hover2 = $(this);
|
||||
handsIn2 = 1;
|
||||
openTime2 = new Date().getTime();
|
||||
$("#sub"+table_hover2[0].id).show();
|
||||
if( typeof(table_noHover2) != 'undefined')
|
||||
if ( "ul#sub"+table_hover2[0].id != "ul#sub"+table_noHover2[0].id )
|
||||
$("ul#sub"+table_noHover2[0].id).hide();
|
||||
}).mouseleave(function() {
|
||||
table_noHover2 = table_hover2;
|
||||
handsIn2 = 0;
|
||||
setTimeout(function() {
|
||||
opened = new Date().getTime() - openTime2;
|
||||
if(opened >= 3000 && handsIn2 == 0) {
|
||||
openTime2 = 4000;
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
}
|
||||
}, 3500);
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
if (!classic_menu) {
|
||||
//Daniel maya 02/06/2016 Display menu with click --INI
|
||||
if(!click_display){
|
||||
$('#container').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
});
|
||||
}else{
|
||||
$('#main').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
});
|
||||
}
|
||||
//Daniel maya 02/06/2016 Display menu with click --END
|
||||
}
|
||||
else {
|
||||
if(!click_display){
|
||||
$('#container').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '145px');
|
||||
$('ul.submenu').css('left', '144px');
|
||||
});
|
||||
}else{
|
||||
$('#main').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '145px');
|
||||
$('ul.submenu').css('left', '144px');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('div.menu>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
|
||||
if (classic_menu) {
|
||||
$('div.menu>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('ul.submenu').css('left', '144px');
|
||||
});
|
||||
|
||||
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('ul.submenu').css('left', '144px');
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('div.menu>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
});
|
||||
|
||||
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
$('#menu').css('width', '45px');
|
||||
$('li.menu_icon').removeClass( " no_hidden_menu");
|
||||
$('ul.submenu').css('left', '44px');
|
||||
$('div#title_menu').hide();
|
||||
});
|
||||
}
|
||||
$('div.menu>ul>li>ul>li>ul>li>a').click(function() {
|
||||
openTime = 4000;
|
||||
if( typeof(table_hover) != 'undefined')
|
||||
$("ul#sub"+table_hover[0].id).hide();
|
||||
if( typeof(table_hover2) != 'undefined')
|
||||
$("ul#sub"+table_hover2[0].id).hide();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
113
pandora_console/general/mysqlerr.php
Normal file
113
pandora_console/general/mysqlerr.php
Normal file
@ -0,0 +1,113 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<style>
|
||||
|
||||
#alert_messages_na{
|
||||
-moz-border-bottom-right-radius: 5px;
|
||||
-webkit-border-bottom-left-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
z-index:2;
|
||||
position:fixed;
|
||||
width:700px;
|
||||
background:white;
|
||||
left:50%;
|
||||
top:20%;
|
||||
margin-left:-350px;
|
||||
|
||||
}
|
||||
|
||||
.modalheade{
|
||||
text-align:center;
|
||||
width:100%;
|
||||
height:37px;
|
||||
left:0px;
|
||||
background-color:#82b92e;
|
||||
}
|
||||
.modalheadertex{
|
||||
color:white;
|
||||
position:relative;
|
||||
font-family:Nunito;
|
||||
font-size:13pt;
|
||||
top:8px;
|
||||
}
|
||||
|
||||
.modalconten{
|
||||
color:black;
|
||||
background:white;
|
||||
}
|
||||
.modalcontentim{
|
||||
float:left;
|
||||
margin-left:30px;
|
||||
margin-top:30px;
|
||||
margin-bottom:30px;
|
||||
}
|
||||
.modalcontenttex{
|
||||
float:left;
|
||||
text-align:justify;
|
||||
color:black;
|
||||
font-size: 9.5pt;
|
||||
line-height:13pt;
|
||||
margin-top:40px;
|
||||
width:430px;
|
||||
margin-left:30px;
|
||||
}
|
||||
.modalwikibutto{
|
||||
cursor:pointer;
|
||||
text-align:center;
|
||||
margin-right:45px;
|
||||
float:right;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
margin-bottom:30px;
|
||||
border-radius: 3px;
|
||||
width:170px;
|
||||
height:30px;
|
||||
border: 1px solid #82b92e;
|
||||
margin-top:8%;
|
||||
background-color:#82b92e;
|
||||
}
|
||||
.modalwikibuttontex{
|
||||
color:#ffffff;
|
||||
font-family:Nunito;
|
||||
font-size:10pt;
|
||||
position:relative;
|
||||
top:6px;
|
||||
}
|
||||
|
||||
#opacity{
|
||||
background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="alert_messages_na">
|
||||
|
||||
<div class='modalheade'>
|
||||
<span class='modalheadertex'>
|
||||
<?php echo __('Database error'); ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class='modalconten'>
|
||||
<img class='modalcontentim' src='<?php echo $config['homeurl']; ?>/images/mysqlerr.png'>
|
||||
<div class='modalcontenttex'>
|
||||
<?php
|
||||
echo __('Failure to connect to Database server, please check the configuration file config.php or contact system administrator if you need assistance.');
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<a href='https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration' target='_blank'>
|
||||
<div class='modalwikibutto cerrar'>
|
||||
<span class='modalwikibuttontex'> <?php echo __('Documentation'); ?></span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="opacity"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -229,14 +229,14 @@ if (!$new_agent) {
|
||||
$table->data[0][1] .= " <span align='right'><a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=$id_agente&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
|
||||
}
|
||||
|
||||
$table->data[1][0] = __('Alias');
|
||||
$table->data[1][0] = __('Alias').ui_print_help_tip(__('Characters /,\,|,%,#,&,$ will be ignored'), true).'</span>';
|
||||
$table->data[1][1] = html_print_input_text('alias', $alias, '', 50, 100, true);
|
||||
if ($new_agent) {
|
||||
$table->data[1][1] .= html_print_checkbox('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name');
|
||||
}
|
||||
|
||||
$table->data[2][0] = __('IP Address');
|
||||
$table->data[2][1] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true);
|
||||
$table->data[2][1] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true).html_print_checkbox('unique_ip', 1, $config['unique_ip'], true).__('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
|
||||
|
||||
if ($id_agente) {
|
||||
$table->data[2][1] .= ' ';
|
||||
@ -708,6 +708,13 @@ foreach ($fields as $field) {
|
||||
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
|
||||
true
|
||||
);
|
||||
$combo = [];
|
||||
$combo = $field['combo_values'];
|
||||
$combo = explode(',', $combo);
|
||||
$combo_values = [];
|
||||
foreach ($combo as $value) {
|
||||
$combo_values[$value] = $value;
|
||||
}
|
||||
|
||||
$custom_value = db_get_value_filter(
|
||||
'description',
|
||||
@ -747,6 +754,28 @@ foreach ($fields as $field) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($field['combo_values'] !== '') {
|
||||
$data[1] = html_print_select(
|
||||
$combo_values,
|
||||
'customvalue_'.$field['id_field'],
|
||||
$custom_value,
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false
|
||||
);
|
||||
};
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
@ -757,7 +786,7 @@ if (!empty($fields)) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
|
||||
// The context help about the learning mode
|
||||
// The context help about the learning mode.
|
||||
if ($modo == 0) {
|
||||
echo "<span id='modules_not_learning_mode_context_help' style=''>";
|
||||
} else {
|
||||
|
@ -321,6 +321,8 @@ if ($create_modules) {
|
||||
$module_type = 2;
|
||||
} else if (preg_match('/ifAdminStatus/', $name_array[1])) {
|
||||
$module_type = 2;
|
||||
} else if (preg_match('/ifOperStatus/', $name_array[1])) {
|
||||
$module_type = 18;
|
||||
} else {
|
||||
$module_type = 4;
|
||||
}
|
||||
@ -367,7 +369,24 @@ if ($create_modules) {
|
||||
if ($row['server_type'] == 13) {
|
||||
$module_type_name = db_get_value_filter('nombre', 'ttipo_modulo', ['id_tipo' => $values['id_tipo_modulo']]);
|
||||
|
||||
$new_module_configuration_data = "module_begin\nmodule_name ".io_safe_input($name)."\nmodule_description ".io_safe_output($values['descripcion'])."\nmodule_type ".$module_type_name."\nmodule_snmp\nmodule_oid ".$conf_oid."\nmodule_community ".$values['snmp_community']."\nmodule_end";
|
||||
$new_module_configuration_data = "module_begin\nmodule_name ".io_safe_input($name)."\nmodule_description ".io_safe_output($values['descripcion'])."\nmodule_type ".$module_type_name."\nmodule_snmp\nmodule_version ".$snmp_version."\nmodule_oid ".$conf_oid."\nmodule_community ".$values['snmp_community'];
|
||||
|
||||
if ($snmp_version == '3') {
|
||||
$new_module_configuration_data .= "\nmodule_secname ".$snmp3_auth_user;
|
||||
$new_module_configuration_data .= "\nmodule_seclevel ".$snmp3_security_level;
|
||||
|
||||
if ($snmp3_security_level == 'authNoPriv' || $snmp3_security_level == 'authPriv') {
|
||||
$new_module_configuration_data .= "\nmodule_authpass ".$snmp3_auth_pass;
|
||||
$new_module_configuration_data .= "\nmodule_authproto ".$snmp3_auth_method;
|
||||
}
|
||||
|
||||
if ($snmp3_security_level == 'authPriv') {
|
||||
$new_module_configuration_data .= "\nmodule_privproto ".$snmp3_privacy_method;
|
||||
$new_module_configuration_data .= "\nmodule_privpass ".$snmp3_privacy_pass;
|
||||
}
|
||||
}
|
||||
|
||||
$new_module_configuration_data .= "\nmodule_end";
|
||||
|
||||
config_agents_add_module_in_conf($id_agent, $new_module_configuration_data);
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ $alias_as_name = 0;
|
||||
$direccion_agente = get_parameter('direccion', '');
|
||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||
$direccion_agente = io_safe_input($direccion_agente);
|
||||
$unique_ip = 0;
|
||||
$intervalo = SECONDS_5MINUTES;
|
||||
$ff_interval = 0;
|
||||
$quiet_module = 0;
|
||||
@ -158,9 +159,11 @@ $module_macros = [];
|
||||
// Create agent
|
||||
if ($create_agent) {
|
||||
$mssg_warning = 0;
|
||||
$alias = (string) get_parameter_post('alias', '');
|
||||
$alias_safe_output = io_safe_output(get_parameter('alias', ''));
|
||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output)));
|
||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||
$unique_ip = (int) get_parameter_post('unique_ip', 0);
|
||||
|
||||
// safe_output only validate ip
|
||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||
@ -216,7 +219,12 @@ if ($create_agent) {
|
||||
$nombre_agente = $alias;
|
||||
}
|
||||
|
||||
if (!$exists_alias) {
|
||||
if ($unique_ip && $direccion_agente != '') {
|
||||
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
||||
$exists_ip = db_get_row_sql($sql);
|
||||
}
|
||||
|
||||
if (!$exists_alias && !$exists_ip) {
|
||||
$id_agente = db_process_sql_insert(
|
||||
'tagente',
|
||||
[
|
||||
@ -326,6 +334,8 @@ if ($create_agent) {
|
||||
$agent_creation_error = __('Could not be created');
|
||||
if ($exists_alias) {
|
||||
$agent_creation_error = __('Could not be created, because name already exists');
|
||||
} else if ($exists_ip) {
|
||||
$agent_creation_error = __('Could not be created, because IP already exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -755,9 +765,11 @@ if ($update_agent) {
|
||||
$mssg_warning = 0;
|
||||
$id_agente = (int) get_parameter_post('id_agente');
|
||||
$nombre_agente = str_replace('`', '‘', (string) get_parameter_post('agente', ''));
|
||||
$alias = str_replace('`', '‘', (string) get_parameter_post('alias', ''));
|
||||
$alias_safe_output = io_safe_output(get_parameter('alias', ''));
|
||||
$alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$-]/', '', $alias_safe_output)));
|
||||
$alias_as_name = (int) get_parameter_post('alias_as_name', 0);
|
||||
$direccion_agente = (string) get_parameter_post('direccion', '');
|
||||
$unique_ip = (int) get_parameter_post('unique_ip', 0);
|
||||
// safe_output only validate ip
|
||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||
|
||||
@ -860,8 +872,15 @@ if ($update_agent) {
|
||||
// If there is an agent with the same name, but a different ID
|
||||
}
|
||||
|
||||
if ($unique_ip && $direccion_agente != '') {
|
||||
$sql = 'SELECT direccion FROM tagente WHERE direccion = "'.$direccion_agente.'"';
|
||||
$exists_ip = db_get_row_sql($sql);
|
||||
}
|
||||
|
||||
if ($grupo <= 0) {
|
||||
ui_print_error_message(__('The group id %d is incorrect.', $grupo));
|
||||
} else if ($exists_ip) {
|
||||
ui_print_error_message(__('Duplicate main IP address'));
|
||||
} else {
|
||||
// If different IP is specified than previous, add the IP
|
||||
if ($direccion_agente != ''
|
||||
@ -915,7 +934,7 @@ if ($update_agent) {
|
||||
|
||||
$result = db_process_sql_update('tagente', $values, ['id_agente' => $id_agente]);
|
||||
|
||||
if ($result == false && $update_custom_result == false) {
|
||||
if ($result === false && $update_custom_result == false) {
|
||||
ui_print_error_message(
|
||||
__('There was a problem updating the agent')
|
||||
);
|
||||
@ -945,6 +964,10 @@ if ($update_agent) {
|
||||
$disabled ? '1' : '0',
|
||||
]
|
||||
);
|
||||
// Validate alerts for disabled agents.
|
||||
if ($disabled) {
|
||||
alerts_validate_alert_agent($id_agente);
|
||||
}
|
||||
}
|
||||
|
||||
if ($tpolicy_group_old) {
|
||||
|
@ -25,13 +25,16 @@ $id_field = (int) get_parameter('id_field', 0);
|
||||
$name = (string) get_parameter('name', '');
|
||||
$display_on_front = (bool) get_parameter('display_on_front', 0);
|
||||
$is_password_type = (bool) get_parameter('is_password_type', 0);
|
||||
|
||||
// Header
|
||||
$is_combo_enable = (bool) get_parameter('is_combo_enable', 0);
|
||||
$combo_values = (string) get_parameter('combo_values', '');
|
||||
// Header.
|
||||
if ($id_field) {
|
||||
$field = db_get_row_filter('tagent_custom_fields', ['id_field' => $id_field]);
|
||||
$name = $field['name'];
|
||||
$display_on_front = $field['display_on_front'];
|
||||
$is_password_type = $field['is_password_type'];
|
||||
$combo_values = $field['combo_values'];
|
||||
$is_combo_enable = $config['is_combo_enable'];
|
||||
ui_print_page_header(__('Update agent custom field'), 'images/custom_field.png', false, '', true, '');
|
||||
} else {
|
||||
ui_print_page_header(__('Create agent custom field'), 'images/custom_field.png', false, '', true, '');
|
||||
@ -40,17 +43,87 @@ if ($id_field) {
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->id = 'configure_field';
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->style[4] = 'font-weight: bold';
|
||||
$table->style[6] = 'font-weight: bold';
|
||||
|
||||
echo "<div id='message_set_password' title='".__('Agent Custom Fields Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;font-weight: bold;'>".__('You cannot set the Password type until you clear the combo values and click on update button.').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
echo "<div id='message_set_combo' title='".__('Agent Custom Fields Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;font-weight: bold;'>".__('You cannot unset the enable combo until you clear the combo values and click on update.').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
echo "<div id='message_no_set_password' title='".__('Agent Custom Fields Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;font-weight: bold;'>".__('If you select Enabled combo the Password type will be disabled.').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
echo "<div id='message_no_set_combo' title='".__('Agent Custom Fields Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;font-weight: bold;'>".__('If you select Passord type the Enabled combo will be disabled.').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 100, true);
|
||||
$table->data[0][1] = html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
35,
|
||||
100,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[0][2] = __('Pass type').ui_print_help_tip(__('The fields with pass type enabled will be displayed like html input type pass in html'), true);
|
||||
$table->data[0][3] = html_print_checkbox('is_password_type', 1, $is_password_type, true);
|
||||
$table->data[1][0] = __('Pass type').ui_print_help_tip(
|
||||
__('The fields with pass type enabled will be displayed like html input type pass in html'),
|
||||
true
|
||||
);
|
||||
$table->data[1][1] = html_print_checkbox_switch(
|
||||
'is_password_type',
|
||||
1,
|
||||
$is_password_type,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[0][4] = __('Display on front').ui_print_help_tip(__('The fields with display on front enabled will be displayed into the agent details'), true);
|
||||
$table->data[0][5] = html_print_checkbox('display_on_front', 1, $display_on_front, true);
|
||||
$table->data[2][0] = __('Display on front').ui_print_help_tip(
|
||||
__('The fields with display on front enabled will be displayed into the agent details'),
|
||||
true
|
||||
);
|
||||
$table->data[2][1] = html_print_checkbox_switch(
|
||||
'display_on_front',
|
||||
1,
|
||||
$display_on_front,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('Enabled combo');
|
||||
$table->data[3][1] = html_print_checkbox_switch_extended(
|
||||
'is_combo_enable',
|
||||
0,
|
||||
$config['is_combo_enable'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$table->rowstyle[4] = 'display: none;';
|
||||
$table->data[4][0] = __('Combo values').ui_print_help_tip(
|
||||
__('Set values separated by comma'),
|
||||
true
|
||||
);
|
||||
$table->data[4][1] = html_print_input_text(
|
||||
'combo_values',
|
||||
io_safe_output($combo_values),
|
||||
'',
|
||||
35,
|
||||
200,
|
||||
true
|
||||
);
|
||||
|
||||
echo '<form name="field" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/fields_manager">';
|
||||
html_print_table($table);
|
||||
@ -67,3 +140,67 @@ if ($id_field) {
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(document).ready (function () {
|
||||
if($('input[type=hidden][name=update_field]').val() == 1 && $('input[type=text][name=combo_values]').val() != ''){
|
||||
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
|
||||
$('#configure_field-4').show();
|
||||
$('input[type=checkbox][name=is_password_type]').change(function (e) {
|
||||
dialog_message("#message_set_password");
|
||||
$('input[type=checkbox][name=is_password_type]').prop('checked', false);
|
||||
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
|
||||
$('#configure_field-4').show();
|
||||
e.preventDefault();
|
||||
});
|
||||
$('input[type=checkbox][name=is_combo_enable]').change(function (e) {
|
||||
if($('input[type=text][name=combo_values]').val() != '' && $('input[type=checkbox][name=is_combo_enable]').prop('checked', true)){
|
||||
dialog_message("#message_set_combo");
|
||||
$('input[type=checkbox][name=is_combo_enable]').prop('checked', true);
|
||||
$('#configure_field-4').show();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('input[type=checkbox][name=is_combo_enable]').change(function () {
|
||||
if( $(this).is(":checked") ){
|
||||
$('#configure_field-4').show();
|
||||
dialog_message("#message_no_set_password");
|
||||
$('#configure_field-1').hide();
|
||||
}
|
||||
else{
|
||||
$('#configure_field-4').hide();
|
||||
$('#configure_field-1').show();
|
||||
}
|
||||
});
|
||||
$('input[type=checkbox][name=is_password_type]').change(function () {
|
||||
if( $(this).is(":checked")){
|
||||
dialog_message("#message_no_set_combo");
|
||||
$('#configure_field-3').hide();
|
||||
}
|
||||
else{
|
||||
$('#configure_field-3').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function dialog_message(message_id) {
|
||||
$(message_id)
|
||||
.css("display", "inline")
|
||||
.dialog({
|
||||
modal: true,
|
||||
show: "blind",
|
||||
hide: "blind",
|
||||
width: "400px",
|
||||
buttons: {
|
||||
Close: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -26,7 +26,7 @@ if (!check_acl($config['id_user'], 0, 'PM')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Agents custom fields manager'), 'images/custom_field.png', false, '', true, '');
|
||||
|
||||
$create_field = (bool) get_parameter('create_field');
|
||||
@ -36,10 +36,12 @@ $id_field = (int) get_parameter('id_field', 0);
|
||||
$name = (string) get_parameter('name', '');
|
||||
$display_on_front = (int) get_parameter('display_on_front', 0);
|
||||
$is_password_type = (int) get_parameter('is_password_type', 0);
|
||||
$combo_values = (string) get_parameter('combo_values', '');
|
||||
$combo_value_selected = (string) get_parameter('combo_value_selected', '');
|
||||
|
||||
// Create field
|
||||
// Create field.
|
||||
if ($create_field) {
|
||||
// Check if name field is empty
|
||||
// Check if name field is empty.
|
||||
if ($name == '') {
|
||||
ui_print_error_message(__('The name must not be empty'));
|
||||
} else if ($name == db_get_value('name', 'tagent_custom_fields', 'name', $name)) {
|
||||
@ -51,20 +53,22 @@ if ($create_field) {
|
||||
'name' => $name,
|
||||
'display_on_front' => $display_on_front,
|
||||
'is_password_type' => $is_password_type,
|
||||
'combo_values' => $combo_values,
|
||||
]
|
||||
);
|
||||
ui_print_success_message(__('Field successfully created'));
|
||||
}
|
||||
}
|
||||
|
||||
// Update field
|
||||
// Update field.
|
||||
if ($update_field) {
|
||||
// Check if name field is empty
|
||||
// Check if name field is empty.
|
||||
if ($name != '') {
|
||||
$values = [
|
||||
'name' => $name,
|
||||
'display_on_front' => $display_on_front,
|
||||
'is_password_type' => $is_password_type,
|
||||
'combo_values' => $combo_values,
|
||||
];
|
||||
|
||||
$result = db_process_sql_update('tagent_custom_fields', $values, ['id_field' => $id_field]);
|
||||
@ -79,7 +83,7 @@ if ($update_field) {
|
||||
}
|
||||
}
|
||||
|
||||
// Delete field
|
||||
// Delete field.
|
||||
if ($delete_field) {
|
||||
$result = db_process_sql_delete(
|
||||
'tagent_custom_fields',
|
||||
|
@ -431,7 +431,7 @@ if (modules_is_string_type($id_module_type) || $edit) {
|
||||
str_replace('"', '', $str_warning),
|
||||
'',
|
||||
10,
|
||||
255,
|
||||
1024,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
@ -484,7 +484,7 @@ if (modules_is_string_type($id_module_type) || $edit) {
|
||||
str_replace('"', '', $str_critical),
|
||||
'',
|
||||
10,
|
||||
255,
|
||||
1024,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
|
@ -128,7 +128,7 @@ $snmp_versions['2c'] = 'v. 2c';
|
||||
$snmp_versions['3'] = 'v. 3';
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('SNMP community');
|
||||
$data[0] = __('SNMP community').ui_print_help_icon('column_macros', true);
|
||||
$adopt = false;
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && isset($id_agent_module)) {
|
||||
$adopt = policies_is_module_adopt($id_agent_module);
|
||||
@ -277,7 +277,7 @@ if (!isset($id_agent_module)) {
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Auth user');
|
||||
$data[0] = __('Auth user').ui_print_help_icon('column_macros', true);
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp3_auth_user',
|
||||
$snmp3_auth_user,
|
||||
@ -290,7 +290,7 @@ $data[1] = html_print_input_text(
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$data[2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[2] = __('Auth password').ui_print_help_icon('column_macros', true).ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_auth_pass',
|
||||
$snmp3_auth_pass,
|
||||
@ -312,7 +312,7 @@ push_table_simple($data, 'field_snmpv3_row1');
|
||||
$data = [];
|
||||
$data[0] = __('Privacy method');
|
||||
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[2] = __('Privacy pass').ui_print_help_icon('column_macros', true).ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_privacy_pass',
|
||||
$snmp3_privacy_pass,
|
||||
|
@ -44,8 +44,7 @@ if (empty($update_module_id)) {
|
||||
$data = [];
|
||||
$data[0] = __('Target IP');
|
||||
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
||||
$data[2] = __('Namespace');
|
||||
$data[2] .= ui_print_help_icon('wminamespace', true);
|
||||
$data[2] = __('Namespace').ui_print_help_tip(__('Optional. WMI namespace. If unsure leave blank.'), true);
|
||||
$data[3] = html_print_input_text(
|
||||
'tcp_send',
|
||||
$tcp_send,
|
||||
@ -61,7 +60,7 @@ $data[3] = html_print_input_text(
|
||||
push_table_simple($data, 'target_ip');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Username');
|
||||
$data[0] = __('Username').ui_print_help_icon('column_macros', true);
|
||||
$data[1] = html_print_input_text(
|
||||
'plugin_user',
|
||||
$plugin_user,
|
||||
@ -74,7 +73,7 @@ $data[1] = html_print_input_text(
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$data[2] = __('Password');
|
||||
$data[2] = __('Password').ui_print_help_icon('column_macros', true);
|
||||
$data[3] = html_print_input_password(
|
||||
'plugin_pass',
|
||||
$plugin_pass,
|
||||
@ -110,8 +109,7 @@ $table_simple->colspan['wmi_query'][1] = 3;
|
||||
push_table_simple($data, 'wmi_query');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Key string');
|
||||
$data[0] .= ui_print_help_icon('wmikey', true);
|
||||
$data[0] = __('Key string').ui_print_help_tip(__('Optional. Substring to look for in the WQL query result. The module returns 1 if found, 0 if not.'), true);
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp_community',
|
||||
$snmp_community,
|
||||
@ -124,8 +122,7 @@ $data[1] = html_print_input_text(
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$data[2] = __('Field number');
|
||||
$data[2] .= ui_print_help_icon('wmifield', true);
|
||||
$data[2] = __('Field number').ui_print_help_tip(__('Column number to retrieve from the WQL query result (starting from zero).'), true);
|
||||
$data[3] = html_print_input_text(
|
||||
'tcp_port',
|
||||
$tcp_port,
|
||||
|
272
pandora_console/godmode/agentes/status_monitor_custom_fields.php
Normal file
272
pandora_console/godmode/agentes/status_monitor_custom_fields.php
Normal file
@ -0,0 +1,272 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU 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.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AR')
|
||||
&& ! check_acl($config['id_user'], 0, 'AW')
|
||||
&& ! check_acl($config['id_user'], 0, 'AM')
|
||||
) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$update = get_parameter('upd_button', '');
|
||||
$default = (int) get_parameter('default', 0);
|
||||
|
||||
|
||||
if ($default != 0) {
|
||||
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||
} else if ($update != '') {
|
||||
$fields_selected = (array) get_parameter('fields_selected');
|
||||
|
||||
if ($fields_selected[0] == '') {
|
||||
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||
} else {
|
||||
$status_monitor_fields = implode(',', $fields_selected);
|
||||
}
|
||||
|
||||
$values = [
|
||||
'token' => 'status_monitor_fields',
|
||||
'value' => $status_monitor_fields,
|
||||
];
|
||||
|
||||
// update 'status_monitor_fields' in tconfig table to keep the value at update.
|
||||
$result = db_process_sql_update(
|
||||
'tconfig',
|
||||
$values,
|
||||
['token' => 'status_monitor_fields']
|
||||
);
|
||||
|
||||
ui_print_result_message($result, __('Successfully updated'), __('Could not be updated'));
|
||||
|
||||
$config['status_monitor_fields'] = $status_monitor_fields;
|
||||
}
|
||||
|
||||
$fields_selected = [];
|
||||
$status_monitor_fields = '';
|
||||
$fields_selected = explode(',', $config['status_monitor_fields']);
|
||||
|
||||
$result_selected = [];
|
||||
|
||||
// show list of fields selected.
|
||||
if ($fields_selected[0] != '') {
|
||||
foreach ($fields_selected as $field_selected) {
|
||||
switch ($field_selected) {
|
||||
case 'policy':
|
||||
$result = __('Policy');
|
||||
break;
|
||||
|
||||
case 'agent':
|
||||
$result = __('Agent');
|
||||
break;
|
||||
|
||||
case 'data_type':
|
||||
$result = __('Data type');
|
||||
break;
|
||||
|
||||
case 'module_name':
|
||||
$result = __('Module name');
|
||||
break;
|
||||
|
||||
case 'server_type':
|
||||
$result = __('Server type');
|
||||
break;
|
||||
|
||||
case 'interval':
|
||||
$result = __('Interval');
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
$result = __('Status');
|
||||
break;
|
||||
|
||||
case 'graph':
|
||||
$result = __('Graph');
|
||||
break;
|
||||
|
||||
case 'warn':
|
||||
$result = __('Warn');
|
||||
break;
|
||||
|
||||
case 'data':
|
||||
$result = __('Data');
|
||||
break;
|
||||
|
||||
case 'timestamp':
|
||||
$result = __('Timestamp');
|
||||
break;
|
||||
|
||||
case 'to_critical':
|
||||
$result = __('Last status change');
|
||||
break;
|
||||
}
|
||||
|
||||
$result_selected[$field_selected] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<h3>'.__('Show monitor detail fields').'</h3>';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
|
||||
$table->size = [];
|
||||
// ~ $table->size[0] = '20%';
|
||||
$table->size[1] = '10px';
|
||||
// ~ $table->size[2] = '20%';
|
||||
$table->style[0] = 'text-align:center;';
|
||||
$table->style[2] = 'text-align:center;';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$fields_available = [];
|
||||
|
||||
$fields_available['policy'] = __('Policy');
|
||||
$fields_available['agent'] = __('Agent');
|
||||
$fields_available['data_type'] = __('Data type');
|
||||
$fields_available['module_name'] = __('Module name');
|
||||
$fields_available['server_type'] = __('Server type');
|
||||
$fields_available['interval'] = __('Interval');
|
||||
$fields_available['status'] = __('Status');
|
||||
$fields_available['graph'] = __('Graph');
|
||||
$fields_available['warn'] = __('Warn');
|
||||
$fields_available['data'] = __('Data');
|
||||
$fields_available['timestamp'] = __('Timestamp');
|
||||
$fields_available['to_critical'] = __('Last status change');
|
||||
|
||||
// remove fields already selected
|
||||
foreach ($fields_available as $key => $available) {
|
||||
foreach ($result_selected as $selected) {
|
||||
if ($selected == $available) {
|
||||
unset($fields_available[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[0][0] = '<b>'.__('Fields available').'</b>';
|
||||
$table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||
$table->data[1][1] = '<a href="javascript:">'.html_print_image(
|
||||
'images/darrowright.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'right',
|
||||
'title' => __('Add fields to select'),
|
||||
]
|
||||
).'</a>';
|
||||
$table->data[1][1] .= '<br><br><br><br><a href="javascript:">'.html_print_image(
|
||||
'images/darrowleft.png',
|
||||
true,
|
||||
[
|
||||
'id' => 'left',
|
||||
'title' => __('Delete fields to select'),
|
||||
]
|
||||
).'</a>';
|
||||
|
||||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Fields selected').'</b>';
|
||||
$table->data[1][2] = html_print_select(
|
||||
$result_selected,
|
||||
'fields_selected[]',
|
||||
true,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'width: 300px'
|
||||
);
|
||||
|
||||
echo '<form id="custom_status_monitor" method="post" action="index.php?sec=view&sec2=operation/agentes/status_monitor§ion=fields&pure='.$config['pure'].'">';
|
||||
html_print_table($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
|
||||
$("#right").click (function () {
|
||||
jQuery.each($("select[name='fields_available[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").html(field_name).attr("value", id_field));
|
||||
$("#fields_available").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#left").click (function () {
|
||||
var current_fields_size = ($('#fields_selected option').length);
|
||||
var selected_fields = [];
|
||||
var selected_fields_total = '';
|
||||
|
||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
selected_fields.push(field_name);
|
||||
selected_fields_total = selected_fields.length;
|
||||
});
|
||||
|
||||
if(selected_fields_total === current_fields_size){
|
||||
display_confirm_dialog(
|
||||
"<?php echo '<span style=text-transform:none;font-size:9.5pt;>'.__('There must be at least one custom field. Timestamp will be set by default').'</span>'; ?>",
|
||||
"<?php echo __('Confirm'); ?>",
|
||||
"<?php echo __('Cancel'); ?>",
|
||||
function () {
|
||||
move_left();
|
||||
$("#fields_available").find("option[value='timestamp']").remove();
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").val('timestamp').html('<i>' + 'Timestamp' + '</i>'));
|
||||
}
|
||||
);
|
||||
}
|
||||
else{
|
||||
move_left();
|
||||
}
|
||||
});
|
||||
|
||||
$("#submit-upd_button").click(function () {
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
$('#fields_selected option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function move_left(){
|
||||
jQuery.each($("select[name='fields_selected[]'] option:selected"), function (key, value) {
|
||||
field_name = $(value).html();
|
||||
if (field_name != <?php echo "'".__('None')."'"; ?>) {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
@ -1,17 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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();
|
||||
@ -51,15 +66,22 @@ if (is_ajax()) {
|
||||
}
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
// Header
|
||||
ui_print_page_header(__('Module groups defined in %s', get_product_name()), 'images/module_group.png', false, '', true, '');
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
__('Module groups defined in %s', get_product_name()),
|
||||
'images/module_group.png',
|
||||
false,
|
||||
'',
|
||||
true,
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
$create_group = (bool) get_parameter('create_group');
|
||||
$update_group = (bool) get_parameter('update_group');
|
||||
$delete_group = (bool) get_parameter('delete_group');
|
||||
|
||||
// Create group
|
||||
// Create group.
|
||||
if ($create_group) {
|
||||
$name = (string) get_parameter('name');
|
||||
$icon = (string) get_parameter('icon');
|
||||
@ -70,22 +92,29 @@ if ($create_group) {
|
||||
|
||||
if ($name) {
|
||||
if (!$check) {
|
||||
$result = db_process_sql_insert('tmodule_group', ['name' => $name]);
|
||||
$result = db_process_sql_insert(
|
||||
'tmodule_group',
|
||||
['name' => $name]
|
||||
);
|
||||
|
||||
if ($result) {
|
||||
ui_print_success_message(__('Group successfully created'));
|
||||
} else {
|
||||
ui_print_error_message(__('There was a problem creating group'));
|
||||
ui_print_error_message(
|
||||
__('There was a problem creating group')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(__('Each module group must have a different name'));
|
||||
ui_print_error_message(
|
||||
__('Each module group must have a different name')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(__('Module group must have a name'));
|
||||
}
|
||||
}
|
||||
|
||||
// Update group
|
||||
// Update group.
|
||||
if ($update_group) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$name = (string) get_parameter('name');
|
||||
@ -98,38 +127,79 @@ if ($update_group) {
|
||||
|
||||
if ($name) {
|
||||
if (!$check || $subcheck == $name) {
|
||||
$result = db_process_sql_update('tmodule_group', ['name' => $name], ['id_mg' => $id_group]);
|
||||
$result = db_process_sql_update(
|
||||
'tmodule_group',
|
||||
['name' => $name],
|
||||
['id_mg' => $id_group]
|
||||
);
|
||||
|
||||
if ($result !== false) {
|
||||
ui_print_success_message(__('Group successfully updated'));
|
||||
} else {
|
||||
ui_print_error_message(__('There was a problem modifying group'));
|
||||
ui_print_error_message(
|
||||
__('There was a problem modifying group')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(__('Each module group must have a different name'));
|
||||
ui_print_error_message(
|
||||
__('Each module group must have a different name')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(__('Module group must have a name'));
|
||||
}
|
||||
}
|
||||
|
||||
// Delete group
|
||||
// Delete group.
|
||||
if ($delete_group) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
|
||||
$result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]);
|
||||
|
||||
if ($result) {
|
||||
$result = db_process_sql_update('tagente_modulo', ['id_module_group' => 0], ['id_module_group' => $id_group]);
|
||||
db_process_sql_update('tpolicy_modules', ['id_module_group' => 0], ['id_module_group' => $id_group]);
|
||||
db_process_sql_update('tcontainer_item', ['id_module_group' => 0], ['id_module_group' => $id_group]);
|
||||
db_process_sql_update('tnetwork_component', ['id_module_group' => 0], ['id_module_group' => $id_group]);
|
||||
db_process_sql_update('treport_content', ['id_module_group' => 0], ['id_module_group' => $id_group]);
|
||||
db_process_sql_update('tnetwork_map', ['id_module_group' => 0], ['id_module_group' => $id_group]);
|
||||
db_process_sql_update('tlocal_component', ['id_module_group' => 0], ['id_module_group' => $id_group]);
|
||||
db_process_sql_update('treport_content_template', ['id_module_group' => 0], ['id_module_group' => $id_group]);
|
||||
$result = db_process_sql_update(
|
||||
'tagente_modulo',
|
||||
['id_module_group' => 0],
|
||||
['id_module_group' => $id_group]
|
||||
);
|
||||
db_process_sql_update(
|
||||
'tpolicy_modules',
|
||||
['id_module_group' => 0],
|
||||
['id_module_group' => $id_group]
|
||||
);
|
||||
db_process_sql_update(
|
||||
'tcontainer_item',
|
||||
['id_module_group' => 0],
|
||||
['id_module_group' => $id_group]
|
||||
);
|
||||
db_process_sql_update(
|
||||
'tnetwork_component',
|
||||
['id_module_group' => 0],
|
||||
['id_module_group' => $id_group]
|
||||
);
|
||||
db_process_sql_update(
|
||||
'treport_content',
|
||||
['id_module_group' => 0],
|
||||
['id_module_group' => $id_group]
|
||||
);
|
||||
db_process_sql_update(
|
||||
'tnetwork_map',
|
||||
['id_module_group' => 0],
|
||||
['id_module_group' => $id_group]
|
||||
);
|
||||
db_process_sql_update(
|
||||
'tlocal_component',
|
||||
['id_module_group' => 0],
|
||||
['id_module_group' => $id_group]
|
||||
);
|
||||
db_process_sql_update(
|
||||
'treport_content_template',
|
||||
['id_module_group' => 0],
|
||||
['id_module_group' => $id_group]
|
||||
);
|
||||
|
||||
// A group with no modules can be deleted, to avoid a message error then do the follwing
|
||||
// A group with no modules can be deleted,
|
||||
// to avoid a message error then do the follwing.
|
||||
if ($result !== false) {
|
||||
$result = true;
|
||||
}
|
||||
@ -150,36 +220,15 @@ $offset = (int) get_parameter('offset', 0);
|
||||
|
||||
ui_pagination($total_groups, $url, $offset);
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$sql = 'SELECT *
|
||||
FROM tmodule_group
|
||||
ORDER BY name ASC
|
||||
LIMIT '.$offset.', '.$config['block_size'];
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
$sql = 'SELECT *
|
||||
FROM tmodule_group
|
||||
ORDER BY name ASC
|
||||
LIMIT '.$config['block_size'].' OFFSET '.$offset;
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$set = [];
|
||||
$set['limit'] = $config['block_size'];
|
||||
$set['offset'] = $offset;
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM tmodule_group
|
||||
ORDER BY name ASC';
|
||||
|
||||
$sql = oracle_recode_query($sql, $set);
|
||||
break;
|
||||
}
|
||||
$sql = 'SELECT *
|
||||
FROM tmodule_group
|
||||
ORDER BY name ASC
|
||||
LIMIT '.$offset.', '.$config['block_size'];
|
||||
|
||||
$groups = db_get_all_rows_sql($sql);
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
|
||||
@ -210,11 +259,21 @@ if (!empty($groups)) {
|
||||
|
||||
html_print_table($table);
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined module groups') ]);
|
||||
ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('There are no defined module groups'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_submit_button(__('Create module group'), 'crt', false, 'class="sub next"');
|
||||
html_print_submit_button(
|
||||
__('Create module group'),
|
||||
'crt',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
@ -1,17 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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 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
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
@ -34,7 +49,8 @@ if (is_ajax()) {
|
||||
|
||||
if ($get_agents) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||
// Is is possible add keys prefix to avoid auto
|
||||
// sorting in js object conversion.
|
||||
$keys_prefix = (string) get_parameter('keys_prefix', '');
|
||||
|
||||
if ($id_group == 0) {
|
||||
@ -62,7 +78,7 @@ if (is_ajax()) {
|
||||
);
|
||||
}
|
||||
|
||||
// Add keys prefix
|
||||
// Add keys prefix.
|
||||
if ($keys_prefix !== '') {
|
||||
foreach ($agents as $k => $v) {
|
||||
$agents[$keys_prefix.$k] = $v;
|
||||
@ -92,8 +108,8 @@ function process_manage_add($id_alert_template, $id_agents, $module_names)
|
||||
|
||||
foreach ($module_names as $module) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,6 +164,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
|
||||
$return_all_group = true;
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'add_table';
|
||||
$table->class = 'databox filters';
|
||||
$table->width = '100%';
|
||||
@ -251,10 +268,10 @@ html_print_submit_button(__('Add'), 'go', false, 'class="sub add"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
// TODO: Change to iu_print_error system
|
||||
// TODO: Change to iu_print_error system.
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
|
||||
// Hack to translate text "none" in PHP to javascript
|
||||
// Hack to translate text "none" in PHP to javascript.
|
||||
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||
|
||||
ui_require_jquery_file('form');
|
||||
@ -270,42 +287,40 @@ $(document).ready (function () {
|
||||
var get_parameters_count = window.location.href.slice(
|
||||
window.location.href.indexOf('?') + 1).split('&').length;
|
||||
var post_parameters_count = $("#form_alerts").serializeArray().length;
|
||||
|
||||
|
||||
var count_parameters =
|
||||
get_parameters_count + post_parameters_count;
|
||||
|
||||
|
||||
if (count_parameters > limit_parameters_massive) {
|
||||
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#checkbox-recursion").click(function () {
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
||||
|
||||
$("#id_agents").change(agent_changed_by_multiple_agents);
|
||||
|
||||
|
||||
$("#id_group").change (function () {
|
||||
var $select = $("#id_agents").enable ();
|
||||
$("#agent_loading").show ();
|
||||
$("option", $select).remove ();
|
||||
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/massive/massive_add_alerts",
|
||||
"get_agents" : 1,
|
||||
"id_group" : this.value,
|
||||
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
// Add a key prefix to avoid auto sorting in js object conversion.
|
||||
"keys_prefix" : "_"
|
||||
},
|
||||
function (data, status) {
|
||||
options = "";
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
// Remove keys_prefix from the index.
|
||||
id = id.substring(1);
|
||||
|
||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||
});
|
||||
$("#id_agents").append (options);
|
||||
@ -315,40 +330,39 @@ $(document).ready (function () {
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
$("#id_group").value = "0";
|
||||
|
||||
|
||||
$("#id_group").click (
|
||||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
});
|
||||
|
||||
|
||||
$("#id_group").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
});
|
||||
|
||||
|
||||
$("#id_agents").click (
|
||||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
});
|
||||
|
||||
|
||||
$("#id_agents").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
});
|
||||
|
||||
|
||||
$("#module").click (
|
||||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
});
|
||||
|
||||
|
||||
$("#module").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
});
|
||||
|
||||
|
||||
$("#modules_selection_mode").change (function() {
|
||||
$("#id_agents").trigger('change');
|
||||
});
|
||||
|
||||
});
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
@ -205,6 +205,10 @@ if ($update_agents) {
|
||||
$values['disabled'],
|
||||
]
|
||||
);
|
||||
// Validate alerts for disabled agents.
|
||||
if ($values['disabled'] == 1) {
|
||||
alerts_validate_alert_agent($id_agent);
|
||||
}
|
||||
}
|
||||
|
||||
if ($group_old || $result) {
|
||||
@ -685,6 +689,13 @@ foreach ($fields as $field) {
|
||||
__('This field allows url insertion using the BBCode\'s url tag').'.<br />'.__('The format is: [url=\'url to navigate\']\'text to show\'[/url]').'.<br /><br />'.__('e.g.: [url=google.com]Google web search[/url]'),
|
||||
true
|
||||
);
|
||||
$combo = [];
|
||||
$combo = $field['combo_values'];
|
||||
$combo = explode(',', $combo);
|
||||
$combo_values = [];
|
||||
foreach ($combo as $value) {
|
||||
$combo_values[$value] = $value;
|
||||
}
|
||||
|
||||
$custom_value = db_get_value_filter('description', 'tagent_custom_data', ['id_field' => $field['id_field'], 'id_agent' => $id_agente]);
|
||||
|
||||
@ -710,6 +721,28 @@ foreach ($fields as $field) {
|
||||
$data[1] = html_print_textarea('customvalue_'.$field['id_field'], 2, 65, $custom_value, 'style="min-height: 30px;"', true);
|
||||
}
|
||||
|
||||
if ($field['combo_values'] !== '') {
|
||||
$data[1] = html_print_select(
|
||||
$combo_values,
|
||||
'customvalue_'.$field['id_field'],
|
||||
$custom_value,
|
||||
'',
|
||||
__('No change'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false
|
||||
);
|
||||
};
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ if ($update) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Standard procedure
|
||||
// Standard procedure.
|
||||
foreach ($agents_ as $agent_) {
|
||||
if ($modules_ == false) {
|
||||
$modules_ = [];
|
||||
@ -315,7 +315,7 @@ if ($module_type != '') {
|
||||
|
||||
$names = agents_get_modules(
|
||||
array_keys($agents),
|
||||
'DISTINCT(tagente_modulo.nombre)',
|
||||
'tagente_modulo.nombre',
|
||||
$filter,
|
||||
false
|
||||
);
|
||||
@ -562,7 +562,7 @@ $table->data['edit1'][1] = '<table width="100%">';
|
||||
'',
|
||||
'',
|
||||
5,
|
||||
255,
|
||||
1024,
|
||||
true
|
||||
);
|
||||
$table->data['edit1'][1] .= '</td>';
|
||||
@ -631,7 +631,7 @@ $table->data['edit1'][1] = '<table width="100%">';
|
||||
'',
|
||||
'',
|
||||
5,
|
||||
255,
|
||||
1024,
|
||||
true
|
||||
);
|
||||
$table->data['edit1'][3] .= '</td>';
|
||||
@ -1965,4 +1965,3 @@ function process_manage_edit($module_name, $agents_select=null, $module_status='
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,21 @@ require_once 'include/functions_menu.php';
|
||||
$menu_godmode = [];
|
||||
$menu_godmode['class'] = 'godmode';
|
||||
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub = [];
|
||||
$sub['godmode/servers/discovery']['text'] = __('Discovery');
|
||||
$sub['godmode/servers/discovery']['id'] = 'Discovery';
|
||||
$sub['godmode/servers/discovery']['subsecs'] = ['godmode/servers/discovery'];
|
||||
|
||||
// Add to menu.
|
||||
$menu_godmode['discovery']['text'] = __('Discovery');
|
||||
$menu_godmode['discovery']['sec2'] = 'godmode/servers/discovery';
|
||||
$menu_godmode['discovery']['id'] = 'god-discovery';
|
||||
$menu_godmode['discovery']['sub'] = $sub;
|
||||
}
|
||||
|
||||
|
||||
$sub = [];
|
||||
if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'AD')) {
|
||||
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
|
||||
@ -200,6 +215,7 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, '
|
||||
$menu_godmode['gservers']['id'] = 'god-servers';
|
||||
|
||||
$sub = [];
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$sub['godmode/servers/modificar_server']['text'] = __('Manage servers');
|
||||
$sub['godmode/servers/modificar_server']['id'] = 'Manage servers';
|
||||
@ -209,15 +225,9 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, '
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
enterprise_hook('ha_cluster');
|
||||
|
||||
$sub['godmode/servers/manage_recontask']['text'] = __('Recon task');
|
||||
$sub['godmode/servers/manage_recontask']['id'] = 'Recon task';
|
||||
|
||||
$sub['godmode/servers/plugin']['text'] = __('Plugins');
|
||||
$sub['godmode/servers/plugin']['id'] = 'Plugins';
|
||||
|
||||
$sub['godmode/servers/recon_script']['text'] = __('Recon script');
|
||||
$sub['godmode/servers/recon_script']['id'] = 'Recon script';
|
||||
|
||||
enterprise_hook('export_target_submenu');
|
||||
|
||||
enterprise_hook('manage_satellite_submenu');
|
||||
@ -269,6 +279,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=notifications']['text'] = __('Notifications');
|
||||
$sub2['godmode/setup/setup&section=notifications']['refr'] = 0;
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$sub2['godmode/setup/gis']['text'] = __('Map conections GIS');
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ if ($create_network_from_module) {
|
||||
$id_module_group = $data_module['id_module_group'];
|
||||
$id_plugin = $data_module['id_plugin'];
|
||||
$plugin_user = $data_module['plugin_user'];
|
||||
$plugin_pass = $data_module['plugin_pass'];
|
||||
$plugin_pass = io_output_password($data_module['plugin_pass']);
|
||||
$plugin_parameter = $data_module['plugin_parameter'];
|
||||
$macros = $data_module['macros'];
|
||||
$max_timeout = $data_module['max_timeout'];
|
||||
@ -104,7 +104,7 @@ if (isset($id)) {
|
||||
$id_group = $component['id_group'];
|
||||
$id_plugin = $component['id_plugin'];
|
||||
$plugin_user = $component['plugin_user'];
|
||||
$plugin_pass = $component['plugin_pass'];
|
||||
$plugin_pass = io_output_password($component['plugin_pass']);
|
||||
$plugin_parameter = $component['plugin_parameter'];
|
||||
$macros = $component['macros'];
|
||||
$max_timeout = $component['max_timeout'];
|
||||
@ -140,10 +140,10 @@ if (isset($id)) {
|
||||
// New support for snmp v3
|
||||
$snmp_version = $component['tcp_send'];
|
||||
$snmp3_auth_user = $component['plugin_user'];
|
||||
$snmp3_auth_pass = $component['plugin_pass'];
|
||||
$snmp3_auth_pass = io_output_password($component['plugin_pass']);
|
||||
$snmp3_auth_method = $component['plugin_parameter'];
|
||||
$snmp3_privacy_method = $component['custom_string_1'];
|
||||
$snmp3_privacy_pass = $component['custom_string_2'];
|
||||
$snmp3_privacy_pass = io_output_password($component['custom_string_2']);
|
||||
$snmp3_security_level = $component['custom_string_3'];
|
||||
}
|
||||
} else if (isset($new_component) && $new_component && !$create_network_from_snmp_browser) {
|
||||
|
@ -190,7 +190,7 @@ $table->data[4][1] .= html_print_input_text(
|
||||
$str_warning,
|
||||
'',
|
||||
5,
|
||||
64,
|
||||
1024,
|
||||
true
|
||||
).'</span>';
|
||||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
@ -225,7 +225,7 @@ $table->data[5][1] .= html_print_input_text(
|
||||
$str_critical,
|
||||
'',
|
||||
5,
|
||||
64,
|
||||
1024,
|
||||
true
|
||||
).'</span>';
|
||||
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
|
@ -57,16 +57,16 @@ $data = [];
|
||||
$data[0] = __('SNMP Enterprise String');
|
||||
$data[1] = html_print_input_text('snmp_oid', $snmp_oid, '', 30, 400, true);
|
||||
// $table->colspan['snmp_2'][1] = 3;
|
||||
$data[2] = __('SNMP community');
|
||||
$data[2] = __('SNMP community').ui_print_help_icon('column_macros', true);
|
||||
$data[3] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, true);
|
||||
|
||||
push_table_row($data, 'snmp_2');
|
||||
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Auth user');
|
||||
$data[0] = __('Auth user').ui_print_help_icon('column_macros', true);
|
||||
$data[1] = html_print_input_text('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$data[2] = __('Auth password');
|
||||
$data[2] = __('Auth password').ui_print_help_icon('column_macros', true);
|
||||
$data[3] = html_print_input_password('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$data[3] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mncfn', true);
|
||||
push_table_row($data, 'field_snmpv3_row1');
|
||||
@ -74,7 +74,7 @@ push_table_row($data, 'field_snmpv3_row1');
|
||||
$data = [];
|
||||
$data[0] = __('Privacy method');
|
||||
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
$data[2] = __('Privacy pass');
|
||||
$data[2] = __('Privacy pass').ui_print_help_icon('column_macros', true);
|
||||
$data[3] = html_print_input_password('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
|
||||
push_table_row($data, 'field_snmpv3_row2');
|
||||
|
||||
|
@ -44,9 +44,9 @@ $data[3] = html_print_input_text('tcp_send', $tcp_send, '', 25, 255, true);
|
||||
push_table_row($data, 'wmi_2');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Username');
|
||||
$data[0] = __('Username').ui_print_help_icon('column_macros', true);
|
||||
$data[1] = html_print_input_text('plugin_user', $plugin_user, '', 15, 255, true);
|
||||
$data[2] = __('Password');
|
||||
$data[2] = __('Password').ui_print_help_icon('column_macros', true);
|
||||
$data[3] = html_print_input_password('plugin_pass', $plugin_pass, '', 25, 255, true);
|
||||
|
||||
push_table_row($data, 'wmi_3');
|
||||
|
@ -85,7 +85,6 @@ if ($id) {
|
||||
$dst_port = $filter['dst_port'];
|
||||
$src_port = $filter['src_port'];
|
||||
$aggregate = $filter['aggregate'];
|
||||
$output = $filter['output'];
|
||||
$advanced_filter = $filter['advanced_filter'];
|
||||
} else {
|
||||
$name = '';
|
||||
@ -94,8 +93,7 @@ if ($id) {
|
||||
$ip_src = '';
|
||||
$dst_port = '';
|
||||
$src_port = '';
|
||||
$aggregate = 'none';
|
||||
$output = 'bytes';
|
||||
$aggregate = 'dstip';
|
||||
$advanced_filter = '';
|
||||
}
|
||||
|
||||
@ -103,7 +101,6 @@ if ($update) {
|
||||
$name = (string) get_parameter('name');
|
||||
$assign_group = (int) get_parameter('assign_group');
|
||||
$aggregate = get_parameter('aggregate', '');
|
||||
$output = get_parameter('output', 'bytes');
|
||||
$ip_dst = get_parameter('ip_dst', '');
|
||||
$ip_src = get_parameter('ip_src', '');
|
||||
$dst_port = get_parameter('dst_port', '');
|
||||
@ -123,7 +120,6 @@ if ($update) {
|
||||
'dst_port' => $dst_port,
|
||||
'src_port' => $src_port,
|
||||
'advanced_filter' => $advanced_filter,
|
||||
'output' => $output,
|
||||
];
|
||||
|
||||
// Save filter args
|
||||
@ -142,8 +138,7 @@ if ($update) {
|
||||
if ($create) {
|
||||
$name = (string) get_parameter('name');
|
||||
$assign_group = (int) get_parameter('assign_group');
|
||||
$aggregate = get_parameter('aggregate', 'none');
|
||||
$output = get_parameter('output', 'bytes');
|
||||
$aggregate = get_parameter('aggregate', 'dstip');
|
||||
$ip_dst = get_parameter('ip_dst', '');
|
||||
$ip_src = get_parameter('ip_src', '');
|
||||
$dst_port = get_parameter('dst_port', '');
|
||||
@ -159,7 +154,6 @@ if ($create) {
|
||||
'src_port' => $src_port,
|
||||
'aggregate' => $aggregate,
|
||||
'advanced_filter' => $advanced_filter,
|
||||
'output' => $output,
|
||||
];
|
||||
|
||||
// Save filter args
|
||||
@ -241,8 +235,6 @@ $table->data[7][1] = html_print_textarea('advanced_filter', 4, 40, $advanced_fil
|
||||
|
||||
$table->data[8][0] = '<b>'.__('Aggregate by').'</b>'.ui_print_help_icon('aggregate_by', true);
|
||||
$aggregate_list = [
|
||||
'none' => __('None'),
|
||||
'proto' => __('Protocol'),
|
||||
'srcip' => __('Src Ip Address'),
|
||||
'dstip' => __('Dst Ip Address'),
|
||||
'srcport' => __('Src Port'),
|
||||
@ -251,15 +243,6 @@ $aggregate_list = [
|
||||
|
||||
$table->data[8][1] = html_print_select($aggregate_list, 'aggregate', $aggregate, '', '', 0, true, false, true, '', false);
|
||||
|
||||
$table->data[9][0] = '<b>'.__('Output format').'</b>';
|
||||
$show_output = [
|
||||
'kilobytes' => __('Kilobytes'),
|
||||
'megabytes' => __('Megabytes'),
|
||||
'kilobytespersecond' => __('Kilobytes per second'),
|
||||
'megabytespersecond' => __('Megabytes per second'),
|
||||
];
|
||||
$table->data[9][1] = html_print_select($show_output, 'output', $output, '', '', 0, true, false, true, '', false);
|
||||
|
||||
echo '<form method="post" action="'.$config['homeurl'].'index.php?sec=netf&sec2=godmode/netflow/nf_edit_form&pure='.$pure.'">';
|
||||
html_print_table($table);
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
@ -110,7 +110,7 @@ $event_graph_validated_vs_unvalidated = false;
|
||||
|
||||
$netflow_filter = 0;
|
||||
$max_values = 0;
|
||||
$resolution = 0;
|
||||
$resolution = NETFLOW_RES_MEDD;
|
||||
|
||||
$lapse_calc = 0;
|
||||
$lapse = 300;
|
||||
@ -450,6 +450,7 @@ switch ($action) {
|
||||
case 'event_report_agent':
|
||||
case 'event_report_group':
|
||||
$recursion = $item['recursion'];
|
||||
$include_extended_events = $item['show_extended_events'];
|
||||
break;
|
||||
|
||||
case 'event_report_module':
|
||||
@ -471,6 +472,8 @@ switch ($action) {
|
||||
$event_graph_validated_vs_unvalidated = $style['event_graph_validated_vs_unvalidated'];
|
||||
|
||||
$filter_search = $style['event_filter_search'];
|
||||
|
||||
$include_extended_events = $item['show_extended_events'];
|
||||
break;
|
||||
|
||||
case 'general':
|
||||
@ -597,18 +600,22 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'netflow_area':
|
||||
case 'netflow_pie':
|
||||
case 'netflow_data':
|
||||
case 'netflow_statistics':
|
||||
case 'netflow_summary':
|
||||
$netflow_filter = $item['text'];
|
||||
// Filter
|
||||
// Filter.
|
||||
$period = $item['period'];
|
||||
$description = $item['description'];
|
||||
$resolution = $item['top_n'];
|
||||
// Interval resolution
|
||||
// Interval resolution.
|
||||
$max_values = $item['top_n_value'];
|
||||
// Max values
|
||||
// Max values.
|
||||
break;
|
||||
|
||||
case 'nt_top_n':
|
||||
$period = $item['period'];
|
||||
$description = $item['description'];
|
||||
$top_n_value = $item['top_n_value'];
|
||||
break;
|
||||
}
|
||||
|
||||
@ -635,6 +642,7 @@ switch ($action) {
|
||||
case 'simple_baseline_graph':
|
||||
case 'event_report_log':
|
||||
case 'increment':
|
||||
case 'nt_top_n':
|
||||
$label = (isset($style['label'])) ? $style['label'] : '';
|
||||
break;
|
||||
|
||||
@ -837,7 +845,11 @@ $class = 'databox filters';
|
||||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_extended_select_for_time('resolution', $resolution, '', '', '0', 10);
|
||||
html_print_select(
|
||||
netflow_resolution_select_params(),
|
||||
'resolution',
|
||||
$resolution
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -1729,6 +1741,15 @@ $class = 'databox filters';
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_extended_events" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Include extended events'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox('include_extended_events', true, $include_extended_events);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_event_graphs" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Event graphs'); ?></td>
|
||||
<td>
|
||||
@ -2720,7 +2741,7 @@ function edit_custom_graph() {
|
||||
}
|
||||
});
|
||||
|
||||
window.location.href = server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data;
|
||||
window.location.href = server_url + "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data;
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
@ -3101,6 +3122,7 @@ function chooseType() {
|
||||
$("#row_event_graph_by_user").hide();
|
||||
$("#row_event_graph_by_criticity").hide();
|
||||
$("#row_event_graph_by_validated").hide();
|
||||
$("#row_extended_events").hide();
|
||||
$("#row_netflow_filter").hide();
|
||||
$("#row_max_values").hide();
|
||||
$("#row_resolution").hide();
|
||||
@ -3144,6 +3166,7 @@ function chooseType() {
|
||||
$("#row_event_graph_by_user").show();
|
||||
$("#row_event_graph_by_criticity").show();
|
||||
$("#row_event_graph_by_validated").show();
|
||||
$("#row_extended_events").show();
|
||||
|
||||
$("#row_filter_search").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
@ -3444,6 +3467,7 @@ function chooseType() {
|
||||
$("#row_event_graph_by_criticity").show();
|
||||
$("#row_event_graph_by_validated").show();
|
||||
$("#row_event_type").show();
|
||||
$("#row_extended_events").show();
|
||||
|
||||
$("#row_filter_search").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
@ -3459,7 +3483,8 @@ function chooseType() {
|
||||
$("#row_show_summary_group").show();
|
||||
$("#row_event_graphs").show();
|
||||
$("#row_event_type").show();
|
||||
|
||||
$("#row_extended_events").show();
|
||||
$("#row_extended_events").show();
|
||||
|
||||
$("#row_event_graph_by_user").show();
|
||||
$("#row_event_graph_by_criticity").show();
|
||||
@ -3482,6 +3507,7 @@ function chooseType() {
|
||||
$("#row_show_summary_group").show();
|
||||
$("#row_event_graphs").show();
|
||||
$("#row_event_type").show();
|
||||
$("#row_extended_events").show();
|
||||
|
||||
$("#row_event_graph_by_user").show();
|
||||
$("#row_event_graph_by_criticity").show();
|
||||
@ -3656,16 +3682,6 @@ function chooseType() {
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_pie':
|
||||
$("#row_netflow_filter").show();
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
$("#row_max_values").show();
|
||||
$("#row_resolution").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_data':
|
||||
$("#row_netflow_filter").show();
|
||||
$("#row_description").show();
|
||||
@ -3677,15 +3693,6 @@ function chooseType() {
|
||||
break;
|
||||
|
||||
case 'netflow_summary':
|
||||
$("#row_netflow_filter").show();
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
$("#row_resolution").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'netflow_statistics':
|
||||
$("#row_netflow_filter").show();
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
@ -3694,6 +3701,12 @@ function chooseType() {
|
||||
$("#row_servers").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'nt_top_n':
|
||||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
$("#row_quantity").show();
|
||||
break;
|
||||
}
|
||||
switch (type) {
|
||||
case 'event_report_agent':
|
||||
|
@ -1116,8 +1116,13 @@ switch ($action) {
|
||||
$name_it = (string) get_parameter('name');
|
||||
$values['name'] = reporting_label_macro($items_label, $name_it);
|
||||
|
||||
// Added support for projection graphs, prediction date and SLA reports
|
||||
// 'top_n_value','top_n' and 'text' fields will be reused for these types of report
|
||||
/*
|
||||
Added support for projection graphs,
|
||||
prediction date and SLA reports
|
||||
'top_n_value','top_n' and 'text'
|
||||
fields will be reused for these types of report
|
||||
*/
|
||||
|
||||
switch ($values['type']) {
|
||||
case 'projection_graph':
|
||||
$values['period'] = get_parameter('period1');
|
||||
@ -1127,7 +1132,8 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'event_report_log':
|
||||
$agents_to_report = get_parameter('id_agents2');
|
||||
|
||||
$agents_to_report = get_parameter('id_agents3');
|
||||
$source = get_parameter('source', '');
|
||||
$search = get_parameter('search', '');
|
||||
$log_number = get_parameter('log_number', '');
|
||||
@ -1203,9 +1209,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'netflow_area':
|
||||
case 'netflow_pie':
|
||||
case 'netflow_data':
|
||||
case 'netflow_statistics':
|
||||
case 'netflow_summary':
|
||||
$values['text'] = get_parameter('netflow_filter');
|
||||
$values['description'] = get_parameter('description');
|
||||
@ -1241,6 +1245,12 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'nt_top_n':
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter('radiobutton_max_min_avg', 0);
|
||||
@ -1292,6 +1302,7 @@ switch ($action) {
|
||||
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
||||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['show_extended_events'] = get_parameter('include_extended_events');
|
||||
$values['server_name'] = get_parameter('server_name');
|
||||
$server_id = (int) get_parameter('server_id');
|
||||
if ($server_id != 0) {
|
||||
@ -1430,6 +1441,7 @@ switch ($action) {
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
$style['label'] = $label;
|
||||
} else {
|
||||
@ -1525,7 +1537,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'event_report_log':
|
||||
$agents_to_report = get_parameter('id_agents2');
|
||||
$agents_to_report = get_parameter('id_agents3');
|
||||
$source = get_parameter('source', '');
|
||||
$search = get_parameter('search', '');
|
||||
$log_number = get_parameter('log_number', '');
|
||||
@ -1570,9 +1582,7 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'netflow_area':
|
||||
case 'netflow_pie':
|
||||
case 'netflow_data':
|
||||
case 'netflow_statistics':
|
||||
case 'netflow_summary':
|
||||
$values['text'] = get_parameter('netflow_filter');
|
||||
$values['description'] = get_parameter('description');
|
||||
@ -1608,6 +1618,12 @@ switch ($action) {
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
case 'nt_top_n':
|
||||
$values['top_n_value'] = get_parameter('quantity');
|
||||
$values['period'] = get_parameter('period');
|
||||
$good_format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$values['period'] = get_parameter('period');
|
||||
$values['top_n'] = get_parameter('radiobutton_max_min_avg', 0);
|
||||
@ -1632,17 +1648,6 @@ switch ($action) {
|
||||
$values['server_name'] = get_parameter('combo_server');
|
||||
}
|
||||
|
||||
|
||||
if (is_metaconsole()) {
|
||||
// For SQL Query check if it is setted in the meta
|
||||
if ($values['type'] == 'sql') {
|
||||
if (empty($values['server_name'])) {
|
||||
$good_format = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
$values['id_gs'] = get_parameter('id_custom_graph');
|
||||
if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent') or ($values['type'] == 'agent_configuration') or ($values['type'] == 'group_configuration')) {
|
||||
@ -1694,6 +1699,7 @@ switch ($action) {
|
||||
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
||||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||
$values['id_group'] = get_parameter('combo_group');
|
||||
$values['show_extended_events'] = get_parameter('include_extended_events');
|
||||
|
||||
|
||||
if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
|
||||
@ -1814,6 +1820,7 @@ switch ($action) {
|
||||
case 'MTBF':
|
||||
case 'MTTR':
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
$style['label'] = $label;
|
||||
} else {
|
||||
|
@ -231,6 +231,21 @@ function is_metaconsole() {
|
||||
else return false;
|
||||
}
|
||||
|
||||
function dialog_message(message_id) {
|
||||
$(message_id)
|
||||
.css("display", "inline")
|
||||
.dialog({
|
||||
modal: true,
|
||||
show: "blind",
|
||||
hide: "blind",
|
||||
buttons: {
|
||||
Close: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function update_button_palette_callback() {
|
||||
var values = {};
|
||||
|
||||
@ -240,14 +255,11 @@ function update_button_palette_callback() {
|
||||
switch (selectedItem) {
|
||||
case "background":
|
||||
if (values["width"] < 1024 || values["height"] < 768) {
|
||||
alert("Min allowed size is 1024x768");
|
||||
dialog_message("#message_min_allowed_size");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (values["width"] == 0 && values["height"] == 0) {
|
||||
values["width"] = $("#hidden-background_original_width").val();
|
||||
values["height"] = $("#hidden-background_original_height").val();
|
||||
}
|
||||
$("#hidden-background_width").val(values["width"]);
|
||||
$("#hidden-background_height").val(values["height"]);
|
||||
$("#background").css("width", values["width"]);
|
||||
$("#background").css("height", values["height"]);
|
||||
|
||||
@ -259,11 +271,25 @@ function update_button_palette_callback() {
|
||||
break;
|
||||
case "box_item":
|
||||
if ($("input[name=width_box]").val() == "") {
|
||||
alert("Undefined width");
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name='width_box']").val()) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
if ($("input[name=height_box]").val() == "") {
|
||||
alert("Undefined height");
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name='height_box']").val()) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -288,7 +314,7 @@ function update_button_palette_callback() {
|
||||
values["label"] == "" &&
|
||||
values["show_statistics"] == false
|
||||
) {
|
||||
alert("Undefined image");
|
||||
dialog_message("#message_alert_no_image");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -428,18 +454,32 @@ function update_button_palette_callback() {
|
||||
break;
|
||||
case "static_graph":
|
||||
if ($("input[name=width]").val() == "") {
|
||||
alert("Undefined width");
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name='width']").val()) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
if ($("input[name=height]").val() == "") {
|
||||
alert("Undefined height");
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name='height']").val()) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
(values["image"] == "" || values["image"] == "none") &&
|
||||
values["label"] == ""
|
||||
) {
|
||||
alert("Undefined image");
|
||||
dialog_message("#message_alert_no_image");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -555,13 +595,27 @@ function update_button_palette_callback() {
|
||||
break;
|
||||
case "percentile_bar":
|
||||
case "percentile_item":
|
||||
if ($("input[name=width_percentile]").val() == "") {
|
||||
alert("Undefined width");
|
||||
if ($("input[name=height_percentile]").val() == "") {
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("input[name=height_percentile]").val() == "") {
|
||||
alert("Undefined height");
|
||||
if ($("input[name=width_percentile]").val() == "") {
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
$("input[name=width_percentile]").val() >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
return false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -604,7 +658,6 @@ function update_button_palette_callback() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($("#dir_items").html() == "vertical") {
|
||||
if (
|
||||
parseInt($("#text-top").val()) +
|
||||
@ -621,20 +674,41 @@ function update_button_palette_callback() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
return false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
}
|
||||
if ($("input[name=width_module_graph]").val() == "") {
|
||||
alert("Undefined width");
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
if ($("input[name=height_module_graph]").val() == "") {
|
||||
alert("Undefined height");
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width_module_graph"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name=height_module_graph]").val()) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
$("#custom_graph_row").css("display") != "none" &&
|
||||
$("#custom_graph option:selected").html() == "None"
|
||||
) {
|
||||
alert("Undefined graph");
|
||||
dialog_message("#message_alert_no_custom_graph");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -644,12 +718,19 @@ function update_button_palette_callback() {
|
||||
break;
|
||||
case "bars_graph":
|
||||
if ($("input[name=width_percentile]").val() == "") {
|
||||
alert("Undefined width");
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("input[name=bars_graph_height]").val() == "") {
|
||||
alert("Undefined height");
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
return false;
|
||||
}
|
||||
if (values["agent_string"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -660,18 +741,48 @@ function update_button_palette_callback() {
|
||||
break;
|
||||
|
||||
case "clock":
|
||||
if (
|
||||
parseInt(values["width_percentile"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
|
||||
$("#text_" + idItem).html(values["label"]);
|
||||
$("#image_" + idItem).attr("src", "images/spinner.gif");
|
||||
setClock(idItem, values);
|
||||
break;
|
||||
|
||||
case "auto_sla_graph":
|
||||
if ($("input[name=width]").val() == "") {
|
||||
alert("Undefined width");
|
||||
if (values["height"] == "") {
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
if ($("input[name=height]").val() == "") {
|
||||
alert("Undefined height");
|
||||
if (
|
||||
parseInt(values["height"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
return false;
|
||||
}
|
||||
if (values["width"] == "") {
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
return false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
}
|
||||
$("#text_" + idItem).html(values["label"]);
|
||||
@ -680,8 +791,22 @@ function update_button_palette_callback() {
|
||||
setEventsBar(idItem, values);
|
||||
break;
|
||||
case "donut_graph":
|
||||
if (
|
||||
parseInt(values["width_percentile"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module_string_type");
|
||||
return false;
|
||||
}
|
||||
if (values["agent_string"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
}
|
||||
$("#image_" + idItem).attr("src", "images/spinner.gif");
|
||||
|
||||
setDonutsGraph(idItem, values);
|
||||
break;
|
||||
case "simple_value":
|
||||
@ -718,21 +843,47 @@ function update_button_palette_callback() {
|
||||
"</span></td></tr><tr><td></td></tr></tbody></table>"
|
||||
);
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
return false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "label":
|
||||
if (values["label"] == "") {
|
||||
dialog_message("#message_alert_no_label");
|
||||
return false;
|
||||
}
|
||||
$("#text_" + idItem).html(values["label"]);
|
||||
break;
|
||||
case "icon":
|
||||
if ($("input[name=width]").val() == "") {
|
||||
alert("Undefined width");
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name=width]").val()) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
if ($("input[name=height]").val() == "") {
|
||||
alert("Undefined height");
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name=height]").val()) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
return false;
|
||||
}
|
||||
if (values["image"] == "" || values["image"] == "none") {
|
||||
alert("Undefined image");
|
||||
dialog_message("#message_alert_no_image");
|
||||
return false;
|
||||
}
|
||||
$("#image_" + idItem).attr("src", "images/spinner.gif");
|
||||
@ -779,13 +930,70 @@ function update_button_palette_callback() {
|
||||
var image = values["image"] + ".png";
|
||||
set_image("image", idItem, image);
|
||||
break;
|
||||
case "line_item":
|
||||
if (
|
||||
parseInt(values["line_width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "color_cloud":
|
||||
if (
|
||||
parseInt(values["diameter"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
return false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
return false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "service":
|
||||
if (values["height"] == "" || values["height_module_graph"] == 0) {
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["height"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
return false;
|
||||
}
|
||||
if (values["width"] == "" || values["width_module_graph"] == 0) {
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
$("select[name=service]").val() == "" ||
|
||||
$("select[name=service]").val() == "none"
|
||||
) {
|
||||
dialog_message("#message_alert_no_service");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($("input[name=width]").val() == "") {
|
||||
alert("Undefined width");
|
||||
dialog_message("#message_alert_no_width");
|
||||
return false;
|
||||
}
|
||||
if ($("input[name=height]").val() == "") {
|
||||
alert("Undefined height");
|
||||
dialog_message("#message_alert_no_height");
|
||||
return false;
|
||||
}
|
||||
//Maybe save in any Enterprise item.
|
||||
@ -1018,149 +1226,356 @@ function create_button_palette_callback() {
|
||||
switch (creationItem) {
|
||||
case "box_item":
|
||||
if ($("input[name='width_box']").val() == "") {
|
||||
alert("Undefined width");
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name='width_box']").val()) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if ($("input[name='height_box']").val() == "") {
|
||||
alert("Undefined height");
|
||||
dialog_message("#message_alert_no_height");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt($("input[name='height_box']").val()) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "group_item":
|
||||
if (values["height"] == "") {
|
||||
dialog_message("#message_alert_no_height");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["height"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["width"] == "") {
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
(values["image"] == "" || values["image"] == "none") &&
|
||||
values["label"] == "" &&
|
||||
values["show_statistics"] == false
|
||||
) {
|
||||
alert("Undefined images");
|
||||
dialog_message("#message_alert_no_image");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "static_graph":
|
||||
if (values["width"] == "") {
|
||||
alert("Undefined width");
|
||||
if (values["height"] == "") {
|
||||
dialog_message("#message_alert_no_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["height"] == "") {
|
||||
alert("Undefined height");
|
||||
if (
|
||||
parseInt(values["height"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["width"] == "") {
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
(values["image"] == "" || values["image"] == "none") &&
|
||||
values["label"] == false
|
||||
) {
|
||||
alert("Undefined image");
|
||||
dialog_message("#message_alert_no_image");
|
||||
validate = false;
|
||||
}
|
||||
|
||||
break;
|
||||
case "auto_sla_graph":
|
||||
if (values["height"] == "") {
|
||||
dialog_message("#message_alert_no_height");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["height"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["width"] == "") {
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
validate = false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
alert($("#message_alert_no_agent").html());
|
||||
dialog_message("#message_alert_no_agent");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "donut_graph":
|
||||
if (
|
||||
parseInt(values["width_percentile"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module_string_type");
|
||||
validate = false;
|
||||
}
|
||||
if (values["agent_string"] == "") {
|
||||
alert($("#message_alert_no_agent").html());
|
||||
dialog_message("#message_alert_no_agent");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "label":
|
||||
if (values["label"] == "") {
|
||||
alert($("#message_alert_no_label").html());
|
||||
dialog_message("#message_alert_no_label");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "icon":
|
||||
if (values["width"] == "") {
|
||||
alert("Undefined width");
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["height"] == "") {
|
||||
alert("Undefined height");
|
||||
dialog_message("#message_alert_no_height");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["height"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["image"] == "" || values["image"] == "none") {
|
||||
alert($("#message_alert_no_image").html());
|
||||
dialog_message("#message_alert_no_image");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "percentile_bar":
|
||||
case "percentile_item":
|
||||
if (values["width"] == "") {
|
||||
alert("Undefined width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
alert($("#message_alert_no_agent").html());
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
alert($("#message_alert_no_module").html());
|
||||
validate = false;
|
||||
}
|
||||
if (values["max_percentile"] == "") {
|
||||
alert($("#message_alert_no_max_percentile").html());
|
||||
if (
|
||||
parseInt(values["width_percentile"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["width_percentile"] == "") {
|
||||
alert($("#message_alert_no_width_percentile").html());
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
validate = false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if (values["max_percentile"] == "") {
|
||||
dialog_message("#message_alert_no_max_percentile");
|
||||
validate = false;
|
||||
}
|
||||
|
||||
break;
|
||||
case "module_graph":
|
||||
if (values["width_module_graph"] == "") {
|
||||
alert("Undefined width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["height_module_graph"] == "") {
|
||||
alert("Undefined height");
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
validate = false;
|
||||
}
|
||||
if (values["id_custom_graph"] == 0) {
|
||||
if (values["agent"] == "") {
|
||||
alert($("#message_alert_no_agent").html());
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
alert($("#message_alert_no_module").html());
|
||||
dialog_message("#message_alert_no_agent");
|
||||
validate = false;
|
||||
}
|
||||
if (values["period"] == 0) {
|
||||
alert($("#message_alert_no_period").html());
|
||||
dialog_message("#message_alert_no_period");
|
||||
validate = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "bars_graph":
|
||||
if (values["agent_string"] == "") {
|
||||
alert($("#message_alert_no_agent").html());
|
||||
if (
|
||||
values["height_module_graph"] == "" ||
|
||||
values["height_module_graph"] == 0
|
||||
) {
|
||||
dialog_message("#message_alert_no_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
alert($("#message_alert_no_module").html());
|
||||
if (
|
||||
parseInt(values["height_module_graph"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
values["width_module_graph"] == "" ||
|
||||
values["width_module_graph"] == 0
|
||||
) {
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width_module_graph"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "bars_graph":
|
||||
if (values["bars_graph_height"] == "") {
|
||||
dialog_message("#message_alert_no_height");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["bars_graph_height"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["width_percentile"] == "") {
|
||||
alert($("#message_alert_no_width_percentile").html());
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["bars_graph_height"] == "") {
|
||||
alert($("#message_alert_no_bars_graph_height").html());
|
||||
if (
|
||||
parseInt(values["width_percentile"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
validate = false;
|
||||
}
|
||||
if (values["agent_string"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "simple_value":
|
||||
if (values["agent"] == "") {
|
||||
alert($("#message_alert_no_agent").html());
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
alert($("#message_alert_no_module").html());
|
||||
if (values["agent"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "clock":
|
||||
if (
|
||||
parseInt(values["width_percentile"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "line_item":
|
||||
if (
|
||||
parseInt(values["line_width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "color_cloud":
|
||||
if (
|
||||
parseInt(values["diameter"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["module"] == 0) {
|
||||
dialog_message("#message_alert_no_module");
|
||||
validate = false;
|
||||
}
|
||||
if (values["agent"] == "") {
|
||||
dialog_message("#message_alert_no_agent");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
case "service":
|
||||
if (values["height"] == "" || values["height_module_graph"] == 0) {
|
||||
dialog_message("#message_alert_no_height");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["height"]) >
|
||||
parseInt($("#hidden-background_height").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_height");
|
||||
validate = false;
|
||||
}
|
||||
if (values["width"] == "" || values["width_module_graph"] == 0) {
|
||||
dialog_message("#message_alert_no_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
parseInt(values["width"]) >
|
||||
parseInt($("#hidden-background_width").val())
|
||||
) {
|
||||
dialog_message("#message_alert_max_width");
|
||||
validate = false;
|
||||
}
|
||||
if (
|
||||
$("select[name=service]").val() == "" ||
|
||||
$("select[name=service]").val() == "none"
|
||||
) {
|
||||
dialog_message("#message_alert_no_service");
|
||||
validate = false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
//Maybe save in any Enterprise item.
|
||||
if (typeof enterprise_create_button_palette_callback == "function") {
|
||||
@ -3714,17 +4129,7 @@ function createItem(type, values, id_data) {
|
||||
.attr("height", values["height"]);
|
||||
}
|
||||
}
|
||||
// else{
|
||||
// $('#image_'+id_data).css('width', values['width']+'px');
|
||||
// $('#image_'+id_data).css('height', values['height']+'px');
|
||||
// }
|
||||
/*
|
||||
var $span = $('<span></span>')
|
||||
.attr('id', 'text_' + id_data)
|
||||
.attr('class', 'text')
|
||||
.append(values['label']);
|
||||
|
||||
*/
|
||||
|
||||
var $input = $("<input></input>")
|
||||
.attr("id", "hidden-status_" + id_data)
|
||||
.attr("type", "hidden")
|
||||
@ -4489,7 +4894,6 @@ function createItem(type, values, id_data) {
|
||||
case "clock":
|
||||
sizeStyle = "";
|
||||
imageSize = "";
|
||||
|
||||
if (values["label_position"] == "up") {
|
||||
item = $(
|
||||
'<div id="' +
|
||||
|
134
pandora_console/godmode/servers/discovery.php
Executable file
134
pandora_console/godmode/servers/discovery.php
Executable file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Server Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
ui_require_css_file('discovery');
|
||||
|
||||
|
||||
/**
|
||||
* Mask class names.
|
||||
*
|
||||
* @param string $str Wiz parameter.
|
||||
*
|
||||
* @return string Classname.
|
||||
*/
|
||||
function get_wiz_class($str)
|
||||
{
|
||||
switch ($str) {
|
||||
case 'hd':
|
||||
return 'HostDevices';
|
||||
|
||||
case 'cloud':
|
||||
return 'Cloud';
|
||||
|
||||
case 'tasklist':
|
||||
return 'DiscoveryTaskList';
|
||||
|
||||
case 'app':
|
||||
return 'Applications';
|
||||
|
||||
case 'ctask':
|
||||
return 'ConsoleTasks';
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Aux. function to compare classpath names.
|
||||
*
|
||||
* @param string $a Classpath A.
|
||||
* @param string $b Classpath B.
|
||||
*
|
||||
* @return string Matching one.
|
||||
*/
|
||||
function cl_load_cmp($a, $b)
|
||||
{
|
||||
$str_a = basename($a, '.class.php');
|
||||
$str_b = basename($b, '.class.php');
|
||||
if ($str_a == $str_b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($str_a < $str_b) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* CLASS LOADER.
|
||||
*/
|
||||
|
||||
// Dynamic class loader.
|
||||
$classes = glob($config['homedir'].'/godmode/wizards/*.class.php');
|
||||
if (enterprise_installed()) {
|
||||
$ent_classes = glob(
|
||||
$config['homedir'].'/enterprise/godmode/wizards/*.class.php'
|
||||
);
|
||||
if ($ent_classes === false) {
|
||||
$ent_classes = [];
|
||||
}
|
||||
|
||||
$classes = array_merge($classes, $ent_classes);
|
||||
}
|
||||
|
||||
foreach ($classes as $classpath) {
|
||||
include_once $classpath;
|
||||
}
|
||||
|
||||
// Sort output.
|
||||
uasort($classes, 'cl_load_cmp');
|
||||
|
||||
// Check user action.
|
||||
$wiz_in_use = get_parameter('wiz', null);
|
||||
$page = get_parameter('page', 0);
|
||||
|
||||
$classname_selected = get_wiz_class($wiz_in_use);
|
||||
|
||||
// Else: class not found pseudo exception.
|
||||
if ($classname_selected !== null) {
|
||||
$wiz = new $classname_selected($page);
|
||||
$result = $wiz->run();
|
||||
if (is_array($result) === true) {
|
||||
// Redirect control and messages to DiscoveryTasklist.
|
||||
$classname_selected = 'DiscoveryTaskList';
|
||||
$wiz = new $classname_selected($page);
|
||||
$result = $wiz->run($result['msg'], $result['result']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($classname_selected === null) {
|
||||
// Load classes and print selector.
|
||||
$wiz_data = [];
|
||||
foreach ($classes as $classpath) {
|
||||
$classname = basename($classpath, '.class.php');
|
||||
$obj = new $classname();
|
||||
|
||||
// DiscoveryTaskList must be first button.
|
||||
if ($classname == 'DiscoveryTaskList') {
|
||||
array_unshift($wiz_data, $obj->load());
|
||||
} else {
|
||||
$wiz_data[] = $obj->load();
|
||||
}
|
||||
}
|
||||
|
||||
Wizard::printBigButtonsList($wiz_data);
|
||||
}
|
@ -1,471 +1,27 @@
|
||||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2012 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, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Recon Task Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once $config['homedir'].'/include/functions_network_profiles.php';
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
$options[]['text'] = "<a href='index.php?sec=estado&sec2=operation/servers/recon_view'>".html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>';
|
||||
}
|
||||
|
||||
$user_groups_w = users_get_groups(false, 'PM', true, false, null, 'id_grupo');
|
||||
$user_groups_w = array_keys($user_groups_w);
|
||||
|
||||
$user_groups_r = users_get_groups(false, 'AW', true, false, null, 'id_grupo');
|
||||
$user_groups_r = array_keys($user_groups_r);
|
||||
|
||||
// Headers
|
||||
// ui_print_page_header (__('Manage recontask'), "images/gm_servers.png", false, "", true);
|
||||
ui_print_page_header(__('Manage recontask'), 'images/gm_servers.png', false, '', true, $options);
|
||||
|
||||
|
||||
// --------------------------------
|
||||
// DELETE A RECON TASKs
|
||||
// --------------------------------
|
||||
if (isset($_GET['delete'])) {
|
||||
$id = get_parameter_get('delete');
|
||||
|
||||
$result = db_process_sql_delete('trecon_task', ['id_rt' => $id]);
|
||||
|
||||
if ($result !== false) {
|
||||
ui_print_success_message(__('Successfully deleted recon task'));
|
||||
} else {
|
||||
ui_print_error_message(__('Error deleting recon task'));
|
||||
}
|
||||
} else if (isset($_GET['disabled'])) {
|
||||
$id = get_parameter_get('id');
|
||||
$disabled = get_parameter_get('disabled');
|
||||
|
||||
$result = db_process_sql_update('trecon_task', ['disabled' => $disabled], ['id_rt' => $id]);
|
||||
|
||||
if ($result !== false) {
|
||||
ui_print_success_message(__('Successfully updated recon task'));
|
||||
// If the action is enabled, we force recon_task to be queued asap
|
||||
if ($disabled == 0) {
|
||||
servers_force_recon_task($id);
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(__('Error updating recon task'));
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// GET PARAMETERS IF UPDATE OR CREATE
|
||||
// --------------------------------
|
||||
if ((isset($_GET['update'])) or ((isset($_GET['create'])))) {
|
||||
$name = get_parameter_post('name');
|
||||
$network = get_parameter_post('network');
|
||||
$description = get_parameter_post('description');
|
||||
$id_recon_server = get_parameter_post('id_recon_server');
|
||||
$interval = get_parameter_post('interval');
|
||||
$id_group = get_parameter_post('id_group');
|
||||
$create_incident = get_parameter_post('create_incident');
|
||||
$id_network_profile = get_parameter_post('id_network_profile');
|
||||
$recon_ports = get_parameter_post('recon_ports', '');
|
||||
$id_os = get_parameter_post('id_os', 10);
|
||||
$snmp_community = get_parameter_post('snmp_community', 'public');
|
||||
$id_recon_script = get_parameter('id_recon_script', 0);
|
||||
$mode = get_parameter('mode', '');
|
||||
$field1 = get_parameter('_field1_', '');
|
||||
$field2 = get_parameter('_field2_', '');
|
||||
$field3 = get_parameter('_field3_', '');
|
||||
$field4 = get_parameter('_field4_', '');
|
||||
$snmp_version = get_parameter_post('snmp_version');
|
||||
$snmp3_auth_user = get_parameter_post('snmp_auth_user');
|
||||
$snmp3_auth_pass = get_parameter_post('snmp_auth_pass');
|
||||
$snmp3_privacy_method = get_parameter_post('snmp_privacy_method');
|
||||
$snmp3_privacy_pass = get_parameter_post('snmp_privacy_pass');
|
||||
$snmp3_auth_method = get_parameter_post('snmp_auth_method');
|
||||
$snmp3_security_level = get_parameter_post('snmp_security_level');
|
||||
|
||||
|
||||
if ($mode == 'network_sweep') {
|
||||
$id_recon_script = 0;
|
||||
} else {
|
||||
$id_network_profile = 0;
|
||||
}
|
||||
|
||||
$os_detect = (int) get_parameter('os_detect', 0);
|
||||
$resolve_names = (int) get_parameter('resolve_names', 0);
|
||||
$parent_detection = (int) get_parameter('parent_detection', 0);
|
||||
$parent_recursion = (int) get_parameter('parent_recursion', 1);
|
||||
$alias_as_name = (int) get_parameter('alias_as_name', 0);
|
||||
$snmp_enabled = (int) get_parameter('snmp_enabled', 0);
|
||||
$vlan_enabled = (int) get_parameter('vlan_enabled', 0);
|
||||
// Get macros
|
||||
$macros = (string) get_parameter('macros');
|
||||
|
||||
if (!empty($macros)) {
|
||||
$macros = json_decode(base64_decode($macros), true);
|
||||
|
||||
foreach ($macros as $k => $m) {
|
||||
$macros[$k]['value'] = get_parameter($m['macro'], '');
|
||||
}
|
||||
}
|
||||
|
||||
$macros = io_json_mb_encode($macros);
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// UPDATE A RECON TASK
|
||||
// --------------------------------
|
||||
if (isset($_GET['update'])) {
|
||||
$id = get_parameter_get('update');
|
||||
|
||||
$values = [
|
||||
'snmp_community' => $snmp_community,
|
||||
'id_os' => $id_os,
|
||||
'name' => $name,
|
||||
'subnet' => $network,
|
||||
'description' => $description,
|
||||
'id_recon_server' => $id_recon_server,
|
||||
'create_incident' => $create_incident,
|
||||
'id_group' => $id_group,
|
||||
'interval_sweep' => $interval,
|
||||
'id_network_profile' => $id_network_profile,
|
||||
'recon_ports' => $recon_ports,
|
||||
'id_recon_script' => $id_recon_script,
|
||||
'field1' => $field1,
|
||||
'field2' => $field2,
|
||||
'field3' => $field3,
|
||||
'field4' => $field4,
|
||||
'os_detect' => $os_detect,
|
||||
'resolve_names' => $resolve_names,
|
||||
'parent_detection' => $parent_detection,
|
||||
'parent_recursion' => $parent_recursion,
|
||||
'macros' => $macros,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'snmp_enabled' => $snmp_enabled,
|
||||
'vlan_enabled' => $vlan_enabled,
|
||||
'snmp_version' => $snmp_version,
|
||||
];
|
||||
|
||||
$values_v3 = [
|
||||
'snmp_auth_user' => $snmp3_auth_user,
|
||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
||||
'snmp_auth_method' => $snmp3_auth_method,
|
||||
'snmp_security_level' => $snmp3_security_level,
|
||||
];
|
||||
if ($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c') {
|
||||
$values_v3 = [
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_auth_pass' => '',
|
||||
'snmp_privacy_method' => '',
|
||||
'snmp_privacy_pass' => '',
|
||||
'snmp_auth_method' => '',
|
||||
'snmp_security_level' => '',
|
||||
];
|
||||
}
|
||||
|
||||
$values = array_merge($values, $values_v3);
|
||||
|
||||
$where = ['id_rt' => $id];
|
||||
|
||||
$reason = '';
|
||||
if ($name != '') {
|
||||
if (empty($id_recon_script)) {
|
||||
if (!preg_match('/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/', $network)) {
|
||||
$reason = __('Wrong format in Subnet field');
|
||||
$result = false;
|
||||
} else {
|
||||
$result = db_process_sql_update('trecon_task', $values, $where);
|
||||
}
|
||||
} else {
|
||||
$result = db_process_sql_update('trecon_task', $values, $where);
|
||||
}
|
||||
} else {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
ui_print_success_message(__('Successfully updated recon task'));
|
||||
} else {
|
||||
ui_print_error_message(__('Error updating recon task'));
|
||||
echo $reason;
|
||||
include 'manage_recontask_form.php';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// CREATE A RECON TASK
|
||||
// --------------------------------
|
||||
if (isset($_GET['create'])) {
|
||||
$values = [
|
||||
'name' => $name,
|
||||
'subnet' => $network,
|
||||
'description' => $description,
|
||||
'id_recon_server' => $id_recon_server,
|
||||
'create_incident' => $create_incident,
|
||||
'id_group' => $id_group,
|
||||
'id_network_profile' => $id_network_profile,
|
||||
'interval_sweep' => $interval,
|
||||
'id_os' => $id_os,
|
||||
'recon_ports' => $recon_ports,
|
||||
'snmp_community' => $snmp_community,
|
||||
'id_recon_script' => $id_recon_script,
|
||||
'field1' => $field1,
|
||||
'field2' => $field2,
|
||||
'field3' => $field3,
|
||||
'field4' => $field4,
|
||||
'os_detect' => $os_detect,
|
||||
'resolve_names' => $resolve_names,
|
||||
'parent_detection' => $parent_detection,
|
||||
'parent_recursion' => $parent_recursion,
|
||||
'macros' => $macros,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'snmp_enabled' => $snmp_enabled,
|
||||
'vlan_enabled' => $vlan_enabled,
|
||||
'snmp_version' => $snmp_version,
|
||||
];
|
||||
|
||||
$values_v3 = [
|
||||
'snmp_auth_user' => $snmp3_auth_user,
|
||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
||||
'snmp_auth_method' => $snmp3_auth_method,
|
||||
'snmp_security_level' => $snmp3_security_level,
|
||||
];
|
||||
if ($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c') {
|
||||
$values_v3 = [
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_auth_pass' => '',
|
||||
'snmp_privacy_method' => '',
|
||||
'snmp_privacy_pass' => '',
|
||||
'snmp_auth_method' => '',
|
||||
'snmp_security_level' => '',
|
||||
];
|
||||
}
|
||||
|
||||
if ($values['snmp_version'] == '3') {
|
||||
$values['vlan_enabled'] = 0;
|
||||
}
|
||||
|
||||
$values = array_merge($values, $values_v3);
|
||||
|
||||
$name = io_safe_output($name);
|
||||
$name = trim($name, ' ');
|
||||
$name = io_safe_input($name);
|
||||
$reason = '';
|
||||
|
||||
if ($name != '') {
|
||||
$name_exists = (bool) db_get_value('name', 'trecon_task', 'name', $name);
|
||||
|
||||
if (empty($id_recon_script)) {
|
||||
if ($name_exists && (!preg_match('/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/', $network))) {
|
||||
$reason = __('Recon-task name already exists and incorrect format in Subnet field');
|
||||
$result = false;
|
||||
} else if (!preg_match('/[0-9]+.+[0-9]+.+[0-9]+.+[0-9]+\/+[0-9]/', $network)) {
|
||||
$reason = __('Wrong format in Subnet field');
|
||||
$result = false;
|
||||
} else if ($name_exists) {
|
||||
$reason = __('Recon-task name already exists');
|
||||
$result = false;
|
||||
} else {
|
||||
$result = db_process_sql_insert('trecon_task', $values);
|
||||
}
|
||||
} else {
|
||||
if ($name_exists) {
|
||||
$reason = __('Recon-task name already exists');
|
||||
$result = false;
|
||||
} else {
|
||||
$result = db_process_sql_insert('trecon_task', $values);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$reason = 'The field "Task name" is empty';
|
||||
$result = false;
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
ui_print_success_message(__('Successfully created recon task'));
|
||||
} else {
|
||||
ui_print_error_message(__('Error creating recon task'));
|
||||
echo $reason;
|
||||
include 'manage_recontask_form.php';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// SHOW TABLE WITH ALL RECON TASKs
|
||||
// --------------------------------
|
||||
// Pandora Admin must see all columns
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM trecon_task RT, tusuario_perfil UP
|
||||
WHERE
|
||||
UP.id_usuario = "%s" AND UP.id_grupo = RT.id_group',
|
||||
$config['id_user']
|
||||
);
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
} else {
|
||||
$result = db_get_all_rows_in_table('trecon_task');
|
||||
}
|
||||
|
||||
$color = 1;
|
||||
if ($result !== false) {
|
||||
$table = new StdClass();
|
||||
$table->head = [
|
||||
__('Name'),
|
||||
__('Network'),
|
||||
__('Mode'),
|
||||
__('Group'),
|
||||
__('SNMP Version'),
|
||||
__('Incident'),
|
||||
__('OS'),
|
||||
__('Interval'),
|
||||
__('Ports'),
|
||||
__('Action'),
|
||||
];
|
||||
$table->align = [
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
'left',
|
||||
];
|
||||
$table->width = '100%';
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->class = 'databox data';
|
||||
$table->data = [];
|
||||
|
||||
$table->style[8] = 'text-align: left;';
|
||||
$table->size[8] = '15%';
|
||||
|
||||
foreach ($result as $row) {
|
||||
if (in_array($row['id_group'], $user_groups_r)) {
|
||||
$data = [];
|
||||
$data[0] = $row['name'];
|
||||
if ($row['id_recon_script'] == 0) {
|
||||
$data[1] = $row['subnet'];
|
||||
} else {
|
||||
$data[1] = '-';
|
||||
}
|
||||
|
||||
|
||||
if ($row['id_recon_script'] == 0) {
|
||||
// Network recon task
|
||||
$data[2] = html_print_image('images/network.png', true, ['title' => __('Network recon task')]).' ';
|
||||
$data[2] .= network_profiles_get_name($row['id_network_profile']);
|
||||
$mode_name = '';
|
||||
} else {
|
||||
// APP recon task
|
||||
$data[2] = html_print_image('images/plugin.png', true).' ';
|
||||
$mode_name = db_get_sql(sprintf('SELECT name FROM trecon_script WHERE id_recon_script = %d', $row['id_recon_script']));
|
||||
$data[2] .= $mode_name;
|
||||
}
|
||||
|
||||
|
||||
// GROUP
|
||||
if ($row['id_recon_script'] == 0) {
|
||||
$data[3] = ui_print_group_icon($row['id_group'], true);
|
||||
} else {
|
||||
$data[3] = '-';
|
||||
}
|
||||
|
||||
// SNMP VERSION
|
||||
if ($row['snmp_version'] == '1') {
|
||||
$data[4] = 'v. 1';
|
||||
} else if ($row['snmp_version'] == '2') {
|
||||
$data[4] = 'v. 2';
|
||||
} else if ($row['snmp_version'] == '2c') {
|
||||
$data[4] = 'v. 2c';
|
||||
} else if ($row['snmp_version'] == '3') {
|
||||
$data[4] = 'v. 3';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// INCIDENT
|
||||
$data[5] = (($row['create_incident'] == 1) ? __('Yes') : __('No'));
|
||||
|
||||
// OS
|
||||
if ($row['id_recon_script'] == 0) {
|
||||
$data[6] = (($row['id_os'] > 0) ? ui_print_os_icon($row['id_os'], false, true) : __('Any'));
|
||||
} else {
|
||||
$data[6] = '-';
|
||||
}
|
||||
|
||||
// INTERVAL
|
||||
if ($row['interval_sweep'] == 0) {
|
||||
$data[7] = __('Manual');
|
||||
} else {
|
||||
$data[7] = human_time_description_raw($row['interval_sweep']);
|
||||
}
|
||||
|
||||
// PORTS
|
||||
if ($row['id_recon_script'] == 0) {
|
||||
$data[8] = substr($row['recon_ports'], 0, 15);
|
||||
} else {
|
||||
$data[8] = '-';
|
||||
}
|
||||
|
||||
// ACTION
|
||||
$task_group = $row['id_group'];
|
||||
|
||||
if (in_array($task_group, $user_groups_w)) {
|
||||
$data[9] = '<a href="index.php?sec=estado&sec2=operation/servers/recon_view">'.html_print_image('images/eye.png', true).'</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row['id_rt'].'">'.html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
if ($mode_name != 'IPAM Recon') {
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row['id_rt'].'">'.html_print_image('images/config.png', true).'</a>';
|
||||
} else {
|
||||
$sql_ipam = 'select id from tipam_network where id_recon_task ='.$row['id_rt'];
|
||||
$id_recon_ipam = db_get_sql($sql_ipam);
|
||||
$data[9] .= '<a href="index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id='.$id_recon_ipam.'">'.html_print_image('images/config.png', true).'</a>';
|
||||
}
|
||||
|
||||
if ($row['disabled'] == 0) {
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row['id_rt'].'&disabled=1">'.html_print_image('images/lightbulb.png', true).'</a>';
|
||||
} else {
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row['id_rt'].'&disabled=0">'.html_print_image('images/lightbulb_off.png', true).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
unset($table);
|
||||
} else {
|
||||
echo '<div class="nf">'.__('There are no recon task configured').'</div>';
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: 99%;">';
|
||||
echo '<form method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create">';
|
||||
echo html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
/**
|
||||
* Deprectated.
|
||||
*
|
||||
* @category Deprectated
|
||||
* @package Pandora FMS
|
||||
* @subpackage Recion task script
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
@ -1,672 +1,27 @@
|
||||
<?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, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
|
||||
$user_groups = users_get_groups(false, 'AW', true, false, null, 'id_grupo');
|
||||
$user_groups = array_keys($user_groups);
|
||||
|
||||
if (is_ajax()) {
|
||||
$get_explanation = (bool) get_parameter('get_explanation', 0);
|
||||
|
||||
if ($get_explanation) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
$explanation = db_get_value('description', 'trecon_script', 'id_recon_script', $id);
|
||||
|
||||
echo io_safe_output($explanation);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$get_recon_script_macros = get_parameter('get_recon_script_macros');
|
||||
if ($get_recon_script_macros) {
|
||||
$id_recon_script = (int) get_parameter('id');
|
||||
$id_recon_task = (int) get_parameter('id_rt');
|
||||
|
||||
if (!empty($id_recon_task) && empty($id_recon_script)) {
|
||||
$recon_script_macros = db_get_value('macros', 'trecon_task', 'id_rt', $id_recon_task);
|
||||
} else if (!empty($id_recon_task)) {
|
||||
$recon_task_id_rs = (int) db_get_value('id_recon_script', 'trecon_task', 'id_rt', $id_recon_task);
|
||||
|
||||
if ($id_recon_script == $recon_task_id_rs) {
|
||||
$recon_script_macros = db_get_value('macros', 'trecon_task', 'id_rt', $id_recon_task);
|
||||
} else {
|
||||
$recon_script_macros = db_get_value('macros', 'trecon_script', 'id_recon_script', $id_recon_script);
|
||||
}
|
||||
} else if (!empty($id_recon_script)) {
|
||||
$recon_script_macros = db_get_value('macros', 'trecon_script', 'id_recon_script', $id_recon_script);
|
||||
} else {
|
||||
$recon_script_macros = [];
|
||||
}
|
||||
|
||||
$macros = [];
|
||||
$macros['base64'] = base64_encode($recon_script_macros);
|
||||
$macros['array'] = json_decode($recon_script_macros, true);
|
||||
|
||||
echo io_json_mb_encode($macros);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Edit mode
|
||||
if (isset($_GET['update']) || (isset($_GET['upd']))) {
|
||||
$update_recon = true;
|
||||
if (isset($_GET['upd'])) {
|
||||
if ($_GET['upd'] != 'update') {
|
||||
$update_recon = false;
|
||||
} else {
|
||||
$id_rt = get_parameter('upd');
|
||||
}
|
||||
}
|
||||
|
||||
if ($update_recon) {
|
||||
if (!isset($id_rt)) {
|
||||
$id_rt = (int) get_parameter_get('update');
|
||||
}
|
||||
|
||||
$row = db_get_row('trecon_task', 'id_rt', $id_rt);
|
||||
$name = $row['name'];
|
||||
$network = $row['subnet'];
|
||||
$id_recon_server = $row['id_recon_server'];
|
||||
$description = $row['description'];
|
||||
$interval = $row['interval_sweep'];
|
||||
$id_group = $row['id_group'];
|
||||
$create_incident = $row['create_incident'];
|
||||
$id_network_profile = $row['id_network_profile'];
|
||||
$id_os = $row['id_os'];
|
||||
$recon_ports = $row['recon_ports'];
|
||||
$snmp_community = $row['snmp_community'];
|
||||
$snmp_version = $row['snmp_version'];
|
||||
$snmp3_auth_user = $row['snmp_auth_user'];
|
||||
$snmp3_auth_pass = $row['snmp_auth_pass'];
|
||||
$snmp3_privacy_method = $row['snmp_privacy_method'];
|
||||
$snmp3_privacy_pass = $row['snmp_privacy_pass'];
|
||||
$snmp3_auth_method = $row['snmp_auth_method'];
|
||||
$snmp3_security_level = $row['snmp_security_level'];
|
||||
$id_recon_script = $row['id_recon_script'];
|
||||
$field1 = $row['field1'];
|
||||
$field2 = $row['field2'];
|
||||
$field3 = $row['field3'];
|
||||
$field4 = $row['field4'];
|
||||
if ($id_recon_script == 0) {
|
||||
$mode = 'network_sweep';
|
||||
} else {
|
||||
$mode = 'recon_script';
|
||||
}
|
||||
|
||||
$os_detect = $row['os_detect'];
|
||||
$resolve_names = $row['resolve_names'];
|
||||
$os_detect = $row['os_detect'];
|
||||
$parent_detection = $row['parent_detection'];
|
||||
$parent_recursion = $row['parent_recursion'];
|
||||
$macros = $row['macros'];
|
||||
$alias_as_name = $row['alias_as_name'];
|
||||
$snmp_enabled = $row['snmp_enabled'];
|
||||
$vlan_enabled = $row['vlan_enabled'];
|
||||
|
||||
$name_script = db_get_value(
|
||||
'name',
|
||||
'trecon_script',
|
||||
'id_recon_script',
|
||||
$id_recon_script
|
||||
);
|
||||
|
||||
if (! in_array($id_group, $user_groups)) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Recon Task Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (isset($_GET['create']) || isset($_GET['crt'])) {
|
||||
$create_recon = true;
|
||||
if (isset($_GET['crt'])) {
|
||||
if ($_GET['crt'] != 'Create') {
|
||||
$create_recon = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($create_recon) {
|
||||
$id_rt = -1;
|
||||
$name = get_parameter('name');
|
||||
$network = get_parameter('network');
|
||||
$description = get_parameter('description');
|
||||
$id_recon_server = 0;
|
||||
$interval = 0;
|
||||
$id_group = 0;
|
||||
$create_incident = 1;
|
||||
$snmp_community = 'public';
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp_version = 1;
|
||||
$snmp3_privacy_method = '';
|
||||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
$id_network_profile = 0;
|
||||
$id_os = -1;
|
||||
// Any
|
||||
$recon_ports = '';
|
||||
// Any
|
||||
$field1 = '';
|
||||
$field2 = '';
|
||||
$field3 = '';
|
||||
$field4 = '';
|
||||
$id_recon_script = 0;
|
||||
$mode = 'network_sweep';
|
||||
$os_detect = 0;
|
||||
$resolve_names = 0;
|
||||
$parent_detection = 1;
|
||||
$parent_recursion = 5;
|
||||
$macros = '';
|
||||
$alias_as_name = 0;
|
||||
$snmp_enabled = 0;
|
||||
$vlan_enabled = 0;
|
||||
}
|
||||
|
||||
$modify = false;
|
||||
if (($name != '') || ($network != '')) {
|
||||
$modify = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$modify) {
|
||||
// Headers
|
||||
ui_print_page_header(__('Manage recontask'), '', false, 'recontask', true);
|
||||
}
|
||||
|
||||
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
||||
if ($is_windows) {
|
||||
echo '<div class="notify">';
|
||||
echo __('Warning').': '.__('By default, in Windows, %s only support Standard network sweep, not custom scripts', get_product_name());
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'table_recon';
|
||||
$table->width = '100%';
|
||||
$table->cellspacing = 4;
|
||||
$table->cellpadding = 4;
|
||||
$table->class = 'databox filters';
|
||||
|
||||
$table->rowclass[3] = 'network_sweep';
|
||||
$table->rowclass[5] = 'network_sweep';
|
||||
$table->rowclass[7] = 'network_sweep';
|
||||
$table->rowclass[8] = 'network_sweep';
|
||||
$table->rowclass[11] = 'network_sweep';
|
||||
$table->rowclass[12] = 'network_sweep';
|
||||
$table->rowclass[18] = 'network_sweep';
|
||||
$table->rowclass[19] = 'network_sweep';
|
||||
$table->rowclass[20] = 'network_sweep';
|
||||
$table->rowclass[21] = 'network_sweep';
|
||||
$table->rowclass[22] = 'network_sweep';
|
||||
$table->rowclass[23] = 'network_sweep';
|
||||
$table->rowclass[24] = 'network_sweep';
|
||||
$table->rowclass[25] = 'network_sweep recon_v3';
|
||||
$table->rowclass[26] = 'network_sweep recon_v3';
|
||||
$table->rowclass[27] = 'network_sweep recon_v3';
|
||||
$table->rowclass[28] = 'network_sweep recon_v3';
|
||||
$table->rowclass[29] = 'network_sweep recon_v3';
|
||||
$table->rowclass[30] = 'network_sweep recon_v3';
|
||||
|
||||
$table->rowclass[6] = 'recon_script';
|
||||
$table->rowclass[13] = 'recon_script';
|
||||
$table->rowclass[14] = 'recon_script';
|
||||
$table->rowclass[15] = 'recon_script';
|
||||
$table->rowclass[16] = 'recon_script';
|
||||
$table->rowclass[17] = 'recon_script';
|
||||
// Name
|
||||
$table->data[0][0] = '<b>'.__('Task name').'</b>';
|
||||
$table->data[0][1] = html_print_input_text('name', $name, '', 25, 0, true);
|
||||
|
||||
// Recon server
|
||||
$table->data[1][0] = '<b>'.__('Recon server').ui_print_help_tip(
|
||||
__('You must select a Recon Server for the Task, otherwise the Recon Task will never run'),
|
||||
true
|
||||
);
|
||||
|
||||
$sql = 'SELECT id_server, name
|
||||
FROM tserver
|
||||
WHERE server_type = 3
|
||||
ORDER BY name';
|
||||
$table->data[1][1] = html_print_select_from_sql($sql, 'id_recon_server', $id_recon_server, '', '', '', true);
|
||||
|
||||
$fields['network_sweep'] = __('Network sweep');
|
||||
if (!$is_windows) {
|
||||
$fields['recon_script'] = __('Custom script');
|
||||
}
|
||||
|
||||
|
||||
$table->data[2][0] = '<b>'.__('Mode').'</b>';
|
||||
$table->data[2][1] = html_print_select($fields, 'mode', $mode, '', '', 0, true);
|
||||
|
||||
|
||||
// Network
|
||||
$table->data[3][0] = '<b>'.__('Network').'</b>';
|
||||
$table->data[3][0] .= ui_print_help_tip(__('You can specify several networks, separated by commas, for example: 192.168.50.0/24,192.168.60.0/24'), true);
|
||||
$table->data[3][1] = html_print_input_text('network', $network, '', 25, 0, true);
|
||||
|
||||
// Interval
|
||||
$interv_manual = 0;
|
||||
if ((int) $interval == 0) {
|
||||
$interv_manual = 1;
|
||||
}
|
||||
|
||||
$table->data[4][0] = '<b>'.__('Interval');
|
||||
$table->data[4][0] .= ui_print_help_tip(__('Manual interval means that it will be executed only On-demand'), true);
|
||||
|
||||
$values = [
|
||||
0 => __('Defined'),
|
||||
1 => __('Manual'),
|
||||
];
|
||||
$table->data[4][1] = html_print_select($values, 'interval_manual_defined', $interv_manual, '', '', '', true);
|
||||
|
||||
$table->data[4][1] .= '<span id="interval_manual_container">';
|
||||
$table->data[4][1] .= html_print_extended_select_for_time('interval', $interval, '', '', '0', false, true, false, false);
|
||||
$table->data[4][1] .= ui_print_help_tip(__('The minimum recomended interval for Recon Task is 5 minutes'), true);
|
||||
$table->data[4][1] .= '</span>';
|
||||
|
||||
|
||||
// Module template
|
||||
$table->data[5][0] = '<b>'.__('Module template').'</b>';
|
||||
|
||||
$sql = 'SELECT id_np, name
|
||||
FROM tnetwork_profile
|
||||
ORDER BY name';
|
||||
$table->data[5][1] = html_print_select_from_sql($sql, 'id_network_profile', $id_network_profile, '', __('None'), 0, true);
|
||||
|
||||
// Recon script
|
||||
$data[1] = '';
|
||||
$table->data[6][0] = '<b>'.__('Recon script').'</b>';
|
||||
|
||||
|
||||
$sql = "SELECT id_recon_script, name
|
||||
FROM trecon_script
|
||||
WHERE name <> 'IPAM Recon'
|
||||
ORDER BY name";
|
||||
if ($name_script != 'IPAM Recon') {
|
||||
$table->data[6][1] = html_print_select_from_sql($sql, 'id_recon_script', $id_recon_script, '', '', '', true);
|
||||
$table->data[6][1] .= "<span id='spinner_recon_script' style='display: none;'>".html_print_image('images/spinner.gif', true).'</span>';
|
||||
$table->data[6][1] .= $data[1] .= html_print_input_hidden('macros', base64_encode($macros), true);
|
||||
} else {
|
||||
$table->data[6][1] = 'IPAM Recon';
|
||||
}
|
||||
|
||||
// OS
|
||||
$table->data[7][0] = '<b>'.__('OS').'</b>';
|
||||
|
||||
$sql = 'SELECT id_os, name
|
||||
FROM tconfig_os
|
||||
ORDER BY name';
|
||||
$table->data[7][1] = html_print_select_from_sql($sql, 'id_os', $id_os, '', __('Any'), -1, true);
|
||||
|
||||
// Recon ports
|
||||
$table->data[8][0] = '<b>'.__('Ports').'</b>';
|
||||
$table->data[8][1] = html_print_input_text('recon_ports', $recon_ports, '', 25, 0, true);
|
||||
$table->data[8][1] .= ui_print_help_tip(
|
||||
__('Ports defined like: 80 or 80,443,512 or even 0-1024 (Like Nmap command line format). If dont want to do a sweep using portscan, left it in blank'),
|
||||
true
|
||||
);
|
||||
|
||||
// Group
|
||||
$table->data[9][0] = '<b>'.__('Group');
|
||||
$groups = users_get_groups(false, 'PM', false);
|
||||
$table->data[9][1] = html_print_select_groups(false, 'PM', false, 'id_group', $id_group, '', '', 0, true);
|
||||
|
||||
// Incident
|
||||
$values = [
|
||||
0 => __('No'),
|
||||
1 => __('Yes'),
|
||||
];
|
||||
$table->data[10][0] = '<b>'.__('Incident');
|
||||
$table->data[10][1] = html_print_select(
|
||||
$values,
|
||||
'create_incident',
|
||||
$create_incident,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
).' '.ui_print_help_tip(__('Choose if the discovery of a new system creates an incident or not.'), true);
|
||||
|
||||
// snmp_enabled
|
||||
$table->data[11][0] = '<b>'.__('SNMP enabled');
|
||||
$table->data[11][1] = html_print_checkbox('snmp_enabled', 1, $snmp_enabled, true);
|
||||
|
||||
// SNMP default community
|
||||
$table->data[12][0] = '<b>'.__('SNMP Default community');
|
||||
$table->data[12][0] .= ui_print_help_tip(__('You can specify several values, separated by commas, for example: public,mysecret,1234'), true);
|
||||
$table->data[12][1] = html_print_input_text('snmp_community', $snmp_community, '', 35, 0, true);
|
||||
|
||||
// SNMP version
|
||||
$snmp_versions['1'] = 'v. 1';
|
||||
$snmp_versions['2'] = 'v. 2';
|
||||
$snmp_versions['2c'] = 'v. 2c';
|
||||
$snmp_versions['3'] = 'v. 3';
|
||||
$table->data[24][0] = '<b>'._('SNMP version');
|
||||
$table->data[24][1] = html_print_select($snmp_versions, 'snmp_version', $snmp_version, '', '', 0, true);
|
||||
|
||||
$table->data[25][0] = '<b>'.__('Auth user');
|
||||
$table->data[25][1] = html_print_input_text(
|
||||
'snmp_auth_user',
|
||||
$snmp3_auth_user,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
''
|
||||
);
|
||||
$table->data[26][0] = '<b>'.__('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$table->data[26][1] = html_print_input_password(
|
||||
'snmp_auth_pass',
|
||||
$snmp3_auth_pass,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
''
|
||||
);
|
||||
$table->data[26][1] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mmen', true);
|
||||
|
||||
$table->data[27][0] = '<b>'.__('Privacy method');
|
||||
$table->data[27][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', '');
|
||||
$table->data[28][0] = '<b>'.__('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true);
|
||||
$table->data[28][1] = html_print_input_password(
|
||||
'snmp_privacy_pass',
|
||||
$snmp3_privacy_pass,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
''
|
||||
);
|
||||
$table->data[29][0] = '<b>'.__('Auth method');
|
||||
$table->data[29][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp_auth_method', $snmp3_auth_method, '', '', '', true, false, false, '', '');
|
||||
$table->data[30][0] = '<b>'.__('Security level');
|
||||
$table->data[30][1] = html_print_select(
|
||||
[
|
||||
'noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'),
|
||||
'authPriv' => __('Auth and privacy method'),
|
||||
],
|
||||
'snmp_security_level',
|
||||
$snmp3_security_level,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
''
|
||||
);
|
||||
|
||||
// Explanation
|
||||
$explanation = db_get_value('description', 'trecon_script', 'id_recon_script', $id_recon_script);
|
||||
|
||||
$table->data[13][0] = '<b>'.__('Explanation').'</b>';
|
||||
$table->data[13][1] = "<span id='spinner_layout' style='display: none;'>".html_print_image('images/spinner.gif', true).'</span>'.html_print_textarea('explanation', 4, 60, $explanation, 'style="width: 388px;"', true);
|
||||
|
||||
// A hidden "model row" to clone it from javascript to add fields dynamicaly
|
||||
$data = [];
|
||||
$data[0] = 'macro_desc';
|
||||
$data[0] .= ui_print_help_tip('macro_help', true);
|
||||
$data[1] = html_print_input_text('macro_name', 'macro_value', '', 100, 255, true);
|
||||
$table->colspan['macro_field'][1] = 3;
|
||||
$table->rowstyle['macro_field'] = 'display:none';
|
||||
$table->data['macro_field'] = $data;
|
||||
|
||||
// If there are $macros, we create the form fields
|
||||
if (!empty($macros)) {
|
||||
$macros = json_decode($macros, true);
|
||||
|
||||
foreach ($macros as $k => $m) {
|
||||
$data = [];
|
||||
$data[0] = '<b>'.$m['desc'].'</b>';
|
||||
if (!empty($m['help'])) {
|
||||
$data[0] .= ui_print_help_tip($m['help'], true);
|
||||
}
|
||||
|
||||
if ($m['hide']) {
|
||||
$data[1] = html_print_input_password($m['macro'], $m['value'], '', 100, 255, true);
|
||||
} else {
|
||||
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 255, true);
|
||||
}
|
||||
|
||||
$table->colspan['macro'.$m['macro']][1] = 3;
|
||||
$table->rowclass['macro'.$m['macro']] = 'macro_field';
|
||||
|
||||
$table->data['macro'.$m['macro']] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
// Comments
|
||||
$table->data[18][0] = '<b>'.__('Comments');
|
||||
$table->data[18][1] = html_print_input_text('description', $description, '', 45, 0, true);
|
||||
|
||||
// OS detection
|
||||
$table->data[19][0] = '<b>'.__('OS detection');
|
||||
$table->data[19][1] = html_print_checkbox('os_detect', 1, $os_detect, true);
|
||||
|
||||
// Name resolution
|
||||
$table->data[20][0] = '<b>'.__('Name resolution');
|
||||
$table->data[20][1] = html_print_checkbox('resolve_names', 1, $resolve_names, true);
|
||||
|
||||
// Parent detection
|
||||
$table->data[21][0] = '<b>'.__('Parent detection');
|
||||
$table->data[21][1] = html_print_checkbox('parent_detection', 1, $parent_detection, true);
|
||||
|
||||
// Parent recursion
|
||||
$table->data[22][0] = '<b>'.__('Parent recursion');
|
||||
$table->data[22][1] = html_print_input_text('parent_recursion', $parent_recursion, '', 5, 0, true).ui_print_help_tip(__('Maximum number of parent hosts that will be created if parent detection is enabled.'), true);
|
||||
|
||||
// vlan_enabled
|
||||
$table->data[23][0] = '<b>'.__('Vlan enabled');
|
||||
$table->data[23][1] = html_print_checkbox('vlan_enabled', 1, $vlan_enabled, true);
|
||||
|
||||
// Alias as name
|
||||
// NOTE: The 7.0NG Recon Server will not generate random names, since IP
|
||||
// address collisions could have other consequences.
|
||||
// $table->data[22][0] = "<b>".__('Alias as Name');
|
||||
// $table->data[22][1] = html_print_checkbox ('alias_as_name', 1, $alias_as_name, true);
|
||||
// Different Form url if it's a create or if it's a update form
|
||||
echo '<form name="modulo" method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&'.(($id_rt != -1) ? 'update='.$id_rt : 'create=1').'">';
|
||||
html_print_table($table);
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
if ($id_rt != -1) {
|
||||
if ($name_script != 'IPAM Recon') {
|
||||
html_print_submit_button(__('Update'), 'crt', false, 'class="sub upd"');
|
||||
}
|
||||
} else {
|
||||
html_print_submit_button(__('Add'), 'crt', false, 'class="sub wand"');
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '</form>';
|
||||
|
||||
ui_require_javascript_file('pandora_modules');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
|
||||
});
|
||||
|
||||
var xhrManager = function () {
|
||||
var manager = {};
|
||||
|
||||
manager.tasks = [];
|
||||
|
||||
manager.addTask = function (xhr) {
|
||||
manager.tasks.push(xhr);
|
||||
}
|
||||
|
||||
manager.stopTasks = function () {
|
||||
while (manager.tasks.length > 0)
|
||||
manager.tasks.pop().abort();
|
||||
}
|
||||
|
||||
return manager;
|
||||
};
|
||||
|
||||
var taskManager = new xhrManager();
|
||||
|
||||
$('select#interval_manual_defined').change(function() {
|
||||
if ($("#interval_manual_defined").val() == 1) {
|
||||
$('#interval_manual_container').hide();
|
||||
$('#text-interval_text').val(0);
|
||||
$('#hidden-interval').val(0);
|
||||
}
|
||||
else {
|
||||
$('#interval_manual_container').show();
|
||||
$('#text-interval_text').val(10);
|
||||
$('#hidden-interval').val(600);
|
||||
$('#interval_units').val(60);
|
||||
}
|
||||
}).change();
|
||||
|
||||
$('select#id_recon_script').change(function() {
|
||||
if ($('select#mode').val() == 'recon_script')
|
||||
get_explanation_recon_script($(this).val());
|
||||
});
|
||||
|
||||
$('select#snmp_version').change(function () {
|
||||
if (this.value == "3") {
|
||||
$(".recon_v3").show();
|
||||
$("input[name=active_snmp_v3]").val(1);
|
||||
$("input[name=snmp_community]").attr("disabled", true);
|
||||
$("input[name=vlan_enabled]").removeAttr("checked");
|
||||
$("input[name=vlan_enabled]").attr("disabled", true);
|
||||
}
|
||||
else {
|
||||
$(".recon_v3").hide();
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
$("input[name=vlan_enabled]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$('select#mode').change(function() {
|
||||
var type = $(this).val();
|
||||
if (type == 'recon_script') {
|
||||
$(".recon_script").show();
|
||||
$(".network_sweep").hide();
|
||||
|
||||
get_explanation_recon_script($("#id_recon_script").val());
|
||||
}
|
||||
else if (type == 'network_sweep') {
|
||||
$(".recon_script").hide();
|
||||
$(".network_sweep").show();
|
||||
$('.macro_field').remove();
|
||||
$('select#snmp_version').trigger('change');
|
||||
}
|
||||
}).change();
|
||||
|
||||
function get_explanation_recon_script (id) {
|
||||
// Stop old ajax tasks
|
||||
taskManager.stopTasks();
|
||||
|
||||
// Show the spinners
|
||||
$("#textarea_explanation").hide();
|
||||
$("#spinner_layout").show();
|
||||
|
||||
var xhr = jQuery.ajax ({
|
||||
data: {
|
||||
'page': 'godmode/servers/manage_recontask_form',
|
||||
'get_explanation': 1,
|
||||
'id': id,
|
||||
'id_rt': <?php echo json_encode((int) $id_rt); ?>
|
||||
},
|
||||
url: "<?php echo $config['homeurl']; ?>ajax.php",
|
||||
type: 'POST',
|
||||
dataType: 'text',
|
||||
complete: function (xhr, textStatus) {
|
||||
$("#spinner_layout").hide();
|
||||
},
|
||||
success: function (data, textStatus, xhr) {
|
||||
$("#textarea_explanation").val(data);
|
||||
$("#textarea_explanation").show();
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
console.log(errorThrown);
|
||||
}
|
||||
});
|
||||
taskManager.addTask(xhr);
|
||||
|
||||
// Delete all the macro fields
|
||||
$('.macro_field').remove();
|
||||
$("#spinner_recon_script").show();
|
||||
|
||||
var xhr = jQuery.ajax ({
|
||||
data: {
|
||||
'page': 'godmode/servers/manage_recontask_form',
|
||||
'get_recon_script_macros': 1,
|
||||
'id': id,
|
||||
'id_rt': <?php echo json_encode((int) $id_rt); ?>
|
||||
},
|
||||
url: "<?php echo $config['homeurl']; ?>ajax.php",
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
complete: function (xhr, textStatus) {
|
||||
$("#spinner_recon_script").hide();
|
||||
forced_title_callback();
|
||||
},
|
||||
success: function (data, textStatus, xhr) {
|
||||
if (data.array !== null) {
|
||||
$('#hidden-macros').val(data.base64);
|
||||
|
||||
jQuery.each (data.array, function (i, macro) {
|
||||
if (macro.desc != '') {
|
||||
add_macro_field(macro, 'table_recon-macro');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
console.log(errorThrown);
|
||||
}
|
||||
});
|
||||
taskManager.addTask(xhr);
|
||||
}
|
||||
|
||||
</script>
|
||||
/**
|
||||
* Deprectated.
|
||||
*
|
||||
* @category deprecated
|
||||
* @package Pandora FMS
|
||||
* @subpackage recon task
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
@ -112,6 +112,7 @@ $edit_file = get_parameter('edit_file', false);
|
||||
$update_file = get_parameter('update_file', false);
|
||||
$plugin_command = get_parameter('plugin_command', '');
|
||||
$tab = get_parameter('tab', '');
|
||||
$deploy_plugin = get_parameter('deploy_plugin', 0);
|
||||
|
||||
if ($view != '') {
|
||||
$form_id = $view;
|
||||
@ -192,9 +193,8 @@ if ($filemanager) {
|
||||
// If is win compatible and the compatibility must be unix
|
||||
if ($is_win_compatible !== false && $compatibility == 'unix') {
|
||||
$contentFile = str_replace("\r\n", "\n", $contentFile);
|
||||
}
|
||||
// If is unix compatible and the compatibility must be win
|
||||
else if ($is_win_compatible === false && $compatibility == 'windows') {
|
||||
} else if ($is_win_compatible === false && $compatibility == 'windows') {
|
||||
// If is unix compatible and the compatibility must be win
|
||||
$contentFile = str_replace("\n", "\r\n", $contentFile);
|
||||
}
|
||||
|
||||
@ -268,12 +268,16 @@ if ($filemanager) {
|
||||
// =====================================================================
|
||||
$sec = 'gservers';
|
||||
|
||||
if (($create != '') or ($view != '')) {
|
||||
if (($create != '') || ($view != '')) {
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
|
||||
}
|
||||
} else {
|
||||
if ($create != '') {
|
||||
ui_print_page_header(
|
||||
@ -292,6 +296,16 @@ if (($create != '') or ($view != '')) {
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
please manage this feature from centralized manager console (Metaconsole).'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -564,9 +578,53 @@ if (($create != '') or ($view != '')) {
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
$management_allowed = is_management_allowed();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(__('To manage plugin you must activate centralized management'));
|
||||
}
|
||||
|
||||
if (!$config['metaconsole_deploy_plugin_server'] && $management_allowed) {
|
||||
$deploy_plugin_server = true;
|
||||
|
||||
echo '<div id="deploy_messages" style="display: none">';
|
||||
echo '<span>'.__('The previous configuration of plugins has been imported from the nodes. Please check that the definitions are correct.').'</br></br>'.'<b>'.__('Note:').'</b>'.__(
|
||||
'These definitions will not be operational until you manually
|
||||
copy the files from the nodes to the atachment/plugin/ directory of the meta console.'
|
||||
).'</br></br>'.__('You can find more information at:')."<a href='https://wiki.pandorafms.com'>https://wiki.pandorafms.com</a>".'</span>';
|
||||
echo '</div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#deploy_messages").dialog({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
title: '<?php echo __('Warning'); ?>',
|
||||
width: 528,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
config_update_value('metaconsole_deploy_plugin_server', 1);
|
||||
}
|
||||
} else {
|
||||
ui_print_page_header(__('Plug-ins registered on %s', get_product_name()), 'images/gm_servers.png', false, '', true);
|
||||
|
||||
$management_allowed = !is_central_policies_on_node();
|
||||
if (!$management_allowed) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This console is not manager of this environment,
|
||||
please manage this feature from centralized manager console (Metaconsole).'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
||||
if ($is_windows) {
|
||||
echo '<div class="notify">';
|
||||
@ -576,9 +634,8 @@ if (($create != '') or ($view != '')) {
|
||||
}
|
||||
|
||||
|
||||
// Update plugin
|
||||
// Update plugin.
|
||||
if (isset($_GET['update_plugin'])) {
|
||||
// if modified any parameter
|
||||
$plugin_id = get_parameter('update_plugin', 0);
|
||||
$plugin_name = get_parameter('form_name', '');
|
||||
$plugin_description = get_parameter('form_description', '');
|
||||
@ -709,12 +766,15 @@ if (($create != '') or ($view != '')) {
|
||||
|
||||
$result = db_process_sql_delete('tplugin', ['id' => $plugin_id]);
|
||||
|
||||
if (! $result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
if (!is_metaconsole()) {
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($plugin_id != 0) {
|
||||
// Delete all the modules with this plugin
|
||||
$plugin_modules = db_get_all_rows_filter(
|
||||
@ -737,6 +797,153 @@ if (($create != '') or ($view != '')) {
|
||||
policies_change_delete_pending_module($policies_id['id']);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_plugins.php');
|
||||
$result = plugins_delete_plugin($plugin_id);
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deleting plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deleted successfully'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deploy_plugin) {
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_plugins.php');
|
||||
$result = plugins_deploy_plugin($deploy_plugin);
|
||||
if (!$result) {
|
||||
ui_print_error_message(__('Problem deploying plugin'));
|
||||
} else {
|
||||
ui_print_success_message(__('Plugin deployed successfully'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($deploy_plugin_server) {
|
||||
$setup = db_get_all_rows_in_table('tmetaconsole_setup');
|
||||
// recorremos todos los nodos.
|
||||
foreach ($setup as $key => $value) {
|
||||
// Obtenemos los plugins de la meta.
|
||||
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
// Conectamos con el nodo.
|
||||
if (metaconsole_connect($value) == NOERR) {
|
||||
$values = [];
|
||||
// Obtenemos los plugin del nodo.
|
||||
$node_plugin_server = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
foreach ($node_plugin_server as $key2 => $plugin) {
|
||||
// Comprobamos si el id esta meta y nodo al mismo tiempo.
|
||||
$key_exists = array_search($plugin['id'], array_column($all_plugin_meta, 'id'));
|
||||
if ($key_exists !== false) {
|
||||
// Si el plugin tiene el mismo id pero diferentes datos.
|
||||
if ($all_plugin_meta[$key_exists] != $plugin) {
|
||||
$old_id = $plugin['id'];
|
||||
$new_id = ($plugin['id'] + (1000 * $value['id']));
|
||||
|
||||
// El plugin del nodo pasa a tener otro id y otro nombre.
|
||||
$plugin['id'] = $new_id;
|
||||
$plugin['name'] = $plugin['name'].'_'.$value['server_name'];
|
||||
$result_update = db_process_sql_update(
|
||||
'tplugin',
|
||||
[
|
||||
'id' => $new_id,
|
||||
'name' => $plugin['name'],
|
||||
],
|
||||
['id' => $old_id]
|
||||
);
|
||||
|
||||
if ($result_update) {
|
||||
db_process_sql_update(
|
||||
'tagente_modulo',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tpolicy_modules',
|
||||
['id_plugin' => $new_id],
|
||||
['id_plugin' => $old_id]
|
||||
);
|
||||
}
|
||||
|
||||
// New plugins to insert in the metaconsole.
|
||||
$values[$plugin['id']] = $plugin;
|
||||
}
|
||||
} else {
|
||||
// Exists in the node, but does not exist in the metaconsole.
|
||||
$values[$plugin['id']] = $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore to metaconsole.
|
||||
metaconsole_restore_db();
|
||||
|
||||
// Insert in metaconsole.
|
||||
if (!empty($values)) {
|
||||
foreach ($values as $key2 => $val) {
|
||||
// Insert into metaconsole.
|
||||
$result_insert = db_process_sql_insert('tplugin', $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$all_plugin_meta = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
|
||||
foreach ($setup as $key => $value) {
|
||||
if (metaconsole_connect($value) == NOERR) {
|
||||
$all_plugin_node = db_get_all_rows_sql('SELECT SQL_NO_CACHE * FROM tplugin', false, false);
|
||||
|
||||
$array_diff = array_diff(array_column($all_plugin_meta, 'id'), array_column($all_plugin_node, 'id'));
|
||||
foreach ($array_diff as $key2 => $pluginid) {
|
||||
$other = [];
|
||||
$plugin_meta = $all_plugin_meta[$key2];
|
||||
|
||||
unset($plugin_meta['id']);
|
||||
$other['name'] = urlencode($plugin_meta['name']);
|
||||
$other['description'] = urlencode($plugin_meta['description']);
|
||||
$other['max_timeout'] = $plugin_meta['max_timeout'];
|
||||
$other['max_retries'] = $plugin_meta['max_retries'];
|
||||
$other['execute'] = urlencode($plugin_meta['execute']);
|
||||
$other['net_dst_opt'] = $plugin_meta['net_dst_opt'];
|
||||
$other['net_port_opt'] = $plugin_meta['net_port_opt'];
|
||||
$other['user_opt'] = $plugin_meta['user_opt'];
|
||||
$other['pass_opt'] = $plugin_meta['pass_opt'];
|
||||
$other['plugin_type'] = $plugin_meta['plugin_type'];
|
||||
$other['macros'] = urlencode($plugin_meta['macros']);
|
||||
$other['parameters'] = urlencode($plugin_meta['parameters']);
|
||||
$other = implode('%7C', $other);
|
||||
|
||||
$auth_token = json_decode($value['auth_token']);
|
||||
$url = $value['server_url'].'include/api.php?op=set&op2=push_plugin'.'&id='.$pluginid.'&other_mode=url_encode_separator_%7C&other='.$other."&apipass=$auth_token->api_password"."&user=$auth_token->console_user&pass=$auth_token->console_password";
|
||||
$file_path = realpath($plugin_meta['execute']);
|
||||
$post = '';
|
||||
if (file_exists($file_path)) {
|
||||
$post = ['file' => curl_file_create($file_path)];
|
||||
}
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $url);
|
||||
curl_setopt($curlObj, CURLOPT_POST, 1);
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $post);
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$api_result = curl_exec($curlObj);
|
||||
curl_close($curlObj);
|
||||
}
|
||||
}
|
||||
|
||||
// restore to metaconsole
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
@ -753,7 +960,10 @@ if (($create != '') or ($view != '')) {
|
||||
echo '<th>'.__('Name').'</th>';
|
||||
echo '<th>'.__('Type').'</th>';
|
||||
echo '<th>'.__('Command').'</th>';
|
||||
echo "<th style='width: 90px;'>".'<span title="Operations">'.__('Op.').'</span>'.'</th>';
|
||||
if ($management_allowed) {
|
||||
echo "<th style='width: 120px;'>".'<span title="Operations">'.__('Op.').'</span>'.'</th>';
|
||||
}
|
||||
|
||||
$color = 0;
|
||||
|
||||
foreach ($rows as $row) {
|
||||
@ -767,7 +977,10 @@ if (($create != '') or ($view != '')) {
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td class=$tdcolor>";
|
||||
echo "<b><a href='index.php?sec=$sec&sec2=godmode/servers/plugin&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>";
|
||||
if ($management_allowed) {
|
||||
echo "<b><a href='index.php?sec=$sec&sec2=godmode/servers/plugin&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>";
|
||||
}
|
||||
|
||||
echo $row['name'];
|
||||
echo '</a></b></td>';
|
||||
echo "<td class=$tdcolor>";
|
||||
@ -780,31 +993,38 @@ if (($create != '') or ($view != '')) {
|
||||
echo "</td><td class=$tdcolor>";
|
||||
echo $row['execute'];
|
||||
echo '</td>';
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
if ($management_allowed) {
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
|
||||
// Show it is locket
|
||||
$modules_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tagente_modulo',
|
||||
[
|
||||
'delete_pending' => 0,
|
||||
'id_plugin' => $row['id'],
|
||||
]
|
||||
);
|
||||
$components_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $row['id']]
|
||||
);
|
||||
if (($components_using_plugin + $modules_using_plugin) > 0) {
|
||||
echo '<a href="javascript: show_locked_dialog('.$row['id'].', \''.$row['name'].'\');">';
|
||||
html_print_image('images/lock.png');
|
||||
echo '</a>';
|
||||
// Show it is locket
|
||||
$modules_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tagente_modulo',
|
||||
[
|
||||
'delete_pending' => 0,
|
||||
'id_plugin' => $row['id'],
|
||||
]
|
||||
);
|
||||
$components_using_plugin = db_get_value_filter(
|
||||
'count(*)',
|
||||
'tnetwork_component',
|
||||
['id_plugin' => $row['id']]
|
||||
);
|
||||
if (($components_using_plugin + $modules_using_plugin) > 0) {
|
||||
echo '<a href="javascript: show_locked_dialog('.$row['id'].', \''.$row['name'].'\');">';
|
||||
html_print_image('images/lock.png');
|
||||
echo '</a>';
|
||||
}
|
||||
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a> ';
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&kill_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."' onclick='javascript: if (!confirm(\"".__('All the modules that are using this plugin will be deleted').'. '.__('Are you sure?')."\")) return false;'>".html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
if (is_metaconsole()) {
|
||||
echo " <a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&deploy_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/deploy.png', true, ['title' => __('Deploy'), 'width' => '21 px']).'</a> ';
|
||||
}
|
||||
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&view=".$row['id'].'&tab=plugins&pure='.$config['pure']."'>".html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a> ';
|
||||
echo "<a href='index.php?sec=$sec&sec2=godmode/servers/plugin&tab=$tab&kill_plugin=".$row['id'].'&tab=plugins&pure='.$config['pure']."' onclick='javascript: if (!confirm(\"".__('All the modules that are using this plugin will be deleted').'. '.__('Are you sure?')."\")) return false;'>".html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
@ -813,12 +1033,15 @@ if (($create != '') or ($view != '')) {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no plugins in the system') ]);
|
||||
}
|
||||
|
||||
echo "<table width='100%'>";
|
||||
if ($management_allowed) {
|
||||
echo "<table width='100%'>";
|
||||
|
||||
echo '<tr><td align=right>';
|
||||
echo "<form name=plugin method='post' action='index.php?sec=gservers&sec2=godmode/servers/plugin&tab=$tab&create=1&pure=".$config['pure']."'>";
|
||||
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
|
||||
echo '</td></tr></table>';
|
||||
echo '<tr><td align=right>';
|
||||
echo "<form name=plugin method='post' action='index.php?sec=gservers&sec2=godmode/servers/plugin&tab=$tab&create=1&pure=".$config['pure']."'>";
|
||||
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
|
||||
echo '</td></tr></table>';
|
||||
echo '<div id="deploy_messages" style="display: none">';
|
||||
}
|
||||
|
||||
// The '%s' will be replaced in the javascript code of the function 'show_locked_dialog'
|
||||
echo "<div id='dialog_locked' title='".__('List of modules and components created by "%s" ')."' style='display: none; text-align: left;'>";
|
||||
@ -828,7 +1051,6 @@ if (($create != '') or ($view != '')) {
|
||||
}
|
||||
|
||||
ui_require_javascript_file('pandora_modules');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -1,401 +1,27 @@
|
||||
<?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.
|
||||
if (is_ajax()) {
|
||||
$get_reconscript_description = get_parameter('get_reconscript_description');
|
||||
$id_reconscript = get_parameter('id_reconscript');
|
||||
|
||||
$description = db_get_value_filter(
|
||||
'description',
|
||||
'trecon_script',
|
||||
['id_recon_script' => $id_reconscript]
|
||||
);
|
||||
|
||||
echo htmlentities(io_safe_output($description), ENT_QUOTES, 'UTF-8', true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access recon script Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disabled at the moment.
|
||||
if (!check_referer()) {
|
||||
require ("general/noaccess.php");
|
||||
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Deprectated.
|
||||
*
|
||||
* @category Deprectated
|
||||
* @package Pandora FMS
|
||||
* @subpackage recon script
|
||||
* @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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
$view = get_parameter('view', '');
|
||||
$create = get_parameter('create', '');
|
||||
|
||||
if ($view != '') {
|
||||
$form_id = $view;
|
||||
$reconscript = db_get_row('trecon_script', 'id_recon_script', $form_id);
|
||||
$form_name = $reconscript['name'];
|
||||
$form_description = $reconscript['description'];
|
||||
$form_script = $reconscript['script'];
|
||||
$macros = $reconscript['macros'];
|
||||
}
|
||||
|
||||
if ($create != '') {
|
||||
$form_name = '';
|
||||
$form_description = '';
|
||||
$form_script = '';
|
||||
$macros = '';
|
||||
}
|
||||
|
||||
// SHOW THE FORM
|
||||
// =================================================================
|
||||
if (($create != '') or ($view != '')) {
|
||||
if ($create != '') {
|
||||
ui_print_page_header(__('Recon script creation'), 'images/gm_servers.png', false, 'reconscript_definition', true);
|
||||
} else {
|
||||
ui_print_page_header(__('Recon script update'), 'images/gm_servers.png', false, 'reconscript_definition', true);
|
||||
$id_recon_script = get_parameter('view', '');
|
||||
}
|
||||
|
||||
|
||||
if ($create == '') {
|
||||
echo "<form name=reconscript method='post' action='index.php?sec=gservers&sec2=godmode/servers/recon_script&update_reconscript=$id_recon_script'>";
|
||||
} else {
|
||||
echo "<form name=reconscript method='post' action='index.php?sec=gservers&sec2=godmode/servers/recon_script&create_reconscript=1'>";
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->id = 'table-form';
|
||||
$table->class = 'databox filters';
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->data = [];
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Name');
|
||||
$data[1] = '<input type="text" name="form_name" size=30 value="'.$form_name.'">';
|
||||
$table->data['recon_name'] = $data;
|
||||
$table->colspan['recon_name'][1] = 3;
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Script fullpath');
|
||||
$data[1] = '<input type="text" name="form_script" size=70 value="'.$form_script.'">';
|
||||
$table->data['recon_fullpath'] = $data;
|
||||
$table->colspan['recon_fullpath'][1] = 3;
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Description');
|
||||
$data[1] = '<textarea name="form_description" cols="50" rows="4">';
|
||||
$data[1] .= $form_description;
|
||||
$data[1] .= '</textarea>';
|
||||
$table->data['recon_description'] = $data;
|
||||
$table->colspan['recon_description'][1] = 3;
|
||||
|
||||
$macros = json_decode($macros, true);
|
||||
|
||||
// This code is ready to add locked feature as plugins
|
||||
$locked = false;
|
||||
|
||||
// The next row number is recon_3
|
||||
$next_name_number = 3;
|
||||
$i = 1;
|
||||
while (1) {
|
||||
// Always print at least one macro
|
||||
if ((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
$macro_desc_name = 'field'.$i.'_desc';
|
||||
$macro_desc_value = '';
|
||||
$macro_help_name = 'field'.$i.'_help';
|
||||
$macro_help_value = '';
|
||||
$macro_value_name = 'field'.$i.'_value';
|
||||
$macro_value_value = '';
|
||||
$macro_name_name = 'field'.$i.'_macro';
|
||||
$macro_name = '_field'.$i.'_';
|
||||
$macro_hide_value_name = 'field'.$i.'_hide';
|
||||
$macro_hide_value_value = 0;
|
||||
|
||||
if (isset($macros[$i]['desc'])) {
|
||||
$macro_desc_value = $macros[$i]['desc'];
|
||||
}
|
||||
|
||||
if (isset($macros[$i]['help'])) {
|
||||
$macro_help_value = $macros[$i]['help'];
|
||||
}
|
||||
|
||||
if (isset($macros[$i]['value'])) {
|
||||
$macro_value_value = $macros[$i]['value'];
|
||||
}
|
||||
|
||||
if (isset($macros[$i]['hide'])) {
|
||||
$macro_hide_value_value = $macros[$i]['hide'];
|
||||
}
|
||||
|
||||
$datam = [];
|
||||
$datam[0] = __('Description')."<span style='font-weight: normal'> ($macro_name)</span>";
|
||||
$datam[0] .= html_print_input_hidden($macro_name_name, $macro_name, true);
|
||||
$datam[1] = html_print_input_text_extended($macro_desc_name, $macro_desc_value, 'text-'.$macro_desc_name, '', 30, 255, $locked, '', "class='command_advanced_conf'", true);
|
||||
if ($locked) {
|
||||
$datam[1] .= html_print_image('images/lock.png', true, ['class' => 'command_advanced_conf']);
|
||||
}
|
||||
|
||||
$datam[2] = __('Default value')."<span style='font-weight: normal'> ($macro_name)</span>";
|
||||
$datam[3] = html_print_input_text_extended($macro_value_name, $macro_value_value, 'text-'.$macro_value_name, '', 30, 255, $locked, '', "class='command_component command_advanced_conf'", true);
|
||||
if ($locked) {
|
||||
$datam[3] .= html_print_image('images/lock.png', true, ['class' => 'command_advanced_conf']);
|
||||
}
|
||||
|
||||
$table->data['recon_'.$next_name_number] = $datam;
|
||||
|
||||
$next_name_number++;
|
||||
|
||||
$table->colspan['recon_'.$next_name_number][1] = 3;
|
||||
|
||||
$datam = [];
|
||||
$datam[0] = __('Hide value').ui_print_help_tip(__('This field will show up as dots like a password'), true);
|
||||
$datam[1] = html_print_checkbox_extended($macro_hide_value_name, 1, $macro_hide_value_value, 0, '', ['class' => 'command_advanced_conf'], true, 'checkbox-'.$macro_hide_value_name);
|
||||
|
||||
$table->data['recon_'.$next_name_number] = $datam;
|
||||
$next_name_number++;
|
||||
|
||||
$table->colspan['recon_'.$next_name_number][1] = 3;
|
||||
|
||||
$datam = [];
|
||||
$datam[0] = __('Help')."<span style='font-weight: normal'> ($macro_name)</span><br><br><br>";
|
||||
$tadisabled = $locked === true ? ' disabled' : '';
|
||||
$datam[1] = html_print_textarea($macro_help_name, 6, 100, $macro_help_value, 'class="command_advanced_conf" style="width: 97%;"'.$tadisabled, true);
|
||||
|
||||
if ($locked) {
|
||||
$datam[1] .= html_print_image('images/lock.png', true, ['class' => 'command_advanced_conf']);
|
||||
}
|
||||
|
||||
$datam[1] .= '<br><br><br>';
|
||||
|
||||
$table->data['recon_'.$next_name_number] = $datam;
|
||||
$next_name_number++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!$locked) {
|
||||
$datam = [];
|
||||
$datam[0] = '<span style="font-weight: bold">'.__('Add macro').'</span> <a href="javascript:new_macro(\'table-form-recon_\');update_preview();">'.html_print_image('images/add.png', true).'</a>';
|
||||
$datam[0] .= '<div id="next_macro" style="display:none">'.$i.'</div>';
|
||||
$datam[0] .= '<div id="next_row" style="display:none">'.$next_name_number.'</div>';
|
||||
$delete_macro_style = '';
|
||||
if ($i <= 2) {
|
||||
$delete_macro_style = 'display:none;';
|
||||
}
|
||||
|
||||
$datam[2] = '<div id="delete_macro_button" style="'.$delete_macro_style.'">'.__('Delete macro').' <a href="javascript:delete_macro_form(\'table-form-recon_\');update_preview();">'.html_print_image('images/delete.png', true).'</a></div>';
|
||||
|
||||
$table->colspan['recon_action'][0] = 2;
|
||||
$table->rowstyle['recon_action'] = 'text-align:center';
|
||||
$table->colspan['recon_action'][2] = 2;
|
||||
$table->data['recon_action'] = $datam;
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo '<table width=100%>';
|
||||
echo '<tr><td align="right">';
|
||||
|
||||
if ($create != '') {
|
||||
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
|
||||
} else {
|
||||
echo "<input name='uptbutton' type='submit' class='sub upd' value='".__('Update')."'>";
|
||||
}
|
||||
|
||||
echo '</form></table>';
|
||||
} else {
|
||||
ui_print_page_header(__('Recon scripts registered on %s', get_product_name()), 'images/gm_servers.png', false, '', true);
|
||||
|
||||
// Update reconscript
|
||||
if (isset($_GET['update_reconscript'])) {
|
||||
// if modified any parameter
|
||||
$id_recon_script = get_parameter('update_reconscript', 0);
|
||||
$reconscript_name = get_parameter('form_name', '');
|
||||
$reconscript_description = get_parameter('form_description', '');
|
||||
$reconscript_script = get_parameter('form_script', '');
|
||||
|
||||
// Get macros
|
||||
$i = 1;
|
||||
$macros = [];
|
||||
while (1) {
|
||||
$macro = (string) get_parameter('field'.$i.'_macro');
|
||||
if ($macro == '') {
|
||||
break;
|
||||
}
|
||||
|
||||
$desc = (string) get_parameter('field'.$i.'_desc');
|
||||
$help = (string) get_parameter('field'.$i.'_help');
|
||||
$value = (string) get_parameter('field'.$i.'_value');
|
||||
$hide = get_parameter('field'.$i.'_hide');
|
||||
|
||||
$macros[$i]['macro'] = $macro;
|
||||
$macros[$i]['desc'] = $desc;
|
||||
$macros[$i]['help'] = $help;
|
||||
$macros[$i]['value'] = $value;
|
||||
$macros[$i]['hide'] = $hide;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$macros = io_json_mb_encode($macros);
|
||||
|
||||
$sql_update = "UPDATE trecon_script SET
|
||||
name = '$reconscript_name',
|
||||
description = '$reconscript_description',
|
||||
script = '$reconscript_script',
|
||||
macros = '$macros'
|
||||
WHERE id_recon_script = $id_recon_script";
|
||||
$result = false;
|
||||
if ($reconscript_name != '' && $reconscript_script != '') {
|
||||
$result = db_process_sql($sql_update);
|
||||
}
|
||||
|
||||
if (! $result) {
|
||||
ui_print_error_message(__('Problem updating'));
|
||||
} else {
|
||||
ui_print_success_message(__('Updated successfully'));
|
||||
}
|
||||
}
|
||||
|
||||
// Create reconscript
|
||||
if (isset($_GET['create_reconscript'])) {
|
||||
$reconscript_name = get_parameter('form_name', '');
|
||||
$reconscript_description = get_parameter('form_description', '');
|
||||
$reconscript_script = get_parameter('form_script', '');
|
||||
|
||||
// Get macros
|
||||
$i = 1;
|
||||
$macros = [];
|
||||
while (1) {
|
||||
$macro = (string) get_parameter('field'.$i.'_macro');
|
||||
if ($macro == '') {
|
||||
break;
|
||||
}
|
||||
|
||||
$desc = (string) get_parameter('field'.$i.'_desc');
|
||||
$help = (string) get_parameter('field'.$i.'_help');
|
||||
$value = (string) get_parameter('field'.$i.'_value');
|
||||
$hide = get_parameter('field'.$i.'_hide');
|
||||
|
||||
$macros[$i]['macro'] = $macro;
|
||||
$macros[$i]['desc'] = $desc;
|
||||
$macros[$i]['help'] = $help;
|
||||
$macros[$i]['value'] = $value;
|
||||
$macros[$i]['hide'] = $hide;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$macros = io_json_mb_encode($macros);
|
||||
|
||||
$values = [
|
||||
'name' => $reconscript_name,
|
||||
'description' => $reconscript_description,
|
||||
'script' => $reconscript_script,
|
||||
'macros' => $macros,
|
||||
];
|
||||
$result = false;
|
||||
if ($values['name'] != '' && $values['script'] != '') {
|
||||
$result = db_process_sql_insert('trecon_script', $values);
|
||||
}
|
||||
|
||||
if (! $result) {
|
||||
ui_print_error_message(__('Problem creating'));
|
||||
} else {
|
||||
ui_print_success_message(__('Created successfully'));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['kill_reconscript'])) {
|
||||
// if delete alert
|
||||
$reconscript_id = get_parameter('kill_reconscript', 0);
|
||||
|
||||
$result = db_process_sql_delete(
|
||||
'trecon_script',
|
||||
['id_recon_script' => $reconscript_id]
|
||||
);
|
||||
|
||||
if (! $result) {
|
||||
ui_print_error_message(__('Problem deleting reconscript'));
|
||||
} else {
|
||||
ui_print_success_message(__('reconscript deleted successfully'));
|
||||
}
|
||||
|
||||
if ($reconscript_id != 0) {
|
||||
$result = db_process_sql_delete(
|
||||
'trecon_task',
|
||||
['id_recon_script' => $reconscript_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// If not edition or insert, then list available reconscripts
|
||||
$rows = db_get_all_rows_in_table('trecon_script');
|
||||
|
||||
if ($rows !== false) {
|
||||
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
|
||||
echo '<th>'.__('Name').'</th>';
|
||||
echo '<th>'.__('Description').'</th>';
|
||||
echo '<th>'.__('Delete').'</th>';
|
||||
$color = 0;
|
||||
foreach ($rows as $row) {
|
||||
if ($color == 1) {
|
||||
$tdcolor = 'datos';
|
||||
$color = 0;
|
||||
} else {
|
||||
$tdcolor = 'datos2';
|
||||
$color = 1;
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td class='$tdcolor' style='min-width: 100px;'>";
|
||||
echo "<b><a href='index.php?sec=gservers&sec2=godmode/servers/recon_script&view=".$row['id_recon_script']."'>";
|
||||
echo $row['name'];
|
||||
echo '</a></b></td>';
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
$desc = io_safe_output($row['description']);
|
||||
$desc = str_replace("\n", '<br>', $desc);
|
||||
echo $desc.'<br><br>';
|
||||
echo '<b>'.__('Command').': </b><i>'.$row['script'].'</i>';
|
||||
echo "</td><td align='center' class='$tdcolor'>";
|
||||
echo "<a href='index.php?sec=gservers&sec2=godmode/servers/recon_script&kill_reconscript=".$row['id_recon_script']."'>".html_print_image('images/cross.png', true, ['border' => '0']).'</a>';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no recon scripts in the system') ]);
|
||||
}
|
||||
|
||||
echo '<table width=100%>';
|
||||
echo '<tr><td align=right>';
|
||||
echo "<form name=reconscript method='post' action='index.php?sec=gservers&sec2=godmode/servers/recon_script&create=1'>";
|
||||
echo "<input name='crtbutton' type='submit' class='sub next' value='".__('Add')."'>";
|
||||
echo '</td></tr></table>';
|
||||
}
|
||||
|
||||
ui_require_javascript_file('pandora_modules');
|
||||
|
@ -1,37 +1,242 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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 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
|
||||
// Load global vars.
|
||||
global $config;
|
||||
require_once 'include/config.php';
|
||||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
|
||||
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;
|
||||
}
|
||||
|
||||
// Load enterprise extensions
|
||||
// ~ enterprise_include_once ('godmode/setup/setup.php');
|
||||
/*
|
||||
NOTICE FOR DEVELOPERS:
|
||||
$update_config = get_parameter('update_config', 0);
|
||||
if ($update_config == 1 && $config['history_db_enabled'] == 1) {
|
||||
if (! isset($config['history_db_connection'])
|
||||
|| $config['history_db_connection'] === false
|
||||
) {
|
||||
$config['history_db_connection'] = db_connect(
|
||||
$config['history_db_host'],
|
||||
$config['history_db_name'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$config['history_db_port'],
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$historical_days_purge = get_parameter('historical_days_purge', 0);
|
||||
$historical_days_compact = get_parameter('historical_days_compact', 0);
|
||||
$historical_step_compact = get_parameter('historical_step_compact', 0);
|
||||
$historical_event_purge = get_parameter('historical_event_purge', 0);
|
||||
$historical_string_purge = get_parameter('historical_string_purge', 0);
|
||||
|
||||
$history_connect = @mysql_db_process_sql(
|
||||
'SELECT 1 FROM tconfig',
|
||||
'affected_rows',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
|
||||
$config_history = false;
|
||||
if ($history_connect !== false) {
|
||||
$config_history = mysql_db_process_sql(
|
||||
'SELECT * FROM tconfig',
|
||||
'affected_rows',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
|
||||
if (!$config_history) {
|
||||
$sql = "INSERT INTO tconfig (token, `value`) VALUES
|
||||
('days_purge', ".$historical_days_purge."),
|
||||
('days_compact', ".$historical_days_compact."),
|
||||
('step_compact', ".$historical_step_compact."),
|
||||
('event_purge', ".$historical_event_purge."),
|
||||
('string_purge', ".$historical_string_purge."),
|
||||
('history_db_enabled', 0)";
|
||||
|
||||
mysql_db_process_sql(
|
||||
$sql,
|
||||
'insert_id',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
} else {
|
||||
$sql = 'UPDATE tconfig SET `value` = '.$historical_days_purge." WHERE token = 'days_purge'";
|
||||
mysql_db_process_sql(
|
||||
$sql,
|
||||
'update_id',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
$sql = 'UPDATE tconfig SET `value` = '.$historical_days_compact." WHERE token = 'days_compact'";
|
||||
mysql_db_process_sql(
|
||||
$sql,
|
||||
'update_id',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
$sql = 'UPDATE tconfig SET `value` = '.$historical_step_compact." WHERE token = 'step_compact'";
|
||||
mysql_db_process_sql(
|
||||
$sql,
|
||||
'update_id',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
$sql = 'UPDATE tconfig SET `value` = '.$historical_event_purge." WHERE token = 'event_purge'";
|
||||
mysql_db_process_sql(
|
||||
$sql,
|
||||
'update_id',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
$sql = 'UPDATE tconfig SET `value` = '.$historical_string_purge." WHERE token = 'string_purge'";
|
||||
mysql_db_process_sql(
|
||||
$sql,
|
||||
'update_id',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
$sql = "UPDATE tconfig SET `value` = 0 WHERE token = 'history_db_enabled'";
|
||||
mysql_db_process_sql(
|
||||
$sql,
|
||||
'update_id',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$table_status = new StdClass();
|
||||
$table_status->width = '100%';
|
||||
$table_status->class = 'databox filters';
|
||||
$table_status->style[0] = 'font-weight: bold';
|
||||
$table_status->size[0] = '10%';
|
||||
|
||||
$table_status->data = [];
|
||||
|
||||
$sql = "SELECT UNIX_TIMESTAMP(NOW()) - `value` AS updated_at
|
||||
FROM tconfig
|
||||
WHERE token = 'db_maintance'";
|
||||
|
||||
$time_pandora_db_active = db_get_sql($sql);
|
||||
|
||||
|
||||
if ($time_pandora_db_active < SECONDS_12HOURS) {
|
||||
$table_status->data[0][0] = html_print_image(
|
||||
'images/dot_green.png',
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$table_status->data[0][0] = html_print_image(
|
||||
'images/dot_red.png',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table_status->data[0][0] .= ' '.__('Pandora_db running in active database.');
|
||||
$table_status->data[0][0] .= ' '.__('Executed:').' ';
|
||||
$table_status->data[0][0] .= human_time_description_raw(
|
||||
$time_pandora_db_active,
|
||||
true
|
||||
);
|
||||
|
||||
$table_status->data[0][0] .= ' '.__('ago').'.';
|
||||
|
||||
if ($config['history_db_enabled'] == 1) {
|
||||
if (! isset($config['history_db_connection'])
|
||||
|| $config['history_db_connection'] === false
|
||||
) {
|
||||
$config['history_db_connection'] = db_connect(
|
||||
$config['history_db_host'],
|
||||
$config['history_db_name'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$config['history_db_port'],
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
$history_connect = @mysql_db_process_sql(
|
||||
'SELECT 1 FROM tconfig',
|
||||
'affected_rows',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
|
||||
$time_pandora_db_history = false;
|
||||
if ($history_connect !== false) {
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$time_pandora_db_history = mysql_db_process_sql(
|
||||
$sql,
|
||||
'insert_id',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($time_pandora_db_history !== false
|
||||
&& $time_pandora_db_history[0]['updated_at'] < SECONDS_12HOURS
|
||||
) {
|
||||
$table_status->data[1][0] = html_print_image(
|
||||
'images/dot_green.png',
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$table_status->data[1][0] = html_print_image(
|
||||
'images/dot_red.png',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table_status->data[1][0] .= ' '.__('Pandora_db running in historical database.');
|
||||
$table_status->data[1][0] .= ' '.__('Executed:').' ';
|
||||
if ($time_pandora_db_history !== false) {
|
||||
$table_status->data[1][0] .= human_time_description_raw(
|
||||
$time_pandora_db_history[0]['updated_at'],
|
||||
true
|
||||
).' '.__('ago').'.';
|
||||
} else {
|
||||
$table_status->data[1][0] .= __('not executed');
|
||||
}
|
||||
}
|
||||
|
||||
Update operation is done in config_process.php
|
||||
This is done in that way so the user can see the changes inmediatly.
|
||||
If you added a new token, please check config_update_config() in functions_config.php
|
||||
to add it there.
|
||||
*/
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
@ -44,44 +249,306 @@ $table->size[1] = '30%';
|
||||
|
||||
enterprise_hook('enterprise_warnings_history_days');
|
||||
|
||||
$table->data[1][0] = __('Max. days before delete events').ui_print_help_tip(__('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), true);
|
||||
$table->data[1][1] = html_print_input_text('event_purge', $config['event_purge'], '', 5, 5, true);
|
||||
$table->data[1][0] = __('Max. days before delete events');
|
||||
$table->data[1][0] .= ui_print_help_tip(
|
||||
__('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'),
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][1] = html_print_input_text(
|
||||
'event_purge',
|
||||
$config['event_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[2][0] = __('Max. days before delete traps');
|
||||
$table->data[2][1] = html_print_input_text('trap_purge', $config['trap_purge'], '', 5, 5, true);
|
||||
$table->data[2][1] = html_print_input_text(
|
||||
'trap_purge',
|
||||
$config['trap_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('Max. days before delete audit events');
|
||||
$table->data[3][1] = html_print_input_text('audit_purge', $config['audit_purge'], '', 5, 5, true);
|
||||
$table->data[3][1] = html_print_input_text(
|
||||
'audit_purge',
|
||||
$config['audit_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[4][0] = __('Max. days before delete string data');
|
||||
$table->data[4][1] = html_print_input_text('string_purge', $config['string_purge'], '', 5, 5, true);
|
||||
$table->data[4][1] = html_print_input_text(
|
||||
'string_purge',
|
||||
$config['string_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[5][0] = __('Max. days before delete GIS data');
|
||||
$table->data[5][1] = html_print_input_text('gis_purge', $config['gis_purge'], '', 5, 5, true);
|
||||
$table->data[5][1] = html_print_input_text(
|
||||
'gis_purge',
|
||||
$config['gis_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[6][0] = __('Max. days before purge').ui_print_help_tip(__('Configure a purge period more frequent than a compact data period has no sense'), true);
|
||||
$table->data[6][1] = html_print_input_text('days_purge', $config['days_purge'], '', 5, 5, true);
|
||||
$table->data[6][0] = __('Max. days before purge');
|
||||
$table->data[6][0] .= ui_print_help_tip(
|
||||
__('Configure a purge period more frequent than a compact data period has no sense'),
|
||||
true
|
||||
);
|
||||
$table->data[6][1] = html_print_input_text(
|
||||
'days_purge',
|
||||
$config['days_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[7][0] = __('Max. days before compact data');
|
||||
$table->data[7][1] = html_print_input_text('days_compact', $config['days_compact'], '', 5, 5, true);
|
||||
$table->data[7][1] = html_print_input_text(
|
||||
'days_compact',
|
||||
$config['days_compact'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[8][0] = __('Max. days before delete unknown modules');
|
||||
$table->data[8][1] = html_print_input_text('days_delete_unknown', $config['days_delete_unknown'], '', 5, 5, true);
|
||||
$table->data[8][1] = html_print_input_text(
|
||||
'days_delete_unknown',
|
||||
$config['days_delete_unknown'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[9][0] = __('Max. days before delete autodisabled agents');
|
||||
$table->data[9][1] = html_print_input_text('days_autodisable_deletion', $config['days_autodisable_deletion'], '', 5, 5, true);
|
||||
$table->data[9][1] = html_print_input_text(
|
||||
'days_autodisable_deletion',
|
||||
$config['days_autodisable_deletion'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[10][0] = __('Retention period of past special days').ui_print_help_tip(__('This number is days to keep past special days. 0 means never remove.'), true);
|
||||
$table->data[10][1] = html_print_input_text('num_past_special_days', $config['num_past_special_days'], '', 5, 5, true);
|
||||
$table->data[10][0] = __('Retention period of past special days');
|
||||
$table->data[10][0] .= ui_print_help_tip(
|
||||
__('This number is days to keep past special days. 0 means never remove.'),
|
||||
true
|
||||
);
|
||||
$table->data[10][1] = html_print_input_text(
|
||||
'num_past_special_days',
|
||||
$config['num_past_special_days'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[11][0] = __('Max. macro data fields').ui_print_help_tip(__('Number of macro fields in alerts and templates between 1 and 15'), true);
|
||||
$table->data[11][1] = html_print_input_text('max_macro_fields', $config['max_macro_fields'], '', 5, 5, true, false, false, 'onChange="change_macro_fields()"');
|
||||
$table->data[11][0] = __('Max. macro data fields');
|
||||
$table->data[11][0] .= ui_print_help_tip(
|
||||
__('Number of macro fields in alerts and templates between 1 and 15'),
|
||||
true
|
||||
);
|
||||
$table->data[11][1] = html_print_input_text(
|
||||
'max_macro_fields',
|
||||
$config['max_macro_fields'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'onChange="change_macro_fields()"'
|
||||
);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$table->data[12][0] = __('Max. days before delete inventory data');
|
||||
$table->data[12][1] = html_print_input_text('inventory_purge', $config['inventory_purge'], '', 5, 5, true);
|
||||
$table->data[12][1] = html_print_input_text(
|
||||
'inventory_purge',
|
||||
$config['inventory_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if ($config['history_db_enabled'] == 1) {
|
||||
if (! isset($config['history_db_connection'])
|
||||
|| $config['history_db_connection'] === false
|
||||
) {
|
||||
$config['history_db_connection'] = db_connect(
|
||||
$config['history_db_host'],
|
||||
$config['history_db_name'],
|
||||
$config['history_db_user'],
|
||||
io_output_password($config['history_db_pass']),
|
||||
$config['history_db_port'],
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
$history_connect = @mysql_db_process_sql(
|
||||
'SELECT 1 FROM tconfig',
|
||||
'affected_rows',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
|
||||
$config_history = false;
|
||||
if ($history_connect !== false) {
|
||||
if ($config['history_db_connection'] != false) {
|
||||
$config_history_array = mysql_db_process_sql(
|
||||
'SELECT * FROM tconfig',
|
||||
'affected_rows',
|
||||
$config['history_db_connection'],
|
||||
false
|
||||
);
|
||||
|
||||
if (isset($config_history_array) && is_array($config_history_array)) {
|
||||
foreach ($config_history_array as $key => $value) {
|
||||
$config_history[$value['token']] = $value['value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo ui_print_error_message(
|
||||
__('The tconfig table does not exist in the historical database')
|
||||
);
|
||||
}
|
||||
|
||||
if ($config_history === false) {
|
||||
$config_history = [];
|
||||
$config_history['days_purge'] = 180;
|
||||
$config_history['days_compact'] = 120;
|
||||
$config_history['step_compact'] = 1;
|
||||
$config_history['event_purge'] = 180;
|
||||
$config_history['string_purge'] = 180;
|
||||
}
|
||||
|
||||
$table_historical = new StdClass();
|
||||
$table_historical->width = '100%';
|
||||
$table_historical->class = 'databox filters';
|
||||
$table_historical->data = [];
|
||||
$table_historical->style[0] = 'font-weight: bold';
|
||||
|
||||
$table_historical->size[0] = '70%';
|
||||
$table_historical->size[1] = '30%';
|
||||
|
||||
enterprise_hook('enterprise_warnings_history_days');
|
||||
|
||||
$table_historical->data[0][0] = __('Max. days before purge');
|
||||
$table_historical->data[0][0] .= ui_print_help_tip(
|
||||
__('Configure a purge period more frequent than a compact data period has no sense'),
|
||||
true
|
||||
);
|
||||
$table_historical->data[0][1] = html_print_input_text(
|
||||
'historical_days_purge',
|
||||
$config_history['days_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_historical->data[1][0] = __('Max. days before compact data');
|
||||
$table_historical->data[1][1] = html_print_input_text(
|
||||
'historical_days_compact',
|
||||
$config_history['days_compact'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_historical->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
|
||||
$table_historical->data[2][0] .= ui_print_help_tip(
|
||||
__('Data will be compacted in intervals of the specified length.'),
|
||||
true
|
||||
);
|
||||
$table_historical->data[2][1] = html_print_input_text(
|
||||
'historical_step_compact',
|
||||
$config_history['step_compact'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_historical->data[3][0] = __('Max. days before delete events');
|
||||
$table_historical->data[3][0] .= ui_print_help_tip(
|
||||
__('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'),
|
||||
true
|
||||
);
|
||||
|
||||
$table_historical->data[3][1] = html_print_input_text(
|
||||
'historical_event_purge',
|
||||
$config_history['event_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_historical->data[4][0] = __('Max. days before delete string data');
|
||||
$table_historical->data[4][1] = html_print_input_text(
|
||||
'historical_string_purge',
|
||||
$config_history['string_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_historical->data[4][1] .= html_print_input_hidden(
|
||||
'historical_history_db_enabled',
|
||||
0,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table->data[] = [
|
||||
__('Max. days before delete old messages'),
|
||||
html_print_input_text(
|
||||
'delete_old_messages',
|
||||
$config['delete_old_messages'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
),
|
||||
];
|
||||
|
||||
|
||||
$table->data[] = [
|
||||
__('Max. days before delete old network matrix data'),
|
||||
html_print_input_text(
|
||||
'delete_old_network_matrix',
|
||||
$config['delete_old_network_matrix'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
),
|
||||
];
|
||||
|
||||
$table_other = new stdClass();
|
||||
$table_other->width = '100%';
|
||||
$table_other->class = 'databox filters';
|
||||
@ -91,7 +558,11 @@ $table_other->style[0] = 'font-weight: bold';
|
||||
$table_other->size[0] = '70%';
|
||||
$table_other->size[1] = '30%';
|
||||
|
||||
$table_other->data[1][0] = __('Item limit for realtime reports').ui_print_help_tip(__('Set a value too high cause a slowdown on console and a performance penalty in the system.'), true);
|
||||
$table_other->data[1][0] = __('Item limit for realtime reports');
|
||||
$table_other->data[1][0] .= ui_print_help_tip(
|
||||
__('Set a value too high cause a slowdown on console and a performance penalty in the system.'),
|
||||
true
|
||||
);
|
||||
$table_other->data[1][1] = html_print_input_text(
|
||||
'report_limit',
|
||||
$config['report_limit'],
|
||||
@ -101,7 +572,11 @@ $table_other->data[1][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)').ui_print_help_tip(__('Data will be compacted in intervals of the specified length.'), true);
|
||||
$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
|
||||
$table_other->data[2][0] .= ui_print_help_tip(
|
||||
__('Data will be compacted in intervals of the specified length.'),
|
||||
true
|
||||
);
|
||||
$table_other->data[2][1] = html_print_input_text(
|
||||
'step_compact',
|
||||
$config['step_compact'],
|
||||
@ -122,49 +597,145 @@ $intervals[SECONDS_2WEEK] = __('2 weeks');
|
||||
$intervals[SECONDS_1MONTH] = __('Last month');
|
||||
|
||||
$table_other->data[3][0] = __('Default hours for event view');
|
||||
$table_other->data[3][1] = html_print_input_text('event_view_hr', $config['event_view_hr'], '', 5, 5, true);
|
||||
$table_other->data[3][1] = html_print_input_text(
|
||||
'event_view_hr',
|
||||
$config['event_view_hr'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[5][0] = __('Use realtime statistics');
|
||||
$table_other->data[5][1] = __('Yes').' '.html_print_radio_button('realtimestats', 1, '', $config['realtimestats'], true).' ';
|
||||
$table_other->data[5][1] .= __('No').' '.html_print_radio_button('realtimestats', 0, '', $config['realtimestats'], true);
|
||||
$table_other->data[5][1] = html_print_checkbox_switch(
|
||||
'realtimestats',
|
||||
1,
|
||||
$config['realtimestats'],
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[6][0] = __('Batch statistics period (secs)').ui_print_help_tip(__('If realtime statistics are disabled, statistics interval resfresh will be set here.'), true);
|
||||
$table_other->data[6][1] = html_print_input_text('stats_interval', $config['stats_interval'], '', 5, 5, true);
|
||||
$table_other->data[6][0] = __('Batch statistics period (secs)');
|
||||
$table_other->data[6][0] .= ui_print_help_tip(
|
||||
__('If realtime statistics are disabled, statistics interval resfresh will be set here.'),
|
||||
true
|
||||
);
|
||||
$table_other->data[6][1] = html_print_input_text(
|
||||
'stats_interval',
|
||||
$config['stats_interval'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[7][0] = __('Use agent access graph').ui_print_help_icon('agent_access', true);
|
||||
$table_other->data[7][1] = __('Yes').' '.html_print_radio_button('agentaccess', 1, '', $config['agentaccess'], true).' ';
|
||||
$table_other->data[7][1] .= __('No').' '.html_print_radio_button('agentaccess', 0, '', $config['agentaccess'], true);
|
||||
$table_other->data[7][1] = html_print_checkbox_switch('agentaccess', 1, $config['agentaccess'], true);
|
||||
|
||||
$table_other->data[8][0] = __('Max. recommended number of files in attachment directory').ui_print_help_tip(__('This number is the maximum number of files in attachment directory. If this number is reached then a warning message will appear in the header notification space.'), true);
|
||||
$table_other->data[8][1] = html_print_input_text('num_files_attachment', $config['num_files_attachment'], '', 5, 5, true);
|
||||
$table_other->data[8][0] = __('Max. recommended number of files in attachment directory');
|
||||
$table_other->data[8][0] .= ui_print_help_tip(
|
||||
__('This number is the maximum number of files in attachment directory. If this number is reached then a warning message will appear in the header notification space.'),
|
||||
true
|
||||
);
|
||||
$table_other->data[8][1] = html_print_input_text(
|
||||
'num_files_attachment',
|
||||
$config['num_files_attachment'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[9][0] = __('Delete not init modules');
|
||||
$table_other->data[9][1] = __('Yes').' '.html_print_radio_button('delete_notinit', 1, '', $config['delete_notinit'], true).' ';
|
||||
$table_other->data[9][1] .= __('No').' '.html_print_radio_button('delete_notinit', 0, '', $config['delete_notinit'], true);
|
||||
$table_other->data[9][1] = html_print_checkbox_switch('delete_notinit', 1, $config['delete_notinit'], true);
|
||||
|
||||
$table_other->data[10][0] = __('Big Operation Step to purge old data').ui_print_help_tip(__('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'), true);
|
||||
$table_other->data[10][1] = html_print_input_text('big_operation_step_datos_purge', $config['big_operation_step_datos_purge'], '', 5, 5, true);
|
||||
$table_other->data[10][0] = __('Big Operation Step to purge old data');
|
||||
$table_other->data[10][0] .= ui_print_help_tip(
|
||||
__('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'),
|
||||
true
|
||||
);
|
||||
$table_other->data[10][1] = html_print_input_text(
|
||||
'big_operation_step_datos_purge',
|
||||
$config['big_operation_step_datos_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[11][0] = __('Small Operation Step to purge old data').ui_print_help_tip(__('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'), true);
|
||||
$table_other->data[11][1] = html_print_input_text('small_operation_step_datos_purge', $config['small_operation_step_datos_purge'], '', 5, 5, true);
|
||||
$table_other->data[11][0] = __('Small Operation Step to purge old data');
|
||||
$table_other->data[11][0] .= ui_print_help_tip(
|
||||
__('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'),
|
||||
true
|
||||
);
|
||||
$table_other->data[11][1] = html_print_input_text(
|
||||
'small_operation_step_datos_purge',
|
||||
$config['small_operation_step_datos_purge'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[12][0] = __('Graph container - Max. Items').ui_print_help_tip(__('The number of graphs that are viewed in a container. Default is 10 .Increasing this number could lead to performance problems'), true);
|
||||
$table_other->data[12][1] = html_print_input_text('max_graph_container', $config['max_graph_container'], '', 5, 5, true);
|
||||
$table_other->data[12][0] = __('Graph container - Max. Items');
|
||||
$table_other->data[12][0] .= ui_print_help_tip(
|
||||
__('The number of graphs that are viewed in a container. Default is 10 .Increasing this number could lead to performance problems'),
|
||||
true
|
||||
);
|
||||
$table_other->data[12][1] = html_print_input_text(
|
||||
'max_graph_container',
|
||||
$config['max_graph_container'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
$table_other->data[13][0] = __('Events response max. execution');
|
||||
$table_other->data[13][0] .= ui_print_help_tip(
|
||||
__('Number of events that will perform the desired action at the same time'),
|
||||
true
|
||||
);
|
||||
$table_other->data[13][1] = html_print_input_text(
|
||||
'max_execution_event_response',
|
||||
$config['max_execution_event_response'],
|
||||
'',
|
||||
5,
|
||||
5,
|
||||
true
|
||||
);
|
||||
|
||||
echo '<form id="form_setup" method="post">';
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Database maintenance options').'</legend>';
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_table($table);
|
||||
echo '<legend>'.__('Database maintenance status').'</legend>';
|
||||
html_print_table($table_status);
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Others').'</legend>';
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_table($table_other);
|
||||
echo '<legend>'.__('Database maintenance options').'</legend>';
|
||||
html_print_table($table);
|
||||
echo '</fieldset>';
|
||||
|
||||
if ($config['history_db_enabled'] == 1) {
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Historical database maintenance options').'</legend>';
|
||||
html_print_table($table_historical);
|
||||
echo '</fieldset>';
|
||||
}
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('Others').'</legend>';
|
||||
html_print_table($table_other);
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"');
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_submit_button(
|
||||
__('Update'),
|
||||
'update_button',
|
||||
false,
|
||||
'class="sub upd"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
?>
|
||||
@ -173,7 +744,6 @@ echo '</form>';
|
||||
|
||||
function change_macro_fields() {
|
||||
var value = $("#text-max_macro_fields").val();
|
||||
console.log(value);
|
||||
if (value <= 0) {
|
||||
$("#text-max_macro_fields").val(1);
|
||||
}
|
||||
|
@ -1,17 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Extensions
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU 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();
|
||||
@ -49,7 +64,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
|
||||
return;
|
||||
}
|
||||
|
||||
// Load enterprise extensions
|
||||
// Load enterprise extensions.
|
||||
enterprise_include_once('include/functions_setup.php');
|
||||
enterprise_include_once('include/functions_io.php');
|
||||
enterprise_include_once('godmode/setup/setup.php');
|
||||
@ -63,12 +78,12 @@ enterprise_include_once('godmode/setup/setup.php');
|
||||
to add it there.
|
||||
*/
|
||||
|
||||
// Gets section to jump to another section
|
||||
// Gets section to jump to another section.
|
||||
$section = (string) get_parameter('section', 'general');
|
||||
|
||||
$buttons = [];
|
||||
|
||||
// Draws header
|
||||
// Draws header.
|
||||
$buttons['general'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general">'.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'</a>',
|
||||
@ -107,6 +122,12 @@ $buttons['ehorus'] = [
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup§ion=ehorus">'.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'</a>',
|
||||
];
|
||||
|
||||
// FIXME: Not definitive icon
|
||||
$buttons['notifications'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gsetup&sec2=godmode/setup/setup§ion=notifications">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
|
||||
];
|
||||
|
||||
$help_header = '';
|
||||
if (enterprise_installed()) {
|
||||
$subpage = setup_enterprise_add_subsection_main($section, $buttons, $help_header);
|
||||
@ -114,6 +135,7 @@ if (enterprise_installed()) {
|
||||
|
||||
switch ($section) {
|
||||
case 'general':
|
||||
default:
|
||||
$buttons['general']['active'] = true;
|
||||
$subpage = ' » '.__('General');
|
||||
break;
|
||||
@ -143,9 +165,14 @@ switch ($section) {
|
||||
$buttons['ehorus']['active'] = true;
|
||||
$subpage = ' » '.__('eHorus');
|
||||
break;
|
||||
|
||||
case 'notifications':
|
||||
$buttons['notifications']['active'] = true;
|
||||
$subpage = ' » '.__('Notifications');
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Configuration').$subpage, '', false, $help_header, true, $buttons);
|
||||
|
||||
if (isset($config['error_config_update_config'])) {
|
||||
@ -183,6 +210,10 @@ switch ($section) {
|
||||
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
|
||||
break;
|
||||
|
||||
case 'notifications':
|
||||
include_once $config['homedir'].'/godmode/setup/setup_notifications.php';
|
||||
break;
|
||||
|
||||
default:
|
||||
enterprise_hook('setup_enterprise_select_tab', [$section]);
|
||||
break;
|
||||
|
@ -43,17 +43,15 @@ if (is_ajax()) {
|
||||
if ($type_auth != 'mysql') {
|
||||
// Fallback to local authentication
|
||||
$row = [];
|
||||
$row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed.'), true);
|
||||
$row['control'] = __('Yes').' '.html_print_radio_button('fallback_local_auth', 1, '', $config['fallback_local_auth'], true).' ';
|
||||
$row['control'] .= __('No').' '.html_print_radio_button('fallback_local_auth', 0, '', $config['fallback_local_auth'], true);
|
||||
$row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed. Only available when \'Save password\' is enabled.'), true);
|
||||
$row['control'] = html_print_checkbox_switch('fallback_local_auth', 1, $config['fallback_local_auth'], true);
|
||||
$table->data['fallback_local_auth'] = $row;
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// Autocreate remote users
|
||||
$row = [];
|
||||
$row['name'] = __('Autocreate remote users');
|
||||
$row['control'] = __('Yes').' '.html_print_radio_button_extended('autocreate_remote_users', 1, '', $config['autocreate_remote_users'], false, '', '', true).' ';
|
||||
$row['control'] .= __('No').' '.html_print_radio_button_extended('autocreate_remote_users', 0, '', $config['autocreate_remote_users'], false, '', '', true);
|
||||
$row['control'] = html_print_checkbox_switch_extended('autocreate_remote_users', 1, $config['autocreate_remote_users'], false, '', '', true).' ';
|
||||
$table->data['autocreate_remote_users'] = $row;
|
||||
|
||||
add_enterprise_auth_autocreate_profiles($table, $type_auth);
|
||||
@ -91,8 +89,7 @@ if (is_ajax()) {
|
||||
// Start TLS
|
||||
$row = [];
|
||||
$row['name'] = __('Start TLS');
|
||||
$row['control'] = __('Yes').' '.html_print_radio_button('ldap_start_tls', 1, '', $config['ldap_start_tls'], true).' ';
|
||||
$row['control'] .= __('No').' '.html_print_radio_button('ldap_start_tls', 0, '', $config['ldap_start_tls'], true);
|
||||
$row['control'] = html_print_checkbox_switch('ldap_start_tls', 1, $config['ldap_start_tls'], true);
|
||||
$table->data['ldap_start_tls'] = $row;
|
||||
|
||||
// Base DN
|
||||
@ -137,11 +134,7 @@ if (is_ajax()) {
|
||||
set_unless_defined($config['double_auth_enabled'], false);
|
||||
$row = [];
|
||||
$row['name'] = __('Double authentication').ui_print_help_tip(__('If this option is enabled, the users can use double authentication with their accounts'), true);
|
||||
$row['control'] = __('Yes').' ';
|
||||
$row['control'] .= html_print_radio_button('double_auth_enabled', 1, '', $config['double_auth_enabled'], true);
|
||||
$row['control'] .= ' ';
|
||||
$row['control'] .= __('No').' ';
|
||||
$row['control'] .= html_print_radio_button('double_auth_enabled', 0, '', $config['double_auth_enabled'], true);
|
||||
$row['control'] .= html_print_checkbox_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true);
|
||||
$table->data['double_auth_enabled'] = $row;
|
||||
|
||||
// Session timeout
|
||||
|
@ -1,18 +1,23 @@
|
||||
<?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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// 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.
|
||||
// Warning: This file may be required into the metaconsole's setup
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
@ -23,7 +28,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
|
||||
return;
|
||||
}
|
||||
|
||||
// Check custom field
|
||||
// Check custom field.
|
||||
$custom_field = db_get_value('name', 'tagent_custom_fields', 'name', $config['ehorus_custom_field']);
|
||||
$custom_field_exists = !empty($custom_field);
|
||||
$custom_field_created = null;
|
||||
@ -36,7 +41,7 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
|
||||
$custom_field_exists = $custom_field_created = $result;
|
||||
}
|
||||
|
||||
// Enable table
|
||||
// Enable table.
|
||||
$table_enable = new StdClass();
|
||||
$table_enable->data = [];
|
||||
$table_enable->width = '100%';
|
||||
@ -45,15 +50,13 @@ $table_enable->class = 'databox filters';
|
||||
$table_enable->size['name'] = '30%';
|
||||
$table_enable->style['name'] = 'font-weight: bold';
|
||||
|
||||
// Enable eHorus
|
||||
// Enable eHorus.
|
||||
$row = [];
|
||||
$row['name'] = __('Enable eHorus');
|
||||
$row['control'] = __('Yes').' '.html_print_radio_button('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).' ';
|
||||
$row['control'] .= __('No').' '.html_print_radio_button('ehorus_enabled', 0, '', $config['ehorus_enabled'], true);
|
||||
$row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true);
|
||||
$row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true);
|
||||
$table_enable->data['ehorus_enabled'] = $row;
|
||||
|
||||
// Remote config table
|
||||
// Remote config table.
|
||||
$table_remote = new StdClass();
|
||||
$table_remote->data = [];
|
||||
$table_remote->width = '100%';
|
||||
@ -63,40 +66,40 @@ $table_remote->class = 'databox filters';
|
||||
$table_remote->size['name'] = '30%';
|
||||
$table_remote->style['name'] = 'font-weight: bold';
|
||||
|
||||
// User
|
||||
// User.
|
||||
$row = [];
|
||||
$row['name'] = __('User');
|
||||
$row['control'] = html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true);
|
||||
$table_remote->data['ehorus_user'] = $row;
|
||||
|
||||
// Pass
|
||||
// Pass.
|
||||
$row = [];
|
||||
$row['name'] = __('Password');
|
||||
$row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true);
|
||||
$table_remote->data['ehorus_pass'] = $row;
|
||||
|
||||
// Directory hostname
|
||||
// Directory hostname.
|
||||
$row = [];
|
||||
$row['name'] = __('API Hostname');
|
||||
$row['control'] = html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true);
|
||||
$row['control'] .= ui_print_help_tip(__('Hostname of the eHorus API').'. '.__('Without protocol and port').'. '.__('e.g., portal.ehorus.com'), true);
|
||||
$table_remote->data['ehorus_hostname'] = $row;
|
||||
|
||||
// Directory port
|
||||
// Directory port.
|
||||
$row = [];
|
||||
$row['name'] = __('API Port');
|
||||
$row['control'] = html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true);
|
||||
$row['control'] .= ui_print_help_tip(__('e.g., 18080'), true);
|
||||
$table_remote->data['ehorus_port'] = $row;
|
||||
|
||||
// Request timeout
|
||||
// Request timeout.
|
||||
$row = [];
|
||||
$row['name'] = __('Request timeout');
|
||||
$row['control'] = html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true);
|
||||
$row['control'] .= ui_print_help_tip(__('Time in seconds to set the maximum time of the requests to the eHorus API').'. '.__('0 to disable'), true);
|
||||
$table_remote->data['ehorus_req_timeout'] = $row;
|
||||
|
||||
// Test
|
||||
// Test.
|
||||
$row = [];
|
||||
$row['name'] = __('Test');
|
||||
$row['control'] = html_print_button(__('Start'), 'test-ehorus', false, '', 'class="sub next"', true);
|
||||
@ -106,7 +109,7 @@ $row['control'] .= '<span id="test-ehorus-failure" style="display:none;"> '
|
||||
$row['control'] .= ' <span id="test-ehorus-message" style="display:none;"></span>';
|
||||
$table_remote->data['ehorus_test'] = $row;
|
||||
|
||||
// Print
|
||||
// Print.
|
||||
echo '<div style="text-align: center; padding-bottom: 20px;">';
|
||||
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
|
||||
html_print_image('include/ehorus/images/ehorus-logo-grey.png');
|
||||
@ -136,13 +139,13 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
|
||||
ui_print_error_message($error_message);
|
||||
}
|
||||
|
||||
// Form enable
|
||||
// Form enable.
|
||||
echo '<form id="form_enable" method="post">';
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_table($table_enable);
|
||||
echo '</form>';
|
||||
|
||||
// Form remote
|
||||
// Form remote.
|
||||
if ($config['ehorus_enabled']) {
|
||||
echo '<form id="form_remote" method="post">';
|
||||
echo '<fieldset>';
|
||||
@ -159,6 +162,9 @@ if ($config['ehorus_enabled']) {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('input:checkbox[name="ehorus_enabled"]').attr('checked', false);
|
||||
$('form#form_remote').hide();
|
||||
$('form#form_enable').css('margin-bottom','20px');
|
||||
var showFields = function () {
|
||||
$('form#form_remote').show();
|
||||
}
|
||||
@ -166,10 +172,17 @@ if ($config['ehorus_enabled']) {
|
||||
$('form#form_remote').hide();
|
||||
}
|
||||
var handleEnable = function (event) {
|
||||
if (event.target.value == '1') showFields();
|
||||
else hideFields();
|
||||
var is_checked = $('input:checkbox[name="ehorus_enabled"]').is(':checked');
|
||||
if (event.target.value == '1' && is_checked) {
|
||||
showFields();
|
||||
$('input:checkbox[name="ehorus_enabled"]').attr('checked', false);
|
||||
}
|
||||
else {
|
||||
hideFields();
|
||||
$('input:checkbox[name="ehorus_enabled"]').attr('checked', true);
|
||||
};
|
||||
}
|
||||
$('input:radio[name="ehorus_enabled"]').change(handleEnable);
|
||||
$('input:checkbox[name="ehorus_enabled"]').change(handleEnable);
|
||||
|
||||
var handleTest = function (event) {
|
||||
var user = $('input#text-ehorus_user').val();
|
||||
|
@ -1,17 +1,23 @@
|
||||
<?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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU 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();
|
||||
@ -82,16 +88,17 @@ $sources['sql'] = __('Database');
|
||||
$table->data[9][1] = html_print_select($sources, 'timesource', $config['timesource'], '', '', '', true);
|
||||
|
||||
$table->data[10][0] = __('Automatic check for updates');
|
||||
$table->data[10][1] = __('Yes').' '.html_print_radio_button('autoupdate', 1, '', $config['autoupdate'], true).' ';
|
||||
$table->data[10][1] .= __('No').' '.html_print_radio_button('autoupdate', 0, '', $config['autoupdate'], true);
|
||||
$table->data[10][1] = html_print_checkbox_switch('autoupdate', 1, $config['autoupdate'], true);
|
||||
|
||||
echo "<div id='dialog' title='".__('Enforce https Information')."' style='display:none;'>";
|
||||
echo "<p style='text-align: center;'>".__('If SSL is not properly configured you will lose access to ').get_product_name().__(' Console').'</p>';
|
||||
echo '</div>';
|
||||
|
||||
$table->data[11][0] = __('Enforce https');
|
||||
$table->data[11][1] = __('Yes').' '.html_print_radio_button_extended('https', 1, '', $config['https'], false, "if (! confirm ('".__('If SSL is not properly configured you will lose access to %s Console. Do you want to continue?', get_product_name())."')) return false", '', true).' ';
|
||||
$table->data[11][1] .= __('No').' '.html_print_radio_button('https', 0, '', $config['https'], true);
|
||||
$table->data[11][1] = html_print_checkbox_switch_extended('https', 1, $config['https'], false, '', '', true);
|
||||
|
||||
$table->data[12][0] = __('Use cert of SSL');
|
||||
$table->data[12][1] = __('Yes').' '.html_print_radio_button_extended('use_cert', 1, '', $config['use_cert'], false, '', '', true).' ';
|
||||
$table->data[12][1] .= __('No').' '.html_print_radio_button('use_cert', 0, '', $config['use_cert'], true);
|
||||
$table->data[12][1] = html_print_checkbox_switch_extended('use_cert', 1, $config['use_cert'], false, '', '', true);
|
||||
|
||||
$table->rowstyle[13] = 'display: none;';
|
||||
$table->data[13][0] = __('Path of SSL Cert.').ui_print_help_tip(__('Path where you put your cert and name of this cert. Remember your cert only in .pem extension.'), true);
|
||||
@ -113,8 +120,7 @@ $table->data[16][0] = __('API password').ui_print_help_tip(__('Please be careful
|
||||
$table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true);
|
||||
|
||||
$table->data[17][0] = __('Enable GIS features');
|
||||
$table->data[17][1] = __('Yes').' '.html_print_radio_button('activate_gis', 1, '', $config['activate_gis'], true).' ';
|
||||
$table->data[17][1] .= __('No').' '.html_print_radio_button('activate_gis', 0, '', $config['activate_gis'], true);
|
||||
$table->data[17][1] = html_print_checkbox_switch('activate_gis', 1, $config['activate_gis'], true);
|
||||
|
||||
$table->data[19][0] = __('Enable Netflow');
|
||||
$rbt_disabled = false;
|
||||
@ -123,8 +129,16 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
$table->data[19][0] .= ui_print_help_tip(__('Not supported in Windows systems'), true);
|
||||
}
|
||||
|
||||
$table->data[19][1] = __('Yes').' '.html_print_radio_button_extended('activate_netflow', 1, '', $config['activate_netflow'], $rbt_disabled, '', '', true).' ';
|
||||
$table->data[19][1] .= __('No').' '.html_print_radio_button_extended('activate_netflow', 0, '', $config['activate_netflow'], $rbt_disabled, '', '', true);
|
||||
$table->data[19][1] = html_print_checkbox_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true);
|
||||
|
||||
$table->data[21][0] = __('Enable Network Traffic Analyzer');
|
||||
$table->data[21][1] = html_print_switch(
|
||||
[
|
||||
'name' => 'activate_nta',
|
||||
'value' => $config['activate_nta'],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$zone_name = [
|
||||
'Africa' => __('Africa'),
|
||||
@ -202,18 +216,15 @@ $table->data[28][1] = html_print_input_text('public_url', $config['public_url'],
|
||||
|
||||
$table->data[29][0] = __('Referer security');
|
||||
$table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true);
|
||||
$table->data[29][1] = __('Yes').' '.html_print_radio_button('referer_security', 1, '', $config['referer_security'], true).' ';
|
||||
$table->data[29][1] .= __('No').' '.html_print_radio_button('referer_security', 0, '', $config['referer_security'], true);
|
||||
$table->data[29][1] = html_print_checkbox_switch('referer_security', 1, $config['referer_security'], true);
|
||||
|
||||
$table->data[30][0] = __('Event storm protection');
|
||||
$table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true);
|
||||
$table->data[30][1] = __('Yes').' '.html_print_radio_button('event_storm_protection', 1, '', $config['event_storm_protection'], true).' ';
|
||||
$table->data[30][1] .= __('No').' '.html_print_radio_button('event_storm_protection', 0, '', $config['event_storm_protection'], true);
|
||||
$table->data[30][1] = html_print_checkbox_switch('event_storm_protection', 1, $config['event_storm_protection'], true);
|
||||
|
||||
|
||||
$table->data[31][0] = __('Command Snapshot').ui_print_help_tip(__('The string modules with several lines show as command output'), true);
|
||||
$table->data[31][1] = __('Yes').' '.html_print_radio_button('command_snapshot', 1, '', $config['command_snapshot'], true).' ';
|
||||
$table->data[31][1] .= __('No').' '.html_print_radio_button('command_snapshot', 0, '', $config['command_snapshot'], true);
|
||||
$table->data[31][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
|
||||
|
||||
$table->data[32][0] = __('Server logs directory').ui_print_help_tip(__('Directory where the server logs are stored.'), true);
|
||||
$table->data[32][1] = html_print_input_text(
|
||||
@ -253,8 +264,7 @@ $table->data['tutorial_mode'][1] = html_print_select(
|
||||
|
||||
$config['past_planned_downtimes'] = isset($config['past_planned_downtimes']) ? $config['past_planned_downtimes'] : 1;
|
||||
$table->data[34][0] = __('Allow create planned downtimes in the past').ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true);
|
||||
$table->data[34][1] = __('Yes').' '.html_print_radio_button('past_planned_downtimes', 1, '', $config['past_planned_downtimes'], true).' ';
|
||||
$table->data[34][1] .= __('No').' '.html_print_radio_button('past_planned_downtimes', 0, '', $config['past_planned_downtimes'], true);
|
||||
$table->data[34][1] = html_print_checkbox_switch('past_planned_downtimes', 1, $config['past_planned_downtimes'], true);
|
||||
|
||||
$table->data[35][0] = __('Limit for bulk operations').ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get('max_input_vars')), true);
|
||||
$table->data[35][1] = html_print_input_text(
|
||||
@ -267,15 +277,16 @@ $table->data[35][1] = html_print_input_text(
|
||||
);
|
||||
|
||||
$table->data[36][0] = __('Include agents manually disabled');
|
||||
$table->data[36][1] = __('Yes').' '.html_print_radio_button('include_agents', 1, '', $config['include_agents'], true).' ';
|
||||
$table->data[36][1] .= __('No').' '.html_print_radio_button('include_agents', 0, '', $config['include_agents'], true);
|
||||
$table->data[36][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
|
||||
|
||||
$table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory where audit log is stored.'), true);
|
||||
$table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
|
||||
|
||||
$table->data[38][0] = __('Set alias as name by default in agent creation');
|
||||
$table->data[38][1] = __('Yes').' '.html_print_radio_button('alias_as_name', 1, '', $config['alias_as_name'], true).' ';
|
||||
$table->data[38][1] .= __('No').' '.html_print_radio_button('alias_as_name', 0, '', $config['alias_as_name'], true);
|
||||
$table->data[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
|
||||
|
||||
$table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
|
||||
$table->data[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
|
||||
|
||||
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
||||
@ -339,16 +350,30 @@ $(document).ready (function () {
|
||||
$("#zone").attr("hidden", false);
|
||||
$("#timezone").attr("hidden", false);
|
||||
});
|
||||
|
||||
if ($("input[name=use_cert]").is(':checked')) {
|
||||
$('#setup_general-13').show();
|
||||
}
|
||||
|
||||
$("input[name=use_cert]").change(function () {
|
||||
if( $(this).is(":checked") ){
|
||||
var val = $(this).val();
|
||||
if (val == 1) {
|
||||
if( $(this).is(":checked") )
|
||||
$('#setup_general-13').show();
|
||||
}
|
||||
else
|
||||
$('#setup_general-13').hide();
|
||||
}
|
||||
|
||||
});
|
||||
$("input[name=https]").change(function (){
|
||||
if($("input[name=https]").prop('checked')) {
|
||||
$("#dialog").css({'display': 'inline', 'font-weight': 'bold'}).dialog({
|
||||
modal: true,
|
||||
buttons:{
|
||||
"<?php echo __('Close'); ?>": function(){
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
@ -368,5 +393,3 @@ function get_sounds()
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,16 +1,23 @@
|
||||
<?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.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU 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.
|
||||
global $config;
|
||||
|
||||
require_once 'include/functions_ui.php';
|
||||
@ -55,21 +62,19 @@ $table->data[5][0] = '<b>'.__('Maximum chart resolution').'</b>'.ui_print_help_t
|
||||
$table->data[5][1] = html_print_input_text('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true);
|
||||
|
||||
$table->data[6][0] = '<b>'.__('Disable custom live view filters').'</b>'.ui_print_help_tip(__('Disable the definition of custom filters in the live view. Only existing filters can be used.'), true);
|
||||
$table->data[6][1] = __('Yes').' '.html_print_radio_button('netflow_disable_custom_lvfilters', 1, '', $config['netflow_disable_custom_lvfilters'], true).' ';
|
||||
$table->data[6][1] .= __('No').' '.html_print_radio_button('netflow_disable_custom_lvfilters', 0, '', $config['netflow_disable_custom_lvfilters'], true);
|
||||
$table->data[6][1] = html_print_checkbox_switch('netflow_disable_custom_lvfilters', 1, $config['netflow_disable_custom_lvfilters'], true);
|
||||
$table->data[7][0] = '<b>'.__('Netflow max lifetime').'</b>'.ui_print_help_tip(__('Sets the maximum lifetime for netflow data in days.'), true);
|
||||
$table->data[7][1] = html_print_input_text('netflow_max_lifetime', $config['netflow_max_lifetime'], false, 50, 200, true);
|
||||
|
||||
$table->data[8][0] = '<b>'.__('Name resolution for IP address').'</b>'.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true);
|
||||
$onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;";
|
||||
$table->data[8][1] = __('Yes').' '.html_print_radio_button_extended('netflow_get_ip_hostname', 1, '', $config['netflow_get_ip_hostname'], false, $onclick, '', true).' ';
|
||||
$table->data[8][1] .= __('No').' '.html_print_radio_button('netflow_get_ip_hostname', 0, '', $config['netflow_get_ip_hostname'], true);
|
||||
$table->data[8][1] = html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true);
|
||||
|
||||
echo '<form id="netflow_setup" method="post">';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
// Update button
|
||||
// Update button.
|
||||
echo '<div class="action-buttons" style="width:100%;">';
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');
|
||||
|
413
pandora_console/godmode/setup/setup_notifications.php
Normal file
413
pandora_console/godmode/setup/setup_notifications.php
Normal file
@ -0,0 +1,413 @@
|
||||
<?php
|
||||
/**
|
||||
* Library. Notification system auxiliary functions.
|
||||
*
|
||||
* @category UI file
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_notifications.php';
|
||||
|
||||
check_login();
|
||||
|
||||
// AJAX actions.
|
||||
$source = get_parameter('source', '');
|
||||
$users = get_parameter('users', '');
|
||||
$elements = get_parameter('elements', []);
|
||||
$is_users = $users === 'users';
|
||||
if (get_parameter('get_selection_two_ways_form', 0)) {
|
||||
$info_selec = ($is_users === true) ? notifications_get_user_source_not_configured($source) : notifications_get_group_source_not_configured($source);
|
||||
|
||||
echo notifications_print_two_ways_select(
|
||||
$info_selec,
|
||||
$users,
|
||||
$source
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('add_source_to_database', 0)) {
|
||||
$res = ($is_users) ? notifications_add_users_to_source($source, $elements) : notifications_add_group_to_source($source, $elements);
|
||||
$result = ['result' => $res];
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('remove_source_on_database', 0)) {
|
||||
$res = ($is_users) ? notifications_remove_users_from_source($source, $elements) : notifications_remove_group_from_source($source, $elements);
|
||||
$result = ['result' => $res];
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('update_config', 0)) {
|
||||
$element = (string) get_parameter('element', '');
|
||||
$value = (int) get_parameter('value', 0);
|
||||
|
||||
// Update the label value.
|
||||
ob_clean();
|
||||
$res = false;
|
||||
switch ($element) {
|
||||
// All users has other action.
|
||||
case 'all_users':
|
||||
$res = ($value) ? notifications_add_group_to_source($source, [0]) : notifications_remove_group_from_source($source, [0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
$res = (bool) db_process_sql_update(
|
||||
'tnotification_source',
|
||||
[$element => $value],
|
||||
['id' => $source]
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
echo json_encode(['result' => $res]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('check_new_notifications', 0)) {
|
||||
$last_id_ui = (int) get_parameter('last_id', 0);
|
||||
$counters = notifications_get_counters();
|
||||
if ((int) $last_id_ui === (int) $counters['last_id']) {
|
||||
echo json_encode(['has_new_notifications' => false]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (messages_get_count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$messages = messages_get_overview(
|
||||
'timestamp',
|
||||
'ASC',
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
['id_mensaje' => '>'.$last_id_ui]
|
||||
);
|
||||
if ($messages === false) {
|
||||
$messages = [];
|
||||
}
|
||||
|
||||
// If there is new messages, get the info.
|
||||
echo json_encode(
|
||||
[
|
||||
'has_new_notifications' => true,
|
||||
'new_ball' => base64_encode(
|
||||
notifications_print_ball(
|
||||
$counters['notifications'],
|
||||
$counters['last_id']
|
||||
)
|
||||
),
|
||||
'new_notifications' => array_map(
|
||||
function ($elem) {
|
||||
$elem['full_url'] = messages_get_url($elem['id_mensaje']);
|
||||
return $elem;
|
||||
},
|
||||
$messages
|
||||
),
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('mark_notification_as_read', 0)) {
|
||||
$message = (int) get_parameter('message', 0);
|
||||
messages_process_read($message);
|
||||
// TODO check read.
|
||||
$url = messages_get_url($message);
|
||||
// Return false if cannot get the URL.
|
||||
if ($url === false) {
|
||||
echo json_encode(['result' => false]);
|
||||
return;
|
||||
}
|
||||
|
||||
// If there is new messages, get the info.
|
||||
echo json_encode(
|
||||
[
|
||||
'result' => true,
|
||||
'url' => $url,
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_parameter('get_notifications_dropdown', 0)) {
|
||||
echo notifications_print_dropdown();
|
||||
return;
|
||||
}
|
||||
|
||||
// Notification table. It is just a wrapper.
|
||||
$table_content = new StdClass();
|
||||
$table_content->data = [];
|
||||
$table_content->width = '100%';
|
||||
$table_content->id = 'notifications-wrapper';
|
||||
$table_content->class = 'databox filters';
|
||||
$table_content->size['name'] = '30%';
|
||||
|
||||
// Print each source configuration.
|
||||
$table_content->data = array_map(
|
||||
function ($source) {
|
||||
return notifications_print_global_source_configuration($source);
|
||||
},
|
||||
notifications_get_all_sources()
|
||||
);
|
||||
|
||||
html_print_table($table_content);
|
||||
|
||||
?>
|
||||
<script>
|
||||
// Get index of two ways element dialog.
|
||||
function notifications_two_ways_element_get_dialog (id, source_id) {
|
||||
return 'global_config_notifications_dialog_add-' + id + '-' + source_id;
|
||||
}
|
||||
|
||||
// Get index of two ways element form.
|
||||
function notifications_two_ways_element_get_sufix (id, source_id) {
|
||||
return 'multi-' + id + '-' + source_id;
|
||||
}
|
||||
|
||||
// Open a dialog with selector of source elements.
|
||||
function add_source_dialog(users, source_id) {
|
||||
// Display the dialog
|
||||
var dialog_id = notifications_two_ways_element_get_dialog(users, source_id);
|
||||
// Clean id element.
|
||||
var previous_dialog = document.getElementById(dialog_id);
|
||||
if (previous_dialog !== null) previous_dialog.remove();
|
||||
// Create or recreate the content.
|
||||
var not_dialog = document.createElement('div');
|
||||
not_dialog.setAttribute(
|
||||
'class',
|
||||
'global_config_notifications_dialog_add_wrapper'
|
||||
);
|
||||
not_dialog.setAttribute('id', dialog_id);
|
||||
document.body.appendChild(not_dialog);
|
||||
$("#" + dialog_id).dialog({
|
||||
resizable: false,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
dialogClass: "global_config_notifications_dialog_add_full",
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
closeOnEscape: true,
|
||||
modal: true
|
||||
});
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/setup/setup_notifications",
|
||||
"get_selection_two_ways_form" : 1,
|
||||
"users" : users,
|
||||
"source" : source_id
|
||||
},
|
||||
function (data, status) {
|
||||
not_dialog.innerHTML = data
|
||||
},
|
||||
"html"
|
||||
);
|
||||
}
|
||||
|
||||
// Move from selected and not selected source elements.
|
||||
function notifications_modify_two_ways_element (id, source_id, operation) {
|
||||
var index_sufix = notifications_two_ways_element_get_sufix (id, source_id);
|
||||
var start_id = operation === 'add' ? 'all-' : 'selected-';
|
||||
var end_id = operation !== 'add' ? 'all-' : 'selected-';
|
||||
var select = document.getElementById(
|
||||
start_id + index_sufix
|
||||
);
|
||||
var select_end = document.getElementById(
|
||||
end_id + index_sufix
|
||||
);
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
if(select.options[i].selected){
|
||||
select_end.appendChild(select.options[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add elements to database and close dialog
|
||||
function notifications_add_source_element_to_database(id, source_id) {
|
||||
var index = 'selected-' +
|
||||
notifications_two_ways_element_get_sufix (id, source_id);
|
||||
var select = document.getElementById(index);
|
||||
var selected = [];
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
selected.push(select.options[i].value);
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/setup/setup_notifications",
|
||||
"add_source_to_database" : 1,
|
||||
"users" : id,
|
||||
"source" : source_id,
|
||||
"elements": selected
|
||||
},
|
||||
function (data, status) {
|
||||
if (data.result) {
|
||||
// Append to other element
|
||||
var out_select = document.getElementById(
|
||||
notifications_two_ways_element_get_sufix(id, source_id)
|
||||
);
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
out_select.appendChild(select.options[i]);
|
||||
}
|
||||
// Close the dialog
|
||||
$("#" + notifications_two_ways_element_get_dialog(
|
||||
id,
|
||||
source_id
|
||||
))
|
||||
.dialog("close");
|
||||
} else {
|
||||
console.log("Cannot update element.");
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
// Add elements to database and remove it form main select
|
||||
function remove_source_elements(id, source_id) {
|
||||
var index = notifications_two_ways_element_get_sufix(id, source_id);
|
||||
var select = document.getElementById(index);
|
||||
var selected = [];
|
||||
var selected_index = [];
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
if(select.options[i].selected){
|
||||
selected.push(select.options[i].value);
|
||||
selected_index.push(i);
|
||||
}
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/setup/setup_notifications",
|
||||
"remove_source_on_database" : 1,
|
||||
"users" : id,
|
||||
"source" : source_id,
|
||||
"elements": selected
|
||||
},
|
||||
function (data, status) {
|
||||
if (data.result) {
|
||||
// Append to other element
|
||||
for (var i = 0; i < selected_index.length; i++) {
|
||||
select.remove(selected_index[i]);
|
||||
}
|
||||
} else {
|
||||
console.log("Cannot delete elements.");
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
|
||||
function notifications_handle_change_element(event) {
|
||||
event.preventDefault();
|
||||
var match = /nt-([0-9]+)-(.*)/.exec(event.target.id);
|
||||
if (!match) {
|
||||
console.error(
|
||||
"Cannot handle change element. Id not valid: ", event.target.id
|
||||
);
|
||||
return;
|
||||
}
|
||||
var action = {source: match[1], bit: match[2]};
|
||||
var element = document.getElementById(event.target.id);
|
||||
if (element === null) {
|
||||
console.error(
|
||||
"Cannot get element. Id: ", event.target.id
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
var value;
|
||||
switch (action.bit) {
|
||||
case 'enabled':
|
||||
case 'also_mail':
|
||||
case 'user_editable':
|
||||
case 'all_users':
|
||||
value = element.checked ? 1 : 0;
|
||||
break;
|
||||
case 'max_postpone_time':
|
||||
value = element.value;
|
||||
break;
|
||||
default:
|
||||
console.error("Unregonized action", action.bit, '.');
|
||||
return;
|
||||
|
||||
}
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/setup/setup_notifications",
|
||||
"update_config" : 1,
|
||||
"source" : match[1],
|
||||
"element" : match[2],
|
||||
"value": value
|
||||
},
|
||||
function (data, status) {
|
||||
if (!data.result) {
|
||||
console.error("Error changing configuration in database.");
|
||||
} else {
|
||||
switch (action.bit) {
|
||||
case 'enabled':
|
||||
case 'also_mail':
|
||||
case 'user_editable':
|
||||
case 'all_users':
|
||||
element.checked = !element.checked;
|
||||
break;
|
||||
case 'max_postpone_time':
|
||||
value = element.value;
|
||||
break;
|
||||
default:
|
||||
console.error(
|
||||
"Unregonized action (insert on db)", action.bit, '.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
.done(function(m){})
|
||||
.fail(function(xhr, textStatus, errorThrown){
|
||||
console.error(
|
||||
"Cannot change configuration in database. Server error.",
|
||||
xhr.responseText
|
||||
);
|
||||
});
|
||||
}
|
||||
(function(){
|
||||
// Add listener to all componentes marked
|
||||
var all_clickables = document.getElementsByClassName('elem-clickable');
|
||||
for (var i = 0; i < all_clickables.length; i++) {
|
||||
all_clickables[i].addEventListener(
|
||||
'click', notifications_handle_change_element, false
|
||||
);
|
||||
}
|
||||
var all_changes = document.getElementsByClassName('elem-changeable');
|
||||
for (var i = 0; i < all_changes.length; i++) {
|
||||
all_changes[i].addEventListener(
|
||||
'change', notifications_handle_change_element, false
|
||||
);
|
||||
}
|
||||
})();
|
||||
</script>
|
File diff suppressed because it is too large
Load Diff
@ -751,7 +751,7 @@ if ($create_alert || $update_alert) {
|
||||
|
||||
// echo '<tr><td class="datos"><b>' . __('Alert filters') . ui_print_help_icon("snmp_alert_filters", true) . '</b></td></tr>';
|
||||
// OID
|
||||
echo '<tr id="tr-oid">'.'<td class="datos2">'.__('Enterprise String').'</td>'.'<td class="datos2">';
|
||||
echo '<tr id="tr-oid">'.'<td class="datos2">'.__('Enterprise String').ui_print_help_tip(__('Matches substrings. End the string with $ for exact matches.'), true).'</td>'.'<td class="datos2">';
|
||||
html_print_input_text('oid', $oid, '', 50, 255);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user