Merge remote-tracking branch 'origin/develop' into ent-4841-8948-Errores-migrate_pandora-6-a-7
This commit is contained in:
commit
070fe32d1e
extras/bin
pandora_agents
pc
AIX
FreeBSD
HP-UX
Linux
NT4
SunOS
Win32
shellscript
aix
bsd-ipso
hp-ux
linux
mac_osx
openWRT
solaris
unix
AIX
DEBIAN
Darwin
FreeBSD
HP-UX
Linux
NT4
NetBSD
SunOS
pandora_agentpandora_agent.redhat.specpandora_agent.specpandora_agent_installerwin32
pandora_console
DEBIAN
composer.jsonextensions
extras
general
alert_enterprise.php
firts_task
header.phphelp_feedback.phplogin_help_dialog.phplogin_page.phpmysqlerr.phpregister.phpsubselect_data_module.phpgodmode
agentes
agent_manager.phpconfigurar_agente.phpmodificar_agente.phpmodule_manager_editor.phpmodule_manager_editor_common.phpmodule_manager_editor_network.phpplanned_downtime.editor.phpplanned_downtime.list.php
alerts
menu.phpmodules
manage_network_components.phpmanage_network_components_form.phpmanage_network_components_form_common.phpmanage_network_components_form_network.php
reporting
setup
users
wizards
images
arrow-icon.pngfeedback-header.pnginput_tick_badge.pngmod_remote_cmd.pngmod_remote_cmd_inc.pngmod_remote_cmd_proc.pngmod_remote_cmd_string.png
include
ajax
class
ConsoleSupervisor.phpCredentialStore.class.phpDiagnostics.class.phpHelpFeedBack.class.phpNetworkMap.class.phpWelcomeWindow.class.php
config_process.phpconstants.phpfunctions.phpfunctions_api.phpfunctions_config.phpfunctions_events.phpfunctions_html.phpfunctions_reporting.phpfunctions_reporting_html.phpfunctions_reports.phpfunctions_ui.phpfunctions_users.php
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Version 7.0NG.740, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, FreeBSD Version
|
||||
# Version 7.0NG.740, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, HP-UX Version
|
||||
# Version 7.0NG.740, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, Solaris Version
|
||||
# Version 7.0NG.740, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Version 7.0NG.740, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.739, HPUX Version
|
||||
# Version 7.0NG.740, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739
|
||||
# Version 7.0NG.740
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.739, Solaris version
|
||||
# Version 7.0NG.740, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, AIX version
|
||||
# Version 7.0NG.740, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.739-191028
|
||||
Version: 7.0NG.740-191118
|
||||
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.739-191028"
|
||||
pandora_version="7.0NG.740-191118"
|
||||
|
||||
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.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, FreeBSD Version
|
||||
# Version 7.0NG.740, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, HP-UX Version
|
||||
# Version 7.0NG.740, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, GNU/Linux
|
||||
# Version 7.0NG.740, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, NetBSD Version
|
||||
# Version 7.0NG.740, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.739, Solaris Version
|
||||
# Version 7.0NG.740, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -41,8 +41,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.739';
|
||||
use constant AGENT_BUILD => '191028';
|
||||
use constant AGENT_VERSION => '7.0NG.740';
|
||||
use constant AGENT_BUILD => '191118';
|
||||
|
||||
# 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.739
|
||||
%define release 191028
|
||||
%define version 7.0NG.740
|
||||
%define release 191118
|
||||
|
||||
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.739
|
||||
%define release 191028
|
||||
%define version 7.0NG.740
|
||||
%define release 191118
|
||||
|
||||
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.739"
|
||||
PI_BUILD="191028"
|
||||
PI_VERSION="7.0NG.740"
|
||||
PI_BUILD="191118"
|
||||
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.739
|
||||
# Version 7.0NG.740
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.739}
|
||||
{Pandora FMS Windows Agent v7.0NG.740}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{191028}
|
||||
{191118}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.739(Build 191028)")
|
||||
#define PANDORA_VERSION ("7.0NG.740(Build 191118)")
|
||||
|
||||
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.739(Build 191028))"
|
||||
VALUE "ProductVersion", "(7.0NG.740(Build 191118))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.739-191028
|
||||
Version: 7.0NG.740-191118
|
||||
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.739-191028"
|
||||
pandora_version="7.0NG.740-191118"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -11,4 +11,11 @@ echo Restart the apache.
|
|||
/etc/init.d/apache2 restart
|
||||
fi
|
||||
|
||||
# Install pandora_websocket_engine service.
|
||||
cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/
|
||||
chmod +x /etc/init.d/pandora_websocket_engine
|
||||
|
||||
echo "You can now start the Pandora FMS Websocket service by executing"
|
||||
echo " /etc/init.d/pandora_websocket_engine start"
|
||||
|
||||
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "Pandora FMS",
|
||||
"name": "pandorafms/console",
|
||||
"description": "Pandora Flexible Monitoring System ",
|
||||
"authors": [
|
||||
{
|
||||
|
@ -14,7 +14,9 @@
|
|||
"autoload": {
|
||||
"psr-4": {
|
||||
"Models\\": "include/rest-api/models",
|
||||
"Enterprise\\Models\\": "enterprise/include/rest-api/models"
|
||||
"Enterprise\\Models\\": "enterprise/include/rest-api/models",
|
||||
"PandoraFMS\\": "include/lib",
|
||||
"PandoraFMS\\Enterprise\\": "enterprise/include/lib"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
|
|
@ -0,0 +1,529 @@
|
|||
<?php
|
||||
/**
|
||||
* Quick Shell extension.
|
||||
*
|
||||
* @category Extension
|
||||
* @package Pandora FMS
|
||||
* @subpackage QuickShell
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
||||
|
||||
|
||||
/**
|
||||
* Show Quick Shell interface.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function quickShell()
|
||||
{
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM') === false) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Profile Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$agent_id = get_parameter('id_agente', 0);
|
||||
$username = get_parameter('username', null);
|
||||
$method = get_parameter('method', null);
|
||||
$method_port = get_parameter('port', null);
|
||||
|
||||
// Retrieve main IP Address.
|
||||
$address = agents_get_address($agent_id);
|
||||
|
||||
ui_require_css_file('wizard');
|
||||
ui_require_css_file('discovery');
|
||||
|
||||
// Settings.
|
||||
// WebSocket host, where to connect.
|
||||
if (isset($config['ws_host']) === false) {
|
||||
config_update_value('ws_host', $_SERVER['SERVER_ADDR']);
|
||||
}
|
||||
|
||||
if (isset($config['ws_port']) === false) {
|
||||
config_update_value('ws_port', 8080);
|
||||
}
|
||||
|
||||
if (empty($config['ws_proxy_url']) === true) {
|
||||
$ws_url = 'http://'.$config['ws_host'].':'.$config['ws_port'];
|
||||
} else {
|
||||
preg_match('/\/\/(.*)/', $config['ws_proxy_url'], $matches);
|
||||
if (isset($_SERVER['HTTPS']) === true) {
|
||||
$ws_url = 'https://'.$matches[1];
|
||||
} else {
|
||||
$ws_url = 'http://'.$matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Gotty settings. Internal communication (WS).
|
||||
if (isset($config['gotty_host']) === false) {
|
||||
config_update_value('gotty_host', '127.0.0.1');
|
||||
}
|
||||
|
||||
if (isset($config['gotty_telnet_port']) === false) {
|
||||
config_update_value('gotty_telnet_port', 8082);
|
||||
}
|
||||
|
||||
if (isset($config['gotty_ssh_port']) === false) {
|
||||
config_update_value('gotty_ssh_port', 8081);
|
||||
}
|
||||
|
||||
// Username. Retrieve from form.
|
||||
if (empty($username) === true) {
|
||||
// No username provided, ask for it.
|
||||
$wiz = new Wizard();
|
||||
|
||||
$test = file_get_contents($ws_url);
|
||||
if ($test === false) {
|
||||
ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
|
||||
$wiz->printForm(
|
||||
[
|
||||
'form' => [
|
||||
'method' => 'POST',
|
||||
'action' => '#',
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'class' => 'w100p',
|
||||
'arguments' => [
|
||||
'name' => 'submit',
|
||||
'label' => __('Retry'),
|
||||
'type' => 'submit',
|
||||
'attributes' => 'class="sub next"',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$wiz->printForm(
|
||||
[
|
||||
'form' => [
|
||||
'action' => '#',
|
||||
'class' => 'wizard',
|
||||
'method' => 'post',
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Username'),
|
||||
'arguments' => [
|
||||
'type' => 'text',
|
||||
'name' => 'username',
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Port'),
|
||||
'arguments' => [
|
||||
'type' => 'text',
|
||||
'id' => 'port',
|
||||
'name' => 'port',
|
||||
'value' => 22,
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Method'),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'name' => 'method',
|
||||
'fields' => [
|
||||
'ssh' => __('SSH'),
|
||||
'telnet' => __('Telnet'),
|
||||
],
|
||||
'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);",
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'type' => 'submit',
|
||||
'label' => __('Connect'),
|
||||
'attributes' => 'class="sub next"',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize Gotty Client.
|
||||
$host = $config['gotty_host'];
|
||||
if ($method == 'ssh') {
|
||||
// SSH.
|
||||
$port = $config['gotty_ssh_port'];
|
||||
$command_arguments = "var args = '?arg=".$username.'@'.$address;
|
||||
$command_arguments .= '&arg=-p '.$method_port."';";
|
||||
} else if ($method == 'telnet') {
|
||||
// Telnet.
|
||||
$port = $config['gotty_telnet_port'];
|
||||
$command_arguments = "var args = '?arg=-l ".$username;
|
||||
$command_arguments .= '&arg='.$address;
|
||||
$command_arguments .= '&arg='.$method_port."';";
|
||||
} else {
|
||||
ui_print_error_message(__('Please use SSH or Telnet.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// If rediretion is enabled, we will try to connect to http:// or https:// endpoint.
|
||||
$test = get_headers($ws_url);
|
||||
if ($test === false) {
|
||||
if (empty($wiz) === true) {
|
||||
$wiz = new Wizard();
|
||||
}
|
||||
|
||||
ui_print_error_message(__('WebService engine has not been started, please check documentation.'));
|
||||
echo $wiz->printGoBackButton('#');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check credentials.
|
||||
$auth_str = '';
|
||||
$gotty_url = $host.':'.$port;
|
||||
if (empty($config['gotty_user']) === false
|
||||
&& empty($config['gotty_pass']) === false
|
||||
) {
|
||||
$auth_str = $config['gotty_user'].':'.$config['gotty_pass'];
|
||||
$gotty_url = $auth_str.'@'.$host.':'.$port;
|
||||
}
|
||||
|
||||
$r = file_get_contents('http://'.$gotty_url.'/js/hterm.js');
|
||||
if (empty($r) === true) {
|
||||
if (empty($wiz) === true) {
|
||||
$wiz = new Wizard();
|
||||
}
|
||||
|
||||
ui_print_error_message(__('WebService engine is not working properly, please check documentation.'));
|
||||
echo $wiz->printGoBackButton('#');
|
||||
return;
|
||||
}
|
||||
|
||||
// Override gotty client settings.
|
||||
if (empty($auth_str) === true) {
|
||||
$r .= "var gotty_auth_token = '';";
|
||||
} else {
|
||||
$r .= "var gotty_auth_token = '";
|
||||
$r .= $auth_str."';";
|
||||
}
|
||||
|
||||
// Set websocket target and method.
|
||||
$gotty = file_get_contents('http://'.$gotty_url.'/js/gotty.js');
|
||||
$url = "var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';";
|
||||
if (empty($config['ws_proxy_url']) === true) {
|
||||
$new = "var url = (httpsEnabled ? 'wss://' : 'ws://')";
|
||||
$new .= " + window.location.host + ':";
|
||||
$new .= $config['ws_port'].'/'.$method."';";
|
||||
} else {
|
||||
$new = "var url = '";
|
||||
$new .= $config['ws_proxy_url'].'/'.$method."';";
|
||||
}
|
||||
|
||||
// Update url.
|
||||
$gotty = str_replace($url, $new, $gotty);
|
||||
|
||||
// Update websocket arguments.
|
||||
$args = 'var args = window.location.search;';
|
||||
$new = $command_arguments;
|
||||
|
||||
// Update arguments.
|
||||
$gotty = str_replace($args, $new, $gotty);
|
||||
|
||||
?>
|
||||
<style>#terminal {
|
||||
height: 650px;
|
||||
width: 100%;
|
||||
margin: 0px;
|
||||
padding: 0;
|
||||
}
|
||||
#terminal > iframe {
|
||||
position: relative!important;
|
||||
}
|
||||
</style>
|
||||
<div id="terminal"></div>
|
||||
<script type="text/javascript">
|
||||
<?php echo $r; ?>
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
<?php echo $gotty; ?>
|
||||
</script>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provide an interface where configure all settings.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function quickShellSettings()
|
||||
{
|
||||
global $config;
|
||||
|
||||
ui_require_css_file('wizard');
|
||||
ui_require_css_file('discovery');
|
||||
|
||||
// Gotty settings. Internal communication (WS).
|
||||
if (isset($config['gotty_host']) === false) {
|
||||
config_update_value('gotty_host', '127.0.0.1');
|
||||
}
|
||||
|
||||
if (isset($config['gotty_telnet_port']) === false) {
|
||||
config_update_value('gotty_telnet_port', 8082);
|
||||
}
|
||||
|
||||
if (isset($config['gotty_ssh_port']) === false) {
|
||||
config_update_value('gotty_ssh_port', 8081);
|
||||
}
|
||||
|
||||
// Parser.
|
||||
if (get_parameter('qs_update', false) !== false) {
|
||||
// Gotty settings. Internal communication (WS).
|
||||
$gotty = get_parameter(
|
||||
'gotty',
|
||||
''
|
||||
);
|
||||
$gotty_host = get_parameter(
|
||||
'gotty_host',
|
||||
$config['gotty_host']
|
||||
);
|
||||
$gotty_ssh_port = get_parameter(
|
||||
'gotty_ssh_port',
|
||||
$config['gotty_ssh_port']
|
||||
);
|
||||
$gotty_telnet_port = get_parameter(
|
||||
'gotty_telnet_port',
|
||||
$config['gotty_telnet_port']
|
||||
);
|
||||
|
||||
$gotty_user = get_parameter(
|
||||
'gotty_user',
|
||||
''
|
||||
);
|
||||
|
||||
$gotty_pass = get_parameter(
|
||||
'gotty_pass',
|
||||
''
|
||||
);
|
||||
|
||||
$gotty_pass = io_input_password($gotty_pass);
|
||||
|
||||
$changes = 0;
|
||||
$critical = 0;
|
||||
if ($config['gotty'] != $gotty) {
|
||||
config_update_value('gotty', $gotty);
|
||||
$changes++;
|
||||
$critical++;
|
||||
}
|
||||
|
||||
if ($config['gotty_host'] != $gotty_host) {
|
||||
config_update_value('gotty_host', $gotty_host);
|
||||
$changes++;
|
||||
}
|
||||
|
||||
if ($config['gotty_telnet_port'] != $gotty_telnet_port) {
|
||||
config_update_value('gotty_telnet_port', $gotty_telnet_port);
|
||||
$changes++;
|
||||
}
|
||||
|
||||
if ($config['gotty_ssh_port'] != $gotty_ssh_port) {
|
||||
config_update_value('gotty_ssh_port', $gotty_ssh_port);
|
||||
$changes++;
|
||||
}
|
||||
|
||||
if ($config['gotty_user'] != $gotty_user) {
|
||||
config_update_value('gotty_user', $gotty_user);
|
||||
$changes++;
|
||||
$critical++;
|
||||
}
|
||||
|
||||
if ($config['gotty_pass'] != $gotty_pass) {
|
||||
$gotty_pass = io_input_password($gotty_pass);
|
||||
config_update_value('gotty_pass', $gotty_pass);
|
||||
$changes++;
|
||||
$critical++;
|
||||
}
|
||||
}
|
||||
|
||||
// Interface.
|
||||
ui_print_page_header(__('QuickShell settings'));
|
||||
|
||||
if ($changes > 0) {
|
||||
$msg = __('%d Updated', $changes);
|
||||
if ($critical > 0) {
|
||||
$msg = __(
|
||||
'%d Updated, please restart WebSocket engine service',
|
||||
$changes
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_success_message($msg);
|
||||
}
|
||||
|
||||
// Form.
|
||||
$wiz = new Wizard();
|
||||
|
||||
$wiz->printForm(
|
||||
[
|
||||
'form' => [
|
||||
'action' => '#',
|
||||
'class' => 'wizard',
|
||||
'method' => 'post',
|
||||
],
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Gotty path').ui_print_help_tip(
|
||||
__('Leave blank if using an external Gotty service'),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'type' => 'text',
|
||||
'name' => 'gotty',
|
||||
'value' => $config['gotty'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Gotty host'),
|
||||
'arguments' => [
|
||||
'type' => 'text',
|
||||
'name' => 'gotty_host',
|
||||
'value' => $config['gotty_host'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Gotty ssh port'),
|
||||
'arguments' => [
|
||||
'type' => 'text',
|
||||
'name' => 'gotty_ssh_port',
|
||||
'value' => $config['gotty_ssh_port'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Gotty telnet port'),
|
||||
'arguments' => [
|
||||
'type' => 'text',
|
||||
'name' => 'gotty_telnet_port',
|
||||
'value' => $config['gotty_telnet_port'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Gotty user').ui_print_help_tip(
|
||||
__('Optional, set a user to access gotty service'),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'type' => 'text',
|
||||
'name' => 'gotty_user',
|
||||
'value' => $config['gotty_user'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Gotty password').ui_print_help_tip(
|
||||
__('Optional, set a password to access gotty service'),
|
||||
true
|
||||
),
|
||||
'arguments' => [
|
||||
'type' => 'password',
|
||||
'name' => 'gotty_pass',
|
||||
'value' => io_output_password($config['gotty_pass']),
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'type' => 'hidden',
|
||||
'name' => 'qs_update',
|
||||
'value' => 1,
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'type' => 'submit',
|
||||
'label' => __('Update'),
|
||||
'attributes' => 'class="sub next"',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// This extension is usefull only if the agent has associated IP.
|
||||
$agent_id = get_parameter('id_agente');
|
||||
if (empty($agent_id) === false
|
||||
&& get_parameter('sec2', '') == 'operation/agentes/ver_agente'
|
||||
) {
|
||||
$address = agents_get_address($agent_id);
|
||||
if (empty($address) === false) {
|
||||
// Extension registration.
|
||||
extensions_add_opemode_tab_agent(
|
||||
// TabId.
|
||||
'quick_shell',
|
||||
// TabName.
|
||||
__('QuickShell'),
|
||||
// TabIcon.
|
||||
'images/ehorus/terminal.png',
|
||||
// TabFunction.
|
||||
'quickShell',
|
||||
// Version.
|
||||
'N/A',
|
||||
// Acl.
|
||||
'PM'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
extensions_add_godmode_menu_option(
|
||||
// Name.
|
||||
__('QuickShell settings'),
|
||||
// Acl.
|
||||
'PM',
|
||||
// FatherId.
|
||||
'gextensions',
|
||||
// Icon.
|
||||
'images/ehorus/terminal.png',
|
||||
// Version.
|
||||
'N/A',
|
||||
// SubfatherId.
|
||||
null
|
||||
);
|
||||
|
||||
extensions_add_godmode_function('quickShellSettings');
|
|
@ -238,19 +238,6 @@ function output_xml_report($id)
|
|||
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
|
||||
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'TTRT':
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
break;*/
|
||||
}
|
||||
|
||||
echo "</item>\n";
|
||||
|
|
|
@ -375,19 +375,6 @@ function process_upload_xml_report($xml, $group_filter=0)
|
|||
$values['line_separator'] = io_safe_input($item['line_separator']);
|
||||
$values['column_separator'] = io_safe_input($item['column_separator']);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'TTRT':
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
break;*/
|
||||
}
|
||||
|
||||
if (empty($agents_item)) {
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
require_once __DIR__.'/../include/config.php';
|
||||
require_once __DIR__.'/../include/auth/mysql.php';
|
||||
require_once __DIR__.'/../include/functions.php';
|
||||
require_once __DIR__.'/../include/functions_db.php';
|
||||
/*
|
||||
* Review if sample agent is active and deploys configuration for
|
||||
* visual consoles if necessary
|
||||
*/
|
||||
global $config;
|
||||
|
||||
// Deployment of sample agent for visual consoles.
|
||||
if ($config['sample_agent'] == 1 && !isset($config['sample_agent_deployed'])) {
|
||||
$id_agente = db_get_sql('SELECT id_agente FROM tagente WHERE nombre = "Sample_Agent";');
|
||||
$modules = db_get_all_rows_filter('tagente_modulo', ['id_agente' => $id_agente], 'id_agente_modulo');
|
||||
$count_modules = count($modules);
|
||||
|
||||
// Update of layout 1 (Rack sample).
|
||||
$images_rack_server = [
|
||||
'rack_server_rack',
|
||||
'rack_server',
|
||||
'rack_switch',
|
||||
'rack_firewall',
|
||||
'rack_double_server',
|
||||
'rack_frame',
|
||||
'rack_pdu',
|
||||
];
|
||||
$query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE ';
|
||||
for ($i = 0; $i < $count_modules; $i++) {
|
||||
$query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' ';
|
||||
}
|
||||
|
||||
$query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");';
|
||||
|
||||
db_process_sql($query);
|
||||
// Update of layout 2 (Dashboard).
|
||||
$query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE ';
|
||||
$query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' ';
|
||||
$query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' ';
|
||||
$query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);';
|
||||
|
||||
db_process_sql($query);
|
||||
|
||||
// This setting will avoid regenerate all the times the visual consoles.
|
||||
config_update_value('sample_agent_deployed', 1);
|
||||
}
|
||||
|
||||
extensions_add_main_function('sample_agent_deployment');
|
|
@ -0,0 +1,13 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tlayout_template_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0;
|
||||
|
||||
INSERT INTO `ttipo_modulo` VALUES
|
||||
(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'),
|
||||
(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'),
|
||||
(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'),
|
||||
(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png');
|
||||
|
||||
INSERT INTO `tconfig`(`token`, `value`) VALUES ('welcome_state', -1);
|
||||
|
||||
COMMIT;
|
|
@ -1,796 +1,2 @@
|
|||
<script type="text/javascript">
|
||||
|
||||
function effectFadeOut() {
|
||||
$('.content').fadeOut(800).fadeIn(800)
|
||||
}
|
||||
$(document).ready(function(){
|
||||
setInterval(effectFadeOut, 1600);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
// ============================================
|
||||
// Copyright (c) 2010 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to change License settings');
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
$update_settings = (bool) get_parameter_post('update_settings');
|
||||
|
||||
if ($update_settings) {
|
||||
foreach ($_POST['keys'] as $key => $value) {
|
||||
db_process_sql_update(
|
||||
'tupdate_settings',
|
||||
[db_escape_key_identifier('value') => $value],
|
||||
[db_escape_key_identifier('key') => $key]
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_success_message(__('License updated'));
|
||||
}
|
||||
|
||||
ui_require_javascript_file_enterprise('load_enterprise');
|
||||
enterprise_include_once('include/functions_license.php');
|
||||
$license = enterprise_hook('license_get_info');
|
||||
|
||||
$rows = db_get_all_rows_in_table('tupdate_settings');
|
||||
|
||||
$settings = new StdClass;
|
||||
foreach ($rows as $row) {
|
||||
$settings->{$row['key']} = $row['value'];
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
if (enterprise_installed()) {
|
||||
print_js_var_enteprise();
|
||||
}
|
||||
|
||||
echo '</script>';
|
||||
|
||||
|
||||
function render_info($table)
|
||||
{
|
||||
global $console_mode;
|
||||
|
||||
$info = db_get_sql("SELECT COUNT(*) FROM $table");
|
||||
render_row($info, "DB Table $table");
|
||||
}
|
||||
|
||||
|
||||
function render_info_data($query, $label)
|
||||
{
|
||||
global $console_mode;
|
||||
|
||||
$info = db_get_sql($query);
|
||||
render_row($info, $label);
|
||||
}
|
||||
|
||||
|
||||
function render_row($data, $label)
|
||||
{
|
||||
global $console_mode;
|
||||
|
||||
if ($console_mode == 1) {
|
||||
echo $label;
|
||||
echo '|';
|
||||
echo $data;
|
||||
echo "\n";
|
||||
} else {
|
||||
echo '<tr>';
|
||||
echo "<td style='padding:2px;border:0px;' width='60%'><div style='padding:5px;background-color:#f2f2f2;border-radius:2px;text-align:left;border:0px;'>".$label;
|
||||
echo '</div></td>';
|
||||
echo "<td style='font-weight:bold;padding:2px;border:0px;' width='40%'><div style='padding:5px;background-color:#f2f2f2;border-radius:2px;text-align:left;border:0px;'>".$data;
|
||||
echo '</div></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_value_sum($arr)
|
||||
{
|
||||
foreach ($arr as $clave) {
|
||||
foreach ($clave as $valor) {
|
||||
if (is_numeric($valor) === true) {
|
||||
$result += $valor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function execution_time()
|
||||
{
|
||||
$times = db_get_all_rows_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = 29 ORDER BY utimestamp DESC LIMIT 2');
|
||||
if ($times[0]['datos'] > ($times[1]['datos'] * 1.2)) {
|
||||
return "<a class= 'content' style= 'color: red;'>Warning Status</a><a>   The execution time could be degrading. For a more extensive information of this data consult the Execution Time graph</a>";
|
||||
} else {
|
||||
return "<a style ='color: green;'>Normal Status</a><a>   The execution time is correct. For more information about this data, check the Execution Time graph</a>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_logs_size($file)
|
||||
{
|
||||
$file_name = '/var'.$file.'';
|
||||
$size_server_log = filesize($file_name);
|
||||
return $size_server_log;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_status_logs($path)
|
||||
{
|
||||
$status_server_log = '';
|
||||
$size_server_log = number_format(get_logs_size($path));
|
||||
$size_server_log = (0 + str_replace(',', '', $size_server_log));
|
||||
if ($size_server_log <= 10485760) {
|
||||
$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>";
|
||||
}
|
||||
|
||||
return $status_server_log;
|
||||
}
|
||||
|
||||
|
||||
function percentage_modules_per_agent()
|
||||
{
|
||||
$status_average_modules = '';
|
||||
$total_agents = db_get_value_sql('SELECT count(*) FROM tagente');
|
||||
$total_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo');
|
||||
$average_modules_per_agent = ($total_modules / $total_agents);
|
||||
if ($average_modules_per_agent <= 40) {
|
||||
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The average of modules per agent is less than 40</a>";
|
||||
} else {
|
||||
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>  The average of modules per agent is more than 40. You can have performance problems</a>";
|
||||
}
|
||||
|
||||
return $status_average_modules;
|
||||
}
|
||||
|
||||
|
||||
function license_capacity()
|
||||
{
|
||||
$license = enterprise_hook('license_get_info');
|
||||
$license_limit = $license['limit'];
|
||||
$status_license_capacity = '';
|
||||
$current_count = db_get_value_sql('SELECT count(*) FROM tagente');
|
||||
if ($current_count > ($license_limit * 90 / 100)) {
|
||||
$status_license_capacity = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   License capacity exceeds 90 percent</a>";
|
||||
} else {
|
||||
$status_license_capacity = "<a style= 'color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   License capacity is less than 90 percent</a>";
|
||||
}
|
||||
|
||||
return $status_license_capacity;
|
||||
}
|
||||
|
||||
|
||||
function status_license_params($license_param)
|
||||
{
|
||||
$status_license_par = '';
|
||||
if ($license_param <= 0) {
|
||||
$status_license_par = 'OFF';
|
||||
} else {
|
||||
$status_license_par = 'ON';
|
||||
}
|
||||
|
||||
return $status_license_par;
|
||||
}
|
||||
|
||||
|
||||
function interval_average_of_network_modules()
|
||||
{
|
||||
$total_network_modules = db_get_value_sql('SELECT count(*) FROM tagente_modulo WHERE id_tipo_modulo BETWEEN 6 AND 18');
|
||||
$total_module_interval_time = db_get_value_sql('SELECT SUM(module_interval) FROM tagente_modulo WHERE id_tipo_modulo BETWEEN 6 AND 18');
|
||||
$average_time = ((int) $total_module_interval_time / $total_network_modules);
|
||||
|
||||
if ($average_time < 180) {
|
||||
$status_average_modules = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The system is overloaded (average time $average_time) and a very fine configuration is required</a>";
|
||||
} else {
|
||||
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The system is not overloaded (average time $average_time) </a>";
|
||||
}
|
||||
|
||||
if ($average_time == 0) {
|
||||
$status_average_modules = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The system has no load</a>";
|
||||
}
|
||||
|
||||
return $status_average_modules;
|
||||
}
|
||||
|
||||
|
||||
$attachment_total_files = count(glob($config['homedir'].'/attachment/{*.*}', GLOB_BRACE));
|
||||
|
||||
|
||||
function files_attachment_folder($total_files)
|
||||
{
|
||||
if ($total_files <= 700) {
|
||||
$status_total_files = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The attached folder contains less than 700 files.</a>";
|
||||
} else {
|
||||
$status_total_files = "<a class= 'content' style= 'color: red;text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   The attached folder contains more than 700 files.</a>";
|
||||
}
|
||||
|
||||
return $status_total_files;
|
||||
}
|
||||
|
||||
|
||||
$tagente_datos_size = db_get_value_sql('SELECT COUNT(*) FROM tagente_datos');
|
||||
|
||||
|
||||
function status_tagente_datos($tagente_datos_size)
|
||||
{
|
||||
if ($tagente_datos_size <= 3000000) {
|
||||
$tagente_datos_size = "<a style ='color: green;text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   The tagente_datos table contains an acceptable amount of data.</a>";
|
||||
} else {
|
||||
$tagente_datos_size = "<a class= 'content' style ='color: red;text-decoration: none;'>Warning Status</a><a>   The tagente_datos table contains too much data. A historical database is recommended.</a>";
|
||||
}
|
||||
|
||||
return $tagente_datos_size;
|
||||
}
|
||||
|
||||
|
||||
function status_values($val_rec, $val)
|
||||
{
|
||||
if ($val_rec <= $val) {
|
||||
return $val."<a style='text-decoration: none;'> (Min. Recommended Value </a>".$val_rec.'<a>)</a>';
|
||||
} else {
|
||||
return $val."<a style='text-decoration: none;'> (Min. Recommended Value </a>".$val_rec."<a>)</a><a class= 'content' style ='color: red;text-decoration: none;'> Warning Status</a>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tables_fragmentation = db_get_sql(
|
||||
"SELECT (data_free/(index_length+data_length))
|
||||
as frag_ratio from information_schema.tables where DATA_FREE > 0 and table_name='tagente_datos' and table_schema='pandora'"
|
||||
);
|
||||
$db_size = db_get_all_rows_sql(
|
||||
'SELECT table_schema,
|
||||
ROUND(SUM(data_length+index_length)/1024/1024,3)
|
||||
FROM information_schema.TABLES
|
||||
GROUP BY table_schema;'
|
||||
);
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
$total_server_threads = shell_exec('ps -T aux | grep pandora_server | grep -v grep | wc -l');
|
||||
$percentage_threads_ram = shell_exec("ps axo pmem,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'");
|
||||
$percentage_threads_cpu = shell_exec("ps axo pcpu,cmd | grep pandora_server | awk '{sum+=$1} END {print sum}'");
|
||||
$innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'");
|
||||
}
|
||||
|
||||
$path_server_logs = '/log/pandora/pandora_server.log';
|
||||
$path_err_logs = '/log/pandora/pandora_server.error';
|
||||
$path_console_logs = '/www/html/pandora_console/pandora_console.log';
|
||||
$innodb_log_file_size_min_rec_value = '64M';
|
||||
$innodb_log_buffer_size_min_rec_value = '16M';
|
||||
$innodb_flush_log_at_trx_commit_min_rec_value = 0;
|
||||
$query_cache_limit_min_rec_value = 2;
|
||||
$max_allowed_packet_min_rec_value = 32;
|
||||
$innodb_buffer_pool_size_min_rec_value = shell_exec("cat /proc/meminfo | grep -i total | head -1 | awk '{print $(NF-1)*0.4/1024}'");
|
||||
$sort_buffer_size_min_rec_value = 32;
|
||||
$join_buffer_size_min_rec_value = 265;
|
||||
$query_cache_type_min_rec_value = 'ON';
|
||||
$query_cache_size_min_rec_value = 24;
|
||||
$innodb_lock_wait_timeout_max_rec_value = 120;
|
||||
$tables_fragmentation_max_rec_value = 10;
|
||||
$thread_cache_size_max_rec_value = 8;
|
||||
$thread_stack_min_rec_value = 256;
|
||||
$max_connections_max_rec_value = 150;
|
||||
$key_buffer_size_min_rec_value = 256;
|
||||
$read_buffer_size_min_rec_value = 32;
|
||||
$read_rnd_buffer_size_min_rec_value = 32;
|
||||
$query_cache_min_res_unit_min_rec_value = 2;
|
||||
$innodb_file_per_table_min_rec_value = 1;
|
||||
|
||||
|
||||
function status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation)
|
||||
{
|
||||
$status_tables_frag = '';
|
||||
if ($tables_fragmentation > $tables_fragmentation_max_rec_value) {
|
||||
$status_tables_frag = "<a class= 'content' style ='color: red; text-decoration: none;'>Warning Status</a><a style ='text-decoration: none;'>   Table fragmentation is higher than recommended. They should be defragmented.</a>";
|
||||
} else {
|
||||
$status_tables_frag = "<a style ='color: green; text-decoration: none;'>Normal Status</a><a style ='text-decoration: none;'>   Table fragmentation is correct.</a>";
|
||||
}
|
||||
|
||||
return $status_tables_frag;
|
||||
}
|
||||
|
||||
|
||||
$console_mode = 1;
|
||||
if (!isset($argc)) {
|
||||
$console_mode = 0;
|
||||
}
|
||||
|
||||
if ($console_mode == 1) {
|
||||
echo "\nPandora FMS PHP diagnostic tool v3.2 (c) Artica ST 2009-2010 \n";
|
||||
|
||||
if ($argc == 1 || in_array($argv[1], ['--help', '-help', '-h', '-?'])) {
|
||||
echo "\nThis command line script contains information about Pandora FMS database.
|
||||
This program can only be executed from the console, and it needs a parameter, the
|
||||
full path to Pandora FMS 'config.php' file.
|
||||
|
||||
Usage:
|
||||
php pandora_diag.php path_to_pandora_console
|
||||
|
||||
Example:
|
||||
php pandora_diag.php /var/www/pandora_console
|
||||
|
||||
";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (preg_match('/[^a-zA-Z0-9_\/\.]|(\/\/)|(\.\.)/', $argv[1])) {
|
||||
echo "Invalid path: $argv[1]. Always use absolute paths.";
|
||||
exit;
|
||||
}
|
||||
|
||||
include $argv[1].'/include/config.php';
|
||||
} else {
|
||||
if (file_exists('../include/config.php')) {
|
||||
include '../include/config.php';
|
||||
}
|
||||
|
||||
// Not from console, this is a web session.
|
||||
if ((!isset($config['id_user'])) || (!check_acl($config['id_user'], 0, 'PM'))) {
|
||||
echo "<h2>You don't have privileges to use diagnostic tool</h2>";
|
||||
echo '<p>Please login with an administrator account before try to use this tool</p>';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
__('Pandora FMS Diagnostic tool'),
|
||||
'',
|
||||
false,
|
||||
'diagnostic_tool_tab',
|
||||
true
|
||||
);
|
||||
|
||||
echo "<table id='diagnostic_info' width='1000px' border='0' style='border:0px;' class='databox data' cellpadding='4' cellspacing='4'>";
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Pandora status info').'</th></tr>';
|
||||
}
|
||||
|
||||
render_row($build_version, 'Pandora FMS Build');
|
||||
render_row($pandora_version, 'Pandora FMS Version');
|
||||
render_info_data("SELECT value FROM tconfig where token ='MR'", 'Minor Release');
|
||||
render_row($config['homedir'], 'Homedir');
|
||||
render_row($config['homeurl'], 'HomeUrl');
|
||||
render_info_data(
|
||||
"SELECT `value`
|
||||
FROM tconfig
|
||||
WHERE `token` = 'enterprise_installed'",
|
||||
'Enterprise installed'
|
||||
);
|
||||
|
||||
$full_key = db_get_sql(
|
||||
"SELECT value
|
||||
FROM tupdate_settings
|
||||
WHERE `key` = 'customer_key'"
|
||||
);
|
||||
|
||||
$compressed_key = substr($full_key, 0, 5).'...'.substr($full_key, -5);
|
||||
|
||||
render_row($compressed_key, 'Update Key');
|
||||
|
||||
render_info_data(
|
||||
"SELECT value
|
||||
FROM tupdate_settings
|
||||
WHERE `key` = 'updating_code_path'",
|
||||
'Updating code path'
|
||||
);
|
||||
|
||||
render_info_data(
|
||||
"SELECT value
|
||||
FROM tupdate_settings
|
||||
WHERE `key` = 'current_update'",
|
||||
'Current Update #'
|
||||
);
|
||||
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('PHP setup').'</th></tr>';
|
||||
|
||||
|
||||
render_row(phpversion(), 'PHP Version');
|
||||
|
||||
render_row(ini_get('max_execution_time').' seconds', 'PHP Max execution time');
|
||||
|
||||
render_row(ini_get('max_input_time').' seconds', 'PHP Max input time');
|
||||
|
||||
render_row(ini_get('memory_limit'), 'PHP Memory limit');
|
||||
|
||||
render_row(ini_get('session.cookie_lifetime'), 'Session cookie lifetime');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Database size stats').'</th></tr>';
|
||||
|
||||
render_info_data('SELECT COUNT(*) FROM tagente', 'Total agents');
|
||||
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 tagent_access', 'Total agent access record');
|
||||
render_info_data('SELECT COUNT(*) FROM tevento', 'Total events');
|
||||
|
||||
if ($config['enterprise_installed']) {
|
||||
render_info_data('SELECT COUNT(*) FROM ttrap', 'Total traps');
|
||||
}
|
||||
|
||||
render_info_data('SELECT COUNT(*) FROM tusuario', 'Total users');
|
||||
render_info_data('SELECT COUNT(*) FROM tsesion', 'Total sessions');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Database sanity').'</th></tr>';
|
||||
|
||||
render_info_data(
|
||||
'SELECT COUNT( DISTINCT tagente.id_agente)
|
||||
FROM tagente_estado, tagente, tagente_modulo
|
||||
WHERE tagente.disabled = 0
|
||||
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.id_agente = tagente.id_agente
|
||||
AND tagente_estado.estado = 3',
|
||||
'Total unknown agents'
|
||||
);
|
||||
|
||||
render_info_data(
|
||||
'SELECT COUNT(tagente_estado.estado)
|
||||
FROM tagente_estado
|
||||
WHERE tagente_estado.estado = 4',
|
||||
'Total not-init modules'
|
||||
);
|
||||
|
||||
|
||||
$last_run_difference = '';
|
||||
|
||||
$diferencia = (time() - date(
|
||||
db_get_sql(
|
||||
"SELECT `value`
|
||||
FROM tconfig
|
||||
WHERE `token` = 'db_maintance'"
|
||||
)
|
||||
));
|
||||
|
||||
$last_run_difference_months = 0;
|
||||
$last_run_difference_weeks = 0;
|
||||
$last_run_difference_days = 0;
|
||||
$last_run_difference_minutos = 0;
|
||||
$last_run_difference_seconds = 0;
|
||||
|
||||
while ($diferencia >= 2419200) {
|
||||
$diferencia -= 2419200;
|
||||
$last_run_difference_months++;
|
||||
}
|
||||
|
||||
while ($diferencia >= 604800) {
|
||||
$diferencia -= 604800;
|
||||
$last_run_difference_weeks++;
|
||||
}
|
||||
|
||||
while ($diferencia >= 86400) {
|
||||
$diferencia -= 86400;
|
||||
$last_run_difference_days++;
|
||||
}
|
||||
|
||||
while ($diferencia >= 3600) {
|
||||
$diferencia -= 3600;
|
||||
$last_run_difference_hours++;
|
||||
}
|
||||
|
||||
while ($diferencia >= 60) {
|
||||
$diferencia -= 60;
|
||||
$last_run_difference_minutes++;
|
||||
}
|
||||
|
||||
$last_run_difference_seconds = $diferencia;
|
||||
|
||||
if ($last_run_difference_months > 0) {
|
||||
$last_run_difference .= $last_run_difference_months.'month/s ';
|
||||
}
|
||||
|
||||
if ($last_run_difference_weeks > 0) {
|
||||
$last_run_difference .= $last_run_difference_weeks.' week/s ';
|
||||
}
|
||||
|
||||
if ($last_run_difference_days > 0) {
|
||||
$last_run_difference .= $last_run_difference_days.' day/s ';
|
||||
}
|
||||
|
||||
if ($last_run_difference_hours > 0) {
|
||||
$last_run_difference .= $last_run_difference_hours.' hour/s ';
|
||||
}
|
||||
|
||||
if ($last_run_difference_minutes > 0) {
|
||||
$last_run_difference .= $last_run_difference_minutes.' minute/s ';
|
||||
}
|
||||
|
||||
$last_run_difference .= $last_run_difference_seconds.' second/s ago';
|
||||
|
||||
render_row(
|
||||
date(
|
||||
'Y/m/d H:i:s',
|
||||
db_get_sql(
|
||||
"SELECT `value`
|
||||
FROM tconfig
|
||||
WHERE `token` = 'db_maintance'"
|
||||
)
|
||||
).' ('.$last_run_difference.')'.' *',
|
||||
'PandoraDB Last run'
|
||||
);
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('Database status info').'</th></tr>';
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
render_info_data(
|
||||
"SELECT `value`
|
||||
FROM tconfig
|
||||
WHERE `token` = 'db_scheme_first_version'",
|
||||
'DB Schema Version (first installed)'
|
||||
);
|
||||
render_info_data(
|
||||
"SELECT `value`
|
||||
FROM tconfig
|
||||
WHERE `token` = 'db_scheme_version'",
|
||||
'DB Schema Version (actual)'
|
||||
);
|
||||
render_info_data(
|
||||
"SELECT `value`
|
||||
FROM tconfig
|
||||
WHERE `token` = 'db_scheme_build'",
|
||||
'DB Schema Build'
|
||||
);
|
||||
|
||||
render_row(get_value_sum($db_size).'M', 'DB Size');
|
||||
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('System info').'</th></tr>';
|
||||
|
||||
$output = 'cat /proc/cpuinfo | grep "model name" | tail -1 | cut -f 2 -d ":"';
|
||||
$output2 = 'cat /proc/cpuinfo | grep "processor" | wc -l';
|
||||
|
||||
render_row(exec($output).' x '.exec($output2), 'CPU');
|
||||
|
||||
$output = 'cat /proc/meminfo | grep "MemTotal"';
|
||||
|
||||
render_row(exec($output), 'RAM');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgresql':
|
||||
render_info_data(
|
||||
"SELECT \"value\"
|
||||
FROM tconfig
|
||||
WHERE \"token\" = 'db_scheme_version'",
|
||||
'DB Schema Version'
|
||||
);
|
||||
render_info_data(
|
||||
"SELECT \"value\"
|
||||
FROM tconfig
|
||||
WHERE \"token\" = 'db_scheme_build'",
|
||||
'DB Schema Build'
|
||||
);
|
||||
render_info_data(
|
||||
"SELECT \"value\"
|
||||
FROM tconfig
|
||||
WHERE \"token\" = 'enterprise_installed'",
|
||||
'Enterprise installed'
|
||||
);
|
||||
render_row(
|
||||
date(
|
||||
'Y/m/d H:i:s',
|
||||
db_get_sql(
|
||||
"SELECT \"value\"
|
||||
FROM tconfig WHERE \"token\" = 'db_maintance'"
|
||||
)
|
||||
),
|
||||
'PandoraDB Last run'
|
||||
);
|
||||
|
||||
render_info_data(
|
||||
"SELECT value
|
||||
FROM tupdate_settings
|
||||
WHERE \"key\" = 'customer_key';",
|
||||
'Update Key'
|
||||
);
|
||||
render_info_data(
|
||||
"SELECT value
|
||||
FROM tupdate_settings
|
||||
WHERE \"key\" = 'updating_code_path'",
|
||||
'Updating code path'
|
||||
);
|
||||
render_info_data(
|
||||
"SELECT value
|
||||
FROM tupdate_settings
|
||||
WHERE \"key\" = 'current_update'",
|
||||
'Current Update #'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
render_info_data(
|
||||
"SELECT value
|
||||
FROM tconfig
|
||||
WHERE token = 'db_scheme_version'",
|
||||
'DB Schema Version'
|
||||
);
|
||||
render_info_data(
|
||||
"SELECT value
|
||||
FROM tconfig
|
||||
WHERE token = 'db_scheme_build'",
|
||||
'DB Schema Build'
|
||||
);
|
||||
render_info_data(
|
||||
"SELECT value
|
||||
FROM tconfig
|
||||
WHERE token = 'enterprise_installed'",
|
||||
'Enterprise installed'
|
||||
);
|
||||
render_row(
|
||||
db_get_sql(
|
||||
"SELECT value
|
||||
FROM tconfig
|
||||
WHERE token = 'db_maintance'"
|
||||
),
|
||||
'PandoraDB Last run'
|
||||
);
|
||||
|
||||
render_info_data(
|
||||
'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings
|
||||
WHERE \"key\" = 'customer_key'",
|
||||
'Update Key'
|
||||
);
|
||||
render_info_data(
|
||||
'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings
|
||||
WHERE \"key\" = 'updating_code_path'",
|
||||
'Updating code path'
|
||||
);
|
||||
render_info_data(
|
||||
'SELECT '.db_escape_key_identifier('value')." FROM tupdate_settings
|
||||
WHERE \"key\" = 'current_update'",
|
||||
'Current Update #'
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$innodb_log_file_size = (db_get_value_sql('SELECT @@innodb_log_file_size') / 1048576);
|
||||
$innodb_log_buffer_size = (db_get_value_sql('SELECT @@innodb_log_buffer_size') / 1048576);
|
||||
$innodb_flush_log_at_trx_commit = db_get_value_sql('SELECT @@innodb_flush_log_at_trx_commit');
|
||||
$max_allowed_packet = (db_get_value_sql('SELECT @@max_allowed_packet') / 1048576);
|
||||
$innodb_buffer_pool_size = (db_get_value_sql('SELECT @@innodb_buffer_pool_size') / 1024);
|
||||
$sort_buffer_size = number_format((db_get_value_sql('SELECT @@sort_buffer_size') / 1024), 2);
|
||||
$join_buffer_size = (db_get_value_sql('SELECT @@join_buffer_size') / 1024);
|
||||
$query_cache_type = db_get_value_sql('SELECT @@query_cache_type');
|
||||
$query_cache_size = (db_get_value_sql('SELECT @@query_cache_size') / 1048576);
|
||||
$query_cache_limit = (db_get_value_sql('SELECT @@query_cache_limit') / 1048576);
|
||||
$innodb_lock_wait_timeout = db_get_value_sql('SELECT @@innodb_lock_wait_timeout');
|
||||
$thread_cache_size = db_get_value_sql('SELECT @@thread_cache_size');
|
||||
$thread_stack = (db_get_value_sql('SELECT @@thread_stack') / 1024);
|
||||
$max_connections = db_get_value_sql('SELECT @@max_connections');
|
||||
$key_buffer_size = (db_get_value_sql('SELECT @@key_buffer_size') / 1024);
|
||||
$read_buffer_size = (db_get_value_sql('SELECT @@read_buffer_size') / 1024);
|
||||
$read_rnd_buffer_size = (db_get_value_sql('SELECT @@read_rnd_buffer_size') / 1024);
|
||||
$query_cache_min_res_unit = (db_get_value_sql('SELECT @@query_cache_min_res_unit') / 1024);
|
||||
$innodb_file_per_table = db_get_value_sql('SELECT @@innodb_file_per_table');
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__('MySQL Performance metrics').' '.ui_print_help_icon('performance_metrics_tab', true).'</th></tr>';
|
||||
|
||||
render_row(status_values($innodb_log_file_size_min_rec_value, $innodb_log_file_size), 'InnoDB log file size ', 'InnoDB log file size ');
|
||||
render_row(status_values($innodb_log_buffer_size_min_rec_value, $innodb_log_buffer_size), 'InnoDB log buffer size ', 'InnoDB log buffer size ');
|
||||
render_row(status_values($innodb_flush_log_at_trx_commit_min_rec_value, $innodb_flush_log_at_trx_commit), 'InnoDB flush log at trx-commit ', 'InnoDB flush log at trx-commit ');
|
||||
render_row(status_values($max_allowed_packet_min_rec_value, $max_allowed_packet), 'Maximun allowed packet ', 'Maximun allowed packet ');
|
||||
render_row(status_values($innodb_buffer_pool_size_min_rec_value, $innodb_buffer_pool_size), 'InnoDB buffer pool size ', 'InnoDB buffer pool size ');
|
||||
render_row(status_values($sort_buffer_size_min_rec_value, $sort_buffer_size), 'Sort buffer size ', 'Sort buffer size ');
|
||||
render_row(status_values($join_buffer_size_min_rec_value, $join_buffer_size), 'Join buffer size ', 'Join buffer size ');
|
||||
render_row(status_values($query_cache_type_min_rec_value, $query_cache_type), 'Query cache type ', 'Query cache type ');
|
||||
render_row(status_values($query_cache_size_min_rec_value, $query_cache_size), 'Query cache size ', 'Query cache size ');
|
||||
render_row(status_values($query_cache_limit_min_rec_value, $query_cache_limit), 'Query cache limit ', 'Query cache limit ');
|
||||
render_row(status_values($innodb_lock_wait_timeout_max_rec_value, $innodb_lock_wait_timeout), 'InnoDB lock wait timeout ', 'InnoDB lock wait timeout ');
|
||||
render_row(status_values($thread_cache_size_max_rec_value, $thread_cache_size), 'Thread cache size ', 'Thread cache size ');
|
||||
render_row(status_values($thread_stack_min_rec_value, $thread_stack), 'Thread stack ', 'Thread stack ');
|
||||
render_row(status_values($max_connections_max_rec_value, $max_connections), 'Maximum connections ', 'Maximun connections ');
|
||||
render_row(status_values($key_buffer_size_min_rec_value, $key_buffer_size), 'Key buffer size ', 'Key buffer size ');
|
||||
render_row(status_values($read_buffer_size_min_rec_value, $read_buffer_size), 'Read buffer size ', 'Read buffer size ');
|
||||
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 Pandora FMS database').'</th></tr>';
|
||||
|
||||
|
||||
|
||||
render_row($tables_fragmentation_max_rec_value.'%', 'Tables fragmentation (maximum recommended value)');
|
||||
render_row(number_format($tables_fragmentation, 2).'%', 'Tables fragmentation (current value)');
|
||||
render_row(status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), 'Table fragmentation status');
|
||||
|
||||
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) / 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_err_logs) / 1048576), 3).'M', 'Size error logs (current value)');
|
||||
render_row(get_status_logs($path_err_logs), 'Status error logs');
|
||||
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'>".__(' 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'], $license['expiry_caption']);
|
||||
render_row($license['limit'].' agents', 'Platform Limit');
|
||||
render_row($license['count'].' agents', 'Current Platform Count');
|
||||
render_row($license['count_enabled'].' agents', 'Current Platform Count (enabled: items)');
|
||||
render_row($license['count_disabled'].' agents', 'Current Platform Count (disabled: items)');
|
||||
render_row($license['license_mode'], 'License Mode');
|
||||
render_row(status_license_params($license['nms']), 'Network Management System');
|
||||
render_row(status_license_params($license['dhpm']), 'Satellite');
|
||||
render_row($license['licensed_to'], 'Licensed to');
|
||||
render_row(license_capacity(), 'Status of agents capacity');
|
||||
render_row(percentage_modules_per_agent(), 'Status of average modules per agent');
|
||||
render_row(interval_average_of_network_modules(), 'Interval average of the network modules');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Status of the attachment folder').'</th></tr>';
|
||||
|
||||
render_row($attachment_total_files, 'Total files in the attached folder');
|
||||
render_row(files_attachment_folder($attachment_total_files), 'Status of the attachment folder');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Information from the tagente_datos table').'</th></tr>';
|
||||
|
||||
render_row($tagente_datos_size, 'Total data in tagente_datos table');
|
||||
render_row(status_tagente_datos($tagente_datos_size), 'Tangente_datos table status');
|
||||
render_row(execution_time(), 'Execution time degradation when executing a count');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Pandora FMS server threads').'</th></tr>';
|
||||
|
||||
render_row($total_server_threads, 'Total server threads');
|
||||
render_row($percentage_threads_ram.'%', 'Percentage of threads used by the RAM');
|
||||
render_row($percentage_threads_cpu.'%', 'Percentage of threads used by the CPU');
|
||||
|
||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Graphs modules that represent the self-monitoring system').'</th></tr>';
|
||||
|
||||
$server_name = db_get_value_sql('SELECT name FROM tserver WHERE master = 1');
|
||||
$agent_id = db_get_value_sql("SELECT id_agente FROM tagente WHERE nombre = '$server_name'");
|
||||
|
||||
$id_modules = agents_get_modules($agent_id);
|
||||
|
||||
$id_modules = [
|
||||
modules_get_agentmodule_id('Agents_Unknown', $agent_id),
|
||||
modules_get_agentmodule_id('Database Maintenance', $agent_id),
|
||||
modules_get_agentmodule_id('FreeDisk_SpoolDir', $agent_id),
|
||||
modules_get_agentmodule_id('Free_RAM', $agent_id),
|
||||
modules_get_agentmodule_id('Queued_Modules', $agent_id),
|
||||
modules_get_agentmodule_id('Status', $agent_id),
|
||||
modules_get_agentmodule_id('System_Load_AVG', $agent_id),
|
||||
modules_get_agentmodule_id('Execution_time', $agent_id),
|
||||
];
|
||||
|
||||
foreach ($id_modules as $id_module) {
|
||||
$params = [
|
||||
'agent_module_id' => $id_module['id_agente_modulo'],
|
||||
'period' => SECONDS_1MONTH,
|
||||
'date' => time(),
|
||||
'height' => '150',
|
||||
];
|
||||
render_row(grafico_modulo_sparse($params), 'Graph of the '.$id_module['nombre'].' module.');
|
||||
}
|
||||
|
||||
if ($console_mode == 0) {
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
echo "<hr color='#b1b1b1' size=1 width=1000 align=left>";
|
||||
|
||||
echo '<span>'.__(
|
||||
'(*) Please check your Pandora Server setup and make sure that the database maintenance daemon is running. It\' is very important to
|
||||
keep the database up-to-date to get the best performance and results in Pandora'
|
||||
).'</span><br><br><br>';
|
||||
// remove file.
|
||||
|
|
|
@ -1396,9 +1396,6 @@ ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned d
|
|||
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL default 0;
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_type` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_normal` int(4) unsigned default '0';
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_warning` int(4) unsigned default '0';
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `ff_critical` int(4) unsigned default '0';
|
||||
ALTER TABLE `tagente_modulo` DROP COLUMN `ff_normal`,
|
||||
DROP COLUMN `ff_warning`,
|
||||
DROP COLUMN `ff_critical`,
|
||||
|
@ -1757,7 +1754,12 @@ INSERT INTO tmodule VALUES (8, 'Wux module');
|
|||
-- Table `ttipo_modulo`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png');
|
||||
INSERT INTO `ttipo_modulo` VALUES
|
||||
(25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'),
|
||||
(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'),
|
||||
(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'),
|
||||
(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'),
|
||||
(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tdashboard`
|
||||
|
@ -2010,6 +2012,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
|||
`linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
|
||||
`linked_layout_node_id` INT(10) NOT NULL default 0,
|
||||
`cache_expiration` INTEGER UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
@ -2423,4 +2426,4 @@ ALTER TABLE `trecon_script` ADD COLUMN `type` int(11) NOT NULL DEFAULT '0';
|
|||
-- ---------------------------------------------------------------------
|
||||
-- Table `tusuario_perfil`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `tusuario_perfil` MODIFY COLUMN `no_hierarchy` tinyint(1) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `tusuario_perfil` MODIFY COLUMN `no_hierarchy` tinyint(1) NOT NULL DEFAULT '0';
|
||||
|
|
|
@ -105,7 +105,7 @@ if (check_login()) {
|
|||
|
||||
echo __(
|
||||
"This is the online help for %s console. This help is -in best cases- just a brief contextual help, not intented to teach you how to use %s. Official documentation of %s is about 900 pages, and you probably don't need to read it entirely, but sure, you should download it and take a look.<br><br>
|
||||
<a href='%s' target='_blanck' style='color: #82b92e; font-size: 10pt; text-decoration: underline;'>Download the official documentation</a>",
|
||||
<a href='%s' target='_blanck' class='pandora_green_text' style='font-size: 10pt; text-decoration: underline;'>Download the official documentation</a>",
|
||||
get_product_name(),
|
||||
get_product_name(),
|
||||
get_product_name(),
|
||||
|
|
|
@ -33,7 +33,7 @@ ui_require_css_file('firts_task');
|
|||
);
|
||||
?>
|
||||
</p>
|
||||
<form action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" method="post">
|
||||
<form action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" method="post">
|
||||
<input type="submit" class="button_task" value="<?php echo __('Create Planned Downtime'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -328,22 +328,40 @@ if ($config['menu_type'] == 'classic') {
|
|||
$header_autorefresh_counter .= $autorefresh_additional;
|
||||
$header_autorefresh_counter .= '</div>';
|
||||
|
||||
// Button for feedback pandora.
|
||||
if (enterprise_installed()) {
|
||||
$header_feedback = '<div id="feedback-icon-header">';
|
||||
$header_feedback .= '<div id="modal-feedback-form" style="display:none;"></div>';
|
||||
$header_feedback .= '<div id="msg-header" style="display: none"></div>';
|
||||
$header_feedback .= html_print_image(
|
||||
'/images/feedback-header.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Feedback'),
|
||||
'id' => 'feedback-header',
|
||||
'alt' => __('Feedback'),
|
||||
'style' => 'cursor: pointer; width: 27px;',
|
||||
]
|
||||
);
|
||||
$header_feedback .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
// Support.
|
||||
if (defined('PANDORA_ENTERPRISE')) {
|
||||
$header_support_link = 'https://support.artica.es/';
|
||||
if (enterprise_installed()) {
|
||||
$header_support_link = $config['custom_support_url'];
|
||||
} 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 .= '<a href="'.ui_get_full_external_url($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_docu">';
|
||||
$header_docu .= '<a href="https://wiki.pandorafms.com/index.php?title=Main_Page" target="_blank">';
|
||||
$header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">';
|
||||
$header_docu .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']);
|
||||
$header_docu .= '</a></div>';
|
||||
|
||||
|
@ -388,9 +406,9 @@ if ($config['menu_type'] == 'classic') {
|
|||
|
||||
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 class="header_right">'.$header_chat, $header_autorefresh, $header_autorefresh_counter, $header_discovery, $servers_list, $header_feedback, $header_support, $header_docu, $header_user, $header_logout.'</div>';
|
||||
?>
|
||||
</div> <!-- Closes #table_header_inner -->
|
||||
</div> <!-- Closes #table_header_inner -->
|
||||
</div> <!-- Closes #table_header -->
|
||||
|
||||
|
||||
|
@ -610,8 +628,41 @@ if ($config['menu_type'] == 'classic') {
|
|||
});
|
||||
|
||||
var fixed_header = <?php echo json_encode((bool) $config_fixed_header); ?>;
|
||||
|
||||
|
||||
var new_chat = <?php echo (int) $_SESSION['new_chat']; ?>;
|
||||
|
||||
/**
|
||||
* Loads modal from AJAX to add feedback.
|
||||
*/
|
||||
function show_feedback() {
|
||||
var btn_ok_text = '<?php echo __('Send'); ?>';
|
||||
var btn_cancel_text = '<?php echo __('Cancel'); ?>';
|
||||
var title = '<?php echo __('Report an issue'); ?>';
|
||||
var url = '<?php echo 'tools/diagnostics'; ?>';
|
||||
|
||||
load_modal({
|
||||
target: $('#modal-feedback-form'),
|
||||
form: 'modal_form_feedback',
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
modal: {
|
||||
title: title,
|
||||
ok: btn_ok_text,
|
||||
cancel: btn_cancel_text,
|
||||
},
|
||||
onshow: {
|
||||
page: url,
|
||||
method: 'formFeedback',
|
||||
},
|
||||
onsubmit: {
|
||||
page: url,
|
||||
method: 'createdScheduleFeedbackTask',
|
||||
dataType: 'json',
|
||||
},
|
||||
ajax_callback: generalShowMsg,
|
||||
idMsgCallback: 'msg-header',
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
// Check new notifications on a periodic way
|
||||
|
@ -661,7 +712,17 @@ if ($config['menu_type'] == 'classic') {
|
|||
$("#ui_close_dialog_titlebar").click(function () {
|
||||
$("#agent_access").css("display","");
|
||||
});
|
||||
|
||||
|
||||
<?php if (enterprise_installed()) { ?>
|
||||
// Feedback.
|
||||
$("#feedback-header").click(function () {
|
||||
// Clean DOM.
|
||||
$("#feedback-header").empty();
|
||||
// Function charge Modal.
|
||||
show_feedback();
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
function blinkpubli(){
|
||||
$(".publienterprise").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkpubli);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* Credential store
|
||||
*
|
||||
* @category HelperFeedBack
|
||||
* @package Pandora FMS
|
||||
* @subpackage Help Feedback
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
|
||||
/**
|
||||
* Class HelpFeedBack.
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/class/HelpFeedBack.class.php';
|
||||
|
||||
$ajaxPage = 'general/help_feedback';
|
||||
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$helpfeedback = new HelpFeedBack($ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
if (is_ajax()) {
|
||||
echo json_encode(['error' => '[HelpFeedBack]'.$e->getMessage() ]);
|
||||
exit;
|
||||
} else {
|
||||
echo '[HelpFeedBack]'.$e->getMessage();
|
||||
}
|
||||
|
||||
// Stop this execution, but continue 'globally'.
|
||||
return;
|
||||
}
|
||||
|
||||
// Ajax controller.
|
||||
if (is_ajax()) {
|
||||
$method = get_parameter('method', '');
|
||||
|
||||
if (method_exists($helpfeedback, $method) === true) {
|
||||
if ($helpfeedback->ajaxMethod($method) === true) {
|
||||
$helpfeedback->{$method}();
|
||||
} else {
|
||||
$helpfeedback->error('Unavailable method.');
|
||||
}
|
||||
} else {
|
||||
$helpfeedback->error('Method not found. ['.$method.']');
|
||||
}
|
||||
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
||||
} else {
|
||||
// Run.
|
||||
$helpfeedback->run();
|
||||
}
|
|
@ -87,7 +87,7 @@ echo '<div id="login_help_dialog" title="'.__('Welcome to %s', get_product_name(
|
|||
echo '</td>';
|
||||
|
||||
echo '<td style="border:1px solid #FFF; text-align:center;">';
|
||||
echo '<a href="'.$config['custom_docs_url'].'" target="_blank" style="text-decoration:none;">'.html_print_image(
|
||||
echo '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank" style="text-decoration:none;">'.html_print_image(
|
||||
'images/documentation.png',
|
||||
true,
|
||||
[
|
||||
|
@ -96,7 +96,7 @@ echo '<div id="login_help_dialog" title="'.__('Welcome to %s', get_product_name(
|
|||
]
|
||||
).'</a>';
|
||||
echo '<br style="margin-bottom: 40px;" />';
|
||||
echo '<a style="font-size: 9pt;" href="'.$config['custom_docs_url'].'" target="_blank">'.__('Documentation').'</span></a>';
|
||||
echo '<a style="font-size: 9pt;"href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Documentation').'</span></a>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
|
|
@ -88,6 +88,24 @@ if (!empty($config['login_background'])) {
|
|||
$login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\"";
|
||||
}
|
||||
|
||||
// Get alternative custom in case of db fail.
|
||||
$custom_fields = [
|
||||
'custom_logo_login',
|
||||
'custom_splash_login',
|
||||
'custom_title1_login',
|
||||
'custom_title2_login',
|
||||
'rb_product_name',
|
||||
];
|
||||
|
||||
foreach ($custom_fields as $field) {
|
||||
if (!isset($config[$field])) {
|
||||
if (isset($config[$field.'_alt'])) {
|
||||
$config[$field] = $config[$field.'_alt'];
|
||||
$custom_conf_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the custom icons.
|
||||
$docs_logo = ui_get_docs_logo();
|
||||
$support_logo = ui_get_support_logo();
|
||||
|
@ -102,7 +120,7 @@ if ($docs_logo !== false) {
|
|||
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 id="li_margin_left"><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
}
|
||||
|
||||
echo '<li><a href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
|
||||
|
@ -133,7 +151,7 @@ if (defined('METACONSOLE')) {
|
|||
html_print_image('enterprise/images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
}
|
||||
} else {
|
||||
if (!isset($config['custom_logo_login']) || $config['custom_logo_login'] == 0) {
|
||||
if (!isset($config['custom_logo_login']) || $config['custom_logo_login'] === 0) {
|
||||
html_print_image('images/custom_logo_login/pandora_logo.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
} else {
|
||||
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
|
@ -423,9 +441,14 @@ if ($login_screen == 'logout') {
|
|||
}
|
||||
|
||||
switch ($login_screen) {
|
||||
case 'error_authconfig':
|
||||
case 'error_dbconfig':
|
||||
$title = __('Problem with %s database', get_product_name());
|
||||
case 'error_authconfig':
|
||||
if (!isset($config['rb_product_name_alt'])) {
|
||||
$title = __('Problem with %s database', get_product_name());
|
||||
} else {
|
||||
$title = __('Problem with %s database', $config['rb_product_name_alt']);
|
||||
}
|
||||
|
||||
$message = __(
|
||||
'Cannot connect to the database, please check your database setup in the <b>include/config.php</b> file.<i><br/><br/>
|
||||
Probably your database, hostname, user or password values are incorrect or
|
||||
|
|
|
@ -83,7 +83,6 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="alert_messages_na">
|
||||
|
||||
<div class='modalheade'>
|
||||
|
@ -100,10 +99,29 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
|
|||
?>
|
||||
</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>
|
||||
<?php
|
||||
$custom_conf_enabled = false;
|
||||
foreach ($config as $key => $value) {
|
||||
if (preg_match('/._alt/i', $key)) {
|
||||
$custom_conf_enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$custom_conf_enabled) {
|
||||
echo '
|
||||
<a href="https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration" target="_blank">
|
||||
<div class="modalwikibutto cerrar">
|
||||
<span class="modalwikibuttontex">'.__('Documentation').'
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_update_manager.php';
|
||||
require_once $config['homedir'].'/include/class/WelcomeWindow.class.php';
|
||||
|
||||
|
||||
if (is_ajax()) {
|
||||
|
@ -122,6 +123,8 @@ if (is_ajax()) {
|
|||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ui_require_css_file('register');
|
||||
|
||||
$initial = isset($config['initial_wizard']) !== true
|
||||
|
@ -170,6 +173,16 @@ if (!$config['disabled_newsletter']) {
|
|||
}
|
||||
}
|
||||
|
||||
$welcome = !$registration && !$show_newsletter && !$initial;
|
||||
try {
|
||||
$welcome_window = new WelcomeWindow($welcome);
|
||||
if ($welcome_window !== null) {
|
||||
$welcome_window->run();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$welcome = false;
|
||||
}
|
||||
|
||||
$newsletter = null;
|
||||
|
||||
?>
|
||||
|
|
|
@ -13,7 +13,8 @@ switch ($_GET['module']) {
|
|||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria between 3 and 5 '
|
||||
WHERE categoria between 3 and 5
|
||||
OR categoria = 10 '
|
||||
);
|
||||
break;
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ if ($new_agent) {
|
|||
|
||||
$table_alias = '<div class="label_select"><p class="input_label">'.__('Alias').': '.ui_print_help_tip(__('Characters /,\,|,%,#,&,$ will be ignored'), true).'</p>';
|
||||
$table_alias .= '<div class='.$label_select_parent.'>';
|
||||
$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true).'</div>';
|
||||
$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'</div>';
|
||||
if ($new_agent) {
|
||||
$table_alias .= '<div class="label_select_child_right">'.html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name').'</div>';
|
||||
}
|
||||
|
|
|
@ -1330,7 +1330,7 @@ if ($update_module || $create_module) {
|
|||
// Change double quotes by single.
|
||||
$snmp_oid = preg_replace('/"/', ''', $snmp_oid);
|
||||
|
||||
if (empty($snmp_oid)) {
|
||||
if (empty($snmp_oid) === true) {
|
||||
// The user did not set any OID manually but did a SNMP walk.
|
||||
$snmp_oid = (string) get_parameter('select_snmp_oid');
|
||||
}
|
||||
|
@ -1339,18 +1339,30 @@ if ($update_module || $create_module) {
|
|||
// New support for snmp v3.
|
||||
$tcp_send = (string) get_parameter('snmp_version');
|
||||
$plugin_user = (string) get_parameter('snmp3_auth_user');
|
||||
$plugin_pass = io_input_password((string) get_parameter('snmp3_auth_pass'));
|
||||
$plugin_pass = io_input_password(
|
||||
(string) get_parameter('snmp3_auth_pass')
|
||||
);
|
||||
$plugin_parameter = (string) get_parameter('snmp3_auth_method');
|
||||
|
||||
$custom_string_1 = (string) get_parameter('snmp3_privacy_method');
|
||||
$custom_string_2 = io_input_password((string) get_parameter('snmp3_privacy_pass'));
|
||||
$custom_string_2 = io_input_password(
|
||||
(string) get_parameter('snmp3_privacy_pass')
|
||||
);
|
||||
$custom_string_3 = (string) get_parameter('snmp3_security_level');
|
||||
} else if ($id_module_type >= 34 && $id_module_type <= 37) {
|
||||
$tcp_send = (string) get_parameter('command_text');
|
||||
$custom_string_1 = (string) get_parameter(
|
||||
'command_credential_identifier'
|
||||
);
|
||||
$custom_string_2 = (string) get_parameter('command_os');
|
||||
} else {
|
||||
$plugin_user = (string) get_parameter('plugin_user');
|
||||
if (get_parameter('id_module_component_type') == 7) {
|
||||
$plugin_pass = (int) get_parameter('plugin_pass');
|
||||
} else {
|
||||
$plugin_pass = io_input_password((string) get_parameter('plugin_pass'));
|
||||
$plugin_pass = io_input_password(
|
||||
(string) get_parameter('plugin_pass')
|
||||
);
|
||||
}
|
||||
|
||||
$plugin_parameter = (string) get_parameter('plugin_parameter');
|
||||
|
@ -2266,6 +2278,10 @@ if ($updateGIS) {
|
|||
// -----------------------------------
|
||||
// Load page depending on tab selected
|
||||
// -----------------------------------
|
||||
if ($_SESSION['create_module'] && $config['welcome_state'] == 1) {
|
||||
$edit_module = true;
|
||||
}
|
||||
|
||||
switch ($tab) {
|
||||
case 'main':
|
||||
include 'agent_manager.php';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// Load global vars
|
||||
check_login();
|
||||
|
||||
// Take some parameters (GET)
|
||||
// Take some parameters (GET).
|
||||
$offset = (int) get_parameter('offset');
|
||||
$group_id = (int) get_parameter('group_id');
|
||||
$ag_group = get_parameter('ag_group_refresh', -1);
|
||||
|
@ -47,10 +47,10 @@ require_once 'include/functions_users.php';
|
|||
|
||||
$search = get_parameter('search', '');
|
||||
|
||||
// Prepare the tab system to the future
|
||||
// Prepare the tab system to the future.
|
||||
$tab = 'view';
|
||||
|
||||
// Setup tab
|
||||
// Setup tab.
|
||||
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>';
|
||||
|
||||
$viewtab['operation'] = true;
|
||||
|
@ -59,10 +59,10 @@ $viewtab['active'] = false;
|
|||
|
||||
$onheader = ['view' => $viewtab];
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Agents defined in %s', get_product_name()), 'images/agent_mc.png', false, '', true, $onheader);
|
||||
|
||||
// Perform actions
|
||||
// Perform actions.
|
||||
$agent_to_delete = (int) get_parameter('borrar_agente');
|
||||
$enable_agent = (int) get_parameter('enable_agent');
|
||||
$disable_agent = (int) get_parameter('disable_agent');
|
||||
|
@ -99,7 +99,7 @@ if ($agent_to_delete) {
|
|||
ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.'));
|
||||
|
||||
if (enterprise_installed()) {
|
||||
// Check if the remote config file still exist
|
||||
// Check if the remote config file still exist.
|
||||
if (isset($config['remote_config'])) {
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
if (enterprise_hook('config_agents_has_remote_configuration', [$id_agente])) {
|
||||
|
@ -114,7 +114,7 @@ if ($enable_agent) {
|
|||
$alias = agents_get_alias($enable_agent);
|
||||
|
||||
if ($result) {
|
||||
// Update the agent from the metaconsole cache
|
||||
// Update the agent from the metaconsole cache.
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$values = ['disabled' => 0];
|
||||
enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]);
|
||||
|
@ -136,7 +136,7 @@ if ($disable_agent) {
|
|||
$alias = agents_get_alias($disable_agent);
|
||||
|
||||
if ($result) {
|
||||
// Update the agent from the metaconsole cache
|
||||
// Update the agent from the metaconsole cache.
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
$values = ['disabled' => 1];
|
||||
enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]);
|
||||
|
@ -223,6 +223,10 @@ switch ($config['dbtype']) {
|
|||
case 'oracle':
|
||||
$order_collation = '';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
|
||||
$selected = true;
|
||||
|
@ -252,6 +256,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -274,6 +282,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -296,6 +308,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -318,6 +334,10 @@ switch ($sortField) {
|
|||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -378,7 +398,7 @@ if ($os != 0) {
|
|||
}
|
||||
|
||||
$user_groups_to_sql = '';
|
||||
// Show only selected groups
|
||||
// Show only selected groups.
|
||||
if ($ag_group > 0) {
|
||||
$ag_groups = [];
|
||||
$ag_groups = (array) $ag_group;
|
||||
|
@ -388,7 +408,7 @@ if ($ag_group > 0) {
|
|||
|
||||
$user_groups_to_sql = implode(',', $ag_groups);
|
||||
} else {
|
||||
// Concatenate AW and AD permisions to get all the possible groups where the user can manage
|
||||
// Concatenate AW and AD permisions to get all the possible groups where the user can manage.
|
||||
$user_groupsAW = users_get_groups($config['id_user'], 'AW');
|
||||
$user_groupsAD = users_get_groups($config['id_user'], 'AD');
|
||||
|
||||
|
@ -431,24 +451,25 @@ $sql = sprintf(
|
|||
|
||||
$agents = db_get_all_rows_sql($sql);
|
||||
|
||||
// Delete rnum row generated by oracle_recode_query() function
|
||||
// Delete rnum row generated by oracle_recode_query() function.
|
||||
if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
|
||||
for ($i = 0; $i < count($agents); $i++) {
|
||||
unset($agents[$i]['rnum']);
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare pagination
|
||||
// Prepare pagination.
|
||||
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
|
||||
|
||||
if ($agents !== false) {
|
||||
// Urls to sort the table.
|
||||
// Agent name size and description for Chinese and Japanese languages are adjusted
|
||||
$agent_font_size = '7';
|
||||
$description_font_size = '6.5';
|
||||
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
|
||||
$agent_font_size = '15';
|
||||
$description_font_size = '11';
|
||||
if ($config['language'] == 'ja'
|
||||
|| $config['language'] == 'zh_CN'
|
||||
|| $own_info['language'] == 'ja'
|
||||
|| $own_info['language'] == 'zh_CN'
|
||||
) {
|
||||
// Adds a custom font size for Japanese and Chinese language.
|
||||
$custom_font_size = 'custom_font_size';
|
||||
}
|
||||
|
||||
$url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
|
||||
|
@ -476,21 +497,21 @@ if ($agents !== false) {
|
|||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
foreach ($agents as $agent) {
|
||||
// Begin Update tagente.remote 0/1 with remote agent function return
|
||||
// Begin Update tagente.remote 0/1 with remote agent function return.
|
||||
if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) {
|
||||
db_process_sql_update('tagente', ['remote' => 1], 'id_agente = '.$agent['id_agente'].'');
|
||||
} else {
|
||||
db_process_sql_update('tagente', ['remote' => 0], 'id_agente = '.$agent['id_agente'].'');
|
||||
}
|
||||
|
||||
// End Update tagente.remote 0/1 with remote agent function return
|
||||
// End Update tagente.remote 0/1 with remote agent function return.
|
||||
$all_groups = agents_get_all_groups_agent($agent['id_agente'], $agent['id_grupo']);
|
||||
$check_aw = check_acl_one_of_groups($config['id_user'], $all_groups, 'AW');
|
||||
$check_ad = check_acl_one_of_groups($config['id_user'], $all_groups, 'AD');
|
||||
|
||||
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
||||
|
||||
// Do not show the agent if there is not enough permissions
|
||||
// Do not show the agent if there is not enough permissions.
|
||||
if (!$check_aw && !$check_ad) {
|
||||
continue;
|
||||
}
|
||||
|
@ -512,7 +533,7 @@ if ($agents !== false) {
|
|||
|
||||
$rowPair = !$rowPair;
|
||||
$iterator++;
|
||||
// Agent name
|
||||
// Agent name.
|
||||
echo "<tr class='$rowclass'><td class='$tdcolor' width='40%'>";
|
||||
if ($agent['disabled']) {
|
||||
echo '<em>';
|
||||
|
@ -537,7 +558,7 @@ if ($agents !== false) {
|
|||
} else {
|
||||
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
|
||||
id_agente=".$agent['id_agente']."'>".'<span style="font-size: '.$agent_font_size.'pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
|
||||
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
|
||||
}
|
||||
|
||||
echo '</strong>';
|
||||
|
@ -617,12 +638,12 @@ if ($agents !== false) {
|
|||
|
||||
echo '</td>';
|
||||
|
||||
// Operating System icon
|
||||
// Operating System icon.
|
||||
echo "<td class='$tdcolor' align='left' valign='middle'>";
|
||||
ui_print_os_icon($agent['id_os'], false);
|
||||
echo '</td>';
|
||||
|
||||
// Type agent (Networt, Software or Satellite)
|
||||
// Type agent (Networt, Software or Satellite).
|
||||
echo "<td class='$tdcolor' align='left' valign='middle'>";
|
||||
echo ui_print_type_agent_icon(
|
||||
$agent['id_os'],
|
||||
|
@ -634,10 +655,12 @@ if ($agents !== false) {
|
|||
echo '</td>';
|
||||
|
||||
|
||||
// Group icon and name
|
||||
// Group icon and name.
|
||||
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
|
||||
// Description
|
||||
echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[…]', 'font-size: '.$description_font_size.'pt;').'</td>';
|
||||
|
||||
// Description.
|
||||
echo "<td class='".$tdcolor."f9'><span class='".$custom_font_size."'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[…]').'</span></td>';
|
||||
|
||||
// Action
|
||||
// When there is only one element in page it's necesary go back page.
|
||||
if ((count($agents) == 1) && ($offset >= $config['block_size'])) {
|
||||
|
@ -695,7 +718,7 @@ if ($agents !== false) {
|
|||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
// Create agent button
|
||||
// Create agent button.
|
||||
echo '<div style="text-align: right;">';
|
||||
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||
html_print_input_hidden('new_agent', 1);
|
||||
|
|
|
@ -1,16 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category Modules
|
||||
* @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.
|
||||
require_once 'include/functions_network_components.php';
|
||||
enterprise_include_once('include/functions_local_components.php');
|
||||
|
||||
|
@ -19,18 +35,65 @@ if (is_ajax()) {
|
|||
$snmp_walk = (bool) get_parameter('snmp_walk');
|
||||
$get_module_component = (bool) get_parameter('get_module_component');
|
||||
$get_module_components = (bool) get_parameter('get_module_components');
|
||||
$get_module_local_components = (bool) get_parameter('get_module_local_components');
|
||||
$get_module_local_component = (bool) get_parameter('get_module_local_component');
|
||||
$get_module_local_components = (bool) get_parameter(
|
||||
'get_module_local_components'
|
||||
);
|
||||
$get_module_local_component = (bool) get_parameter(
|
||||
'get_module_local_component'
|
||||
);
|
||||
|
||||
if ($get_module_component) {
|
||||
$id_component = (int) get_parameter('id_module_component');
|
||||
|
||||
$component = db_get_row('tnetwork_component', 'id_nc', $id_component);
|
||||
|
||||
$component['throw_unknown_events'] = network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
|
||||
$component['throw_unknown_events'] = network_components_is_disable_type_event(
|
||||
$id_component,
|
||||
EVENTS_GOING_UNKNOWN
|
||||
);
|
||||
|
||||
// Decrypt passwords in the component.
|
||||
$component['plugin_pass'] = io_output_password($component['plugin_pass']);
|
||||
$component['plugin_pass'] = io_output_password(
|
||||
$component['plugin_pass']
|
||||
);
|
||||
|
||||
if ($component['type'] >= 15
|
||||
&& $component['type'] <= 18
|
||||
) {
|
||||
// New support for snmp v3.
|
||||
$component['snmp_version'] = $component['tcp_send'];
|
||||
$component['snmp3_auth_user'] = io_safe_output(
|
||||
$component['plugin_user']
|
||||
);
|
||||
// Must use io_output_password.
|
||||
$component['snmp3_auth_pass'] = io_safe_output(
|
||||
$component['plugin_pass']
|
||||
);
|
||||
$component['snmp3_auth_method'] = io_safe_output(
|
||||
$component['plugin_parameter']
|
||||
);
|
||||
$component['snmp3_privacy_method'] = io_safe_output(
|
||||
$component['custom_string_1']
|
||||
);
|
||||
$component['snmp3_privacy_pass'] = io_safe_output(
|
||||
$component['custom_string_2']
|
||||
);
|
||||
$component['snmp3_security_level'] = io_safe_output(
|
||||
$component['custom_string_3']
|
||||
);
|
||||
} else if ($component['type'] >= 34
|
||||
&& $component['type'] <= 37
|
||||
) {
|
||||
$component['command_text'] = io_safe_output(
|
||||
$component['tcp_send']
|
||||
);
|
||||
$component['command_credential_identifier'] = io_safe_output(
|
||||
$component['custom_string_1']
|
||||
);
|
||||
$component['command_os'] = io_safe_output(
|
||||
$component['custom_string_2']
|
||||
);
|
||||
}
|
||||
|
||||
$component['str_warning'] = io_safe_output($component['str_warning']);
|
||||
$component['str_critical'] = io_safe_output($component['str_critical']);
|
||||
|
@ -83,33 +146,29 @@ if (is_ajax()) {
|
|||
|
||||
$component = db_get_row('tlocal_component', 'id', $id_component);
|
||||
foreach ($component as $index => $element) {
|
||||
$component[$index] = html_entity_decode($element, ENT_QUOTES, 'UTF-8');
|
||||
$component[$index] = html_entity_decode(
|
||||
$element,
|
||||
ENT_QUOTES,
|
||||
'UTF-8'
|
||||
);
|
||||
}
|
||||
|
||||
$typeName = local_components_parse_module_extract_value('module_type', $component['data']);
|
||||
$typeName = local_components_parse_module_extract_value(
|
||||
'module_type',
|
||||
$component['data']
|
||||
);
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$component['type'] = db_get_value_sql(
|
||||
'
|
||||
SELECT id_tipo
|
||||
FROM ttipo_modulo
|
||||
WHERE nombre LIKE "'.$typeName.'"'
|
||||
);
|
||||
break;
|
||||
$component['type'] = db_get_value_sql(
|
||||
'
|
||||
SELECT id_tipo
|
||||
FROM ttipo_modulo
|
||||
WHERE nombre LIKE "'.$typeName.'"'
|
||||
);
|
||||
|
||||
case 'postgresql':
|
||||
case 'oracle':
|
||||
$component['type'] = db_get_value_sql(
|
||||
'
|
||||
SELECT id_tipo
|
||||
FROM ttipo_modulo
|
||||
WHERE nombre LIKE \''.$typeName.'\''
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
$component['throw_unknown_events'] = !local_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN);
|
||||
$component['throw_unknown_events'] = !local_components_is_disable_type_event(
|
||||
$id_component,
|
||||
EVENTS_GOING_UNKNOWN
|
||||
);
|
||||
|
||||
echo io_json_mb_encode($component);
|
||||
return;
|
||||
|
@ -136,7 +195,9 @@ if (is_ajax()) {
|
|||
$snmp3_auth_method = get_parameter('snmp3_auth_method');
|
||||
$snmp3_auth_pass = io_safe_output(get_parameter('snmp3_auth_pass'));
|
||||
$snmp3_privacy_method = get_parameter('snmp3_privacy_method');
|
||||
$snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass'));
|
||||
$snmp3_privacy_pass = io_safe_output(
|
||||
get_parameter('snmp3_privacy_pass')
|
||||
);
|
||||
$snmp_port = get_parameter('snmp_port');
|
||||
|
||||
$snmpwalk = get_snmpwalk(
|
||||
|
@ -177,7 +238,7 @@ require_once 'include/functions_exportserver.php';
|
|||
require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
|
||||
// Reading a module
|
||||
// Reading a module.
|
||||
if ($id_agent_module) {
|
||||
$module = modules_get_agentmodule($id_agent_module);
|
||||
$moduletype = $module['id_modulo'];
|
||||
|
@ -202,19 +263,25 @@ if ($id_agent_module) {
|
|||
$snmp_community = $module['snmp_community'];
|
||||
$snmp_oid = $module['snmp_oid'];
|
||||
|
||||
// New support for snmp v3
|
||||
// New support for snmp v3.
|
||||
$snmp_version = $module['tcp_send'];
|
||||
$snmp3_auth_user = $module['plugin_user'];
|
||||
$snmp3_auth_pass = io_output_password($module['plugin_pass']);
|
||||
|
||||
// Auth method could be MD5 or SHA
|
||||
// Auth method could be MD5 or SHA.
|
||||
$snmp3_auth_method = $module['plugin_parameter'];
|
||||
|
||||
// Privacy method could be DES or AES
|
||||
// Privacy method could be DES or AES.
|
||||
$snmp3_privacy_method = $module['custom_string_1'];
|
||||
$snmp3_privacy_pass = io_output_password($module['custom_string_2']);
|
||||
|
||||
// Security level Could be noAuthNoPriv | authNoPriv | authPriv
|
||||
// For Remote cmd fields are reused:
|
||||
// tcp_send, custom_string_1, custom_string_2.
|
||||
$command_text = $module['tcp_send'];
|
||||
$command_credential_identifier = $module['custom_string_1'];
|
||||
$command_os = $module['custom_string_2'];
|
||||
|
||||
// Security level Could be noAuthNoPriv | authNoPriv | authPriv.
|
||||
$snmp3_security_level = $module['custom_string_3'];
|
||||
|
||||
$ip_target = $module['ip_target'];
|
||||
|
@ -265,39 +332,39 @@ if ($id_agent_module) {
|
|||
$id_category = $module['id_category'];
|
||||
|
||||
$cron_interval = explode(' ', $module['cron_interval']);
|
||||
if (isset($cron_interval[4])) {
|
||||
if (isset($cron_interval[4]) === true) {
|
||||
$minute_from = $cron_interval[0];
|
||||
$minute = explode('-', $minute_from);
|
||||
$minute_from = $minute[0];
|
||||
if (isset($minute[1])) {
|
||||
if (isset($minute[1]) === true) {
|
||||
$minute_to = $minute[1];
|
||||
}
|
||||
|
||||
$hour_from = $cron_interval[1];
|
||||
$h = explode('-', $hour_from);
|
||||
$hour_from = $h[0];
|
||||
if (isset($h[1])) {
|
||||
if (isset($h[1]) === true) {
|
||||
$hour_to = $h[1];
|
||||
}
|
||||
|
||||
$mday_from = $cron_interval[2];
|
||||
$md = explode('-', $mday_from);
|
||||
$mday_from = $md[0];
|
||||
if (isset($md[1])) {
|
||||
if (isset($md[1]) === true) {
|
||||
$mday_to = $md[1];
|
||||
}
|
||||
|
||||
$month_from = $cron_interval[3];
|
||||
$m = explode('-', $month_from);
|
||||
$month_from = $m[0];
|
||||
if (isset($m[1])) {
|
||||
if (isset($m[1]) === true) {
|
||||
$month_to = $m[1];
|
||||
}
|
||||
|
||||
$wday_from = $cron_interval[4];
|
||||
$wd = explode('-', $wday_from);
|
||||
$wday_from = $wd[0];
|
||||
if (isset($wd[1])) {
|
||||
if (isset($wd[1]) === true) {
|
||||
$wday_to = $wd[1];
|
||||
}
|
||||
} else {
|
||||
|
@ -315,14 +382,20 @@ if ($id_agent_module) {
|
|||
}
|
||||
|
||||
$module_macros = null;
|
||||
if (isset($module['module_macros'])) {
|
||||
$module_macros = json_decode(base64_decode($module['module_macros']), true);
|
||||
if (isset($module['module_macros']) === true) {
|
||||
$module_macros = json_decode(
|
||||
base64_decode($module['module_macros']),
|
||||
true
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (!isset($moduletype)) {
|
||||
if (isset($moduletype) === false) {
|
||||
$moduletype = (string) get_parameter('moduletype');
|
||||
if ($_SESSION['create_module'] && $config['welcome_state'] == 1) {
|
||||
$moduletype = 'networkserver';
|
||||
}
|
||||
|
||||
// Clean up specific network modules fields
|
||||
// Clean up specific network modules fields.
|
||||
$name = '';
|
||||
$description = '';
|
||||
$id_module_group = 1;
|
||||
|
@ -374,7 +447,7 @@ if ($id_agent_module) {
|
|||
$str_critical = '';
|
||||
$ff_event = 0;
|
||||
|
||||
// New support for snmp v3
|
||||
// New support for snmp v3.
|
||||
$snmp_version = 1;
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
|
@ -383,6 +456,11 @@ if ($id_agent_module) {
|
|||
$snmp3_privacy_pass = '';
|
||||
$snmp3_security_level = '';
|
||||
|
||||
// For Remote CMD.
|
||||
$command_text = '';
|
||||
$command_credential_identifier = '';
|
||||
$command_os = '';
|
||||
|
||||
$critical_instructions = '';
|
||||
$warning_instructions = '';
|
||||
$unknown_instructions = '';
|
||||
|
@ -418,7 +496,9 @@ if ($id_agent_module) {
|
|||
}
|
||||
}
|
||||
|
||||
$is_function_policies = enterprise_include_once('include/functions_policies.php');
|
||||
$is_function_policies = enterprise_include_once(
|
||||
'include/functions_policies.php'
|
||||
);
|
||||
|
||||
if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
|
||||
$relink_policy = get_parameter('relink_policy', 0);
|
||||
|
@ -428,19 +508,32 @@ if ($is_function_policies !== ENTERPRISE_NOT_HOOK) {
|
|||
$policy_info = policies_info_module_policy($id_agent_module);
|
||||
$policy_id = $policy_info['id_policy'];
|
||||
|
||||
if ($relink_policy && policies_get_policy_queue_status($policy_id) == STATUS_IN_QUEUE_APPLYING) {
|
||||
ui_print_error_message(__('This policy is applying and cannot be modified'));
|
||||
if ($relink_policy
|
||||
&& policies_get_policy_queue_status($policy_id) == STATUS_IN_QUEUE_APPLYING
|
||||
) {
|
||||
ui_print_error_message(
|
||||
__('This policy is applying and cannot be modified')
|
||||
);
|
||||
} else {
|
||||
$result = policies_relink_module($id_agent_module);
|
||||
ui_print_result_message($result, __('Module will be linked in the next application'));
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Module will be linked in the next application')
|
||||
);
|
||||
|
||||
db_pandora_audit('Agent management', 'Re-link module '.$id_agent_module);
|
||||
db_pandora_audit(
|
||||
'Agent management',
|
||||
'Re-link module '.$id_agent_module
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($unlink_policy) {
|
||||
$result = policies_unlink_module($id_agent_module);
|
||||
ui_print_result_message($result, __('Module will be unlinked in the next application'));
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Module will be unlinked in the next application')
|
||||
);
|
||||
|
||||
db_pandora_audit('Agent management', 'Unlink module '.$id_agent_module);
|
||||
}
|
||||
|
@ -452,7 +545,7 @@ $remote_conf = false;
|
|||
|
||||
if ($__code_from !== 'policies') {
|
||||
// Only check in the module editor.
|
||||
// Check ACL tags
|
||||
// Check ACL tags.
|
||||
$tag_acl = true;
|
||||
|
||||
// If edit a existing module.
|
||||
|
@ -479,12 +572,12 @@ switch ($moduletype) {
|
|||
$remote_conf = false;
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
$remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$id_agente]);
|
||||
$remote_conf = enterprise_hook(
|
||||
'config_agents_has_remote_configuration',
|
||||
[$id_agente]
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Categories is an array containing the allowed module types
|
||||
(generic_data, generic_string, etc) from ttipo_modulo (field categoria) */
|
||||
$categories = [
|
||||
0,
|
||||
1,
|
||||
|
@ -503,12 +596,16 @@ switch ($moduletype) {
|
|||
'config_agents_get_module_from_conf',
|
||||
[
|
||||
$id_agente,
|
||||
io_safe_output(modules_get_agentmodule_name($id_agent_module)),
|
||||
io_safe_output(
|
||||
modules_get_agentmodule_name($id_agent_module)
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
enterprise_include('godmode/agentes/module_manager_editor_data.php');
|
||||
enterprise_include(
|
||||
'godmode/agentes/module_manager_editor_data.php'
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -520,6 +617,10 @@ switch ($moduletype) {
|
|||
4,
|
||||
5,
|
||||
];
|
||||
if (enterprise_installed()) {
|
||||
$categories[] = 10;
|
||||
}
|
||||
|
||||
include 'module_manager_editor_common.php';
|
||||
include 'module_manager_editor_network.php';
|
||||
break;
|
||||
|
@ -562,9 +663,12 @@ switch ($moduletype) {
|
|||
include 'module_manager_editor_wmi.php';
|
||||
break;
|
||||
|
||||
// WARNING: type 7 is reserved on enterprise
|
||||
// WARNING: type 7 is reserved on enterprise.
|
||||
default:
|
||||
if (enterprise_include('godmode/agentes/module_manager_editor.php') === ENTERPRISE_NOT_HOOK) {
|
||||
if (enterprise_include(
|
||||
'godmode/agentes/module_manager_editor.php'
|
||||
) === ENTERPRISE_NOT_HOOK
|
||||
) {
|
||||
ui_print_error_message(sprintf(__('Invalid module type')));
|
||||
return;
|
||||
}
|
||||
|
@ -580,7 +684,7 @@ if ($config['enterprise_installed'] && $id_agent_module) {
|
|||
|
||||
echo '<h3 id="message" class="error invisible"></h3>';
|
||||
|
||||
// TODO: Change to the ui_print_error system
|
||||
// TODO: Change to the ui_print_error system.
|
||||
echo '<form method="post" id="module_form">';
|
||||
|
||||
ui_toggle(
|
||||
|
@ -602,12 +706,18 @@ ui_toggle(
|
|||
|
||||
if ($moduletype != 13) {
|
||||
ui_toggle(
|
||||
html_print_table($table_new_relations, true).html_print_table($table_relations, true),
|
||||
html_print_table(
|
||||
$table_new_relations,
|
||||
true
|
||||
).html_print_table(
|
||||
$table_relations,
|
||||
true
|
||||
),
|
||||
__('Module relations')
|
||||
);
|
||||
}
|
||||
|
||||
// Submit
|
||||
// Submit.
|
||||
echo '<div class="action-buttons" style="width: '.$table_simple->width.'">';
|
||||
if ($id_agent_module) {
|
||||
html_print_submit_button(
|
||||
|
@ -659,38 +769,84 @@ ui_require_javascript_file('pandora_modules');
|
|||
<script language="javascript">
|
||||
/* <![CDATA[ */
|
||||
var no_name_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No module name provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No module name provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_target_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No target IP provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No target IP provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_oid_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No SNMP OID provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No SNMP OID provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_prediction_module_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No module to predict') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No module to predict'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_plugin_lang =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No plug-in provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No plug-in provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
var no_execute_test_from =`
|
||||
<?php echo ui_print_info_message(['no_close' => true, 'message' => __('No server provided') ]); ?>
|
||||
<?php
|
||||
echo ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No server provided'),
|
||||
]
|
||||
);
|
||||
?>
|
||||
`;
|
||||
|
||||
$(document).ready (function () {
|
||||
configure_modules_form ();
|
||||
|
||||
$("#module_form").submit(function() {
|
||||
if (typeof(check_remote_conf) != 'undefined') {
|
||||
if (typeof(check_remote_conf) != 'undefined') {
|
||||
if (check_remote_conf) {
|
||||
//Check the name
|
||||
//Check the name.
|
||||
name = $("#text-name").val();
|
||||
remote_config = $("#textarea_configuration_data").val();
|
||||
|
||||
regexp_name = new RegExp('module_name\\s*' + name.replace(/([^0-9A-Za-z_])/g, "\\$1") +"\n");
|
||||
|
||||
|
||||
regexp_name = new RegExp(
|
||||
'module_name\\s*' + name.replace(/([^0-9A-Za-z_])/g,
|
||||
"\\$1"
|
||||
) +"\n"
|
||||
);
|
||||
|
||||
regexp_plugin = new RegExp('^module_plugin\\s*');
|
||||
|
||||
|
||||
if (remote_config == '' || remote_config.match(regexp_name) ||
|
||||
remote_config.match(regexp_plugin) ||
|
||||
$("#id_module_type").val()==100 ||
|
||||
|
@ -698,15 +854,15 @@ $(document).ready (function () {
|
|||
return true;
|
||||
}
|
||||
else {
|
||||
alert("<?php echo __('Error, The field name and name in module_name in data configuration are different.'); ?>");
|
||||
alert ("<?php echo __('Error, The field name and name in module_name in data configuration are different.'); ?>");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
function checkKeepaliveModule() {
|
||||
// keepalive modules have id = 100
|
||||
if ($("#id_module_type").val()==100 ||
|
||||
|
@ -720,11 +876,10 @@ $(document).ready (function () {
|
|||
$("#simple-configuration_data").show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
checkKeepaliveModule();
|
||||
|
||||
|
||||
$("#id_module_type").change (function () {
|
||||
checkKeepaliveModule();
|
||||
});
|
||||
|
@ -741,11 +896,15 @@ function handleFileSelect() {
|
|||
err_msg_2 = "<?php echo __('Couldn`t find the fileinput element.'); ?>";
|
||||
err_msg_3 = "<?php echo __('This browser doesn`t seem to support the files property of file inputs.'); ?>";
|
||||
err_msg_4 = "<?php echo __('Please select a file before clicking Load'); ?>";
|
||||
|
||||
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
|
||||
|
||||
if (!window.File ||
|
||||
!window.FileReader ||
|
||||
!window.FileList ||
|
||||
!window.Blob
|
||||
) {
|
||||
$('#mssg_error_div').append(err_msg_1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
input = document.getElementById('file-file_html_text');
|
||||
|
||||
|
@ -756,7 +915,7 @@ function handleFileSelect() {
|
|||
$('#mssg_error_div').append(err_msg_3);
|
||||
}
|
||||
else if (!input.files[0]) {
|
||||
$('#mssg_error_div').append(err_msg_4);
|
||||
$('#mssg_error_div').append(err_msg_4);
|
||||
}
|
||||
else {
|
||||
file = input.files[0];
|
||||
|
@ -767,7 +926,9 @@ function handleFileSelect() {
|
|||
}
|
||||
|
||||
function receivedText() {
|
||||
document.getElementById('textarea_custom_string_1').appendChild(document.createTextNode(fr.result));
|
||||
}
|
||||
document
|
||||
.getElementById('textarea_custom_string_1')
|
||||
.appendChild(document.createTextNode(fr.result));
|
||||
}
|
||||
/* ]]> */
|
||||
</script>
|
||||
|
|
|
@ -132,7 +132,7 @@ function add_component_selection($id_network_component_type)
|
|||
require_once 'include/functions_network_components.php';
|
||||
enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
// If code comes from policies disable export select
|
||||
// If code comes from policies disable export select.
|
||||
global $__code_from;
|
||||
|
||||
$disabledBecauseInPolicy = false;
|
||||
|
@ -209,8 +209,7 @@ $table_simple->data[0][1] = html_print_input_text_extended(
|
|||
$largeClassDisabledBecauseInPolicy,
|
||||
true
|
||||
);
|
||||
// $table_simple->data[0][1] = html_print_input_text ('name',
|
||||
// io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy);
|
||||
|
||||
if (!empty($id_agent_module) && isset($id_agente)) {
|
||||
$table_simple->data[0][1] .= ' <b>'.__('ID').'</b> '.$id_agent_module.' ';
|
||||
|
||||
|
@ -237,7 +236,13 @@ if ($policy_link != 0) {
|
|||
}
|
||||
|
||||
$table_simple->data[0][2] = __('Disabled');
|
||||
$table_simple->data[0][2] .= html_print_checkbox('disabled', 1, $disabled, true, $disabled_enable);
|
||||
$table_simple->data[0][2] .= html_print_checkbox(
|
||||
'disabled',
|
||||
1,
|
||||
$disabled,
|
||||
true,
|
||||
$disabled_enable
|
||||
);
|
||||
$table_simple->data[0][3] = __('Module group');
|
||||
$table_simple->data[0][3] .= html_print_select_from_sql(
|
||||
'SELECT id_mg, name FROM tmodule_group ORDER BY name',
|
||||
|
@ -260,12 +265,18 @@ if ((isset($id_agent_module) && $id_agent_module) || $id_policy_module != 0) {
|
|||
|
||||
$in_policy = strstr($page, 'policy_modules');
|
||||
if (!$in_policy) {
|
||||
// Cannot select the current module to be itself parent
|
||||
$module_parent_filter = $id_agent_module ? ['tagente_modulo.id_agente_modulo' => "<>$id_agent_module"] : '';
|
||||
// Cannot select the current module to be itself parent.
|
||||
$module_parent_filter = ($id_agent_module) ? ['tagente_modulo.id_agente_modulo' => "<>$id_agent_module"] : '';
|
||||
$table_simple->data[1][0] = __('Module parent');
|
||||
$modules_can_be_parent = agents_get_modules($id_agente, false, $module_parent_filter);
|
||||
// If the user cannot have access to parent module, only print the name
|
||||
if ($parent_module_id != 0 && !in_array($parent_module_id, array_keys($modules_can_be_parent))) {
|
||||
$modules_can_be_parent = agents_get_modules(
|
||||
$id_agente,
|
||||
false,
|
||||
$module_parent_filter
|
||||
);
|
||||
// If the user cannot have access to parent module, only print the name.
|
||||
if ($parent_module_id != 0
|
||||
&& !in_array($parent_module_id, array_keys($modules_can_be_parent))
|
||||
) {
|
||||
$table_simple->data[1][1] = db_get_value(
|
||||
'nombre',
|
||||
'tagente_modulo',
|
||||
|
@ -305,7 +316,11 @@ if (!$edit) {
|
|||
}
|
||||
|
||||
$table_simple->data[2][1] = '<em>'.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')</em>';
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names', base64_encode(io_json_mb_encode($type_names_hash)), true);
|
||||
$table_simple->data[2][1] .= html_print_input_hidden(
|
||||
'type_names',
|
||||
base64_encode(io_json_mb_encode($type_names_hash)),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
if (isset($id_module_type)) {
|
||||
$idModuleType = $id_module_type;
|
||||
|
@ -313,12 +328,13 @@ if (!$edit) {
|
|||
$idModuleType = '';
|
||||
}
|
||||
|
||||
// Removed web analysis and log4x from select
|
||||
// Removed web analysis and log4x from select.
|
||||
$sql = sprintf(
|
||||
'SELECT id_tipo, descripcion, nombre
|
||||
'SELECT id_tipo, descripcion, nombre, categoria
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s) AND id_tipo NOT IN (24, 25)
|
||||
ORDER BY descripcion',
|
||||
WHERE categoria IN (%s)
|
||||
AND id_tipo NOT IN (24, 25)
|
||||
ORDER BY id_tipo ASC',
|
||||
implode(',', $categories)
|
||||
);
|
||||
|
||||
|
@ -326,7 +342,9 @@ if (!$edit) {
|
|||
|
||||
$type_names_hash = [];
|
||||
$type_description_hash = [];
|
||||
if (isset($type_names) && is_array($type_names)) {
|
||||
if (isset($type_names) === true
|
||||
&& is_array($type_names) === true
|
||||
) {
|
||||
foreach ($type_names as $tn) {
|
||||
$type_names_hash[$tn['id_tipo']] = $tn['nombre'];
|
||||
$type_description_hash[$tn['id_tipo']] = $tn['descripcion'];
|
||||
|
@ -342,7 +360,7 @@ if (!$edit) {
|
|||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
|
@ -350,8 +368,12 @@ if (!$edit) {
|
|||
100
|
||||
);
|
||||
|
||||
// Store the relation between id and name of the types on a hidden field
|
||||
$table_simple->data[2][1] .= html_print_input_hidden('type_names', base64_encode(io_json_mb_encode($type_names_hash)), true);
|
||||
// Store the relation between id and name of the types on a hidden field.
|
||||
$table_simple->data[2][1] .= html_print_input_hidden(
|
||||
'type_names',
|
||||
base64_encode(io_json_mb_encode($type_names_hash)),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
if ($edit_module) {
|
||||
|
@ -380,15 +402,32 @@ if ($edit_module) {
|
|||
$help_header = 'webserver_module_tab';
|
||||
}
|
||||
|
||||
$table_simple->data[2][0] = __('Type').' '.ui_print_help_icon($help_header, true);
|
||||
$table_simple->data[2][0] = __('Type').' ';
|
||||
$table_simple->data[2][0] .= ui_print_help_icon($help_header, true);
|
||||
}
|
||||
|
||||
if ($disabledBecauseInPolicy) {
|
||||
$table_simple->data[2][3] .= html_print_input_hidden('id_module_group', $id_module_group, true);
|
||||
$table_simple->data[2][3] .= html_print_input_hidden(
|
||||
'id_module_group',
|
||||
$id_module_group,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$table_simple->data[3][0] = __('Dynamic Threshold Interval');
|
||||
$table_simple->data[3][1] = html_print_extended_select_for_time('dynamic_interval', $dynamic_interval, '', 'None', '0', 10, true, 'width:150px', false, $classdisabledBecauseInPolicy, $disabledBecauseInPolicy);
|
||||
$table_simple->data[3][1] = html_print_extended_select_for_time(
|
||||
'dynamic_interval',
|
||||
$dynamic_interval,
|
||||
'',
|
||||
'None',
|
||||
'0',
|
||||
10,
|
||||
true,
|
||||
'width:150px',
|
||||
false,
|
||||
$classdisabledBecauseInPolicy,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->data[3][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
|
||||
if ($in_policy) {
|
||||
$table_simple->cellclass[2][2] = 'hide_dinamic';
|
||||
|
|
|
@ -1,30 +1,50 @@
|
|||
<?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.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_snmp_browser.php';
|
||||
$snmp_browser_path = is_metaconsole() ? '../../' : '';
|
||||
$snmp_browser_path = (is_metaconsole()) ? '../../' : '';
|
||||
$snmp_browser_path .= 'include/javascript/pandora_snmp_browser.js';
|
||||
echo "<script type='text/javascript' src='$snmp_browser_path'></script>";
|
||||
// This line does not run with the dinamic loader editor in policies.
|
||||
// ui_require_javascript_file ('pandora_snmp_browser');
|
||||
// WARNING REPEAT input hidden errors in console
|
||||
// Save some variables for javascript functions
|
||||
// html_print_input_hidden ('ajax_url', ui_get_full_url("ajax.php"), false);
|
||||
// html_print_input_hidden ('search_matches_translation', __("Search matches"), false);
|
||||
// Define a custom action to save the OID selected in the SNMP browser to the form
|
||||
html_print_input_hidden('custom_action', urlencode(base64_encode(' <a href="javascript:setOID()"><img src="'.ui_get_full_url('images').'/input_filter.disabled.png" title="'.__('Use this OID').'" style="vertical-align: middle;"></img></a>')), false);
|
||||
echo "<script type='text/javascript' src='".$snmp_browser_path."'></script>";
|
||||
|
||||
// Define a custom action to save the OID selected
|
||||
// in the SNMP browser to the form.
|
||||
html_print_input_hidden(
|
||||
'custom_action',
|
||||
urlencode(
|
||||
base64_encode(
|
||||
' <a href="javascript:setOID()"><img src="'.ui_get_full_url('images').'/input_filter.disabled.png" title="'.__('Use this OID').'" style="vertical-align: middle;"></img></a>'
|
||||
)
|
||||
),
|
||||
false
|
||||
);
|
||||
|
||||
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
|
||||
|
||||
|
@ -50,17 +70,15 @@ if (strstr($page, 'policy_modules') === false) {
|
|||
define('ID_NETWORK_COMPONENT_TYPE', 2);
|
||||
|
||||
if (empty($update_module_id)) {
|
||||
// Function in module_manager_editor_common.php
|
||||
// Function in module_manager_editor_common.php.
|
||||
add_component_selection(ID_NETWORK_COMPONENT_TYPE);
|
||||
} else {
|
||||
// TODO: Print network component if available
|
||||
}
|
||||
|
||||
$extra_title = __('Network server module');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Target IP');
|
||||
// show agent_for defect;
|
||||
// Show agent_for defect.
|
||||
if ($page == 'enterprise/godmode/policies/policy_modules') {
|
||||
if ($ip_target != 'auto' && $ip_target != '') {
|
||||
$custom_ip_target = $ip_target;
|
||||
|
@ -100,7 +118,7 @@ if ($page == 'enterprise/godmode/policies/policy_modules') {
|
|||
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
||||
}
|
||||
|
||||
// In ICMP modules, port is not configurable
|
||||
// In ICMP modules, port is not configurable.
|
||||
if ($id_module_type >= 6 && $id_module_type <= 7) {
|
||||
$data[2] = '';
|
||||
$data[3] = '';
|
||||
|
@ -148,7 +166,15 @@ if (!$adopt) {
|
|||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
} else {
|
||||
$data[1] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, true, false);
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp_community',
|
||||
$snmp_community,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
$data[2] = _('SNMP version');
|
||||
|
@ -213,8 +239,27 @@ $data[1] .= html_print_input_text(
|
|||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$data[1] .= '<span class="invisible" id="oid">';
|
||||
$data[1] .= html_print_select([], 'select_snmp_oid', $snmp_oid, '', '', 0, true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[1] .= html_print_image('images/edit.png', true, ['class' => 'invisible clickable', 'id' => 'edit_oid']);
|
||||
$data[1] .= html_print_select(
|
||||
[],
|
||||
'select_snmp_oid',
|
||||
$snmp_oid,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$data[1] .= html_print_image(
|
||||
'images/edit.png',
|
||||
true,
|
||||
[
|
||||
'class' => 'invisible clickable',
|
||||
'id' => 'edit_oid',
|
||||
]
|
||||
);
|
||||
$data[1] .= '</span>';
|
||||
$data[1] .= '</span><span class="right" style="width: 50%; text-align: right">';
|
||||
$data[1] .= html_print_button(
|
||||
|
@ -231,42 +276,50 @@ $table_simple->colspan['snmp_2'][1] = 3;
|
|||
|
||||
push_table_simple($data, 'snmp_2');
|
||||
|
||||
// Advanced stuff
|
||||
// Advanced stuff.
|
||||
$data = [];
|
||||
$data[0] = __('TCP send');
|
||||
$data[1] = html_print_textarea('tcp_send', 2, 65, $tcp_send, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
||||
$data[1] = html_print_textarea(
|
||||
'tcp_send',
|
||||
2,
|
||||
65,
|
||||
$tcp_send,
|
||||
$disabledTextBecauseInPolicy,
|
||||
true,
|
||||
$largeclassdisabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->colspan['tcp_send'][1] = 3;
|
||||
|
||||
push_table_simple($data, 'tcp_send');
|
||||
|
||||
$data[0] = __('TCP receive');
|
||||
$data[1] = html_print_textarea('tcp_rcv', 2, 65, $tcp_rcv, $disabledTextBecauseInPolicy, true, $largeclassdisabledBecauseInPolicy);
|
||||
$data[1] = html_print_textarea(
|
||||
'tcp_rcv',
|
||||
2,
|
||||
65,
|
||||
$tcp_rcv,
|
||||
$disabledTextBecauseInPolicy,
|
||||
true,
|
||||
$largeclassdisabledBecauseInPolicy
|
||||
);
|
||||
$table_simple->colspan['tcp_receive'][1] = 3;
|
||||
|
||||
push_table_simple($data, 'tcp_receive');
|
||||
|
||||
if ($id_module_type < 8 || $id_module_type > 11) {
|
||||
// NOT TCP
|
||||
// NOT TCP.
|
||||
$table_simple->rowstyle['tcp_send'] = 'display: none;';
|
||||
$table_simple->rowstyle['tcp_receive'] = 'display: none;';
|
||||
}
|
||||
|
||||
if ($id_module_type < 15 || $id_module_type > 18) {
|
||||
// NOT SNMP
|
||||
// NOT SNMP.
|
||||
$table_simple->rowstyle['snmp_1'] = 'display: none';
|
||||
$table_simple->rowstyle['snmp_2'] = 'display: none';
|
||||
}
|
||||
|
||||
// For a policy
|
||||
if (!isset($id_agent_module)) {
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp_version = 1;
|
||||
$snmp3_privacy_method = '';
|
||||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
} else if ($id_agent_module === false) {
|
||||
// For a policy.
|
||||
if (isset($id_agent_module) === false || $id_agent_module === false) {
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp_version = 1;
|
||||
|
@ -274,6 +327,9 @@ if (!isset($id_agent_module)) {
|
|||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
$command_text = '';
|
||||
$command_os = 'inherited';
|
||||
$command_credential_identifier = '';
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
@ -333,7 +389,22 @@ push_table_simple($data, 'field_snmpv3_row2');
|
|||
|
||||
$data = [];
|
||||
$data[0] = __('Auth method');
|
||||
$data[1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true, false, false, '', $disabledBecauseInPolicy);
|
||||
$data[1] = html_print_select(
|
||||
[
|
||||
'MD5' => __('MD5'),
|
||||
'SHA' => __('SHA'),
|
||||
],
|
||||
'snmp3_auth_method',
|
||||
$snmp3_auth_method,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$data[2] = __('Security level');
|
||||
$data[3] = html_print_select(
|
||||
[
|
||||
|
@ -358,13 +429,84 @@ if ($snmp_version != 3) {
|
|||
|
||||
push_table_simple($data, 'field_snmpv3_row3');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Command');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'command_text',
|
||||
$command_text,
|
||||
'command_text',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
$disabledBecauseInPolicy,
|
||||
'',
|
||||
$largeClassDisabledBecauseInPolicy,
|
||||
true
|
||||
);
|
||||
$table_simple->colspan['row-cmd-row-1'][1] = 3;
|
||||
push_table_simple($data, 'row-cmd-row-1');
|
||||
|
||||
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
|
||||
|
||||
$data[0] = __('Credential identifier');
|
||||
$data[1] = html_print_select(
|
||||
$array_credential_identifier,
|
||||
'command_credential_identifier',
|
||||
$command_credential_identifier,
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$array_os = [
|
||||
'inherited' => __('Inherited'),
|
||||
'linux' => __('Linux'),
|
||||
'windows' => __('Windows'),
|
||||
];
|
||||
|
||||
$data[2] = __('Target OS');
|
||||
$data[3] = html_print_select(
|
||||
$array_os,
|
||||
'command_os',
|
||||
$command_os,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
push_table_simple($data, 'row-cmd-row-2');
|
||||
|
||||
if ($id_module_type !== 34
|
||||
&& $id_module_type !== 35
|
||||
&& $id_module_type !== 36
|
||||
&& $id_module_type !== 37
|
||||
) {
|
||||
$table_simple->rowstyle['row-cmd-row-1'] = 'display: none;';
|
||||
$table_simple->rowstyle['row-cmd-row-2'] = 'display: none;';
|
||||
}
|
||||
|
||||
snmp_browser_print_container(false, '100%', '60%', 'none');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("#id_module_type").change(function (){
|
||||
if ((this.value == "17") || (this.value == "18") || (this.value == "16") || (this.value == "15")) {
|
||||
if ((this.value == "17") ||
|
||||
(this.value == "18") ||
|
||||
(this.value == "16") ||
|
||||
(this.value == "15")
|
||||
) {
|
||||
if ($("#snmp_version").val() == "3"){
|
||||
$("#simple-field_snmpv3_row1").attr("style", "");
|
||||
$("#simple-field_snmpv3_row2").attr("style", "");
|
||||
|
@ -379,6 +521,18 @@ $(document).ready (function () {
|
|||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
|
||||
if((this.value == "34") ||
|
||||
(this.value == "35") ||
|
||||
(this.value == "36") ||
|
||||
(this.value == "37")
|
||||
) {
|
||||
$("#simple-row-cmd-row-1").attr("style", "");
|
||||
$("#simple-row-cmd-row-2").attr("style", "");
|
||||
} else {
|
||||
$("#simple-row-cmd-row-1").css("display", "none");
|
||||
$("#simple-row-cmd-row-2").css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
$("#snmp_version").change(function () {
|
||||
|
@ -397,27 +551,28 @@ $(document).ready (function () {
|
|||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#select_snmp_oid").click (
|
||||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
$(this).css ("min-width", "180px");
|
||||
});
|
||||
|
||||
|
||||
$("#select_snmp_oid").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
});
|
||||
|
||||
|
||||
$("#id_module_type").click (
|
||||
function () {
|
||||
$(this).css ("width", "auto");
|
||||
$(this).css ("min-width", "180px");
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
$("#id_module_type").blur (function () {
|
||||
$(this).css ("width", "180px");
|
||||
});
|
||||
|
||||
|
||||
// Keep elements in the form and the SNMP browser synced
|
||||
$('#text-ip_target').keyup(function() {
|
||||
$('#text-target_ip').val($(this).val());
|
||||
|
@ -433,13 +588,12 @@ $(document).ready (function () {
|
|||
});
|
||||
$('#snmp_version').change(function() {
|
||||
$('#snmp_browser_version').val($(this).val());
|
||||
|
||||
// Display or collapse the SNMP browser's v3 options
|
||||
checkSNMPVersion ();
|
||||
});
|
||||
$('#snmp_browser_version').change(function() {
|
||||
$('#snmp_version').val($(this).val());
|
||||
|
||||
|
||||
// Display or collapse the SNMP v3 options in the main window
|
||||
if ($(this).val() == "3") {
|
||||
$("#simple-field_snmpv3_row1").attr("style", "");
|
||||
|
@ -498,10 +652,10 @@ $(document).ready (function () {
|
|||
}
|
||||
$('#ip_target').change(function() {
|
||||
if($(this).val() == 'custom') {
|
||||
$("#text-custom_ip_target").show();
|
||||
$("#text-custom_ip_target").show();
|
||||
}
|
||||
else{
|
||||
$("#text-custom_ip_target").hide();
|
||||
$("#text-custom_ip_target").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -827,7 +827,7 @@ $table->data[5][1] = "
|
|||
</table>
|
||||
</div>';
|
||||
|
||||
echo '<form method="POST" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
echo '<form method="POST" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
|
||||
if ($id_downtime > 0) {
|
||||
echo '<table width=100% border=0 cellpadding=4 >';
|
||||
|
@ -929,7 +929,7 @@ if ($id_downtime > 0) {
|
|||
$disabled_add_button = true;
|
||||
}
|
||||
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
||||
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
|
||||
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
|
||||
|
||||
html_print_checkbox('recursion', 1, $recursion, false, false, '');
|
||||
|
@ -939,7 +939,7 @@ if ($id_downtime > 0) {
|
|||
echo '</form>';
|
||||
// Show available agents to include into downtime
|
||||
echo '<h4>'.__('Available agents').':</h4>';
|
||||
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
|
||||
echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
|
||||
|
||||
echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;');
|
||||
|
||||
|
@ -1085,7 +1085,7 @@ if ($id_downtime > 0) {
|
|||
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
$data[5] .= '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
$data[5] .= '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
$table->data['agent_'.$downtime_agent['id_agente']] = $data;
|
||||
|
|
|
@ -357,7 +357,7 @@ if (!$downtimes && !$filter_performed) {
|
|||
// No downtimes cause the user performed a search.
|
||||
else if (!$downtimes) {
|
||||
// Filter form.
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
|
@ -369,7 +369,7 @@ else if (!$downtimes) {
|
|||
// Create button.
|
||||
if ($write_permisson) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
@ -378,11 +378,11 @@ else if (!$downtimes) {
|
|||
}
|
||||
// Has downtimes.
|
||||
else {
|
||||
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
|
||||
// User groups with AR, AD or AW permission.
|
||||
$groupsAD = users_get_groups($config['id_user'], $access);
|
||||
|
@ -476,7 +476,7 @@ else {
|
|||
if (in_array($downtime['id_group'], $groupsAD)) {
|
||||
// Stop button
|
||||
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
|
||||
$data['stop'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
$data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
} else {
|
||||
$data['stop'] = '';
|
||||
}
|
||||
|
@ -484,12 +484,12 @@ else {
|
|||
// Edit & delete buttons.
|
||||
if ($downtime['executed'] == 0) {
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
// Delete.
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
|
||||
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
|
||||
// Delete.
|
||||
$data['delete'] = __('N/A');
|
||||
} else {
|
||||
|
@ -515,7 +515,7 @@ else {
|
|||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
// CSV export button.
|
||||
|
@ -532,7 +532,7 @@ else {
|
|||
// Create button.
|
||||
if ($write_permisson) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ $(document).ready (function () {
|
|||
|
||||
if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) {
|
||||
if (confirm("<?php echo __('WARNING: There are malformed planned downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
|
||||
window.location.href = "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
|
||||
window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -184,9 +184,11 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
|||
}
|
||||
|
||||
ui_require_css_file('cluetip', 'include/styles/js/');
|
||||
ui_require_jquery_file('validate');
|
||||
ui_require_jquery_file('cluetip');
|
||||
ui_require_jquery_file('pandora.controls');
|
||||
ui_require_jquery_file('bgiframe');
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
@ -201,7 +203,25 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
// Rule.
|
||||
$.validator.addMethod(
|
||||
"valueNotEquals",
|
||||
function(value, element, arg) {
|
||||
return arg != value;
|
||||
},
|
||||
"Value must not equal arg."
|
||||
);
|
||||
|
||||
// configure your validation
|
||||
$("form.add_alert_form").validate({
|
||||
rules: {
|
||||
id_agent_module: { valueNotEquals: "0" }
|
||||
},
|
||||
messages: {
|
||||
id_agent_module: { valueNotEquals: "Please select an item!" }
|
||||
}
|
||||
});
|
||||
$("select#template").change (function () {
|
||||
id = this.value;
|
||||
$a = $(this).siblings ("a.template_details");
|
||||
|
|
|
@ -339,13 +339,13 @@ if (check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, '
|
|||
$sub = [];
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
// Audit //meter en extensiones
|
||||
// Audit //meter en extensiones.
|
||||
$sub['godmode/admin_access_logs']['text'] = __('System audit log');
|
||||
$sub['godmode/admin_access_logs']['id'] = 'System audit log';
|
||||
$sub['godmode/setup/links']['text'] = __('Links');
|
||||
$sub['godmode/setup/links']['id'] = 'Links';
|
||||
$sub['extras/pandora_diag']['text'] = __('Diagnostic info');
|
||||
$sub['extras/pandora_diag']['id'] = 'Diagnostic info';
|
||||
$sub['tools/diagnostics']['text'] = __('Diagnostic info');
|
||||
$sub['tools/diagnostics']['id'] = 'Diagnostic info';
|
||||
$sub['godmode/setup/news']['text'] = __('Site news');
|
||||
$sub['godmode/setup/news']['id'] = 'Site news';
|
||||
$sub['godmode/setup/file_manager']['text'] = __('File manager');
|
||||
|
|
|
@ -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();
|
||||
|
@ -32,7 +47,7 @@ require_once $config['homedir'].'/include/functions_categories.php';
|
|||
enterprise_include_once('meta/include/functions_components_meta.php');
|
||||
require_once $config['homedir'].'/include/functions_component_groups.php';
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
components_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
|
@ -40,15 +55,6 @@ if (defined('METACONSOLE')) {
|
|||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
$new_component = (bool) get_parameter('new_component');
|
||||
} else {
|
||||
/*
|
||||
Hello there! :)
|
||||
|
||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
|
||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||
|
||||
*/
|
||||
|
||||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
$new_component = (bool) get_parameter('new_component');
|
||||
if ($id_modulo == 2 || $id_modulo == 4 || $id_modulo == 6) {
|
||||
|
@ -59,7 +65,6 @@ if (defined('METACONSOLE')) {
|
|||
$help_header = 'network_component_tab';
|
||||
}
|
||||
|
||||
|
||||
ui_print_page_header(
|
||||
__('Module management').' » '.__('Network component management'),
|
||||
'',
|
||||
|
@ -73,7 +78,6 @@ if (defined('METACONSOLE')) {
|
|||
$sec = 'gmodules';
|
||||
}
|
||||
|
||||
|
||||
$type = (int) get_parameter('type');
|
||||
$name = (string) get_parameter('name');
|
||||
$description = (string) get_parameter('description');
|
||||
|
@ -120,7 +124,7 @@ $history_data = (bool) get_parameter('history_data');
|
|||
|
||||
// Don't read as (float) because it lost it's decimals when put into MySQL
|
||||
// where are very big and PHP uses scientific notation, p.e:
|
||||
// 1.23E-10 is 0.000000000123
|
||||
// 1.23E-10 is 0.000000000123.
|
||||
$post_process = (string) get_parameter('post_process', 0.0);
|
||||
|
||||
$unit = (string) get_parameter('unit');
|
||||
|
@ -151,9 +155,16 @@ $snmp3_auth_user = (string) io_safe_output(get_parameter('snmp3_auth_user'));
|
|||
$snmp3_auth_pass = io_input_password((string) get_parameter('snmp3_auth_pass'));
|
||||
$snmp3_auth_method = (string) get_parameter('snmp3_auth_method');
|
||||
$snmp3_privacy_method = (string) get_parameter('snmp3_privacy_method');
|
||||
$snmp3_privacy_pass = io_input_password((string) get_parameter('snmp3_privacy_pass'));
|
||||
$snmp3_privacy_pass = io_input_password(
|
||||
(string) get_parameter('snmp3_privacy_pass')
|
||||
);
|
||||
$snmp3_security_level = (string) get_parameter('snmp3_security_level');
|
||||
|
||||
$command_text = (string) get_parameter('command_text');
|
||||
$command_credential_identifier = (string) get_parameter(
|
||||
'command_credential_identifier'
|
||||
);
|
||||
$command_os = (string) get_parameter('command_os');
|
||||
|
||||
$throw_unknown_events = get_parameter('throw_unknown_events', false);
|
||||
// Set the event type that can show.
|
||||
|
@ -163,11 +174,19 @@ $disabled_types_event = json_encode($disabled_types_event);
|
|||
$create_component = (bool) get_parameter('create_component');
|
||||
$update_component = (bool) get_parameter('update_component');
|
||||
$delete_component = (bool) get_parameter('delete_component');
|
||||
$duplicate_network_component = (bool) get_parameter('duplicate_network_component');
|
||||
$duplicate_network_component = (bool) get_parameter(
|
||||
'duplicate_network_component'
|
||||
);
|
||||
$delete_multiple = (bool) get_parameter('delete_multiple');
|
||||
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
|
||||
$create_network_from_module = (bool) get_parameter('create_network_from_module', 0);
|
||||
$create_network_from_snmp_browser = (bool) get_parameter('create_network_from_snmp_browser', 0);
|
||||
$create_network_from_module = (bool) get_parameter(
|
||||
'create_network_from_module',
|
||||
0
|
||||
);
|
||||
$create_network_from_snmp_browser = (bool) get_parameter(
|
||||
'create_network_from_snmp_browser',
|
||||
0
|
||||
);
|
||||
|
||||
if ($duplicate_network_component) {
|
||||
$source_id = (int) get_parameter('source_id');
|
||||
|
@ -182,18 +201,34 @@ if ($duplicate_network_component) {
|
|||
__('Could not be created')
|
||||
);
|
||||
|
||||
// List unset for jump the bug in the pagination (TODO) that the make another
|
||||
// copy for each pass into pages.
|
||||
// List unset for jump the bug in the pagination
|
||||
// that the make another copy for each pass into pages.
|
||||
unset($_GET['source_id']);
|
||||
unset($_GET['duplicate_network_component']);
|
||||
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
$custom_string_1 = '';
|
||||
$custom_string_2 = '';
|
||||
$custom_string_3 = '';
|
||||
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
// New support for snmp v3.
|
||||
$tcp_send = $snmp_version;
|
||||
$plugin_user = $snmp3_auth_user;
|
||||
$plugin_pass = $snmp3_auth_pass;
|
||||
$plugin_parameter = $snmp3_auth_method;
|
||||
$custom_string_1 = $snmp3_privacy_method;
|
||||
$custom_string_2 = $snmp3_privacy_pass;
|
||||
$custom_string_3 = $snmp3_security_level;
|
||||
} else if ($type >= 34 && $type <= 37) {
|
||||
$tcp_send = $command_text;
|
||||
$custom_string_1 = $command_credential_identifier;
|
||||
$custom_string_2 = $command_os;
|
||||
}
|
||||
|
||||
if ($create_component) {
|
||||
$custom_string_1 = '';
|
||||
$custom_string_2 = '';
|
||||
$custom_string_3 = '';
|
||||
$name_check = db_get_value(
|
||||
'name',
|
||||
'tnetwork_component',
|
||||
|
@ -201,25 +236,6 @@ if ($create_component) {
|
|||
$name
|
||||
);
|
||||
|
||||
// remote_snmp = 15
|
||||
// remote_snmp_proc = 18
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
// New support for snmp v3
|
||||
$tcp_send = $snmp_version;
|
||||
$plugin_user = $snmp3_auth_user;
|
||||
$plugin_pass = $snmp3_auth_pass;
|
||||
$plugin_parameter = $snmp3_auth_method;
|
||||
$custom_string_1 = $snmp3_privacy_method;
|
||||
$custom_string_2 = $snmp3_privacy_pass;
|
||||
$custom_string_3 = $snmp3_security_level;
|
||||
$name_check = db_get_value(
|
||||
'name',
|
||||
'tnetwork_component',
|
||||
'name',
|
||||
$name
|
||||
);
|
||||
}
|
||||
|
||||
if ($name && !$name_check) {
|
||||
$id = network_components_create_network_component(
|
||||
$name,
|
||||
|
@ -283,13 +299,16 @@ if ($create_component) {
|
|||
}
|
||||
|
||||
if ($id === false || !$id) {
|
||||
db_pandora_audit('Module management', 'Fail try to create network component');
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Fail try to create network component'
|
||||
);
|
||||
ui_print_error_message(__('Could not be created'));
|
||||
include_once 'godmode/modules/manage_network_components_form.php';
|
||||
return;
|
||||
}
|
||||
|
||||
db_pandora_audit('Module management', "Create network component #$id");
|
||||
db_pandora_audit('Module management', 'Create network component #'.$id);
|
||||
ui_print_success_message(__('Created successfully'));
|
||||
$id = 0;
|
||||
}
|
||||
|
@ -297,23 +316,6 @@ if ($create_component) {
|
|||
if ($update_component) {
|
||||
$id = (int) get_parameter('id');
|
||||
|
||||
$custom_string_1 = '';
|
||||
$custom_string_2 = '';
|
||||
$custom_string_3 = '';
|
||||
|
||||
// $name_check = db_get_value ('name', 'tnetwork_component', 'name', $name);
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
// New support for snmp v3
|
||||
$tcp_send = $snmp_version;
|
||||
$plugin_user = $snmp3_auth_user;
|
||||
$plugin_pass = $snmp3_auth_pass;
|
||||
$plugin_parameter = $snmp3_auth_method;
|
||||
$custom_string_1 = $snmp3_privacy_method;
|
||||
$custom_string_2 = $snmp3_privacy_pass;
|
||||
$custom_string_3 = $snmp3_security_level;
|
||||
// $name_check = db_get_value ('name', 'tnetwork_component', 'name', $name);
|
||||
}
|
||||
|
||||
if (!empty($name)) {
|
||||
$result = network_components_update_network_component(
|
||||
$id,
|
||||
|
@ -380,14 +382,14 @@ if ($update_component) {
|
|||
if ($result === false || !$result) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Fail try to update network component #$id"
|
||||
'Fail try to update network component #'.$id
|
||||
);
|
||||
ui_print_error_message(__('Could not be updated'));
|
||||
include_once 'godmode/modules/manage_network_components_form.php';
|
||||
return;
|
||||
}
|
||||
|
||||
db_pandora_audit('Module management', "Update network component #$id");
|
||||
db_pandora_audit('Module management', 'Update network component #'.$id);
|
||||
ui_print_success_message(__('Updated successfully'));
|
||||
|
||||
$id = 0;
|
||||
|
@ -401,12 +403,12 @@ if ($delete_component) {
|
|||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Delete network component #$id"
|
||||
'Delete network component #'.$id
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Fail try to delete network component #$id"
|
||||
'Fail try to delete network component #'.$id
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -433,12 +435,12 @@ if ($multiple_delete) {
|
|||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Multiple delete network component: $str_ids"
|
||||
'Multiple delete network component:'.$str_ids
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
"Fail try to delete network component: $str_ids"
|
||||
'Fail try to delete network component:'.$str_ids
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -451,7 +453,10 @@ if ($multiple_delete) {
|
|||
$id = 0;
|
||||
}
|
||||
|
||||
if ($id || $new_component || $create_network_from_module || $create_network_from_snmp_browser) {
|
||||
if ($id || $new_component
|
||||
|| $create_network_from_module
|
||||
|| $create_network_from_snmp_browser
|
||||
) {
|
||||
include_once $config['homedir'].'/godmode/modules/manage_network_components_form.php';
|
||||
return;
|
||||
}
|
||||
|
@ -540,7 +545,7 @@ if ($component_groups === false) {
|
|||
foreach ($component_groups as $component_group_key => $component_group_val) {
|
||||
$num_components = db_get_num_rows(
|
||||
'SELECT id_nc
|
||||
FROM tnetwork_component
|
||||
FROM tnetwork_component
|
||||
WHERE id_group = '.$component_group_key
|
||||
);
|
||||
|
||||
|
@ -551,14 +556,14 @@ foreach ($component_groups as $component_group_key => $component_group_val) {
|
|||
if ($childs !== false) {
|
||||
foreach ($childs as $child) {
|
||||
$num_components_childs += db_get_num_rows(
|
||||
'SELECT id
|
||||
FROM tlocal_component
|
||||
'SELECT id
|
||||
FROM tlocal_component
|
||||
WHERE id_network_component_group = '.$child['id_sg']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Only show component groups with local components
|
||||
// Only show component groups with local components.
|
||||
if ($num_components == 0 && $num_components_childs == 0) {
|
||||
unset($component_groups[$component_group_key]);
|
||||
}
|
||||
|
@ -622,7 +627,11 @@ if ($search_string != '') {
|
|||
$filter[] = '(name LIKE '."'%".$search_string."%'".'OR description LIKE '."'%".$search_string."%'".'OR tcp_send LIKE '."'%".$search_string."%'".'OR tcp_rcv LIKE '."'%".$search_string."%'".')';
|
||||
}
|
||||
|
||||
$total_components = network_components_get_network_components(false, $filter, 'COUNT(*) AS total');
|
||||
$total_components = network_components_get_network_components(
|
||||
false,
|
||||
$filter,
|
||||
'COUNT(*) AS total'
|
||||
);
|
||||
$total_components = $total_components[0]['total'];
|
||||
ui_pagination($total_components, $url);
|
||||
$filter['offset'] = (int) get_parameter('offset');
|
||||
|
@ -651,7 +660,13 @@ unset($table);
|
|||
$table->width = '100%';
|
||||
$table->head = [];
|
||||
$table->class = 'info_table';
|
||||
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->head['checkbox'] = html_print_checkbox(
|
||||
'all_delete',
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
);
|
||||
$table->head[0] = __('Module name');
|
||||
$table->head[1] = __('Type');
|
||||
$table->head[3] = __('Description');
|
||||
|
@ -669,12 +684,21 @@ foreach ($components as $component) {
|
|||
$data = [];
|
||||
|
||||
if ($component['max'] == $component['min'] && $component['max'] == 0) {
|
||||
$component['max'] = $component['min'] = __('N/A');
|
||||
$component['max'] = __('N/A');
|
||||
$component['min'] = __('N/A');
|
||||
}
|
||||
|
||||
$data['checkbox'] = html_print_checkbox_extended('delete_multiple[]', $component['id_nc'], false, false, '', 'class="check_delete"', true);
|
||||
$data['checkbox'] = html_print_checkbox_extended(
|
||||
'delete_multiple[]',
|
||||
$component['id_nc'],
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'class="check_delete"',
|
||||
true
|
||||
);
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&'.'sec2=godmode/modules/manage_network_components&'.'id='.$component['id_nc'].'&pure='.$pure.'">';
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/modules/manage_network_components&id='.$component['id_nc'].'&pure='.$pure.'">';
|
||||
$data[0] .= io_safe_output($component['name']);
|
||||
$data[0] .= '</a>';
|
||||
$data[1] = ui_print_moduletype_icon($component['type'], true);
|
||||
|
@ -702,6 +726,10 @@ foreach ($components as $component) {
|
|||
['title' => __('Plug-in module')]
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
|
||||
$data[3] = "<span style='font-size: 8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>';
|
||||
|
@ -719,13 +747,32 @@ if (isset($data)) {
|
|||
echo "<form method='post' action='index.php?sec=".$sec.'&sec2=godmode/modules/manage_network_components&search_id_group=0search_string=&pure='.$pure."'>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_table($table);
|
||||
ui_pagination($total_components, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination(
|
||||
$total_components,
|
||||
$url,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
'offset',
|
||||
true,
|
||||
'pagination-bottom'
|
||||
);
|
||||
echo "<div style='float: right; margin-left: 5px;'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
html_print_submit_button(
|
||||
__('Delete'),
|
||||
'delete_btn',
|
||||
false,
|
||||
'class="sub delete"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined network components') ]);
|
||||
ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('There are no defined network components'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
|
@ -744,7 +791,12 @@ html_print_select(
|
|||
'',
|
||||
''
|
||||
);
|
||||
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next" style="margin-left: 5px;"');
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'crt',
|
||||
false,
|
||||
'class="sub next" style="margin-left: 5px;"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
|
@ -752,30 +804,33 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
$('[id^=checkbox-delete_multiple]')
|
||||
.parent()
|
||||
.parent()
|
||||
.addClass('checkselected');
|
||||
$(".check_delete")
|
||||
.prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$('[id^=checkbox-delete_multiple]')
|
||||
.parent()
|
||||
.parent()
|
||||
.removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</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();
|
||||
|
@ -26,12 +41,18 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
|||
}
|
||||
|
||||
$create_network_from_module = get_parameter('create_network_from_module');
|
||||
$create_network_from_snmp_browser = get_parameter('create_network_from_snmp_browser', 0);
|
||||
$create_network_from_snmp_browser = get_parameter(
|
||||
'create_network_from_snmp_browser',
|
||||
0
|
||||
);
|
||||
$pure = get_parameter('pure', 0);
|
||||
|
||||
if ($create_network_from_module) {
|
||||
$id_agentmodule = get_parameter('create_module_from');
|
||||
$data_module = db_get_row_filter('tagente_modulo', ['id_agente_modulo' => $id_agentmodule]);
|
||||
$data_module = db_get_row_filter(
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $id_agentmodule]
|
||||
);
|
||||
|
||||
$name = $data_module['nombre'];
|
||||
$description = $data_module['descripcion'];
|
||||
|
@ -139,16 +160,25 @@ if (isset($id)) {
|
|||
$each_ff = $component['each_ff'];
|
||||
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
// New support for snmp v3
|
||||
// New support for snmp v3.
|
||||
$snmp_version = $component['tcp_send'];
|
||||
$snmp3_auth_user = $component['plugin_user'];
|
||||
$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 = io_output_password($component['custom_string_2']);
|
||||
$snmp3_privacy_pass = io_output_password(
|
||||
$component['custom_string_2']
|
||||
);
|
||||
$snmp3_security_level = $component['custom_string_3'];
|
||||
} else if ($type >= 34 && $type <= 37) {
|
||||
$command_text = $component['tcp_send'];
|
||||
$command_credential_identifier = $component['custom_string_1'];
|
||||
$command_os = $component['custom_string_2'];
|
||||
}
|
||||
} else if (isset($new_component) && $new_component && !$create_network_from_snmp_browser) {
|
||||
} else if (isset($new_component)
|
||||
&& $new_component
|
||||
&& !$create_network_from_snmp_browser
|
||||
) {
|
||||
$name = '';
|
||||
$snmp_oid = '';
|
||||
$description = '';
|
||||
|
@ -204,21 +234,13 @@ if (isset($id)) {
|
|||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
|
||||
$command_text = '';
|
||||
$command_os = 'inherited';
|
||||
$command_credential_identifier = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($create_network_from_snmp_browser) {
|
||||
}
|
||||
|
||||
/*
|
||||
* $id_component_type has these values:
|
||||
* 6 - Module WMI
|
||||
* 4 - Plugin component
|
||||
* 2 - network component
|
||||
*
|
||||
* You can see this values in file godmode/modules/manage_network_components.php
|
||||
* in the last lines (in the call function "html_print_select").
|
||||
*/
|
||||
$table = new stdClass();
|
||||
|
||||
if ($id_component_type == 6) {
|
||||
|
@ -243,6 +265,10 @@ if ($id_component_type == 6) {
|
|||
4,
|
||||
5,
|
||||
];
|
||||
if (enterprise_installed()) {
|
||||
$categories[] = 10;
|
||||
}
|
||||
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_common.php';
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_network.php';
|
||||
} else {
|
||||
|
@ -253,7 +279,7 @@ echo '<form name="component" method="post">';
|
|||
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
// $table came from manage_network_components_form_common.php
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if ($id) {
|
||||
$table->head[0] = __('Update Network Component');
|
||||
|
@ -295,61 +321,78 @@ ui_require_javascript_file('pandora_modules');
|
|||
function type_change () {
|
||||
// type 1-4 - Generic_xxxxxx
|
||||
if ((document.component.type.value > 0) && (document.component.type.value < 5)) {
|
||||
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=snmp_community]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp_community]").attr("disabled", true);
|
||||
|
||||
$("input[name=tcp_rcv]").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("input[name=tcp_rcv]").css({backgroundColor: '#ddd '});
|
||||
$("input[name=tcp_rcv]").attr("disabled", true);
|
||||
|
||||
|
||||
<?php
|
||||
if ($id_component_type != MODULE_WMI) {
|
||||
?>
|
||||
$("input[name=snmp_oid]").css({backgroundColor: '#ddd !important'});
|
||||
$("input[name=snmp_oid]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp_oid]").attr("disabled", true);
|
||||
|
||||
$("input[name=tcp_send]").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("input[name=tcp_send]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=tcp_send]").attr("disabled", true);
|
||||
|
||||
$("input[name=tcp_port]").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("input[name=tcp_port]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=tcp_port]").attr("disabled", true);
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("input[name=snmp3_auth_user]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp3_auth_user]").attr("disabled", true);
|
||||
|
||||
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("input[name=snmp3_auth_pass]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp3_auth_pass]").attr("disabled", true);
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#ddd '});
|
||||
$("#snmp3_privacy_method").attr("disabled", true);
|
||||
|
||||
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("input[name=snmp3_privacy_pass]")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("input[name=snmp3_privacy_pass]").attr("disabled", true);
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#ddd '});
|
||||
$("#snmp3_auth_method").attr("disabled", true);
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#ddd !important'});
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#ddd '});
|
||||
$("#snmp3_security_level").attr("disabled", true);
|
||||
|
||||
$("#command_text").css({backgroundColor: '#ddd '});
|
||||
$("#command_text").attr("disabled", true);
|
||||
|
||||
$("#command_credential_identifier")
|
||||
.css({backgroundColor: '#ddd '});
|
||||
$("#command_credential_identifier").attr("disabled", true);
|
||||
|
||||
$("#command_os").css({backgroundColor: '#ddd '});
|
||||
$("#command_os").attr("disabled", true);
|
||||
}
|
||||
// type 15-18- SNMP
|
||||
if ((document.component.type.value > 14) && (document.component.type.value < 19 )) {
|
||||
document.component.snmp_oid.style.background="#fff";
|
||||
document.component.snmp_oid.style.disabled=false;
|
||||
document.component.snmp_community.style.background="#fff";
|
||||
document.component.snmp_community.disabled=false;
|
||||
if ((document.component.type.value > 14) && (document.component.type.value < 19 )) {
|
||||
document.component.snmp_oid.style.background="#fff";
|
||||
document.component.snmp_oid.disabled=false;
|
||||
document.component.tcp_send.style.background="#ddd !important";
|
||||
|
||||
document.getElementById('text-snmp_community').style.background="#fff";
|
||||
document.getElementById('text-snmp_community').disabled=false;
|
||||
document.component.snmp_oid.style.background="#fff";
|
||||
document.component.snmp_oid.disabled=false;
|
||||
document.component.tcp_send.style.background="#ddd ";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd !important";
|
||||
document.component.tcp_rcv.style.background="#ddd ";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
|
||||
|
||||
document.component.snmp_version.style.background="#fff";
|
||||
document.component.snmp_version.disabled=false;
|
||||
document.component.snmp3_auth_user.style.background="#fff";
|
||||
|
@ -364,94 +407,161 @@ function type_change () {
|
|||
document.component.snmp3_auth_method.disabled=false;
|
||||
document.component.snmp3_security_level.style.background="#fff";
|
||||
document.component.snmp3_security_level.disabled=false;
|
||||
|
||||
|
||||
document.component.command_text.style.background="#ddd";
|
||||
document.component.command_text.style.disabled=true;
|
||||
document.component.command_credential_identifier.style.background="#ddd";
|
||||
document.component.command_credential_identifier.disabled=true;
|
||||
document.component.command_os.style.background="#ddd";
|
||||
document.component.command_os.disabled=true;
|
||||
|
||||
$("#snmp_version" ).trigger("change");
|
||||
}
|
||||
|
||||
if ((document.component.type.value >= 34) && (document.component.type.value <= 37 )) {
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.getElementById('text-snmp_community').style.background="#ddd";
|
||||
document.getElementById('text-snmp_community').disabled=true;
|
||||
document.component.snmp_oid.style.background="#ddd";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_version.style.background="#ddd";
|
||||
document.component.snmp_version.disabled=true;
|
||||
|
||||
document.component.tcp_send.style.background="#ddd";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
|
||||
document.component.snmp3_auth_user.style.background="#ddd ";
|
||||
document.component.snmp3_auth_user.disabled=true;
|
||||
document.component.snmp3_auth_pass.background="#ddd ";
|
||||
document.component.snmp3_auth_pass.disabled=true;
|
||||
document.component.snmp3_privacy_method.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_method.disabled=true;
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_pass.disabled=true;
|
||||
document.component.snmp3_auth_method.style.background="#ddd ";
|
||||
document.component.snmp3_auth_method.disabled=true;
|
||||
document.component.snmp3_security_level.style.background="#ddd ";
|
||||
document.component.snmp3_security_level.disabled=true;
|
||||
|
||||
document.component.command_text.style.background="#fff";
|
||||
document.component.command_text.style.disabled=false;
|
||||
document.component.command_credential_identifier.style.background="#fff";
|
||||
document.component.command_credential_identifier.disabled=false;
|
||||
document.component.command_os.style.background="#fff";
|
||||
document.component.command_os.disabled=false;
|
||||
}
|
||||
|
||||
// type 6-7 - ICMP
|
||||
if ((document.component.type.value == 6) || (document.component.type.value == 7)) {
|
||||
document.component.snmp_oid.style.background="#ddd !important";
|
||||
document.component.snmp_oid.style.background="#ddd ";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd !important";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.component.snmp_oid.style.background="#ddd !important";
|
||||
document.getElementById('text-snmp_community').style.background="#ddd";
|
||||
document.getElementById('text-snmp_community').disabled=true;
|
||||
document.component.snmp_oid.style.background="#ddd ";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.tcp_send.style.background="#ddd !important";
|
||||
document.component.tcp_send.style.background="#ddd ";
|
||||
document.component.tcp_send.disabled=true;
|
||||
document.component.tcp_rcv.style.background="#ddd !important";
|
||||
document.component.tcp_rcv.style.background="#ddd ";
|
||||
document.component.tcp_rcv.disabled=true;
|
||||
document.component.tcp_port.style.background="#ddd !important";
|
||||
document.component.tcp_port.style.background="#ddd ";
|
||||
document.component.tcp_port.disabled=true;
|
||||
|
||||
document.component.snmp_version.style.background="#ddd !important";
|
||||
|
||||
document.component.snmp_version.style.background="#ddd ";
|
||||
document.component.snmp_version.disabled=true;
|
||||
document.component.snmp3_auth_user.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_user.style.background="#ddd ";
|
||||
document.component.snmp3_auth_user.disabled=true;
|
||||
document.component.snmp3_auth_pass.background="#ddd !important";
|
||||
document.component.snmp3_auth_pass.background="#ddd ";
|
||||
document.component.snmp3_auth_pass.disabled=true;
|
||||
document.component.snmp3_privacy_method.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_method.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_method.disabled=true;
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_pass.disabled=true;
|
||||
document.component.snmp3_auth_method.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_method.style.background="#ddd ";
|
||||
document.component.snmp3_auth_method.disabled=true;
|
||||
document.component.snmp3_security_level.style.background="#ddd !important";
|
||||
document.component.snmp3_security_level.style.background="#ddd ";
|
||||
document.component.snmp3_security_level.disabled=true;
|
||||
|
||||
document.component.command_text.style.background="#ddd";
|
||||
document.component.command_text.style.disabled=true;
|
||||
document.component.command_credential_identifier.style.background="#ddd";
|
||||
document.component.command_credential_identifier.disabled=true;
|
||||
document.component.command_os.style.background="#ddd";
|
||||
document.component.command_os.disabled=true;
|
||||
}
|
||||
// type 8-11 - TCP
|
||||
if ((document.component.type.value > 7) && (document.component.type.value < 12)) {
|
||||
document.component.snmp_oid.style.background="#ddd !important";
|
||||
document.component.snmp_oid.style.background="#ddd ";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd !important";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.getElementById('text-snmp_community').style.background="#ddd ";
|
||||
document.getElementById('text-snmp_community').disabled=true;
|
||||
document.component.tcp_send.style.background="#fff";
|
||||
document.component.tcp_send.disabled=false;
|
||||
document.component.tcp_rcv.style.background="#fff";
|
||||
document.component.tcp_rcv.disabled=false;
|
||||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
|
||||
document.component.snmp_version.style.background="#ddd !important";
|
||||
|
||||
document.component.snmp_version.style.background="#ddd ";
|
||||
document.component.snmp_version.disabled=true;
|
||||
document.component.snmp3_auth_user.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_user.style.background="#ddd ";
|
||||
document.component.snmp3_auth_user.disabled=true;
|
||||
document.component.snmp3_auth_pass.background="#ddd !important";
|
||||
document.component.snmp3_auth_pass.background="#ddd ";
|
||||
document.component.snmp3_auth_pass.disabled=true;
|
||||
document.component.snmp3_privacy_method.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_method.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_method.disabled=true;
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_pass.disabled=true;
|
||||
document.component.snmp3_auth_method.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_method.style.background="#ddd ";
|
||||
document.component.snmp3_auth_method.disabled=true;
|
||||
document.component.snmp3_security_level.style.background="#ddd !important";
|
||||
document.component.snmp3_security_level.style.background="#ddd ";
|
||||
document.component.snmp3_security_level.disabled=true;
|
||||
|
||||
document.component.command_text.style.background="#ddd";
|
||||
document.component.command_text.style.disabled=true;
|
||||
document.component.command_credential_identifier.style.background="#ddd";
|
||||
document.component.command_credential_identifier.disabled=true;
|
||||
document.component.command_os.style.background="#ddd";
|
||||
document.component.command_os.disabled=true;
|
||||
}
|
||||
// type 12 - UDP
|
||||
if (document.component.type.value == 12) {
|
||||
document.component.snmp_oid.style.background="#ddd !important";
|
||||
document.component.snmp_oid.style.background="#ddd ";
|
||||
document.component.snmp_oid.disabled=true;
|
||||
document.component.snmp_community.style.background="#ddd !important";
|
||||
document.component.snmp_community.disabled=true;
|
||||
document.getElementById('text-snmp_community').style.background="#ddd ";
|
||||
document.getElementById('text-snmp_community').disabled=true;
|
||||
document.component.tcp_send.style.background="#fff";
|
||||
document.component.tcp_send.disabled=false;
|
||||
document.component.tcp_rcv.style.background="#fff";
|
||||
document.component.tcp_rcv.disabled=false;
|
||||
document.component.tcp_port.style.background="#fff";
|
||||
document.component.tcp_port.disabled=false;
|
||||
|
||||
document.component.snmp_version.style.background="#ddd !important";
|
||||
|
||||
document.component.snmp_version.style.background="#ddd ";
|
||||
document.component.snmp_version.disabled=true;
|
||||
document.component.snmp3_auth_user.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_user.style.background="#ddd ";
|
||||
document.component.snmp3_auth_user.disabled=true;
|
||||
document.component.snmp3_auth_pass.background="#ddd !important";
|
||||
document.component.snmp3_auth_pass.background="#ddd ";
|
||||
document.component.snmp3_auth_pass.disabled=true;
|
||||
document.component.snmp3_privacy_method.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_method.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_method.disabled=true;
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd !important";
|
||||
document.component.snmp3_privacy_pass.style.background="#ddd ";
|
||||
document.component.snmp3_privacy_pass.disabled=true;
|
||||
document.component.snmp3_auth_method.style.background="#ddd !important";
|
||||
document.component.snmp3_auth_method.style.background="#ddd ";
|
||||
document.component.snmp3_auth_method.disabled=true;
|
||||
document.component.snmp3_security_level.style.background="#ddd !important";
|
||||
document.component.snmp3_security_level.style.background="#ddd ";
|
||||
document.component.snmp3_security_level.disabled=true;
|
||||
|
||||
document.component.command_text.style.background="#ddd";
|
||||
document.component.command_text.style.disabled=true;
|
||||
document.component.command_credential_identifier.style.background="#ddd";
|
||||
document.component.command_credential_identifier.disabled=true;
|
||||
document.component.command_os.style.background="#ddd";
|
||||
document.component.command_os.disabled=true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -470,7 +580,7 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#left").click (function () {
|
||||
jQuery.each($("select[name='id_tag_selected[]'] option:selected"), function (key, value) {
|
||||
tag_name = $(value).html();
|
||||
|
@ -485,38 +595,38 @@ $(document).ready (function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#submit-crt").click(function () {
|
||||
$('#id_tag_selected option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#submit-upd").click(function () {
|
||||
$('#id_tag_selected option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
if ($("#snmp_version").val() == "3") {
|
||||
$("input[name=snmp3_auth_user]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_auth_user]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_auth_pass]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_privacy_method").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_privacy_pass]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_auth_method").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_security_level").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=active_snmp_v3]").val(1);
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp_community]").attr("disabled",true);
|
||||
|
@ -525,49 +635,47 @@ $(document).ready (function () {
|
|||
$("input[name=snmp3_auth_user]").val("");
|
||||
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_auth_user]").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=snmp3_auth_pass]").val("");
|
||||
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_auth_pass]").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_privacy_method").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=snmp3_privacy_pass]").val("");
|
||||
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_privacy_pass]").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_auth_method").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_security_level").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
|
||||
|
||||
$("#snmp_version").change(function () {
|
||||
if (this.value == "3") {
|
||||
$("input[name=snmp3_auth_user]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_auth_user]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_auth_pass]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_privacy_method").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_privacy_pass]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_auth_method").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_security_level").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=active_snmp_v3]").val(1);
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp_community]").attr("disabled",true);
|
||||
|
@ -576,50 +684,50 @@ $(document).ready (function () {
|
|||
$("input[name=snmp3_auth_user]").val("");
|
||||
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_auth_user]").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=snmp3_auth_pass]").val("");
|
||||
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_auth_pass]").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_privacy_method").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=snmp3_privacy_pass]").val("");
|
||||
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_privacy_pass]").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_auth_method").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_security_level").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#type"). change(function () {
|
||||
if ($("#snmp_version").val() == "3") {
|
||||
$("input[name=snmp3_auth_user]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_auth_user]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_auth_pass]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_privacy_method").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp3_privacy_pass]").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_auth_method").removeAttr('disabled');
|
||||
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#fff'});
|
||||
$("#snmp3_security_level").removeAttr('disabled');
|
||||
|
||||
|
||||
$("input[name=active_snmp_v3]").val(1);
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp_community]").attr("disabled",true);
|
||||
|
@ -628,30 +736,28 @@ $(document).ready (function () {
|
|||
$("input[name=snmp3_auth_user]").val("");
|
||||
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_auth_user]").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=snmp3_auth_pass]").val("");
|
||||
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_auth_pass]").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_privacy_method").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_privacy_method").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=snmp3_privacy_pass]").val("");
|
||||
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'});
|
||||
$("input[name=snmp3_privacy_pass]").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_auth_method").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_auth_method").attr("disabled", true);
|
||||
|
||||
|
||||
$("#snmp3_security_level").css({backgroundColor: '#ddd'});
|
||||
$("#snmp3_security_level").attr("disabled", true);
|
||||
|
||||
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").css({backgroundColor: '#fff'});
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#snmp_version" ).trigger("change");
|
||||
});
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ $sql = sprintf(
|
|||
'SELECT id_tipo, descripcion
|
||||
FROM ttipo_modulo
|
||||
WHERE categoria IN (%s)
|
||||
ORDER BY descripcion',
|
||||
ORDER BY id_tipo ASC',
|
||||
implode(',', $categories)
|
||||
);
|
||||
$table->data[1][1] = html_print_select_from_sql(
|
||||
|
|
|
@ -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();
|
||||
|
@ -55,32 +70,94 @@ push_table_row($data, 'snmp_port');
|
|||
|
||||
$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[1] = html_print_input_text(
|
||||
'snmp_oid',
|
||||
$snmp_oid,
|
||||
'',
|
||||
30,
|
||||
400,
|
||||
true
|
||||
);
|
||||
|
||||
$data[2] = __('SNMP community');
|
||||
$data[3] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, 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[1] = html_print_input_text('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$data[1] = html_print_input_text(
|
||||
'snmp3_auth_user',
|
||||
$snmp3_auth_user,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
$data[2] = __('Auth password');
|
||||
$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);
|
||||
$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');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Privacy method');
|
||||
$data[1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
$data[1] = html_print_select(
|
||||
[
|
||||
'DES' => __('DES'),
|
||||
'AES' => __('AES'),
|
||||
],
|
||||
'snmp3_privacy_method',
|
||||
$snmp3_privacy_method,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$data[2] = __('Privacy pass');
|
||||
$data[3] = html_print_input_password('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
|
||||
$data[3] = html_print_input_password(
|
||||
'snmp3_privacy_pass',
|
||||
$snmp3_privacy_pass,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
push_table_row($data, 'field_snmpv3_row2');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Auth method');
|
||||
$data[1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);
|
||||
$data[1] = html_print_select(
|
||||
[
|
||||
'MD5' => __('MD5'),
|
||||
'SHA' => __('SHA'),
|
||||
],
|
||||
'snmp3_auth_method',
|
||||
$snmp3_auth_method,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$data[2] = __('Security level');
|
||||
$data[3] = html_print_select(
|
||||
[
|
||||
|
@ -110,12 +187,11 @@ $data[1] = html_print_extended_select_for_post_process(
|
|||
false,
|
||||
true
|
||||
);
|
||||
$data[2] = $data[3] = '';
|
||||
$data[2] = '';
|
||||
$data[3] = '';
|
||||
push_table_row($data, 'field_process');
|
||||
|
||||
|
||||
|
||||
// Advanced stuff
|
||||
// Advanced stuff.
|
||||
$data = [];
|
||||
$data[0] = __('TCP send');
|
||||
$data[1] = html_print_textarea('tcp_send', 2, 65, $tcp_send, '', true);
|
||||
|
@ -129,6 +205,64 @@ $data[1] = html_print_textarea('tcp_rcv', 2, 65, $tcp_rcv, '', true);
|
|||
$table->colspan['tcp_receive'][1] = 3;
|
||||
|
||||
push_table_row($data, 'tcp_receive');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Command');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'command_text',
|
||||
$command_text,
|
||||
'command_text',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
$disabledBecauseInPolicy,
|
||||
'',
|
||||
$largeClassDisabledBecauseInPolicy,
|
||||
true
|
||||
);
|
||||
$table->colspan['row-cmd-row-1'][1] = 3;
|
||||
push_table_row($data, 'row-cmd-row-1');
|
||||
|
||||
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||
$array_credential_identifier = CredentialStore::getKeys('CUSTOM');
|
||||
|
||||
$data[0] = __('Credential identifier');
|
||||
$data[1] = html_print_select(
|
||||
$array_credential_identifier,
|
||||
'command_credential_identifier',
|
||||
$command_credential_identifier,
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$array_os = [
|
||||
'inherited' => __('Inherited'),
|
||||
'linux' => __('Linux'),
|
||||
'windows' => __('Windows'),
|
||||
];
|
||||
|
||||
$data[2] = __('Target OS');
|
||||
$data[3] = html_print_select(
|
||||
$array_os,
|
||||
'command_os',
|
||||
$command_os,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
push_table_row($data, 'row-cmd-row-2');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -140,7 +274,7 @@ push_table_row($data, 'tcp_receive');
|
|||
validate_post_process();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function validate_post_process() {
|
||||
var post_process = $("#text-post_process").val();
|
||||
if (post_process != undefined){
|
||||
|
|
|
@ -290,7 +290,7 @@ $table_aux = new stdClass();
|
|||
foreach ($result_graphs as $graph) {
|
||||
$data = [];
|
||||
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
|
||||
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text(io_safe_output($graph['name']), 70).'</a>';
|
||||
|
||||
$data[1] = ui_print_truncate_text($graph['description'], 70);
|
||||
|
||||
|
|
|
@ -482,51 +482,6 @@ switch ($action) {
|
|||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'TTRT':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
$period = $item['period'];
|
||||
break;
|
||||
*/
|
||||
case 'alert_report_module':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
|
@ -791,11 +746,6 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
/*
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'simple_baseline_graph':
|
||||
case 'event_report_log':
|
||||
case 'increment':
|
||||
|
@ -3757,10 +3707,6 @@ $(document).ready (function () {
|
|||
case 'event_report_module':
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
/* case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'avg_value':
|
||||
|
@ -3798,10 +3744,6 @@ $(document).ready (function () {
|
|||
case 'event_report_module':
|
||||
case 'simple_graph':
|
||||
case 'simple_baseline_graph':
|
||||
/* case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'prediction_date':
|
||||
case 'projection_graph':
|
||||
case 'avg_value':
|
||||
|
@ -3835,11 +3777,14 @@ $(document).ready (function () {
|
|||
});
|
||||
|
||||
$("#checkbox-checkbox_show_resume").change(function(){
|
||||
if($(this).is(":checked")){
|
||||
type = $("#type").val();
|
||||
if($(this).is(":checked") && type !== 'general'){
|
||||
$("#row_select_fields2").show();
|
||||
$("#row_select_fields3").show();
|
||||
}
|
||||
else{
|
||||
$("#row_select_fields2").hide();
|
||||
$("#row_select_fields3").hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -4833,38 +4778,6 @@ function chooseType() {
|
|||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
/*
|
||||
case 'TTRT':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'MTTR':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
break;*/
|
||||
|
||||
case 'alert_report_module':
|
||||
$("#row_description").show();
|
||||
|
@ -5218,10 +5131,6 @@ function chooseType() {
|
|||
case 'min_value':
|
||||
case 'max_value':
|
||||
case 'avg_value':
|
||||
/* case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'simple_baseline_graph':
|
||||
$("#row_label").show();
|
||||
break;
|
||||
|
|
|
@ -2006,11 +2006,6 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
/*
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
|
@ -2613,11 +2608,6 @@ switch ($action) {
|
|||
case 'avg_value':
|
||||
case 'projection_graph':
|
||||
case 'prediction_date':
|
||||
/*
|
||||
case 'TTRT':
|
||||
case 'TTO':
|
||||
case 'MTBF':
|
||||
case 'MTTR':*/
|
||||
case 'simple_baseline_graph':
|
||||
case 'nt_top_n':
|
||||
if ($label != '') {
|
||||
|
|
|
@ -63,9 +63,20 @@ if (is_ajax()) {
|
|||
|
||||
$test_address = get_parameter('test_address', '');
|
||||
|
||||
$res = enterprise_hook('send_email_attachment', [$test_address, __('This is an email test sent from Pandora FMS. If you can read this, your configuration works.'), __('Testing Pandora FMS email'), null]);
|
||||
$res = enterprise_hook(
|
||||
'send_email_attachment',
|
||||
[
|
||||
$test_address,
|
||||
__('This is an email test sent from Pandora FMS. If you can read this, your configuration works.'),
|
||||
__('Testing Pandora FMS email'),
|
||||
null,
|
||||
]
|
||||
);
|
||||
|
||||
echo $res;
|
||||
|
||||
// Exit after ajax response.
|
||||
exit();
|
||||
}
|
||||
|
||||
$table = new StdClass();
|
||||
|
@ -389,6 +400,52 @@ html_print_input_hidden('update_config', 1);
|
|||
html_print_table($table_mail_conf);
|
||||
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<fieldset>';
|
||||
echo '<legend>'.__('WebSocket settings').'</legend>';
|
||||
|
||||
$t = new StdClass();
|
||||
$t->data = [];
|
||||
$t->width = '100%';
|
||||
$t->class = 'databox filters';
|
||||
$t->data = [];
|
||||
$t->style[0] = 'font-weight: bold';
|
||||
|
||||
$t->data[0][0] = __('Bind address');
|
||||
$t->data[0][1] = html_print_input_text(
|
||||
'ws_bind_address',
|
||||
$config['ws_bind_address'],
|
||||
'',
|
||||
30,
|
||||
100,
|
||||
true
|
||||
);
|
||||
|
||||
$t->data[1][0] = __('Bind port');
|
||||
$t->data[1][2] = html_print_input_text(
|
||||
'ws_port',
|
||||
$config['ws_port'],
|
||||
'',
|
||||
30,
|
||||
100,
|
||||
true
|
||||
);
|
||||
|
||||
$t->data[2][0] = __('WebSocket proxy url').ui_print_help_tip(__('If you had configured a wsproxy set here target URL (for instance ws://your.public.fqdn/ws).'), true);
|
||||
$t->data[2][2] = html_print_input_text(
|
||||
'ws_proxy_url',
|
||||
$config['ws_proxy_url'],
|
||||
'',
|
||||
30,
|
||||
100,
|
||||
true
|
||||
);
|
||||
|
||||
html_print_input_hidden('update_config', 1);
|
||||
html_print_table($t);
|
||||
|
||||
|
||||
echo '</fieldset>';
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
|
|
@ -557,7 +557,7 @@ $row++;
|
|||
|
||||
|
||||
// For 5.1 Autohidden menu feature
|
||||
$table_styles->data['autohidden'][0] = __('Autohidden menu');
|
||||
$table_styles->data['autohidden'][0] = __('Automatically hide submenu');
|
||||
$table_styles->data['autohidden'][1] = html_print_checkbox_switch(
|
||||
'autohidden_menu',
|
||||
1,
|
||||
|
@ -1032,6 +1032,12 @@ $row++;
|
|||
);
|
||||
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = __('Font size for items reports');
|
||||
$table_other->data[$row][1] = "<input type ='number' value=".$config['font_size_item_report']." size='1' name='font_size_item_report' min='1' max='9' step='0.1'>";
|
||||
|
||||
$row++;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
$dirItems = scandir($config['homedir'].'/images/custom_logo');
|
||||
foreach ($dirItems as $entryDir) {
|
||||
|
|
|
@ -418,7 +418,7 @@ if ($own_info['is_admin']) {
|
|||
else {
|
||||
foreach ($info1 as $key => $usr) {
|
||||
$u = get_user_info($key);
|
||||
$g = users_get_groups($key, 'AR', $u['is_admin']);
|
||||
$g = users_get_groups($key, false, $u['is_admin']);
|
||||
$result = array_intersect($g, $own_groups);
|
||||
|
||||
// Show users without profile too.
|
||||
|
|
|
@ -404,13 +404,42 @@ class Wizard
|
|||
|
||||
/**
|
||||
* Print a block of inputs.
|
||||
* Example, using direct to 'anidate' inputs directly to wrapper:
|
||||
* [
|
||||
* 'wrapper' => 'div',
|
||||
* 'block_id' => 'example_id',
|
||||
* 'class' => 'your class',
|
||||
* 'direct' => 1,
|
||||
* 'block_content' => [
|
||||
* [
|
||||
* 'arguments' => [
|
||||
* 'label' => __('Sugesstion'),
|
||||
* 'type' => 'button',
|
||||
* 'attributes' => 'class="sub ok btn_sug"',
|
||||
* 'name' => 'option_1',
|
||||
* 'id' => 'option_1',
|
||||
* 'script' => 'change_option1()',
|
||||
* ],
|
||||
* ],
|
||||
* [
|
||||
* 'arguments' => [
|
||||
* 'label' => __('Something is not quite right'),
|
||||
* 'type' => 'button',
|
||||
* 'attributes' => 'class="sub ok btn_something"',
|
||||
* 'name' => 'option_2',
|
||||
* 'id' => 'option_2',
|
||||
* 'script' => 'change_option2()',
|
||||
* ],
|
||||
* ],
|
||||
* ],
|
||||
* ].
|
||||
*
|
||||
* @param array $input Definition of target block to be printed.
|
||||
* @param boolean $return Return as string or direct output.
|
||||
*
|
||||
* @return string HTML content.
|
||||
*/
|
||||
public function printBlock(array $input, bool $return=false)
|
||||
public function printBlock(array $input, bool $return=false, bool $not_direct=false)
|
||||
{
|
||||
$output = '';
|
||||
if ($input['hidden'] == 1) {
|
||||
|
@ -424,33 +453,47 @@ class Wizard
|
|||
}
|
||||
|
||||
if (is_array($input['block_content']) === true) {
|
||||
$not_direct = (bool) $input['direct'];
|
||||
|
||||
// Print independent block of inputs.
|
||||
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
||||
|
||||
if ($input['wrapper']) {
|
||||
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
||||
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
|
||||
} else {
|
||||
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
|
||||
}
|
||||
|
||||
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
||||
if (!$not_direct) {
|
||||
// Avoid encapsulation if input is direct => 1.
|
||||
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
||||
}
|
||||
|
||||
foreach ($input['block_content'] as $input) {
|
||||
$output .= $this->printBlock($input, $return);
|
||||
$output .= $this->printBlock($input, $return, (bool) $not_direct);
|
||||
}
|
||||
|
||||
// Close block.
|
||||
if ($input['wrapper']) {
|
||||
$output .= '</ul></'.$input['wrapper'].'>';
|
||||
} else {
|
||||
$output .= '</ul></li>';
|
||||
if (!$not_direct) {
|
||||
$output .= '</ul>';
|
||||
}
|
||||
|
||||
if ($input['wrapper']) {
|
||||
$output .= '</'.$input['wrapper'].'>';
|
||||
}
|
||||
|
||||
$output .= '</li>';
|
||||
} else {
|
||||
if ($input['arguments']['type'] != 'hidden') {
|
||||
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
|
||||
if (!$not_direct) {
|
||||
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
|
||||
}
|
||||
|
||||
$output .= '<label>'.$input['label'].'</label>';
|
||||
$output .= $this->printInput($input['arguments']);
|
||||
// Allow dynamic content.
|
||||
$output .= $input['extra'];
|
||||
$output .= '</li>';
|
||||
if (!$not_direct) {
|
||||
$output .= '</li>';
|
||||
}
|
||||
} else {
|
||||
$output .= $this->printInput($input['arguments']);
|
||||
// Allow dynamic content.
|
||||
|
|
Binary file not shown.
After ![]() (image error) Size: 369 B |
Binary file not shown.
After ![]() (image error) Size: 554 B |
Binary file not shown.
After ![]() (image error) Size: 190 KiB |
Binary file not shown.
After ![]() (image error) Size: 1.5 KiB |
Binary file not shown.
After ![]() (image error) Size: 1.4 KiB |
Binary file not shown.
After ![]() (image error) Size: 1.5 KiB |
Binary file not shown.
After ![]() (image error) Size: 1.4 KiB |
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* Welcome window ajax controller.
|
||||
*
|
||||
* @category WelcomeWindow
|
||||
* @package Pandora FMS
|
||||
* @subpackage New Installation Welcome Window
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/class/WelcomeWindow.class.php';
|
||||
if (is_ajax() === false) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$ajaxPage = 'include/ajax/welcome_window';
|
||||
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$welcome_actions = new WelcomeWindow(true, $ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Ajax controller.
|
||||
$method = get_parameter('method', '');
|
||||
|
||||
if (method_exists($welcome_actions, $method) === true) {
|
||||
if ($welcome_actions->ajaxMethod($method) === true) {
|
||||
$welcome_actions->{$method}();
|
||||
} else {
|
||||
$welcome_actions->error('Unavailable method.');
|
||||
}
|
||||
} else {
|
||||
$welcome_actions->error('Method not found. ['.$method.']');
|
||||
}
|
||||
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
|
@ -2354,26 +2354,52 @@ class ConsoleSupervisor
|
|||
public function checkConsoleServerVersions()
|
||||
{
|
||||
global $config;
|
||||
// List all servers except satellite server
|
||||
// List all servers except satellite server.
|
||||
$server_version_list = db_get_all_rows_sql(
|
||||
'SELECT name, version FROM tserver WHERE server_type != '.SERVER_TYPE_ENTERPRISE_SATELLITE
|
||||
sprintf(
|
||||
'SELECT `name`, `version`
|
||||
FROM tserver
|
||||
WHERE server_type != %d
|
||||
GROUP BY `version`',
|
||||
SERVER_TYPE_ENTERPRISE_SATELLITE
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($server_version_list as $server) {
|
||||
if (strpos($server['version'], $config['current_package_enterprise']) === false) {
|
||||
$title_ver_misaligned = $server['name'].' version misaligned with Console';
|
||||
$message_ver_misaligned = 'Server '.$server['name'].' and this console have different versions. This might cause several malfunctions. Please, update this server.';
|
||||
$missed = 0;
|
||||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.MISALIGNED',
|
||||
'title' => __($title_ver_misaligned),
|
||||
'message' => __($message_ver_misaligned),
|
||||
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
]
|
||||
);
|
||||
if (is_array($server_version_list) === true) {
|
||||
foreach ($server_version_list as $server) {
|
||||
if (strpos(
|
||||
$server['version'],
|
||||
$config['current_package_enterprise']
|
||||
) === false
|
||||
) {
|
||||
$missed++;
|
||||
$title_ver_misaligned = __(
|
||||
'%s version misaligned with Console',
|
||||
$server['name']
|
||||
);
|
||||
$message_ver_misaligned = __(
|
||||
'Server %s and this console have different versions. This might cause several malfunctions. Please, update this server.',
|
||||
$server['name']
|
||||
);
|
||||
|
||||
$this->notify(
|
||||
[
|
||||
'type' => 'NOTIF.SERVER.MISALIGNED',
|
||||
'title' => __($title_ver_misaligned),
|
||||
'message' => __($message_ver_misaligned),
|
||||
'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup notifications if exception is recovered.
|
||||
if ($missed == 0) {
|
||||
$this->cleanNotifications('NOTIF.SERVER.MISALIGNED');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -403,6 +403,8 @@ class CredentialStore extends Wizard
|
|||
{
|
||||
global $config;
|
||||
|
||||
$filter = [];
|
||||
|
||||
if ($product !== false) {
|
||||
$filter['product'] = $product;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,390 @@
|
|||
<?php
|
||||
/**
|
||||
* Credential store
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Help Feedback
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
||||
ui_require_css_file('pandora');
|
||||
/**
|
||||
* Class HelpFeedBack.
|
||||
*/
|
||||
class HelpFeedBack extends Wizard
|
||||
{
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $AJAXMethods = [
|
||||
'loadFeedbackForm',
|
||||
'sendMailMethod',
|
||||
];
|
||||
|
||||
/**
|
||||
* Url of controller.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ajaxController;
|
||||
|
||||
|
||||
/**
|
||||
* Checks if target method is available to be called using AJAX.
|
||||
*
|
||||
* @param string $method Target method.
|
||||
*
|
||||
* @return boolean True allowed, false not.
|
||||
*/
|
||||
public function ajaxMethod($method)
|
||||
{
|
||||
return in_array($method, $this->AJAXMethods);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $ajax_controller Controller.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function __construct($ajax_controller)
|
||||
{
|
||||
$this->ajaxController = $ajax_controller;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Main method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
ui_require_css_File('discovery');
|
||||
ui_require_css_file('help_feedback');
|
||||
|
||||
$help_url = get_parameter('url', null);
|
||||
if ($help_url === null) {
|
||||
echo __('Page not found');
|
||||
} else {
|
||||
?>
|
||||
<iframe width="100%" height="100%" frameBorder="0"
|
||||
src="<?php echo $help_url; ?>">
|
||||
<?php echo __('Browser not compatible.'); ?>
|
||||
</iframe>
|
||||
<?php
|
||||
}
|
||||
|
||||
$hidden = '<input type="hidden" value="'.$help_url.'" ';
|
||||
$hidden .= ' form="feedback_form" name="help_url" />';
|
||||
|
||||
echo $hidden;
|
||||
|
||||
echo '<div class="help_feedback">';
|
||||
// Load feedback form.
|
||||
echo $this->loadFeedbackForm();
|
||||
echo '</div><div id="back" style="display: none"></div>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads a feedback form
|
||||
*
|
||||
* @return string HTML code for form.
|
||||
*
|
||||
* @return Function loadFeedbackForm.
|
||||
*/
|
||||
public function loadFeedbackForm()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$form = [
|
||||
'action' => '#',
|
||||
'id' => 'feedback_form',
|
||||
'onsubmit' => 'return false;',
|
||||
];
|
||||
|
||||
$inputs = [
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'flex-row-baseline w100p',
|
||||
'class' => 'flex-row-baseline w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => __('Sugesstion'),
|
||||
'type' => 'radio_button',
|
||||
'attributes' => 'class="btn"',
|
||||
'name' => 'suggestion',
|
||||
'id' => 'suggestion',
|
||||
'script' => 'disableRadio(\'report\')',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => __('Something is not quite right'),
|
||||
'type' => 'radio_button',
|
||||
'attributes' => 'class="btn"',
|
||||
'name' => 'report',
|
||||
'id' => 'report',
|
||||
'script' => 'disableRadio(\'suggestion\')',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
||||
'label' => __('What happened?'),
|
||||
'class' => 'explain',
|
||||
'arguments' => [
|
||||
'class' => 'textarea_feedback',
|
||||
'id' => 'feedback_text',
|
||||
'type' => 'textarea',
|
||||
'name' => 'feedback_text',
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Your Email'),
|
||||
'arguments' => [
|
||||
'id' => 'feedback_email',
|
||||
'name' => 'feedback_email',
|
||||
'input_class' => 'email_feedback',
|
||||
'class' => 'email_feedback',
|
||||
'type' => 'email',
|
||||
'required' => true,
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'button_class' => 'btn_submit',
|
||||
'class' => 'btn_submit',
|
||||
'attributes' => 'class="sub next btn_submit_feed_back"',
|
||||
'type' => 'submit',
|
||||
'id' => 'submit_feedback',
|
||||
'label' => __('Submit'),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$output = ui_print_toggle(
|
||||
[
|
||||
'id' => 'toggle_help_feedback',
|
||||
'content' => $this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
'inputs' => $inputs,
|
||||
],
|
||||
true
|
||||
),
|
||||
'name' => __('Feedback'),
|
||||
'return' => true,
|
||||
'class' => 'no-border',
|
||||
'img_a' => 'images/arrow_down_white.png',
|
||||
'img_b' => 'images/arrow_up_white.png',
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$output .= $this->loadJS();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function send_mail_method,we use send_email_attachment method
|
||||
* from functions_cron.php.
|
||||
*
|
||||
* @param string $feedback_option type fo mail.
|
||||
* @param string $feedback_text text mail.
|
||||
* @param string $feedback_mail costumer mail.
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
public function sendMailMethod()
|
||||
{
|
||||
$suggestion = get_parameter('type', 'false');
|
||||
$feedback_text = get_parameter('feedback_text', null);
|
||||
$feedback_mail = get_parameter('feedback_email', null);
|
||||
$help_url = get_parameter('help_url', 'unknown');
|
||||
|
||||
$section = explode('title=', $help_url, 2);
|
||||
|
||||
$subject = '';
|
||||
if (is_array($section) === true && isset($section[1]) === true) {
|
||||
$subject = '['.$section[1].']';
|
||||
}
|
||||
|
||||
if ($suggestion !== 'false') {
|
||||
$subject .= __('[pandorafms wiki] New suggestion');
|
||||
} else {
|
||||
$subject .= __('[pandorafms wiki] New report');
|
||||
}
|
||||
|
||||
if (empty($feedback_mail) === true) {
|
||||
$error = [
|
||||
'error' => __(
|
||||
'Please provide your email address, we promise not to bother you'
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
if (empty($feedback_text) === true) {
|
||||
if ($suggestion !== 'false') {
|
||||
$msg = 'Please provide some feedback. Write something awesome!';
|
||||
} else {
|
||||
$msg = 'Please provide some feedback. We\'ll appreciate it!';
|
||||
}
|
||||
|
||||
$error = [
|
||||
'error' => __($msg),
|
||||
];
|
||||
}
|
||||
|
||||
if ($error !== null) {
|
||||
echo json_encode($error);
|
||||
exit;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_cron.php');
|
||||
|
||||
$uid = $config['pandora_uid'];
|
||||
if (empty($uid) === true) {
|
||||
$uid = 'not registered';
|
||||
}
|
||||
|
||||
$body = '<ul><li><b>User mail</b> '.$feedback_mail.'</li>';
|
||||
$body .= '<li><b>Console</b> <i>'.$uid.'</i></li>';
|
||||
$body .= '<li><b>URL</b> '.$help_url.'</li></ul>';
|
||||
$body .= '<h2>Message</h2>';
|
||||
$body .= '<p>'.$feedback_text.'</p>';
|
||||
|
||||
$res = enterprise_hook(
|
||||
'send_email_attachment',
|
||||
[
|
||||
'feedback@artica.es',
|
||||
$body,
|
||||
$subject,
|
||||
]
|
||||
);
|
||||
|
||||
// Response.
|
||||
if ($res == 1) {
|
||||
$r = ['error' => ''];
|
||||
} else {
|
||||
$r = ['error' => __('Something went wrong while sending the report.')];
|
||||
}
|
||||
|
||||
echo json_encode($r);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load extra JS.
|
||||
*
|
||||
* @return string JS content.
|
||||
*/
|
||||
public function loadJS()
|
||||
{
|
||||
ob_start();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function disableRadio(id) {
|
||||
$('#'+id).prop('checked', false)
|
||||
}
|
||||
|
||||
// Set values to data.
|
||||
$("#feedback_form").on('submit', function() {
|
||||
// Make the AJAX call to send mails.
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "<?php echo $this->ajaxController; ?>",
|
||||
method: 'sendMailMethod',
|
||||
type: $('#suggestion').prop('checked'),
|
||||
feedback_text: $("textarea[name=feedback_text]").val(),
|
||||
feedback_email: $("input[name=feedback_email]").val(),
|
||||
help_url: $("input[name=help_url]").val(),
|
||||
},
|
||||
success: function (data) {
|
||||
var title;
|
||||
var content;
|
||||
var failed = 0;
|
||||
var className='submit-next';
|
||||
|
||||
if (data.error != "") {
|
||||
title = '<?php echo __('Failed'); ?>';
|
||||
content = data.error;
|
||||
failed = 1;
|
||||
className='submit-cancel';
|
||||
} else {
|
||||
title = '<?php echo __('Success'); ?>';
|
||||
content = '<?php echo __('Your report had been successfully sent to Artica.').'<br>'.__('Thank you!'); ?>';
|
||||
}
|
||||
$('#back').html(content);
|
||||
$('#back').dialog({
|
||||
title: title,
|
||||
buttons: [
|
||||
{
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd " + className,
|
||||
text: '<?php echo __('OK'); ?>',
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
if (failed == 0) {
|
||||
$('#toggle_help_feedback').empty();
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
})
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to send help feedback mail")
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2642,8 +2642,17 @@ class NetworkMap
|
|||
*/
|
||||
public function loadMapData()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$networkmap = $this->map;
|
||||
|
||||
// ACL.
|
||||
$networkmap_write = check_acl(
|
||||
$config['id_user'],
|
||||
$networkmap['id_group'],
|
||||
'MW'
|
||||
);
|
||||
|
||||
$simulate = false;
|
||||
if (isset($networkmap['__simulated']) === false) {
|
||||
$networkmap['filter'] = json_decode(
|
||||
|
@ -2711,6 +2720,7 @@ class NetworkMap
|
|||
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
|
||||
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
|
||||
$output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n";
|
||||
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
|
||||
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
|
||||
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
|
||||
$output .= "var networkmap = {'nodes': [], 'links': []};\n";
|
||||
|
|
|
@ -0,0 +1,900 @@
|
|||
<?php
|
||||
/**
|
||||
* Welcome to Pandora FMS feature.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage New Installation Welcome Window
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
||||
|
||||
/**
|
||||
* Class WelcomeWindow.
|
||||
*/
|
||||
class WelcomeWindow extends Wizard
|
||||
{
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $AJAXMethods = [
|
||||
'loadWelcomeWindow',
|
||||
'cancelWelcome',
|
||||
];
|
||||
|
||||
/**
|
||||
* Tasks.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $tasks = [
|
||||
'welcome_mail_configured',
|
||||
'welcome_id_agent',
|
||||
'welcome_module',
|
||||
'welcome_alert',
|
||||
'welcome_task',
|
||||
];
|
||||
|
||||
/**
|
||||
* Url of controller.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ajaxController;
|
||||
|
||||
/**
|
||||
* Current step.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $step;
|
||||
|
||||
/**
|
||||
* Current agent (created example).
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $agent;
|
||||
|
||||
|
||||
/**
|
||||
* Generates a JSON error.
|
||||
*
|
||||
* @param string $msg Error message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function error($msg)
|
||||
{
|
||||
echo json_encode(
|
||||
['error' => $msg]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if target method is available to be called using AJAX.
|
||||
*
|
||||
* @param string $method Target method.
|
||||
*
|
||||
* @return boolean True allowed, false not.
|
||||
*/
|
||||
public function ajaxMethod($method)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Check access.
|
||||
check_login();
|
||||
|
||||
return in_array($method, $this->AJAXMethods);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param boolean $must_run Must run or not.
|
||||
* @param string $ajax_controller Controller.
|
||||
*
|
||||
* @return object
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public function __construct(
|
||||
bool $must_run=false,
|
||||
$ajax_controller='include/ajax/welcome_window'
|
||||
) {
|
||||
$this->ajaxController = $ajax_controller;
|
||||
|
||||
if ($this->initialize($must_run) !== true) {
|
||||
throw new Exception('Must not be shown');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Main method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
ui_require_css_file('new_installation_welcome_window');
|
||||
echo '<div id="welcome_modal_window" style="display: none"; >';
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
load_modal({
|
||||
target: $('#welcome_modal_window'),
|
||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||
modal: {
|
||||
title: "<?php echo __('Welcome to Pandora FMS'); ?>",
|
||||
cancel: '<?php echo __('Do not show anymore'); ?>',
|
||||
ok: '<?php echo __('Close'); ?>'
|
||||
},
|
||||
onshow: {
|
||||
page: '<?php echo $this->ajaxController; ?>',
|
||||
method: 'loadWelcomeWindow',
|
||||
},
|
||||
oncancel: {
|
||||
page: '<?php echo $this->ajaxController; ?>',
|
||||
title: "<?php echo __('Cancel Configuration Window'); ?>",
|
||||
method: 'cancelWelcome',
|
||||
confirm: function (fn) {
|
||||
confirmDialog({
|
||||
title: '<?php echo __('Are you sure?'); ?>',
|
||||
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
|
||||
ok: '<?php echo __('OK'); ?>',
|
||||
cancel: '<?php echo __('Cancel'); ?>',
|
||||
onAccept: function() {
|
||||
// Continue execution.
|
||||
fn();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to cancel welcome modal window.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cancelWelcome()
|
||||
{
|
||||
// Config update value.
|
||||
$this->setStep(WELCOME_FINISHED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return current step.
|
||||
*
|
||||
* @return integer Step.
|
||||
*/
|
||||
public function getStep(): int
|
||||
{
|
||||
global $config;
|
||||
$this->step = $config['welcome_state'];
|
||||
|
||||
// Get step available.
|
||||
if (empty($config['welcome_mail_configured']) === true
|
||||
&& get_parameter('sec2') == 'godmode/setup/setup'
|
||||
&& get_parameter('section', '') == 'general'
|
||||
&& get_parameter('update_config', false) !== false
|
||||
) {
|
||||
$this->step = W_CONFIGURE_MAIL;
|
||||
} else if (empty($config['welcome_id_agent']) === true) {
|
||||
$this->step = W_CREATE_AGENT;
|
||||
} else if (empty($config['welcome_module']) === true) {
|
||||
$this->step = W_CREATE_MODULE;
|
||||
} else if (empty($config['welcome_alert']) === true) {
|
||||
$this->step = W_CREATE_ALERT;
|
||||
} else if (empty($config['welcome_task']) === true) {
|
||||
$this->step = W_CREATE_TASK;
|
||||
}
|
||||
|
||||
return $this->step;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets current step.
|
||||
*
|
||||
* @param integer $step Current step.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setStep(int $step)
|
||||
{
|
||||
$this->step = $step;
|
||||
config_update_value('welcome_state', $step);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Completes current step.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function completeStep()
|
||||
{
|
||||
switch ($this->step) {
|
||||
case W_CONFIGURE_MAIL:
|
||||
config_update_value('welcome_mail_configured', true);
|
||||
break;
|
||||
|
||||
case W_CREATE_AGENT:
|
||||
config_update_value('welcome_id_agent', true);
|
||||
break;
|
||||
|
||||
case W_CREATE_MODULE:
|
||||
config_update_value('welcome_module', true);
|
||||
break;
|
||||
|
||||
case W_CREATE_ALERT:
|
||||
config_update_value('welcome_alert', true);
|
||||
break;
|
||||
|
||||
case W_CREATE_TASK:
|
||||
config_update_value('welcome_task', true);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if all tasks had been completed.
|
||||
*
|
||||
* @return boolean All completed or not.
|
||||
*/
|
||||
public function checkAllTasks()
|
||||
{
|
||||
global $config;
|
||||
|
||||
foreach ($this->tasks as $t) {
|
||||
if (empty($config[$t]) === true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve current welcome agent id.
|
||||
*
|
||||
* @return integer Agent id (created).
|
||||
*/
|
||||
public function getWelcomeAgent()
|
||||
{
|
||||
global $config;
|
||||
|
||||
return $config['welcome_id_agent'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves current welcome agent (latest created).
|
||||
*
|
||||
* @param integer $id_agent Agent id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setWelcomeAgent(int $id_agent)
|
||||
{
|
||||
config_update_value('welcome_id_agent', $id_agent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads a welcome window form
|
||||
*
|
||||
* @return string HTML code for form.
|
||||
*
|
||||
* @return void Runs loadWelcomeWindow (AJAX).
|
||||
*/
|
||||
public function loadWelcomeWindow()
|
||||
{
|
||||
global $config;
|
||||
$btn_configure_mail_class = 'pending';
|
||||
$btn_create_agent_class = 'pending';
|
||||
$btn_create_module_class = '';
|
||||
$btn_create_alert_class = '';
|
||||
$btn_create_discovery_class = 'pending';
|
||||
|
||||
$li_configure_mail_class = 'row_green';
|
||||
$li_create_agent_class = 'row_green';
|
||||
$li_create_module_class = 'row_grey';
|
||||
$li_create_alert_class = 'row_grey';
|
||||
$li_create_discovery_class = 'row_green';
|
||||
|
||||
if (empty($config['welcome_mail_configured']) === false) {
|
||||
$btn_configure_mail_class = ' completed';
|
||||
}
|
||||
|
||||
if (empty($config['welcome_id_agent']) === false) {
|
||||
$btn_create_agent_class = ' completed';
|
||||
$btn_create_module_class = ' pending';
|
||||
$li_create_module_class = 'row_green';
|
||||
}
|
||||
|
||||
if (empty($config['welcome_module']) === false) {
|
||||
$btn_create_module_class = ' completed';
|
||||
$btn_create_alert_class = ' pending';
|
||||
$li_create_module_class = 'row_green';
|
||||
}
|
||||
|
||||
if (empty($config['welcome_alert']) === false) {
|
||||
$btn_create_alert_class = ' completed';
|
||||
$li_create_alert_class = 'row_green';
|
||||
}
|
||||
|
||||
if (empty($config['welcome_task']) === false) {
|
||||
$btn_create_discovery_class = ' completed';
|
||||
}
|
||||
|
||||
if ((int) $config['welcome_state'] === WELCOME_FINISHED) {
|
||||
// Nothing left to do.
|
||||
$btn_configure_mail_class = ' completed';
|
||||
$btn_create_agent_class = ' completed';
|
||||
$btn_create_module_class = ' completed';
|
||||
$btn_create_alert_class = ' completed';
|
||||
$btn_create_discovery_class = ' completed';
|
||||
$li_create_module_class = 'row_green';
|
||||
$li_create_alert_class = 'row_green';
|
||||
}
|
||||
|
||||
$form = [
|
||||
'action' => '#',
|
||||
'id' => 'welcome_form',
|
||||
'onsubmit' => 'this.dialog("close");',
|
||||
'class' => 'modal',
|
||||
];
|
||||
|
||||
$logo_url = '';
|
||||
if (enterprise_installed()) {
|
||||
$logo_url = ENTERPRISE_DIR.'/';
|
||||
}
|
||||
|
||||
$logo_url .= 'images/custom_logo/'.$config['custom_logo_white_bg'];
|
||||
|
||||
$inputs = [
|
||||
[
|
||||
'class' => 'white_box',
|
||||
'block_content' => [
|
||||
[
|
||||
'class' => 'centered_full',
|
||||
'arguments' => [
|
||||
'type' => 'image',
|
||||
'src' => $logo_url,
|
||||
'value' => 1,
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_configure_mail',
|
||||
'class' => 'hole flex-row w100p '.$li_configure_mail_class,
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Please ensure mail configuration matches your needs'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_create_agent',
|
||||
'id' => 'lbl_create_agent',
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'type' => 'button',
|
||||
'attributes' => 'class="go '.$btn_configure_mail_class.'"',
|
||||
'name' => 'btn_email_conf',
|
||||
'id' => 'btn_email_conf',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => 'Learn to monitor',
|
||||
'class' => 'extra',
|
||||
'arguments' => [
|
||||
'class' => 'class="lbl_learn"',
|
||||
'name' => 'lbl_learn',
|
||||
'id' => 'lbl_learn',
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_create_agent',
|
||||
'class' => 'learn_content_indented flex-row w100p '.$li_create_agent_class,
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Create an agent'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_create_agent',
|
||||
'id' => 'lbl_create_agent',
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'type' => 'button',
|
||||
'attributes' => 'class="go '.$btn_create_agent_class.'"',
|
||||
'name' => 'btn_create_agent',
|
||||
'id' => 'btn_create_agent',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_monitor_actions',
|
||||
'class' => 'learn_content_indented flex-row w100p '.$li_create_module_class,
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Create a module to check if an agent is online'),
|
||||
'arguments' => [
|
||||
'class' => 'second_lbl',
|
||||
'name' => 'lbl_check_agent',
|
||||
'id' => 'lbl_check_agent',
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'type' => 'button',
|
||||
'attributes' => 'class="go '.$btn_create_module_class.'"',
|
||||
'name' => 'btn_create_module',
|
||||
'id' => 'btn_create_module',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_monitor_actions',
|
||||
'class' => 'hole learn_content_indented flex-row w100p '.$li_create_alert_class,
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Be warned if something is wrong, create an alert on the module'),
|
||||
'arguments' => [
|
||||
'class' => 'second_lbl',
|
||||
'name' => 'lbl_create_alert',
|
||||
'id' => 'lbl_create_alert',
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'type' => 'button',
|
||||
'attributes' => 'class="go '.$btn_create_alert_class.'"',
|
||||
'name' => 'btn_create_alert',
|
||||
'id' => 'btn_create_alert',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_discover',
|
||||
'class' => 'hole flex-row w100p '.$li_create_discovery_class,
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('Discover hosts and devices in your network'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_discover_devices',
|
||||
'id' => 'lbl_discover_devices',
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => '',
|
||||
'type' => 'button',
|
||||
'attributes' => 'class="go '.$btn_create_discovery_class.'"',
|
||||
'name' => 'btn_discover_devices',
|
||||
'id' => 'btn_discover_devices',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$inputs[] = [
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'div_not_working',
|
||||
'class' => 'hole flex-row w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'label' => __('If something is not working as expected, look for this icon and report!'),
|
||||
'arguments' => [
|
||||
'class' => 'first_lbl',
|
||||
'name' => 'lbl_not_working',
|
||||
'id' => 'lbl_not_working',
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => html_print_image(
|
||||
'images/feedback-header.png',
|
||||
true,
|
||||
[
|
||||
'onclick' => '$(\'#feedback-header\').click()',
|
||||
'style' => 'cursor: pointer;',
|
||||
]
|
||||
),
|
||||
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$output = $this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
'inputs' => $inputs,
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$output .= $this->loadJS();
|
||||
echo $output;
|
||||
|
||||
// Ajax methods does not continue.
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function acts as a constructor. Receive the condition to check with
|
||||
* the global config (welcome_state) if continues
|
||||
*
|
||||
* @param boolean $must_run Must be run or not (check register.php).
|
||||
*
|
||||
* @return boolean True if initialized or false if must not run.
|
||||
*/
|
||||
public function initialize($must_run)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['welcome_state']) === false) {
|
||||
$this->completeStep();
|
||||
$this->setStep(W_CONFIGURE_MAIL);
|
||||
}
|
||||
|
||||
// Check current page.
|
||||
$sec2 = get_parameter('sec2', '');
|
||||
|
||||
// Search also does not fulfill sec2.
|
||||
if (empty($sec2) === true) {
|
||||
$sec2 = get_parameter('keywords', '');
|
||||
}
|
||||
|
||||
if ($must_run === false
|
||||
|| ((int) $config['welcome_state']) === WELCOME_FINISHED
|
||||
) {
|
||||
// Do not show if finished.
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->step = $this->getStep();
|
||||
$this->agent = $this->getWelcomeAgent();
|
||||
|
||||
/*
|
||||
* Configure mail. Control current flow.
|
||||
*
|
||||
* On empty sec2: show current step.
|
||||
* On setup page: do not show.
|
||||
* After mail configuration: enable agent step.
|
||||
*/
|
||||
|
||||
if ($this->step === W_CONFIGURE_MAIL) {
|
||||
if ($sec2 === 'godmode/setup/setup'
|
||||
&& get_parameter('section', '') == 'general'
|
||||
&& get_parameter('update_config', false) !== false
|
||||
) {
|
||||
// Mail configuration have been processed.
|
||||
$this->step = W_CONFIGURE_MAIL;
|
||||
$this->completeStep();
|
||||
$this->setStep(W_CREATE_AGENT);
|
||||
} else if ($sec2 === 'godmode/setup/setup'
|
||||
&& get_parameter('section', '') === 'general'
|
||||
) {
|
||||
// Mail configuration is being processed.
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// Show main page.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create agent. Control current flow.
|
||||
*
|
||||
* Welcome wizard is shown if you create your first agent.
|
||||
*
|
||||
*/
|
||||
|
||||
if (empty($config['welcome_id_agent']) === true) {
|
||||
// Create agent is pending.
|
||||
if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('create_agent', false) !== false
|
||||
) {
|
||||
// Agent have been created. Store.
|
||||
// Here complete step is not needed because is already done
|
||||
// by setWelcomeAgent.
|
||||
$this->setWelcomeAgent(
|
||||
// Non yet processed. Get next available ID.
|
||||
db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT AUTO_INCREMENT
|
||||
FROM information_schema.TABLES
|
||||
WHERE TABLE_SCHEMA = "%s"
|
||||
AND TABLE_NAME = "%s"',
|
||||
$config['dbname'],
|
||||
'tagente'
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->setStep(W_CREATE_MODULE);
|
||||
return true;
|
||||
} else if ($sec2 === 'godmode/agentes/configurar_agente') {
|
||||
// Agent is being created.
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// If at main page, show welcome.
|
||||
return true;
|
||||
}
|
||||
} else if ($this->step === W_CREATE_AGENT) {
|
||||
$this->step = W_CREATE_MODULE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create module. Control current flow.
|
||||
*
|
||||
* On empty sec2: show current step.
|
||||
* On module creation page: do not show.
|
||||
* After module creation: enable alert step.
|
||||
*/
|
||||
|
||||
if ($this->step === W_CREATE_MODULE) {
|
||||
// Create module is pending.
|
||||
if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('tab', '') === 'module'
|
||||
&& get_parameter('create_module', false) !== false
|
||||
) {
|
||||
// Module have been created.
|
||||
$this->completeStep();
|
||||
$this->setStep(W_CREATE_ALERT);
|
||||
return true;
|
||||
} else if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('tab', '') === 'module'
|
||||
) {
|
||||
// Module is being created.
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// If at main page, show welcome.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create alert. Control current flow.
|
||||
*
|
||||
* On empty sec2: show current step.
|
||||
* On alert creation page: do not show.
|
||||
* After alert creation: enable discovery task step.
|
||||
*/
|
||||
|
||||
if ($this->step === W_CREATE_ALERT) {
|
||||
// Create alert is pending.
|
||||
if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('tab', '') === 'alert'
|
||||
&& get_parameter('create_alert', false) !== false
|
||||
) {
|
||||
// Alert have been created.
|
||||
$this->completeStep();
|
||||
$this->setStep(W_CREATE_TASK);
|
||||
return true;
|
||||
} else if ($sec2 === 'godmode/agentes/configurar_agente'
|
||||
&& get_parameter('tab', '') === 'alert'
|
||||
) {
|
||||
// Alert is being created.
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// If at main page, show welcome.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Create discovery task. Control current flow.
|
||||
*
|
||||
* On empty sec2: show current step.
|
||||
* On discovery task creation page: do not show.
|
||||
* After discovery task creation: finish.
|
||||
*/
|
||||
|
||||
// Create Discovery task is pending.
|
||||
// Host&Devices finishses on page 2.
|
||||
if ($sec2 === 'godmode/servers/discovery'
|
||||
&& get_parameter('page', 0) == 2
|
||||
) {
|
||||
// Discovery task have been created.
|
||||
$this->step = W_CREATE_TASK;
|
||||
$this->completeStep();
|
||||
|
||||
// Check if all other tasks had been completed.
|
||||
if ($this->checkAllTasks() === true) {
|
||||
// Finished! do not show.
|
||||
$this->setStep(WELCOME_FINISHED);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if ($sec2 == 'godmode/servers/discovery') {
|
||||
// Discovery task is being created.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if all other tasks had been completed.
|
||||
if ($this->checkAllTasks() === true) {
|
||||
// Finished! do not show.
|
||||
$this->setStep(WELCOME_FINISHED);
|
||||
return false;
|
||||
} else if (empty($sec2) === true) {
|
||||
// Pending tasks.
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->step === WELCOME_FINISHED) {
|
||||
// Welcome tutorial finished.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return a reference to the new object.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load JS content.
|
||||
* function that enables the functions to the buttons when its action is
|
||||
* completed.
|
||||
* Assign the url of each button.
|
||||
*
|
||||
* @return string HTML code for javascript functionality.
|
||||
*/
|
||||
public function loadJS()
|
||||
{
|
||||
ob_start();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
if ($this->step > W_CREATE_AGENT) {
|
||||
switch ($this->step) {
|
||||
case W_CREATE_MODULE:
|
||||
?>
|
||||
document.getElementById("button-btn_create_module").setAttribute(
|
||||
'onclick',
|
||||
'checkAgentOnline()'
|
||||
);
|
||||
<?php
|
||||
break;
|
||||
|
||||
case W_CREATE_ALERT:
|
||||
?>
|
||||
document.getElementById("button-btn_create_alert").setAttribute(
|
||||
'onclick',
|
||||
'createAlertModule()'
|
||||
);
|
||||
<?php
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
document.getElementById("button-btn_email_conf").setAttribute(
|
||||
'onclick',
|
||||
'configureEmail()'
|
||||
);
|
||||
document.getElementById("button-btn_create_agent").setAttribute(
|
||||
'onclick',
|
||||
'createNewAgent()'
|
||||
);
|
||||
document.getElementById("button-btn_discover_devices").setAttribute(
|
||||
'onclick',
|
||||
'discoverDevicesNetwork()'
|
||||
);
|
||||
|
||||
function configureEmail() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general#table3'); ?>';
|
||||
}
|
||||
|
||||
function createNewAgent() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&new_agent=1&crt-2=Create+agent'); ?>';
|
||||
}
|
||||
|
||||
function checkAgentOnline() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$this->getWelcomeAgent().''); ?>';
|
||||
}
|
||||
|
||||
function createAlertModule() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$this->getWelcomeAgent().''); ?>';
|
||||
}
|
||||
|
||||
function monitorRemoteCommands() {
|
||||
window.location = '<?php echo ui_get_full_url(''); ?>';
|
||||
}
|
||||
|
||||
function discoverDevicesNetwork() {
|
||||
window.location = '<?php echo ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan'); ?>';
|
||||
}
|
||||
|
||||
function reportIsNotWorking() {
|
||||
}
|
||||
|
||||
function cierre_dialog(){
|
||||
this.dialog("close");
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -20,8 +20,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC191028';
|
||||
$pandora_version = 'v7.0NG.739';
|
||||
$build_version = 'PC191118';
|
||||
$pandora_version = 'v7.0NG.740';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
@ -148,8 +148,6 @@ if (!isset($config['homeurl_static'])) {
|
|||
}
|
||||
}
|
||||
|
||||
db_select_engine();
|
||||
$config['dbconnection'] = db_connect();
|
||||
|
||||
|
||||
if (! defined('EXTENSIONS_DIR')) {
|
||||
|
@ -160,6 +158,9 @@ if (! defined('ENTERPRISE_DIR')) {
|
|||
define('ENTERPRISE_DIR', 'enterprise');
|
||||
}
|
||||
|
||||
db_select_engine();
|
||||
$config['dbconnection'] = db_connect();
|
||||
|
||||
require_once $ownDir.'functions_config.php';
|
||||
|
||||
date_default_timezone_set('Europe/Madrid');
|
||||
|
|
|
@ -147,7 +147,7 @@ define('COL_UNKNOWN', '#B2B2B2');
|
|||
define('COL_DOWNTIME', '#976DB1');
|
||||
define('COL_IGNORED', '#DDD');
|
||||
define('COL_ALERTFIRED', '#F36201');
|
||||
define('COL_MINOR', '#B2B2B2');
|
||||
define('COL_MINOR', '#F099A2');
|
||||
define('COL_MAJOR', '#C97A4A');
|
||||
define('COL_INFORMATIONAL', '#E4E4E4');
|
||||
define('COL_MAINTENANCE', '#4a83f3');
|
||||
|
@ -648,3 +648,12 @@ define('HA_PENDING', 2);
|
|||
define('HA_PROCESSING', 3);
|
||||
define('HA_DISABLED', 4);
|
||||
define('HA_FAILED', 5);
|
||||
|
||||
|
||||
define('WELCOME_STARTED', 1);
|
||||
define('W_CONFIGURE_MAIL', 1);
|
||||
define('W_CREATE_AGENT', 2);
|
||||
define('W_CREATE_MODULE', 3);
|
||||
define('W_CREATE_ALERT', 4);
|
||||
define('W_CREATE_TASK', 5);
|
||||
define('WELCOME_FINISHED', -1);
|
||||
|
|
|
@ -3881,11 +3881,11 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
|
|||
$img_content = join("\n", $result);
|
||||
|
||||
if ($params['return_img_base_64']) {
|
||||
// To be used in alerts
|
||||
// To be used in alerts.
|
||||
$width_img = 500;
|
||||
return $img_content;
|
||||
} else {
|
||||
// to be used in PDF files
|
||||
// to be used in PDF files.
|
||||
$config['temp_images'][] = $img_path;
|
||||
return '<img src="'.$img_url.'" />';
|
||||
}
|
||||
|
@ -4092,6 +4092,18 @@ function mask2cidr($mask)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* convert the cidr prefix to subnet mask
|
||||
*
|
||||
* @param int cidr prefix
|
||||
* @return string subnet mask
|
||||
*/
|
||||
function cidr2mask($int)
|
||||
{
|
||||
return long2ip(-1 << (32 - (int) $int));
|
||||
}
|
||||
|
||||
|
||||
function get_help_info($section_name)
|
||||
{
|
||||
global $config;
|
||||
|
|
|
@ -1905,7 +1905,7 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
|
|||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator> in this order
|
||||
* @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator><recursion> in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example for CSV:
|
||||
*
|
||||
|
@ -1934,17 +1934,25 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
|
|||
}
|
||||
|
||||
if (isset($other['data'][0])) {
|
||||
// Filter by SO
|
||||
// Filter by SO.
|
||||
if ($other['data'][0] != '') {
|
||||
$where .= ' AND tconfig_os.id_os = '.$other['data'][0];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($other['data'][1])) {
|
||||
// Filter by group
|
||||
// Filter by group.
|
||||
if ($other['data'][1] != '') {
|
||||
$where .= ' AND id_grupo = '.$other['data'][1];
|
||||
$ag_groups = $other['data'][1];
|
||||
// Recursion.
|
||||
if ($other['data'][6] === '1') {
|
||||
$ag_groups = groups_get_id_recursive($ag_groups, true);
|
||||
}
|
||||
|
||||
$ag_groups = implode(',', (array) $ag_groups);
|
||||
}
|
||||
|
||||
$where .= ' AND (id_grupo IN ('.$ag_groups.') OR id_group IN ('.$ag_groups.'))';
|
||||
}
|
||||
|
||||
if (isset($other['data'][3])) {
|
||||
|
@ -1974,24 +1982,27 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
|
|||
// Initialization of array
|
||||
$result_agents = [];
|
||||
// Filter by state
|
||||
if (defined('METACONSOLE')) {
|
||||
$sql = "SELECT id_agente, alias, direccion, comentarios,
|
||||
tconfig_os.name, url_address, nombre
|
||||
FROM tconfig_os, tmetaconsole_agent
|
||||
LEFT JOIN tagent_secondary_group
|
||||
ON tmetaconsole_agent.id_agente = tagent_secondary_group.id_agent
|
||||
WHERE tmetaconsole_agent.id_os = tconfig_os.id_os
|
||||
AND disabled = 0 $where AND $groups";
|
||||
if (is_metaconsole()) {
|
||||
$sql = 'SELECT id_agente, alias, direccion, comentarios,
|
||||
tconfig_os.name, url_address, nombre
|
||||
FROM tconfig_os, tmetaconsole_agent
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group
|
||||
ON tmetaconsole_agent.id_agente = tmetaconsole_agent_secondary_group.id_agent
|
||||
WHERE tmetaconsole_agent.id_os = tconfig_os.id_os
|
||||
AND disabled = 0 '.$where.' AND '.$groups;
|
||||
} else {
|
||||
$sql = "SELECT id_agente, alias, direccion, comentarios,
|
||||
$sql = 'SELECT id_agente, alias, direccion, comentarios,
|
||||
tconfig_os.name, url_address, nombre
|
||||
FROM tconfig_os, tagente
|
||||
LEFT JOIN tagent_secondary_group
|
||||
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||
WHERE tagente.id_os = tconfig_os.id_os
|
||||
AND disabled = 0 $where AND $groups";
|
||||
AND disabled = 0 '.$where.' AND '.$groups;
|
||||
}
|
||||
|
||||
// Group by agent
|
||||
$sql .= ' GROUP BY id_agente';
|
||||
|
||||
$all_agents = db_get_all_rows_sql($sql);
|
||||
|
||||
// Filter by status: unknown, warning, critical, without modules
|
||||
|
@ -9080,7 +9091,9 @@ function api_set_delete_module($id, $id2, $other, $trash1)
|
|||
|
||||
function api_set_module_data($id, $thrash2, $other, $trash1)
|
||||
{
|
||||
if (defined('METACONSOLE')) {
|
||||
global $config;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9129,8 +9142,9 @@ function api_set_module_data($id, $thrash2, $other, $trash1)
|
|||
);
|
||||
|
||||
if (false === @file_put_contents($config['remote_config'].'/'.io_safe_output($agent['nombre']).'.'.$time.'.data', $xml)) {
|
||||
returnError('error_file', 'Can save agent data xml.');
|
||||
returnError('error_file', 'XML file could not be generated in path: '.$config['remote_config']);
|
||||
} else {
|
||||
echo __('XML file was generated successfully in path: ').$config['remote_config'];
|
||||
returnData('string', ['type' => 'string', 'data' => $xml]);
|
||||
return;
|
||||
}
|
||||
|
@ -14226,6 +14240,46 @@ function api_get_agents_id_name_by_cluster_name($cluster_name, $trash1, $trash2,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get agents alias, id and server id (if Metaconsole) given agent alias
|
||||
* matching part of it.
|
||||
*
|
||||
* @param string $alias
|
||||
* @param $trash1
|
||||
* @param $trash2
|
||||
* @param string $returnType
|
||||
* Example:
|
||||
* api.php?op=get&op2=agents_id_name_by_alias&return_type=json&apipass=1234&user=admin&pass=pandora&id=pandrora&id2=strict
|
||||
*/
|
||||
function api_get_agents_id_name_by_alias($alias, $strict, $trash2, $returnType)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($strict == 'strict') {
|
||||
$where_clause = " alias = '$alias'";
|
||||
} else {
|
||||
$where_clause = " upper(alias) LIKE upper('%$alias%')";
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente, id_tagente,id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE $where_clause");
|
||||
} else {
|
||||
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente from tagente WHERE $where_clause");
|
||||
}
|
||||
|
||||
if ($all_agents !== false) {
|
||||
$data = [
|
||||
'type' => 'json',
|
||||
'data' => $all_agents,
|
||||
];
|
||||
|
||||
returnData('json', $data, JSON_FORCE_OBJECT);
|
||||
} else {
|
||||
returnError('error_agents', 'Alias did not match any agent.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_get_modules_id_name_by_cluster_id($cluster_id)
|
||||
{
|
||||
global $config;
|
||||
|
|
|
@ -353,6 +353,18 @@ function config_update_config()
|
|||
if (!config_update_value('email_password', get_parameter('email_password'))) {
|
||||
$error_update[] = __('Email password');
|
||||
}
|
||||
|
||||
if (!config_update_value('ws_bind_address', get_parameter('ws_bind_address'))) {
|
||||
$error_update[] = __('WebSocket bind address');
|
||||
}
|
||||
|
||||
if (!config_update_value('ws_port', get_parameter('ws_port'))) {
|
||||
$error_update[] = __('WebSocket port');
|
||||
}
|
||||
|
||||
if (!config_update_value('ws_proxy_url', get_parameter('ws_proxy_url'))) {
|
||||
$error_update[] = __('WebSocket proxy url');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'enterprise':
|
||||
|
@ -1269,6 +1281,10 @@ function config_update_config()
|
|||
}
|
||||
|
||||
// Juanma (06/05/2014) New feature: Custom front page for reports.
|
||||
if (!config_update_value('font_size_item_report', get_parameter('font_size_item_report', 2))) {
|
||||
$error_update[] = __('Font size for items reports');
|
||||
}
|
||||
|
||||
if (!config_update_value('custom_report_front', get_parameter('custom_report_front'))) {
|
||||
$error_update[] = __('Custom report front');
|
||||
}
|
||||
|
@ -1883,6 +1899,10 @@ function config_process_config()
|
|||
config_update_value('unique_ip', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['welcome_state'])) {
|
||||
config_update_value('welcome_state', WELCOME_STARTED);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the ACL IP list for access API
|
||||
*/
|
||||
|
@ -2793,6 +2813,10 @@ function config_process_config()
|
|||
config_update_value('custom_report_front', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['font_size_item_report'])) {
|
||||
config_update_value('font_size_item_report', 2);
|
||||
}
|
||||
|
||||
if (!isset($config['custom_report_front_font'])) {
|
||||
config_update_value('custom_report_front_font', 'FreeSans.ttf');
|
||||
}
|
||||
|
|
|
@ -4559,116 +4559,98 @@ function events_page_comments($event, $ajax=false)
|
|||
// Comments.
|
||||
global $config;
|
||||
|
||||
$comments = '';
|
||||
|
||||
$comments = $event['user_comment'];
|
||||
if (isset($event['comments'])) {
|
||||
$comments = explode('<br>', $event['comments']);
|
||||
}
|
||||
|
||||
$table_comments = new stdClass;
|
||||
$table_comments->width = '100%';
|
||||
$table_comments->data = [];
|
||||
$table_comments->head = [];
|
||||
$table_comments->class = 'table_modal_alternate';
|
||||
|
||||
$comments = str_replace(["\n", '
'], '<br>', $comments);
|
||||
$comments = ($event['user_comment'] ?? '');
|
||||
|
||||
if (is_array($comments)) {
|
||||
foreach ($comments as $comm) {
|
||||
if (empty($comm)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
||||
}
|
||||
if (empty($comments)) {
|
||||
$table_comments->style[0] = 'text-align:center;';
|
||||
$table_comments->colspan[0][0] = 2;
|
||||
$data = [];
|
||||
$data[0] = __('There are no comments');
|
||||
$table_comments->data[] = $data;
|
||||
} else {
|
||||
// If comments are not stored in json, the format is old.
|
||||
$comments_array = json_decode(io_safe_output($comments), true);
|
||||
}
|
||||
|
||||
foreach ($comments_array as $comm) {
|
||||
// Show the comments more recent first.
|
||||
if (is_array($comm)) {
|
||||
$comm = array_reverse($comm);
|
||||
}
|
||||
|
||||
if (empty($comm)) {
|
||||
$comments_format = 'old';
|
||||
} else {
|
||||
$comments_format = 'new';
|
||||
}
|
||||
|
||||
switch ($comments_format) {
|
||||
case 'new':
|
||||
if (is_array($comments)) {
|
||||
foreach ($comments as $comm) {
|
||||
if (empty($comm)) {
|
||||
$table_comments->style[0] = 'text-align:center;';
|
||||
$table_comments->colspan[0][0] = 2;
|
||||
$data = [];
|
||||
$data[0] = __('There are no comments');
|
||||
$table_comments->data[] = $data;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($comm) === true
|
||||
&& is_array($comm) === true
|
||||
) {
|
||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
||||
}
|
||||
} else {
|
||||
$comments = str_replace(["\n", '
'], '<br>', $comments);
|
||||
// If comments are not stored in json, the format is old.
|
||||
$comments_array[] = json_decode(io_safe_output($comments), true);
|
||||
}
|
||||
|
||||
foreach ($comments_array as $comm) {
|
||||
// Show the comments more recent first.
|
||||
if (is_array($comm)) {
|
||||
$comm = array_reverse($comm);
|
||||
}
|
||||
|
||||
if (empty($comm)) {
|
||||
$comments_format = 'old';
|
||||
} else {
|
||||
$comments_format = 'new';
|
||||
}
|
||||
|
||||
switch ($comments_format) {
|
||||
case 'new':
|
||||
foreach ($comm as $c) {
|
||||
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
|
||||
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
|
||||
$data[1] = '<p style="word-break: break-word;">'.$c['comment'].'</p>';
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'old':
|
||||
$comm = explode('<br>', $comments);
|
||||
case 'old':
|
||||
$comm = explode('<br>', $comments);
|
||||
|
||||
// Split comments and put in table.
|
||||
$col = 0;
|
||||
$data = [];
|
||||
|
||||
foreach ($comm as $c) {
|
||||
switch ($col) {
|
||||
case 0:
|
||||
$row_text = preg_replace('/\s*--\s*/', '', $c);
|
||||
$row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
|
||||
$row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
|
||||
$row_text = preg_replace('/[\[|\]]/', '', $row_text);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
$data[$col] = $row_text;
|
||||
|
||||
$col++;
|
||||
|
||||
if ($col == 2) {
|
||||
$col = 0;
|
||||
$table_comments->data[] = $data;
|
||||
$data = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($comm) == 1 && $comm[0] == '') {
|
||||
$table_comments->style[0] = 'text-align:center;';
|
||||
$table_comments->colspan[0][0] = 2;
|
||||
// Split comments and put in table.
|
||||
$col = 0;
|
||||
$data = [];
|
||||
$data[0] = __('There are no comments');
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
foreach ($comm as $c) {
|
||||
switch ($col) {
|
||||
case 0:
|
||||
$row_text = preg_replace('/\s*--\s*/', '', $c);
|
||||
$row_text = preg_replace('/\<\/b\>/', '</i>', $row_text);
|
||||
$row_text = preg_replace('/\[/', '</b><br><br><i>[', $row_text);
|
||||
$row_text = preg_replace('/[\[|\]]/', '', $row_text);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$row_text = preg_replace("/[\r\n|\r|\n]/", '<br>', io_safe_output(strip_tags($c)));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
|
||||
$data[$col] = $row_text;
|
||||
|
||||
$col++;
|
||||
|
||||
if ($col == 2) {
|
||||
$col = 0;
|
||||
$table_comments->data[] = $data;
|
||||
$data = [];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1535,6 +1535,89 @@ function html_print_input_text($name, $value, $alt='', $size=50, $maxlength=255,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an input email element.
|
||||
*
|
||||
* @param array $settings Array with attributes input.
|
||||
* only name is necessary.
|
||||
*
|
||||
* @return string Html input.
|
||||
*/
|
||||
function html_print_input_email(array $settings):string
|
||||
{
|
||||
// TODO: const.
|
||||
$valid_attrs = [
|
||||
'accept',
|
||||
'disabled',
|
||||
'maxlength',
|
||||
'name',
|
||||
'readonly',
|
||||
'placeholder',
|
||||
'size',
|
||||
'value',
|
||||
'accesskey',
|
||||
'class',
|
||||
'dir',
|
||||
'id',
|
||||
'lang',
|
||||
'style',
|
||||
'tabindex',
|
||||
'title',
|
||||
'xml:lang',
|
||||
'onfocus',
|
||||
'onblur',
|
||||
'onselect',
|
||||
'onchange',
|
||||
'onclick',
|
||||
'ondblclick',
|
||||
'onmousedown',
|
||||
'onmouseup',
|
||||
'onmouseover',
|
||||
'onmousemove',
|
||||
'onmouseout',
|
||||
'onkeypress',
|
||||
'onkeydown',
|
||||
'onkeyup',
|
||||
'required',
|
||||
'pattern',
|
||||
'autocomplete',
|
||||
];
|
||||
|
||||
$output = '';
|
||||
if (isset($settings) === true && is_array($settings) === true) {
|
||||
// Check Name is necessary.
|
||||
if (isset($settings['name']) === true) {
|
||||
$output = '<input type="email" ';
|
||||
|
||||
// Check Max length.
|
||||
if (isset($settings['maxlength']) === false) {
|
||||
$settings['maxlength'] = 255;
|
||||
}
|
||||
|
||||
// Check Size.
|
||||
if (isset($settings['size']) === false
|
||||
|| $settings['size'] === 0
|
||||
) {
|
||||
$settings['size'] = 255;
|
||||
}
|
||||
|
||||
foreach ($settings as $attribute => $attr_value) {
|
||||
// Check valid attribute.
|
||||
if (in_array($attribute, $valid_attrs) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$output .= $attribute.'="'.$attr_value.'" ';
|
||||
}
|
||||
|
||||
$output .= $function.'/>';
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an input image element.
|
||||
*
|
||||
|
@ -1822,7 +1905,7 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
|
|||
*/
|
||||
function html_print_textarea($name, $rows, $columns, $value='', $attributes='', $return=false, $class='')
|
||||
{
|
||||
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.'" class="'.$class.'">';
|
||||
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' class="'.$class.'">';
|
||||
// $output .= io_safe_input ($value);
|
||||
$output .= ($value);
|
||||
$output .= '</textarea>';
|
||||
|
@ -1898,6 +1981,7 @@ function html_get_predefined_table($model='transparent', $columns=4)
|
|||
* $table->titlestyle - Title style
|
||||
* $table->titleclass - Title class
|
||||
* $table->styleTable - Table style
|
||||
* $table->autosize - Autosize
|
||||
* $table->caption - Table title
|
||||
* @param bool Whether to return an output string or echo now
|
||||
*
|
||||
|
@ -2008,6 +2092,12 @@ function html_print_table(&$table, $return=false)
|
|||
// $table->width = '80%';
|
||||
}
|
||||
|
||||
if (isset($table->autosize) === true) {
|
||||
$table->autosize = 'autosize = "1"';
|
||||
} else {
|
||||
$table->autosize = '';
|
||||
}
|
||||
|
||||
if (empty($table->border)) {
|
||||
if (empty($table)) {
|
||||
$table = new stdClass();
|
||||
|
@ -2042,9 +2132,9 @@ function html_print_table(&$table, $return=false)
|
|||
$tableid = empty($table->id) ? 'table'.$table_count : $table->id;
|
||||
|
||||
if (!empty($table->width)) {
|
||||
$output .= '<table style="width:'.$table->width.'; '.$styleTable.' '.$table->tablealign;
|
||||
$output .= '<table '.$table->autosize.' style="width:'.$table->width.'; '.$styleTable.' '.$table->tablealign;
|
||||
} else {
|
||||
$output .= '<table style="'.$styleTable.' '.$table->tablealign;
|
||||
$output .= '<table '.$table->autosize.' style="'.$styleTable.' '.$table->tablealign;
|
||||
}
|
||||
|
||||
$output .= ' cellpadding="'.$table->cellpadding.'" cellspacing="'.$table->cellspacing.'"';
|
||||
|
@ -2189,33 +2279,47 @@ function html_print_table(&$table, $return=false)
|
|||
|
||||
|
||||
/**
|
||||
* Render a radio button input. Extended version, use html_print_radio_button() to simplify.
|
||||
* Render a radio button input. Extended version, use html_print_input()
|
||||
* to simplify.
|
||||
*
|
||||
* @param string Input name.
|
||||
* @param string Input value.
|
||||
* @param string Set the button to be marked (optional, unmarked by default).
|
||||
* @param bool Disable the button (optional, button enabled by default).
|
||||
* @param string Script to execute when onClick event is triggered (optional).
|
||||
* @param string Optional HTML attributes. It's a free string which will be
|
||||
inserted into the HTML tag, use it carefully (optional).
|
||||
* @param bool Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param string $name Input name.
|
||||
* @param string $value Input value.
|
||||
* @param string $label Set the button to be marked (optional, unmarked by default).
|
||||
* @param string $checkedvalue Checked value.
|
||||
* @param string $disabled Disable the button (optional, button enabled by default).
|
||||
* @param string $script Script to execute when onClick event is triggered (optional).
|
||||
* @param string $attributes Optional HTML attributes. It's a free string which will be inserted tag, use it carefully (optional).
|
||||
* @param string $returnparam Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param string $modalparam Modal param.
|
||||
* @param string $message Message.
|
||||
* @param string $id Use custom id.
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
/*
|
||||
Hello there! :)
|
||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||
*/
|
||||
|
||||
function html_print_radio_button_extended($name, $value, $label, $checkedvalue, $disabled, $script, $attributes, $return=false, $modal=false, $message='visualmodal')
|
||||
{
|
||||
function html_print_radio_button_extended(
|
||||
$name,
|
||||
$value,
|
||||
$label,
|
||||
$checkedvalue,
|
||||
$disabled,
|
||||
$script,
|
||||
$attributes,
|
||||
$return=false,
|
||||
$modal=false,
|
||||
$message='visualmodal',
|
||||
$id=null
|
||||
) {
|
||||
static $idcounter = 0;
|
||||
|
||||
$output = '';
|
||||
|
||||
$output = '<input type="radio" name="'.$name.'" value="'.$value.'"';
|
||||
$htmlid = 'radiobtn'.sprintf('%04d', ++$idcounter);
|
||||
if (empty($id) === false) {
|
||||
$htmlid = $id;
|
||||
} else {
|
||||
$htmlid = 'radiobtn'.sprintf('%04d', ++$idcounter);
|
||||
}
|
||||
|
||||
$output .= ' id="'.$htmlid.'"';
|
||||
|
||||
if ($value == $checkedvalue) {
|
||||
|
@ -3003,23 +3107,24 @@ function html_print_csrf_error()
|
|||
|
||||
|
||||
/**
|
||||
* Print an swith button
|
||||
* Print an swith button.
|
||||
*
|
||||
* @param array $atributes. Valid params:
|
||||
* name: Usefull to handle in forms
|
||||
* value: If is checked or not
|
||||
* disabled: Disabled. Cannot be pressed.
|
||||
* id: Optional id for the switch.
|
||||
* class: Additional classes (string).
|
||||
* @return string with HTML of button
|
||||
* @param array $attributes Valid params.
|
||||
* name: Usefull to handle in forms.
|
||||
* value: If is checked or not.
|
||||
* disabled: Disabled. Cannot be pressed.
|
||||
* id: Optional id for the switch.
|
||||
* class: Additional classes (string).
|
||||
*
|
||||
* @return string with HTML of button.
|
||||
*/
|
||||
function html_print_switch($attributes=[])
|
||||
{
|
||||
$html_expand = '';
|
||||
|
||||
// Check the load values on status.
|
||||
$html_expand .= (bool) $attributes['value'] ? ' checked' : '';
|
||||
$html_expand .= (bool) $attributes['disabled'] ? ' disabled' : '';
|
||||
$html_expand .= (bool) ($attributes['value']) ? ' checked' : '';
|
||||
$html_expand .= (bool) ($attributes['disabled']) ? ' disabled' : '';
|
||||
|
||||
// Only load the valid attributes.
|
||||
$valid_attrs = [
|
||||
|
@ -3042,7 +3147,7 @@ function html_print_switch($attributes=[])
|
|||
}
|
||||
|
||||
return "<label class='p-switch' style='".$attributes['style']."'>
|
||||
<input type='checkbox' $html_expand>
|
||||
<input type='checkbox' ".$html_expand.">
|
||||
<span class='p-slider'></span>
|
||||
</label>";
|
||||
}
|
||||
|
@ -3200,6 +3305,10 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
);
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
$output .= html_print_input_email($data);
|
||||
break;
|
||||
|
||||
case 'hidden':
|
||||
$output .= html_print_input_hidden(
|
||||
$data['name'],
|
||||
|
@ -3369,6 +3478,26 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
);
|
||||
break;
|
||||
|
||||
case 'radio_button':
|
||||
$output .= html_print_radio_button_extended(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
$data['label'],
|
||||
((isset($data['checkedvalue']) === true) ? $data['checkedvalue'] : 1),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : ''),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : true),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['modal']) === true) ? $data['modal'] : false),
|
||||
((isset($data['message']) === true) ? $data['message'] : 'visualmodal'),
|
||||
((isset($data['id']) === true) ? $data['id'] : null)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
$output .= html_print_input_email($data);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
|
|
|
@ -179,6 +179,10 @@ function reporting_make_reporting_data(
|
|||
$report['group_name'] = groups_get_name($report['id_group']);
|
||||
$report['contents'] = [];
|
||||
|
||||
if (empty($report['period'])) {
|
||||
$report['period'] = $period;
|
||||
}
|
||||
|
||||
if (empty($contents)) {
|
||||
return reporting_check_structure_report($report);
|
||||
}
|
||||
|
@ -224,7 +228,12 @@ function reporting_make_reporting_data(
|
|||
|
||||
// General reports with 0 period means last value
|
||||
// Avoid to overwrite it by template value.
|
||||
if (!empty($period) && ($content['type'] !== 'general' && $content['period'] != 0)) {
|
||||
$general_last_value = false;
|
||||
if ($content['type'] === 'general' && $content['period'] == 0) {
|
||||
$general_last_value = true;
|
||||
}
|
||||
|
||||
if (!empty($period) && $general_last_value === false) {
|
||||
$content['period'] = $period;
|
||||
}
|
||||
|
||||
|
@ -506,43 +515,6 @@ function reporting_make_reporting_data(
|
|||
);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'MTTR':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'MTTR',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'MTBF',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'TTO',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$report['contents'][] = reporting_value(
|
||||
$report,
|
||||
$content,
|
||||
'TTRT',
|
||||
$pdf
|
||||
);
|
||||
break;
|
||||
*/
|
||||
case 'agent_configuration':
|
||||
$report['contents'][] = io_safe_output(
|
||||
reporting_agent_configuration(
|
||||
|
@ -3276,6 +3248,7 @@ function reporting_database_serialized($report, $content)
|
|||
}
|
||||
|
||||
$return['keys'] = $keys;
|
||||
$return['agent_name_db'] = agents_get_name($id_agent);
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4303,6 +4276,7 @@ function reporting_monitor_report($report, $content)
|
|||
);
|
||||
}
|
||||
|
||||
$return['agent_name_db'] = agents_get_name($id_agent);
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4475,6 +4449,7 @@ function reporting_prediction_date($report, $content)
|
|||
$agent_name = io_safe_output(
|
||||
modules_get_agentmodule_agent_alias($content['id_agent_module'])
|
||||
);
|
||||
$agent_name_db = io_safe_output(modules_get_agentmodule_agent_name($content['id_agent_module']));
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
|
@ -4482,6 +4457,7 @@ function reporting_prediction_date($report, $content)
|
|||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$return['agent_name_db'] = $agent_name_db;
|
||||
$return['agent_name'] = $agent_name;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4526,12 +4502,14 @@ function reporting_projection_graph(
|
|||
|
||||
$module_name = io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
|
||||
$agent_name = io_safe_output(modules_get_agentmodule_agent_alias($content['id_agent_module']));
|
||||
$agent_name_db = io_safe_output(modules_get_agentmodule_agent_name($content['id_agent_module']));
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
$return['agent_name_db'] = $agent_name_db;
|
||||
$return['agent_name'] = $agent_name;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4727,23 +4705,6 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
case 'sum':
|
||||
$return['type'] = 'sumatory';
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'MTTR':
|
||||
$return['type'] = 'MTTR';
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$return['type'] = 'MTBF';
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$return['type'] = 'TTO';
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$return['type'] = 'TTRT';
|
||||
break;*/
|
||||
}
|
||||
|
||||
if (empty($content['name'])) {
|
||||
|
@ -4763,23 +4724,6 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
case 'sum':
|
||||
$content['name'] = __('Summatory');
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'MTTR':
|
||||
$content['name'] = __('MTTR');
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$content['name'] = __('MTBF');
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$content['name'] = __('TTO');
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$content['name'] = __('TTRT');
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4796,6 +4740,9 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$agent_name = io_safe_output(
|
||||
modules_get_agentmodule_agent_alias($content['id_agent_module'])
|
||||
);
|
||||
$agent_name_db = io_safe_output(
|
||||
modules_get_agentmodule_agent_name($content['id_agent_module'])
|
||||
);
|
||||
$unit = db_get_value(
|
||||
'unit',
|
||||
'tagente_modulo',
|
||||
|
@ -4812,6 +4759,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$return['id_agent'] = $content['id_agent'];
|
||||
$return['id_agent_module'] = $content['id_agent_module'];
|
||||
|
||||
$return['agent_name_db'] = $agent_name_db;
|
||||
$return['agent_name'] = $agent_name;
|
||||
$return['module_name'] = $module_name;
|
||||
|
||||
|
@ -4952,51 +4900,6 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'MTTR':
|
||||
$value = reporting_get_agentmodule_mttr(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
$formated_value = null;
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
$value = reporting_get_agentmodule_mtbf(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
$formated_value = null;
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
$value = reporting_get_agentmodule_tto(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
if ($value == 0) {
|
||||
$formated_value = null;
|
||||
} else {
|
||||
$formated_value = human_time_description_raw($value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
$value = reporting_get_agentmodule_ttr(
|
||||
$content['id_agent_module'],
|
||||
$content['period'],
|
||||
$report['datetime']
|
||||
);
|
||||
if ($value == 0) {
|
||||
$formated_value = null;
|
||||
} else {
|
||||
$formated_value = human_time_description_raw($value);
|
||||
}
|
||||
break;*/
|
||||
}
|
||||
|
||||
$return['data'] = [
|
||||
|
@ -7755,6 +7658,7 @@ function reporting_simple_graph(
|
|||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = $agent_alias.' - '.$module_name;
|
||||
$return['agent_name_db'] = agents_get_name($id_agent);
|
||||
$return['agent_name'] = $agent_alias;
|
||||
$return['module_name'] = $module_name;
|
||||
$return['description'] = $content['description'];
|
||||
|
|
|
@ -121,12 +121,9 @@ function html_do_report_info($report)
|
|||
</tr>
|
||||
<tr>
|
||||
<td><b>'.__('Report date').': </b></td>';
|
||||
if (isset($report['period'])) {
|
||||
if (is_numeric($report['datetime']) && is_numeric($report['period'])) {
|
||||
$html .= '<td>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</td>';
|
||||
}
|
||||
|
||||
$html .= '<td></td>';
|
||||
if (is_numeric($report['datetime']) && is_numeric($report['period']) && ($report['period'] != 0)) {
|
||||
$html .= '<td>'.__('From').' <b>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</b></td>';
|
||||
$html .= '<td>'.__('to').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
|
||||
} else {
|
||||
$html .= '<td>'.__('Items period before').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
|
||||
}
|
||||
|
@ -288,23 +285,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||
reporting_html_sum_value($table, $item, $mini);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'MTTR':
|
||||
reporting_html_MTTR_value($table, $item, $mini, true, true);
|
||||
break;
|
||||
|
||||
case 'MTBF':
|
||||
reporting_html_MTBF_value($table, $item, $mini, true, true);
|
||||
break;
|
||||
|
||||
case 'TTO':
|
||||
reporting_html_TTO_value($table, $item, $mini, false, true);
|
||||
break;
|
||||
|
||||
case 'TTRT':
|
||||
reporting_html_TTRT_value($table, $item, $mini, false, true);
|
||||
break;
|
||||
*/
|
||||
case 'agent_configuration':
|
||||
reporting_html_agent_configuration($table, $item);
|
||||
break;
|
||||
|
@ -467,7 +447,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
|||
if ($mini) {
|
||||
$font_size = '1.5';
|
||||
} else {
|
||||
$font_size = '3';
|
||||
$font_size = $config['font_size_item_report'];
|
||||
}
|
||||
|
||||
$metaconsole_on = is_metaconsole();
|
||||
|
@ -2513,7 +2493,7 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
|
|||
if ($mini) {
|
||||
$font_size = '1.5';
|
||||
} else {
|
||||
$font_size = '3';
|
||||
$font_size = $config['font_size_item_report'];
|
||||
}
|
||||
|
||||
$table->colspan['module']['cell'] = 3;
|
||||
|
@ -2729,31 +2709,6 @@ function reporting_html_agent_configuration(
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
function reporting_html_TTRT_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_TTO_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_MTBF_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
|
||||
|
||||
function reporting_html_MTTR_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
|
||||
}
|
||||
*/
|
||||
|
||||
function reporting_html_sum_value(&$table, $item, $mini)
|
||||
{
|
||||
reporting_html_value($table, $item, $mini);
|
||||
|
@ -2780,10 +2735,12 @@ function reporting_html_min_value(&$table, $item, $mini)
|
|||
|
||||
function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($mini) {
|
||||
$font_size = '1.5';
|
||||
} else {
|
||||
$font_size = '3';
|
||||
$font_size = $config['font_size_item_report'];
|
||||
}
|
||||
|
||||
if (isset($item['visual_format']) && $item['visual_format'] != 0
|
||||
|
@ -3625,10 +3582,10 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
}
|
||||
|
||||
$table1->head[3] = __('Value');
|
||||
$table1->style[0] = 'text-align: left';
|
||||
$table1->style[1] = 'text-align: left';
|
||||
$table1->style[2] = 'text-align: left';
|
||||
$table1->style[3] = 'text-align: left';
|
||||
$table1->style[0] = 'text-align: center';
|
||||
$table1->style[1] = 'text-align: center';
|
||||
$table1->style[2] = 'text-align: center';
|
||||
$table1->style[3] = 'text-align: center';
|
||||
|
||||
// Begin - Order by agent.
|
||||
foreach ($item['data'] as $key => $row) {
|
||||
|
@ -3759,12 +3716,16 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
$table_summary->head = [];
|
||||
$table_summary->head_colspan = [];
|
||||
$table_summary->align = [];
|
||||
$table_summary->headstyle = [];
|
||||
$table_summary->headstyle[0] = 'text-align: center;';
|
||||
$table_summary->headstyle[1] = 'text-align: center;';
|
||||
$table_summary->headstyle[2] = 'text-align: center;';
|
||||
|
||||
$table_summary->align[0] = 'left';
|
||||
$table_summary->align[1] = 'right';
|
||||
$table_summary->align[2] = 'right';
|
||||
$table_summary->align[3] = 'left';
|
||||
$table_summary->align[4] = 'right';
|
||||
$table_summary->align[0] = 'center';
|
||||
$table_summary->align[1] = 'center';
|
||||
$table_summary->align[2] = 'center';
|
||||
$table_summary->align[3] = 'center';
|
||||
$table_summary->align[4] = 'center';
|
||||
|
||||
$table_summary->head_colspan[0] = 2;
|
||||
$table_summary->head[0] = __('Min Value');
|
||||
|
@ -3772,11 +3733,11 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
$table_summary->head_colspan[2] = 2;
|
||||
$table_summary->head[2] = __('Max Value');
|
||||
|
||||
$table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module'];
|
||||
$table_summary->data[0][1] = $item['min']['formated_value'];
|
||||
$table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module'].str_repeat(' ', 20).$item['min']['formated_value'];
|
||||
$table_summary->data[0][1] = '';
|
||||
$table_summary->data[0][2] = format_for_graph($item['avg_value'], 2);
|
||||
$table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module'];
|
||||
$table_summary->data[0][4] = $item['max']['formated_value'];
|
||||
$table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module'].str_repeat(' ', 20).$item['max']['formated_value'];
|
||||
$table_summary->data[0][4] = '';
|
||||
|
||||
if ($pdf !== 0) {
|
||||
$return_pdf .= html_print_table($table_summary, true);
|
||||
|
|
|
@ -679,24 +679,6 @@ function reports_get_report_types($template=false, $not_editor=false)
|
|||
'name' => __('Module Histogram graph'),
|
||||
];
|
||||
|
||||
/*
|
||||
$types['TTRT'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('TTRT'),
|
||||
];
|
||||
$types['TTO'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('TTO'),
|
||||
];
|
||||
$types['MTBF'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('MTBF'),
|
||||
];
|
||||
$types['MTTR'] = [
|
||||
'optgroup' => __('ITIL'),
|
||||
'name' => __('MTTR'),
|
||||
];
|
||||
*/
|
||||
$types['SLA'] = [
|
||||
'optgroup' => __('SLA'),
|
||||
'name' => __('S.L.A.'),
|
||||
|
|
|
@ -1411,7 +1411,7 @@ function ui_print_help_icon(
|
|||
[
|
||||
'class' => 'img_help',
|
||||
'title' => __('Help'),
|
||||
'onclick' => "open_help ('".$url."')",
|
||||
'onclick' => "open_help ('".ui_get_full_url('index.php?sec=view&sec2=general/help_feedback&pure=1&url='.$url)."')",
|
||||
'id' => $id,
|
||||
],
|
||||
false,
|
||||
|
@ -3015,6 +3015,10 @@ function ui_print_datatable(array $parameters)
|
|||
$parameters['default_pagination'] = $config['block_size'];
|
||||
}
|
||||
|
||||
if (!isset($parameters['paging'])) {
|
||||
$parameters['paging'] = true;
|
||||
}
|
||||
|
||||
$no_sortable_columns = [];
|
||||
if (isset($parameters['no_sortable_columns'])) {
|
||||
$no_sortable_columns = json_encode($parameters['no_sortable_columns']);
|
||||
|
@ -3165,6 +3169,9 @@ function ui_print_datatable(array $parameters)
|
|||
);
|
||||
}
|
||||
|
||||
// Languages.
|
||||
$processing = __('Processing');
|
||||
|
||||
// Extra html.
|
||||
$extra = '';
|
||||
if (isset($parameters['extra_html']) && !empty($parameters['extra_html'])) {
|
||||
|
@ -3175,7 +3182,7 @@ function ui_print_datatable(array $parameters)
|
|||
$table = '<table id="'.$table_id.'" ';
|
||||
$table .= 'class="'.$parameters['class'].'"';
|
||||
$table .= 'style="'.$parameters['style'].'">';
|
||||
$table .= '<thead><tr>';
|
||||
$table .= '<thead><tr class="datatables_thead_tr">';
|
||||
|
||||
if (isset($parameters['column_names'])
|
||||
&& is_array($parameters['column_names'])
|
||||
|
@ -3224,15 +3231,20 @@ function ui_print_datatable(array $parameters)
|
|||
},
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
paging: true,
|
||||
paging: '.$parameters['paging'].',
|
||||
pageLength: '.$parameters['default_pagination'].',
|
||||
searching: false,
|
||||
responsive: true,
|
||||
dom: "plfrtiBp",
|
||||
language: {
|
||||
processing:"'.$processing.'"
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
extend: "csv",
|
||||
text : "'.__('Export current page to CSV').'",
|
||||
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
|
||||
fieldSeparator: "'.$config['csv_divider'].'",
|
||||
exportOptions : {
|
||||
modifier : {
|
||||
// DataTables core
|
||||
|
@ -3324,10 +3336,18 @@ function ui_print_datatable(array $parameters)
|
|||
|
||||
$("#'.$form_id.'_search_bt").click(function (){
|
||||
dt_'.$table_id.'.draw().page(0)
|
||||
});
|
||||
});
|
||||
});';
|
||||
|
||||
</script>';
|
||||
if (isset($parameters['caption']) === true
|
||||
&& empty($parameters['caption']) === false
|
||||
) {
|
||||
$js .= '$("#'.$table_id.'").append("<caption>'.$parameters['caption'].'</caption>");';
|
||||
$js .= '$(".datatables_thead_tr").css("height", 0);';
|
||||
}
|
||||
|
||||
$js .= '});';
|
||||
|
||||
$js .= '</script>';
|
||||
|
||||
// Order.
|
||||
$err_msg = '<div id="error-'.$table_id.'"></div>';
|
||||
|
@ -3343,7 +3363,7 @@ function ui_print_datatable(array $parameters)
|
|||
$output = $include.$output;
|
||||
|
||||
// Print datatable if needed.
|
||||
if (!(isset($parameters['print']) && $parameters['print'] === false)) {
|
||||
if (isset($parameters['print']) === false || $parameters['print'] === false) {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
|
@ -3521,6 +3541,8 @@ function ui_print_event_priority(
|
|||
* @param string $toggle_class Toggle class.
|
||||
* @param string $container_class Container class.
|
||||
* @param string $main_class Main object class.
|
||||
* @param string $img_a Image (closed).
|
||||
* @param string $img_b Image (opened).
|
||||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
|
@ -3533,20 +3555,22 @@ function ui_toggle(
|
|||
$return=false,
|
||||
$toggle_class='',
|
||||
$container_class='white-box-content',
|
||||
$main_class='box-shadow white_table_graph'
|
||||
$main_class='box-shadow white_table_graph',
|
||||
$img_a='images/arrow_down_green.png',
|
||||
$img_b='images/arrow_right_green.png'
|
||||
) {
|
||||
// Generate unique Id.
|
||||
$uniqid = uniqid('');
|
||||
|
||||
$image_a = html_print_image('images/arrow_down_green.png', true, false, true);
|
||||
$image_b = html_print_image('images/arrow_right_green.png', true, false, true);
|
||||
$image_a = html_print_image($img_a, true, false, true);
|
||||
$image_b = html_print_image($img_b, true, false, true);
|
||||
// Options.
|
||||
if ($hidden_default) {
|
||||
$style = 'display:none';
|
||||
$original = 'images/arrow_right_green.png';
|
||||
$original = $img_b;
|
||||
} else {
|
||||
$style = '';
|
||||
$original = 'images/arrow_down_green.png';
|
||||
$original = $img_a;
|
||||
}
|
||||
|
||||
// Link to toggle.
|
||||
|
@ -3599,6 +3623,31 @@ function ui_toggle(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simplified way of ui_toggle ussage.
|
||||
*
|
||||
* @param array $data Arguments.
|
||||
*
|
||||
* @return string HTML code with toggle content.
|
||||
*/
|
||||
function ui_print_toggle($data)
|
||||
{
|
||||
return ui_toggle(
|
||||
$data['content'],
|
||||
$data['name'],
|
||||
(isset($data['title']) === true) ? $data['title'] : '',
|
||||
(isset($data['id']) === true) ? $data['id'] : '',
|
||||
(isset($data['hidden_default']) === true) ? $data['hidden_default'] : true,
|
||||
(isset($data['return']) === true) ? $data['return'] : false,
|
||||
(isset($data['toggle_class']) === true) ? $data['toggle_class'] : '',
|
||||
(isset($data['container_class']) === true) ? $data['container_class'] : 'white-box-content',
|
||||
(isset($data['main_class']) === true) ? $data['main_class'] : 'box-shadow white_table_graph',
|
||||
(isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow_down_green.png',
|
||||
(isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow_right_green.png'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct and return the URL to be used in order to refresh the current page correctly.
|
||||
*
|
||||
|
@ -5695,7 +5744,7 @@ function ui_print_comments($comments)
|
|||
continue;
|
||||
}
|
||||
|
||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
||||
$comments_array[] = io_safe_output(json_decode($comm, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5733,3 +5782,23 @@ function ui_print_comments($comments)
|
|||
return io_safe_output($comentario);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get complete external pandora url.
|
||||
*
|
||||
* @param string $url Url to be parsed.
|
||||
*
|
||||
* @return string Full url.
|
||||
*/
|
||||
function ui_get_full_external_url(string $url)
|
||||
{
|
||||
$url_parsed = parse_url($url);
|
||||
if ($url_parsed) {
|
||||
if (!isset($url_parsed['scheme'])) {
|
||||
$url = 'http://'.$url;
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
|
|
@ -1236,3 +1236,29 @@ function users_get_explode_tags(&$group)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get mail admin.
|
||||
*
|
||||
* @return string Return mail admin.
|
||||
*/
|
||||
function get_mail_admin():string
|
||||
{
|
||||
$mail = db_get_value('email', 'tusuario', 'is_admin', 1);
|
||||
|
||||
return $mail;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get name admin.
|
||||
*
|
||||
* @return string Return name admin.
|
||||
*/
|
||||
function get_name_admin():string
|
||||
{
|
||||
$mail = db_get_value('fullname', 'tusuario', 'is_admin', 1);
|
||||
|
||||
return $mail;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue