mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Merge branch 'master' of brutus.artica.es:artica/pandorafms into ent-6022-uptime-incorrecto-en-politica-mejorada-windows
This commit is contained in:
commit
b1c4a9890e
31
README.md
31
README.md
@ -8,31 +8,34 @@ Pandora FMS is a monitoring software for IT infrastructure management which incl
|
||||
|
||||
For community support you can visit our forums at http://forums.pandorafms.org. Visit our community page at http://pandorafms.org and if you need commercial information or/and professional support visit http://pandorafms.com.
|
||||
|
||||
|
||||
### How to install Pandora FMS
|
||||
|
||||
Installing Pandora FMS is a very easy task. Please visit our wiki and follow all the steps described for a quick and proper installation. http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Installing
|
||||
|
||||
### What is Pandora FMS?
|
||||
Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize.
|
||||
|
||||
Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US\$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize.
|
||||
|
||||
### Other things Pandora FMS can do
|
||||
Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, remote accesses to servers, etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
|
||||
|
||||
Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, [remote accesses to servers](https://pandorafms.com/server-monitoring/), etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
|
||||
|
||||
### Main features
|
||||
* Network monitoring
|
||||
* WMI monitoring
|
||||
* Agent monitoring (for all OS)
|
||||
* Graphical reporting, based on it's own SQL backend
|
||||
* SLA, and ITIL KPI metrics on reporting
|
||||
* Status & Performance monitoring
|
||||
* GIS tracking and viewing
|
||||
* Inventory management (Local and remote)
|
||||
* User defined visual console screens and Dashboards WYSIWYG
|
||||
* Very high capacity (Thousands of devices)
|
||||
* Multiuser, several levels of ACL management.
|
||||
|
||||
- Network monitoring
|
||||
- WMI monitoring
|
||||
- Agent monitoring (for all OS)
|
||||
- Graphical reporting, based on it's own SQL backend
|
||||
- SLA, and ITIL KPI metrics on reporting
|
||||
- Status & Performance monitoring
|
||||
- GIS tracking and viewing
|
||||
- Inventory management (Local and remote)
|
||||
- User defined visual console screens and Dashboards WYSIWYG
|
||||
- Very high capacity (Thousands of devices)
|
||||
- Multiuser, several levels of ACL management.
|
||||
|
||||
### Screenshots
|
||||
|
||||

|
||||
<br />
|
||||
<br />
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.746, AIX version
|
||||
# Version 7.0NG.749, 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.746, FreeBSD Version
|
||||
# Version 7.0NG.749, 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.746, HP-UX Version
|
||||
# Version 7.0NG.749, 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.746, GNU/Linux
|
||||
# Version 7.0NG.749, 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.746, GNU/Linux
|
||||
# Version 7.0NG.749, 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.746, Solaris Version
|
||||
# Version 7.0NG.749, 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.746
|
||||
# Version 7.0NG.749
|
||||
|
||||
# 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.746, AIX version
|
||||
# Version 7.0NG.749, 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.746
|
||||
# Version 7.0NG.749
|
||||
# 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.746, HPUX Version
|
||||
# Version 7.0NG.749, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.746
|
||||
# Version 7.0NG.749
|
||||
# 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.746
|
||||
# Version 7.0NG.749
|
||||
# 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.746
|
||||
# Version 7.0NG.749
|
||||
# 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.746, Solaris version
|
||||
# Version 7.0NG.749, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.746, AIX version
|
||||
# Version 7.0NG.749, 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.746-200617
|
||||
Version: 7.0NG.749-200909
|
||||
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.746-200617"
|
||||
pandora_version="7.0NG.749-200909"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
@ -81,6 +81,9 @@ cp -aRf man/man1/* temp_package/usr/share/man/man1/
|
||||
# Relocate plugins to the final dir and delete
|
||||
cp temp_package/usr/share/pandora_agent/plugins/* temp_package/etc/pandora/plugins
|
||||
|
||||
# Make sure the plugins have execution privileges
|
||||
chmod 755 temp_package/etc/pandora/plugins/*
|
||||
|
||||
echo "Official plugins are placed on /etc/pandora/plugins" > temp_package/usr/share/pandora_agent/plugins/README
|
||||
|
||||
#Disabled, now the package overwrite the previous files.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.746, GNU/Linux
|
||||
# Version 7.0NG.749, 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.746, FreeBSD Version
|
||||
# Version 7.0NG.749, 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.746, HP-UX Version
|
||||
# Version 7.0NG.749, 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.746, GNU/Linux
|
||||
# Version 7.0NG.749, 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.746, GNU/Linux
|
||||
# Version 7.0NG.749, 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.746, NetBSD Version
|
||||
# Version 7.0NG.749, 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.746, Solaris Version
|
||||
# Version 7.0NG.749, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
@ -54,8 +54,8 @@ my $Sem = undef;
|
||||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.746';
|
||||
use constant AGENT_BUILD => '200617';
|
||||
use constant AGENT_VERSION => '7.0NG.749';
|
||||
use constant AGENT_BUILD => '200909';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
@ -1678,7 +1678,7 @@ sub execute_command_timeout {
|
||||
};
|
||||
|
||||
my $result = ($?>>8);
|
||||
print $result;
|
||||
return $result;
|
||||
|
||||
# Exit child.
|
||||
# Child finishes.
|
||||
@ -1753,7 +1753,7 @@ sub execute_command_block {
|
||||
);
|
||||
|
||||
# Do not retry if success.
|
||||
last if looks_like_number($err_level) && $err_level == 0;
|
||||
$retries = 0 if looks_like_number($err_level) && $err_level == 0;
|
||||
|
||||
} while ((--$retries) > 0);
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.746
|
||||
%define release 200617
|
||||
%define version 7.0NG.749
|
||||
%define release 200909
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -21,10 +21,10 @@ BuildArch: noarch
|
||||
Requires(pre): shadow-utils
|
||||
Requires(post): chkconfig /bin/ln
|
||||
Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
||||
Requires: fileutils textutils unzip
|
||||
Requires: coreutils unzip
|
||||
Requires: util-linux procps grep
|
||||
Requires: /sbin/ip /bin/awk
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny)
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
# Required by plugins
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
@ -108,8 +108,27 @@ mkdir -p /var/spool/pandora/data_out
|
||||
if [ ! -d /var/log/pandora ]; then
|
||||
mkdir -p /var/log/pandora
|
||||
fi
|
||||
/sbin/chkconfig --add pandora_agent_daemon
|
||||
/sbin/chkconfig pandora_agent_daemon on
|
||||
|
||||
if [ `command -v systemctl` ];
|
||||
then
|
||||
echo "Copying new version of pandora_agent_daemon service"
|
||||
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
|
||||
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
|
||||
# Enable the services on SystemD
|
||||
systemctl enable pandora_agent_daemon.service
|
||||
else
|
||||
/sbin/chkconfig --add pandora_agent_daemon
|
||||
/sbin/chkconfig pandora_agent_daemon on
|
||||
fi
|
||||
|
||||
if [ "$1" -gt 1 ]
|
||||
then
|
||||
|
||||
echo "If Pandora Agent daemon was running with init.d script,"
|
||||
echo "please stop it manually and start the service with systemctl"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
%preun
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.746
|
||||
%define release 200617
|
||||
%define version 7.0NG.749
|
||||
%define release 200909
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -20,7 +20,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
|
||||
BuildArch: noarch
|
||||
#PreReq: %fillup_prereq %insserv_prereq /usr/bin/sed /usr/bin/grep /usr/sbin/useradd
|
||||
Requires(pre,preun):/usr/bin/sed /usr/bin/grep /usr/sbin/useradd
|
||||
Requires: coreutils unzip perl perl(Sys::Syslog) perl(IO::Compress::Zip) perl(YAML::Tiny)
|
||||
Requires: coreutils unzip perl perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
AutoReq: 0
|
||||
Provides: %{name}-%{version}
|
||||
|
||||
@ -98,11 +98,27 @@ fi
|
||||
|
||||
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent
|
||||
|
||||
# Enable the service on SystemD
|
||||
systemctl enable pandora_agent_daemon.service
|
||||
|
||||
mkdir -p /var/spool/pandora/data_out
|
||||
chkconfig pandora_agent_daemon on
|
||||
|
||||
if [ `command -v systemctl` ];
|
||||
then
|
||||
echo "Copying new version of pandora_agent_daemon service"
|
||||
cp -f /usr/share/pandora_agent/pandora_agent_daemon.service /usr/lib/systemd/system/
|
||||
chmod -x /usr/lib/systemd/system/pandora_agent_daemon.service
|
||||
# Enable the services on SystemD
|
||||
systemctl enable pandora_agent_daemon.service
|
||||
else
|
||||
chkconfig pandora_agent_daemon on
|
||||
fi
|
||||
|
||||
if [ "$1" -gt 1 ]
|
||||
then
|
||||
|
||||
echo "If Pandora Agent daemon was running with init.d script,"
|
||||
echo "please stop it manually and start the service with systemctl"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
%preun
|
||||
|
||||
|
@ -4,6 +4,8 @@ After=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/pandora_agent /etc/pandora
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -9,8 +9,8 @@
|
||||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.746"
|
||||
PI_BUILD="200617"
|
||||
PI_VERSION="7.0NG.749"
|
||||
PI_BUILD="200909"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -56,6 +56,8 @@ my $Reg_exp = '';
|
||||
# Flag to show or not summary module
|
||||
my $summary_flag = 0;
|
||||
|
||||
my $nodatalist_flag = 0;
|
||||
|
||||
# Number of coincidences found
|
||||
my $coincidences = 0;
|
||||
|
||||
@ -120,7 +122,15 @@ sub error_msg ($) {
|
||||
# Print a help message.
|
||||
###############################################################################
|
||||
sub print_help () {
|
||||
print "Usage: $0 <log_file> <module_name> <pattern> <up_lines_extra> <bot_lines_extra> [--summary]\n";
|
||||
print "Usage: $0 <log_file> <module_name> <pattern> <up_lines_extra> <bot_lines_extra> [--summary] [--nodatalist]\n\n";
|
||||
print "Options:\n";
|
||||
print "\t<log_file>\t\tPath to the log file to be monitored\n";
|
||||
print "\t<module_name>\t\tName of the module that will be created\n";
|
||||
print "\t<pattern>\t\tRegex string to be matched in log file\n";
|
||||
print "\t<up_lines_extra>\tShows NUM lines before matching lines to provide context\n";
|
||||
print "\t<bot_lines_extra>\tShows NUM lines after matching lines to provide context\n";
|
||||
print "\t--summary\t\tCreates a module with the total number of matches\n";
|
||||
print "\t--nodatalist\t\tInserts all coincidences in a single data output instead of a data per line\n";
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@ -317,6 +327,7 @@ sub print_log ($) {
|
||||
if ($#kdata < 0) {
|
||||
print_summary() if ($summary_flag == 1);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
# Log module
|
||||
@ -341,6 +352,18 @@ sub print_log ($) {
|
||||
$output = "<module>\n";
|
||||
$output .= "<name><![CDATA[" . $Module_name . "]]></name>\n";
|
||||
$output .= "<type><![CDATA[async_string]]></type>\n";
|
||||
if ($nodatalist_flag == 1){
|
||||
$output .= "<data><![CDATA[";
|
||||
foreach my $line (@kdata) {
|
||||
foreach my $content (@{$data->{$line}}) {
|
||||
my $processed_line = $content;
|
||||
$processed_line =~ "\n";
|
||||
$output .= $processed_line;
|
||||
}
|
||||
}
|
||||
$output .= "]]></data>\n";
|
||||
}
|
||||
else {
|
||||
$output .= "<datalist>\n";
|
||||
foreach my $line (@kdata) {
|
||||
$output .= "<data><value><![CDATA[";
|
||||
@ -352,10 +375,12 @@ sub print_log ($) {
|
||||
$output .= "]]></value></data>\n";
|
||||
}
|
||||
$output .= "</datalist>\n";
|
||||
}
|
||||
$output .= "</module>\n";
|
||||
|
||||
print stdout $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
@ -376,12 +401,18 @@ $Reg_exp = trim($ARGV[2]);
|
||||
my $up_lines = trim($ARGV[3]);
|
||||
my $bot_lines = trim($ARGV[4]);
|
||||
my $sum_flag = trim($ARGV[5]);
|
||||
my $nodatalist = trim($ARGV[6]);
|
||||
|
||||
if ( ( defined($up_lines) && ($up_lines eq "--summary"))
|
||||
|| ( defined($bot_lines) && ($bot_lines eq "--summary"))
|
||||
|| ( defined($sum_flag) && ($sum_flag eq "--summary")) ) {
|
||||
$summary_flag = 1;
|
||||
if ( grep { /--summary/ } @ARGV )
|
||||
{
|
||||
$summary_flag = 1;
|
||||
}
|
||||
|
||||
if ( grep { /--nodatalist/ } @ARGV )
|
||||
{
|
||||
$nodatalist_flag = 1;
|
||||
}
|
||||
|
||||
# Create index file storage directory
|
||||
if ( ! -d $Idx_dir) {
|
||||
mkdir($Idx_dir) || error_msg("Error creating directory $Idx_dir: "
|
||||
|
@ -460,15 +460,19 @@ close (FILE);
|
||||
$Mode = 'LSHW';
|
||||
$Separator = '\s+\*\-';
|
||||
my @hwinfo;
|
||||
my $lshwpath = $0 =~ s/inventory/lshw/r ;
|
||||
if (is_enabled $AIX) {
|
||||
$Separator = '^\s*$';
|
||||
@hwinfo=`prtconf 2>/dev/null`;
|
||||
} else {
|
||||
@hwinfo = `lshw 2>/dev/null`;
|
||||
if ($? != 0) {
|
||||
$Mode = 'HWINFO';
|
||||
$Separator = 'Hardware Class:';
|
||||
@hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`;
|
||||
@hwinfo = `$lshwpath 2>/dev/null`;
|
||||
if ($? != 0) {
|
||||
$Mode = 'HWINFO';
|
||||
$Separator = 'Hardware Class:';
|
||||
@hwinfo = `hwinfo --cpu --memory --gfxcard --netcard --cdrom --disk 2>/dev/null`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.746
|
||||
# Version 7.0NG.749
|
||||
|
||||
# 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
|
||||
|
Binary file not shown.
@ -3,7 +3,7 @@ AllowLanguageSelection
|
||||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.746}
|
||||
{Pandora FMS Windows Agent v7.0NG.749}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{200617}
|
||||
{200909}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.746(Build 200617)")
|
||||
#define PANDORA_VERSION ("7.0NG.749(Build 200909)")
|
||||
|
||||
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.746(Build 200617))"
|
||||
VALUE "ProductVersion", "(7.0NG.749(Build 200909))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
3
pandora_console/.gitignore
vendored
3
pandora_console/.gitignore
vendored
@ -6,7 +6,10 @@ attachment/collection
|
||||
attachment/files_repo
|
||||
include/config.php
|
||||
pandora_console.log
|
||||
log/console.log
|
||||
log/cron.log
|
||||
enterprise
|
||||
*.bak
|
||||
audit.log
|
||||
log/audit.log
|
||||
install_old.php
|
||||
|
@ -4,5 +4,4 @@ Options -Indexes
|
||||
<Files ~ "\.log$">
|
||||
Order Allow,Deny
|
||||
Deny from All
|
||||
</Files>
|
||||
|
||||
</Files>
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.746-200617
|
||||
Version: 7.0NG.749-200909
|
||||
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.746-200617"
|
||||
pandora_version="7.0NG.749-200909"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -27,6 +27,8 @@
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
define('AJAX', true);
|
||||
|
||||
if (!defined('__PAN_XHPROF__')) {
|
||||
@ -39,7 +41,9 @@ if (__PAN_XHPROF__ === 1) {
|
||||
}
|
||||
}
|
||||
|
||||
if ((! file_exists('include/config.php')) || (! is_readable('include/config.php'))) {
|
||||
if ((! file_exists('include/config.php'))
|
||||
|| (! is_readable('include/config.php'))
|
||||
) {
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -50,13 +54,25 @@ require_once 'include/functions.php';
|
||||
require_once 'include/functions_db.php';
|
||||
require_once 'include/auth/mysql.php';
|
||||
|
||||
// Hash login process
|
||||
if (isset($_GET['loginhash'])) {
|
||||
if (isset($config['console_log_enabled']) === true
|
||||
&& $config['console_log_enabled'] == 1
|
||||
) {
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_log', $config['homedir'].'/log/console.log');
|
||||
} else {
|
||||
ini_set('log_errors', 0);
|
||||
ini_set('error_log', 0);
|
||||
}
|
||||
|
||||
// Hash login process.
|
||||
if (isset($_GET['loginhash']) === true) {
|
||||
$loginhash_data = get_parameter('loginhash_data', '');
|
||||
$loginhash_user = str_rot13(get_parameter('loginhash_user', ''));
|
||||
|
||||
if ($config['loginhash_pwd'] != ''
|
||||
&& $loginhash_data == md5($loginhash_user.io_output_password($config['loginhash_pwd']))
|
||||
&& $loginhash_data == md5(
|
||||
$loginhash_user.io_output_password($config['loginhash_pwd'])
|
||||
)
|
||||
) {
|
||||
db_logon($loginhash_user, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $loginhash_user;
|
||||
@ -65,14 +81,38 @@ if (isset($_GET['loginhash'])) {
|
||||
include_once 'general/login_page.php';
|
||||
db_pandora_audit('Logon Failed (loginhash', '', 'system');
|
||||
while (@ob_end_flush()) {
|
||||
// Dumping...
|
||||
continue;
|
||||
}
|
||||
|
||||
exit('</html>');
|
||||
}
|
||||
}
|
||||
|
||||
$auth_class = io_safe_output(
|
||||
get_parameter('auth_class', 'PandoraFMS\Dashboard\Manager')
|
||||
);
|
||||
$public_hash = get_parameter('auth_hash', false);
|
||||
$public_login = false;
|
||||
// Check user.
|
||||
check_login();
|
||||
if (class_exists($auth_class) === false || $public_hash === false) {
|
||||
check_login();
|
||||
} else {
|
||||
if ($auth_class::validatePublicHash($public_hash) === false) {
|
||||
db_pandora_audit(
|
||||
'Invalid public hash',
|
||||
'Trying to access public dashboard'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// OK. Simulated user log in. If you want to use your own auth_class
|
||||
// remember to set $config['force_instant_logout'] to true to avoid
|
||||
// persistent user login.
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
// Enterprise support.
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
@ -87,7 +127,10 @@ $page .= '.php';
|
||||
$config['id_user'] = $_SESSION['id_usuario'];
|
||||
$isFunctionSkins = enterprise_include_once('include/functions_skins.php');
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$config['relative_path'] = enterprise_hook('skins_set_image_skin_path', [$config['id_user']]);
|
||||
$config['relative_path'] = enterprise_hook(
|
||||
'skins_set_image_skin_path',
|
||||
[$config['id_user']]
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
@ -104,3 +147,29 @@ if (file_exists($page)) {
|
||||
if (__PAN_XHPROF__ === 1) {
|
||||
pandora_xhprof_display_result('ajax', 'console');
|
||||
}
|
||||
|
||||
|
||||
if ($config['force_instant_logout'] === true) {
|
||||
// Force user logout.
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$iduser = $_SESSION['id_usuario'];
|
||||
$_SESSION = [];
|
||||
session_destroy();
|
||||
header_remove('Set-Cookie');
|
||||
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
|
||||
|
||||
if ($config['auth'] == 'saml') {
|
||||
include_once $config['saml_path'].'simplesamlphp/lib/_autoload.php';
|
||||
$as = new SimpleSAML_Auth_Simple('PandoraFMS');
|
||||
$as->logout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (@ob_end_flush()) {
|
||||
// Dumping...
|
||||
continue;
|
||||
}
|
||||
|
@ -6,6 +6,4 @@
|
||||
<FilesMatch "\.(txt|php)$">
|
||||
Deny from all
|
||||
Allow from localhost
|
||||
</FilesMatch>
|
||||
php_flag engine off
|
||||
|
||||
</FilesMatch>
|
@ -69,7 +69,11 @@ function pandoralogs_extension_main()
|
||||
|
||||
$logs_directory = (!empty($config['server_log_dir'])) ? io_safe_output($config['server_log_dir']) : '/var/log/pandora';
|
||||
|
||||
view_logfile($config['homedir'].'/pandora_console.log');
|
||||
// Do not attempt to show console log if disabled.
|
||||
if ($config['console_log_enabled']) {
|
||||
view_logfile($config['homedir'].'/log/console.log');
|
||||
}
|
||||
|
||||
view_logfile($logs_directory.'/pandora_server.log');
|
||||
view_logfile($logs_directory.'/pandora_server.error');
|
||||
}
|
||||
|
@ -199,8 +199,8 @@ function pandora_realtime_graphs()
|
||||
html_print_input_hidden('custom_action', urlencode(base64_encode(' <a href="javascript:realtimeGraphs.setOID();"><img src="'.ui_get_full_url('images').'/input_filter.disabled.png" title="'.__('Use this OID').'" style="vertical-align: middle;"></img></a>')), false);
|
||||
html_print_input_hidden('incremental_base', '0');
|
||||
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.js').'"></script>';
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/pandora_snmp_browser.js').'"></script>';
|
||||
echo '<script type="text/javascript" src="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.js').'"></script>';
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.ui_get_full_url('extensions/realtime_graphs/realtime_graphs.css').'"></style>';
|
||||
|
||||
// Store servers timezone offset to be retrieved from js
|
||||
|
1050
pandora_console/extras/mr/39.sql
Normal file
1050
pandora_console/extras/mr/39.sql
Normal file
File diff suppressed because it is too large
Load Diff
15
pandora_console/extras/mr/40.sql
Normal file
15
pandora_console/extras/mr/40.sql
Normal file
@ -0,0 +1,15 @@
|
||||
START TRANSACTION;
|
||||
|
||||
UPDATE `talert_commands` SET name='Monitoring Event' WHERE name='Pandora FMS Event';
|
||||
|
||||
ALTER TABLE `tservice_element` ADD COLUMN `rules` text;
|
||||
ALTER TABLE `tservice` ADD COLUMN `unknown_as_critical` tinyint(1) NOT NULL default 0 AFTER `warning`;
|
||||
ALTER TABLE `tserver` MODIFY COLUMN `version` varchar(25) NOT NULL DEFAULT '';
|
||||
|
||||
UPDATE `tservice` SET `auto_calculate`=0;
|
||||
|
||||
UPDATE `tservice` SET `cps`= `cps` - 1 WHERE `cps` > 0;
|
||||
UPDATE `tagente` SET `cps`= `cps` - 1 WHERE `cps` > 0;
|
||||
UPDATE `tagente_modulo` SET `cps`= `cps` - 1 WHERE `cps` > 0;
|
||||
|
||||
COMMIT;
|
12
pandora_console/extras/mr/41.sql
Normal file
12
pandora_console/extras/mr/41.sql
Normal file
@ -0,0 +1,12 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `treport_content` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
|
||||
ALTER TABLE `talert_templates` ADD COLUMN `previous_name` text;
|
||||
ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text;
|
||||
ALTER TABLE `talert_commands` ADD COLUMN `previous_name` text;
|
||||
ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
|
||||
ALTER TABLE `tconfig_os` ADD COLUMN `previous_name` text NULL;
|
||||
|
||||
COMMIT;
|
File diff suppressed because it is too large
Load Diff
@ -165,7 +165,12 @@ if (check_login()) {
|
||||
break;
|
||||
|
||||
case 'monitorcheckmodal':
|
||||
echo __('This system has too many modules per agent. OpenSource version could manage thousands of modules, but is not recommended to have more than 40 modules per agent. This configuration has B/A modules per agent. Checkout the Enterprise Version for a professional supported system.');
|
||||
// Get agent/module average.
|
||||
$agentCount = db_get_value_sql('SELECT count(*) FROM tagente');
|
||||
$modulesCount = db_get_value_sql('SELECT count(*) FROM tagente_modulo');
|
||||
$average = ($modulesCount / $agentCount);
|
||||
|
||||
echo __('This system has too many modules per agent. OpenSource version could manage thousands of modules, but is not recommended to have more than 100 modules per agent. This configuration has %d modules per agent. Checkout the Enterprise Version for a professional supported system.', $average);
|
||||
break;
|
||||
|
||||
case 'remotemodulesmodal':
|
||||
|
@ -53,8 +53,8 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clus
|
||||
|
||||
<?php
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
echo "<div id='create_master_window'></div>";
|
||||
echo "<div id='msg'></div>";
|
||||
echo "<div id='create_master_window' style='display:none;'></div>";
|
||||
echo "<div id='msg' style='display:none;'></div>";
|
||||
?>
|
||||
<input style="margin-bottom:20px;" onclick="show_create_ha_cluster();" type="submit" class="button_task" value="<?php echo __('Add new node'); ?>" />
|
||||
<?php
|
||||
|
@ -106,7 +106,7 @@ img.modalclose {
|
||||
<span class='modalheadertex'>
|
||||
<?php echo __('Database error'); ?>
|
||||
</span>
|
||||
<img class='modalclose' src='<?php echo $config['homeurl']; ?>images/icono_cerrar.png'>
|
||||
<img class='modalclose' src='<?php echo $config['homeurl']; ?>/images/icono_cerrar.png'>
|
||||
</div>
|
||||
|
||||
<div class='modalconten'>
|
||||
|
@ -1,66 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Wizard for SNMP / WMI discover.
|
||||
*
|
||||
* @category Agent Wizard
|
||||
* @package Pandora FMS
|
||||
* @subpackage Opensource
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2020 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Begin.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
$wizard_section = get_parameter('wizard_section', 'snmp_interfaces_explorer');
|
||||
$idAgent = (int) get_parameter('id_agente', 0);
|
||||
$ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
|
||||
|
||||
switch ($wizard_section) {
|
||||
case 'snmp_interfaces_explorer':
|
||||
$snmp_interfaces_explorer_style = 'font-weight: bold;';
|
||||
$wmi_explorer_style = '';
|
||||
break;
|
||||
|
||||
case 'wmi_explorer':
|
||||
$snmp_interfaces_explorer_style = '';
|
||||
$wmi_explorer_style = 'font-weight: bold;';
|
||||
break;
|
||||
|
||||
case 'snmp_explorer':
|
||||
$snmp_interfaces_explorer_style = '';
|
||||
$wmi_explorer_style = 'font-weight: bold;';
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
echo "<div style='text-align: right; width: 98%; padding-top: 10px; padding-bottom: 10px;'>";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=$idAgent' style='" . $snmp_interfaces_explorer_style . "'>" . __('SNMP Interfaces explorer') . "</a>";
|
||||
echo " | ";
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=wmi_explorer&id_agente=$idAgent' style='" . $wmi_explorer_style . "'>" . __('WMI explorer') . "</a>";
|
||||
echo "</div>";
|
||||
*/
|
||||
|
||||
require 'agent_wizard.'.$wizard_section.'.php';
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function satellite_remote_warn(id_satellite, remote)
|
||||
{
|
||||
if(!remote)
|
||||
{
|
||||
$('#server_to_exec option[value='+id_satellite+']').prop('disabled', true);
|
||||
$('#satellite_remote_tip').removeAttr("style").show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#satellite_remote_tip').removeAttr("style").hide();
|
||||
// Require needed class.
|
||||
require_once $config['homedir'].'/include/class/AgentWizard.class.php';
|
||||
// This page.
|
||||
$ajaxPage = 'godmode/agentes/agent_wizard';
|
||||
$pageName = '[AgentWizard]';
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$obj = new AgentWizard($ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
if (is_ajax()) {
|
||||
echo json_encode(['error' => $pageName.$e->getMessage() ]);
|
||||
exit;
|
||||
} else {
|
||||
echo $pageName.$e->getMessage();
|
||||
}
|
||||
|
||||
// Stop this execution, but continue 'globally'.
|
||||
return;
|
||||
}
|
||||
|
||||
</script>
|
||||
// AJAX controller.
|
||||
if (is_ajax()) {
|
||||
$method = get_parameter('method');
|
||||
|
||||
if (method_exists($obj, $method) === true) {
|
||||
$obj->{$method}();
|
||||
} else {
|
||||
$obj->error('Method not found. ['.$method.']');
|
||||
}
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
||||
} else {
|
||||
// Run.
|
||||
$obj->run();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,743 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Extension to manage a list of gateways and the node address where they should
|
||||
* point to.
|
||||
*
|
||||
* @category SNMP interfaces.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once 'include/functions_modules.php';
|
||||
require_once 'include/functions_alerts.php';
|
||||
require_once 'include/functions_reporting.php';
|
||||
require_once 'include/graphs/functions_utils.php';
|
||||
|
||||
|
||||
$idAgent = (int) get_parameter('id_agente', 0);
|
||||
$ipAgent = db_get_value('direccion', 'tagente', 'id_agente', $idAgent);
|
||||
|
||||
check_login();
|
||||
$ip_target = (string) get_parameter('ip_target', $ipAgent);
|
||||
$use_agent = get_parameter('use_agent');
|
||||
$snmp_community = (string) get_parameter('snmp_community', 'public');
|
||||
$server_to_exec = get_parameter('server_to_exec', 0);
|
||||
$snmp_version = get_parameter('snmp_version', '1');
|
||||
$snmp3_auth_user = io_safe_output(get_parameter('snmp3_auth_user'));
|
||||
$snmp3_security_level = get_parameter('snmp3_security_level');
|
||||
$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'));
|
||||
$tcp_port = (string) get_parameter('tcp_port');
|
||||
|
||||
// See if id_agente is set (either POST or GET, otherwise -1.
|
||||
$id_agent = $idAgent;
|
||||
|
||||
// Get passed variables.
|
||||
$snmpwalk = (int) get_parameter('snmpwalk', 0);
|
||||
$create_modules = (int) get_parameter('create_modules', 0);
|
||||
|
||||
$interfaces = [];
|
||||
$interfaces_ip = [];
|
||||
|
||||
if ($snmpwalk) {
|
||||
// OID Used is for SNMP MIB-2 Interfaces.
|
||||
$snmpis = get_snmpwalk(
|
||||
$ip_target,
|
||||
$snmp_version,
|
||||
$snmp_community,
|
||||
$snmp3_auth_user,
|
||||
$snmp3_security_level,
|
||||
$snmp3_auth_method,
|
||||
$snmp3_auth_pass,
|
||||
$snmp3_privacy_method,
|
||||
$snmp3_privacy_pass,
|
||||
0,
|
||||
'.1.3.6.1.2.1.2',
|
||||
$tcp_port,
|
||||
$server_to_exec
|
||||
);
|
||||
// IfXTable is also used.
|
||||
$ifxitems = get_snmpwalk(
|
||||
$ip_target,
|
||||
$snmp_version,
|
||||
$snmp_community,
|
||||
$snmp3_auth_user,
|
||||
$snmp3_security_level,
|
||||
$snmp3_auth_method,
|
||||
$snmp3_auth_pass,
|
||||
$snmp3_privacy_method,
|
||||
$snmp3_privacy_pass,
|
||||
0,
|
||||
'.1.3.6.1.2.1.31.1.1',
|
||||
$tcp_port,
|
||||
$server_to_exec
|
||||
);
|
||||
|
||||
// Get the interfaces IPV4/IPV6.
|
||||
$snmp_int_ip = get_snmpwalk(
|
||||
$ip_target,
|
||||
$snmp_version,
|
||||
$snmp_community,
|
||||
$snmp3_auth_user,
|
||||
$snmp3_security_level,
|
||||
$snmp3_auth_method,
|
||||
$snmp3_auth_pass,
|
||||
$snmp3_privacy_method,
|
||||
$snmp3_privacy_pass,
|
||||
0,
|
||||
'.1.3.6.1.2.1.4.34.1.3',
|
||||
$tcp_port,
|
||||
$server_to_exec
|
||||
);
|
||||
|
||||
// Build a [<interface id>] => [<interface ip>] array.
|
||||
if (!empty($snmp_int_ip)) {
|
||||
foreach ($snmp_int_ip as $key => $value) {
|
||||
// The key is something like IP-MIB::ipAddressIfIndex.ipv4."<ip>".
|
||||
// or IP-MIB::ipAddressIfIndex.ipv6."<ip>".
|
||||
// The value is something like INTEGER: <interface id>.
|
||||
$data = explode(': ', $value);
|
||||
$interface_id = !empty($data) && isset($data[1]) ? $data[1] : false;
|
||||
|
||||
if (preg_match('/^.+"(.+)"$/', $key, $matches) && isset($matches[1])) {
|
||||
$interface_ip = $matches[1];
|
||||
}
|
||||
|
||||
// Get the first ip.
|
||||
if ($interface_id !== false && !empty($interface_ip) && !isset($interfaces_ip[$interface_id])) {
|
||||
$interfaces_ip[$interface_id] = $interface_ip;
|
||||
}
|
||||
}
|
||||
|
||||
unset($snmp_int_ip);
|
||||
}
|
||||
|
||||
$snmpis = array_merge((($snmpis === false) ? [] : $snmpis), (($ifxitems === false) ? [] : $ifxitems));
|
||||
|
||||
$interfaces = [];
|
||||
|
||||
// We get here only the interface part of the MIB, not full mib.
|
||||
foreach ($snmpis as $key => $snmp) {
|
||||
$data = explode(': ', $snmp, 2);
|
||||
$keydata = explode('::', $key);
|
||||
$keydata2 = explode('.', $keydata[1]);
|
||||
|
||||
// Avoid results without index and interfaces without name.
|
||||
if (!isset($keydata2[1]) || !isset($data[1])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (array_key_exists(1, $data)) {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
|
||||
} else {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = '';
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0];
|
||||
}
|
||||
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['oid'] = $key;
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['checked'] = 0;
|
||||
}
|
||||
|
||||
unset($interfaces[0]);
|
||||
}
|
||||
|
||||
if ($create_modules) {
|
||||
$id_snmp_serialize = get_parameter_post('id_snmp_serialize');
|
||||
$interfaces = unserialize_in_temp($id_snmp_serialize);
|
||||
|
||||
$id_snmp_int_ip_serialize = get_parameter_post('id_snmp_int_ip_serialize');
|
||||
$interfaces_ip = unserialize_in_temp($id_snmp_int_ip_serialize);
|
||||
|
||||
if (!$interfaces) {
|
||||
$interfaces = [];
|
||||
}
|
||||
|
||||
if (!$interfaces_ip) {
|
||||
$interfaces_ip = [];
|
||||
}
|
||||
|
||||
$values = [];
|
||||
|
||||
if ($tcp_port != '') {
|
||||
$values['tcp_port'] = $tcp_port;
|
||||
}
|
||||
|
||||
$values['snmp_community'] = $snmp_community;
|
||||
if ($use_agent) {
|
||||
$values['ip_target'] = 'auto';
|
||||
} else {
|
||||
$values['ip_target'] = $ip_target;
|
||||
}
|
||||
|
||||
$values['tcp_send'] = $snmp_version;
|
||||
|
||||
if ($snmp_version == '3') {
|
||||
$values['plugin_user'] = $snmp3_auth_user;
|
||||
$values['plugin_pass'] = $snmp3_auth_pass;
|
||||
$values['plugin_parameter'] = $snmp3_auth_method;
|
||||
$values['custom_string_1'] = $snmp3_privacy_method;
|
||||
$values['custom_string_2'] = $snmp3_privacy_pass;
|
||||
$values['custom_string_3'] = $snmp3_security_level;
|
||||
}
|
||||
|
||||
$oids = [];
|
||||
foreach ($interfaces as $key => $interface) {
|
||||
foreach ($interface as $key2 => $module) {
|
||||
$oid = get_parameter($key.'-'.$key2, '');
|
||||
if ($oid != '') {
|
||||
$interfaces[$key][$key2]['checked'] = 1;
|
||||
$oids[$key][] = $interfaces[$key][$key2]['oid'];
|
||||
} else {
|
||||
$interfaces[$key][$key2]['checked'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$modules = get_parameter('module', []);
|
||||
$id_snmp = get_parameter('id_snmp');
|
||||
|
||||
if ($id_snmp == false) {
|
||||
ui_print_error_message(__('No modules selected'));
|
||||
$id_snmp = [];
|
||||
}
|
||||
|
||||
if (agents_get_name($id_agent) == false) {
|
||||
ui_print_error_message(__('No agent selected or the agent does not exist'));
|
||||
$id_snmp = [];
|
||||
}
|
||||
|
||||
$result = false;
|
||||
|
||||
$errors = [];
|
||||
$done = 0;
|
||||
|
||||
foreach ($id_snmp as $id) {
|
||||
$ifname = '';
|
||||
$ifPhysAddress = '';
|
||||
|
||||
if (isset($interfaces[$id]['ifName']) && $interfaces[$id]['ifName']['value'] != '') {
|
||||
$ifname = $interfaces[$id]['ifName']['value'];
|
||||
} else if (isset($interfaces[$id]['ifDescr']) && $interfaces[$id]['ifDescr']['value'] != '') {
|
||||
$ifname = $interfaces[$id]['ifDescr']['value'];
|
||||
}
|
||||
|
||||
if (isset($interfaces[$id]['ifPhysAddress']) && $interfaces[$id]['ifPhysAddress']['value'] != '') {
|
||||
$ifPhysAddress = $interfaces[$id]['ifPhysAddress']['value'];
|
||||
$ifPhysAddress = strtoupper($ifPhysAddress);
|
||||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$oid_array = explode('.', $module);
|
||||
$oid_array[(count($oid_array) - 1)] = $id;
|
||||
$oid = implode('.', $oid_array);
|
||||
|
||||
// Get the name.
|
||||
$name_array = explode('::', $oid_array[0]);
|
||||
$name = $ifname.'_'.$name_array[1];
|
||||
|
||||
// If you select "show all modules" and the module is not from the interface.
|
||||
if (!array_key_exists($name_array[1], $interfaces[$id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Clean the name.
|
||||
$name = str_replace('"', '', $name);
|
||||
|
||||
// Proc moduletypes.
|
||||
if (preg_match('/Status/', $name_array[1])) {
|
||||
$module_type = 18;
|
||||
} else if (preg_match('/Present/', $name_array[1])) {
|
||||
$module_type = 18;
|
||||
} else if (preg_match('/PromiscuousMode/', $name_array[1])) {
|
||||
$module_type = 18;
|
||||
} else if (preg_match('/Alias/', $name_array[1])) {
|
||||
// String moduletypes.
|
||||
$module_type = 17;
|
||||
} else if (preg_match('/Address/', $name_array[1])) {
|
||||
$module_type = 17;
|
||||
} else if (preg_match('/Name/', $name_array[1])) {
|
||||
$module_type = 17;
|
||||
} else if (preg_match('/Specific/', $name_array[1])) {
|
||||
$module_type = 17;
|
||||
} else if (preg_match('/Descr/', $name_array[1])) {
|
||||
$module_type = 17;
|
||||
} else if (preg_match('/s$/', $name_array[1])) {
|
||||
// Specific counters (ends in s).
|
||||
$module_type = 16;
|
||||
} else {
|
||||
// Otherwise, numeric.
|
||||
$module_type = 15;
|
||||
}
|
||||
|
||||
$values['unit'] = '';
|
||||
if (preg_match('/Octets/', $name_array[1])) {
|
||||
$values['unit'] = 'Bytes';
|
||||
}
|
||||
|
||||
$module_server = 2;
|
||||
|
||||
if ($server_to_exec != 0) {
|
||||
$sql = sprintf('SELECT server_type, ip_address FROM tserver WHERE id_server = %d', $server_to_exec);
|
||||
$row = db_get_row_sql($sql);
|
||||
|
||||
if ($row['server_type'] == 13) {
|
||||
if (preg_match('/ifPhysAddress/', $name_array[1])) {
|
||||
$module_type = 3;
|
||||
} else if (preg_match('/ifSpecific/', $name_array[1])) {
|
||||
$module_type = 3;
|
||||
} else if (preg_match('/ifType/', $name_array[1])) {
|
||||
$module_type = 1;
|
||||
} else if (preg_match('/ifSpeed/', $name_array[1])) {
|
||||
$module_type = 1;
|
||||
} else if (preg_match('/ifPromiscuousMode/', $name_array[1])) {
|
||||
$module_type = 2;
|
||||
} else if (preg_match('/ifOutQLen/', $name_array[1])) {
|
||||
$module_type = 1;
|
||||
} else if (preg_match('/ifName/', $name_array[1])) {
|
||||
$module_type = 3;
|
||||
} else if (preg_match('/ifMtu/', $name_array[1])) {
|
||||
$module_type = 1;
|
||||
} else if (preg_match('/ifLinkUpDownTrapEnable/', $name_array[1])) {
|
||||
$module_type = 1;
|
||||
} else if (preg_match('/ifLastChange/', $name_array[1])) {
|
||||
$module_type = 1;
|
||||
} else if (preg_match('/ifIndex/', $name_array[1])) {
|
||||
$module_type = 1;
|
||||
} else if (preg_match('/ifDescr/', $name_array[1])) {
|
||||
$module_type = 3;
|
||||
} else if (preg_match('/ifCounterDiscontinuityTime/', $name_array[1])) {
|
||||
$module_type = 1;
|
||||
} else if (preg_match('/ifConnectorPresent/', $name_array[1])) {
|
||||
$module_type = 2;
|
||||
} else if (preg_match('/ifAdminStatus/', $name_array[1])) {
|
||||
$module_type = 2;
|
||||
} else if (preg_match('/ifOperStatus/', $name_array[1])) {
|
||||
$module_type = 2;
|
||||
} else {
|
||||
$module_type = 4;
|
||||
}
|
||||
|
||||
$module_server = 1;
|
||||
|
||||
$output_oid = '';
|
||||
|
||||
exec('snmptranslate -On '.$oid, $output_oid, $rc);
|
||||
|
||||
$conf_oid = $output_oid[0];
|
||||
$oid = $conf_oid;
|
||||
}
|
||||
}
|
||||
|
||||
$values['id_tipo_modulo'] = $module_type;
|
||||
|
||||
if (!empty($ifPhysAddress) && isset($interfaces_ip[$id])) {
|
||||
$values['descripcion'] = io_safe_input('(IP: '.$interfaces_ip[$id].' - MAC: '.$ifPhysAddress.' - '.$name.') '.$interfaces[$id]['ifDescr']['value']);
|
||||
} else if (!empty($ifPhysAddress)) {
|
||||
$values['descripcion'] = io_safe_input('(MAC: '.$ifPhysAddress.' - '.$name.') '.$interfaces[$id]['ifDescr']['value']);
|
||||
} else if (isset($interfaces_ip[$id])) {
|
||||
$values['descripcion'] = io_safe_input('(IP: '.$interfaces_ip[$id].' - '.$name.') '.$interfaces[$id]['ifDescr']['value']);
|
||||
} else {
|
||||
$values['descripcion'] = io_safe_input('('.$name.') '.$interfaces[$id]['ifDescr']['value']);
|
||||
}
|
||||
|
||||
$values['snmp_oid'] = $oid;
|
||||
$values['id_modulo'] = $module_server;
|
||||
|
||||
$result = modules_create_agent_module($id_agent, io_safe_input($name), $values);
|
||||
|
||||
if (is_error($result)) {
|
||||
if (!isset($errors[$result])) {
|
||||
$errors[$result] = 0;
|
||||
}
|
||||
|
||||
$errors[$result]++;
|
||||
} else {
|
||||
if ($server_to_exec != 0) {
|
||||
$sql = sprintf('SELECT server_type FROM tserver WHERE id_server = %d', $server_to_exec);
|
||||
$row = db_get_row_sql($sql);
|
||||
|
||||
if ($row['server_type'] == 13) {
|
||||
$module_type_name = db_get_value_filter('nombre', 'ttipo_modulo', ['id_tipo' => $values['id_tipo_modulo']]);
|
||||
|
||||
$new_module_configuration_data = "module_begin\nmodule_name ".io_safe_input($name)."\nmodule_description ".io_safe_output($values['descripcion'])."\nmodule_type ".$module_type_name."\nmodule_snmp\nmodule_version ".$snmp_version."\nmodule_oid ".$conf_oid."\nmodule_community ".$values['snmp_community'];
|
||||
|
||||
if ($snmp_version == '3') {
|
||||
$new_module_configuration_data .= "\nmodule_secname ".$snmp3_auth_user;
|
||||
$new_module_configuration_data .= "\nmodule_seclevel ".$snmp3_security_level;
|
||||
|
||||
if ($snmp3_security_level == 'authNoPriv' || $snmp3_security_level == 'authPriv') {
|
||||
$new_module_configuration_data .= "\nmodule_authpass ".$snmp3_auth_pass;
|
||||
$new_module_configuration_data .= "\nmodule_authproto ".$snmp3_auth_method;
|
||||
}
|
||||
|
||||
if ($snmp3_security_level == 'authPriv') {
|
||||
$new_module_configuration_data .= "\nmodule_privproto ".$snmp3_privacy_method;
|
||||
$new_module_configuration_data .= "\nmodule_privpass ".$snmp3_privacy_pass;
|
||||
}
|
||||
}
|
||||
|
||||
$new_module_configuration_data .= "\nmodule_end";
|
||||
|
||||
config_agents_add_module_in_conf($id_agent, $new_module_configuration_data);
|
||||
}
|
||||
}
|
||||
|
||||
$done++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($done > 0) {
|
||||
ui_print_success_message(
|
||||
__('Successfully modules created').' ('.$done.')'
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($errors)) {
|
||||
$msg = __('Could not be created').':';
|
||||
|
||||
|
||||
foreach ($errors as $code => $number) {
|
||||
switch ($code) {
|
||||
case ERR_EXIST:
|
||||
$msg .= '<br>'.__('Another module already exists with the same name').' ('.$number.')';
|
||||
break;
|
||||
|
||||
case ERR_INCOMPLETE:
|
||||
$msg .= '<br>'.__('Some required fields are missed').': ('.__('name').') ('.$number.')';
|
||||
break;
|
||||
|
||||
case ERR_DB:
|
||||
case ERR_GENERIC:
|
||||
default:
|
||||
$msg .= '<br>'.__('Processing error').' ('.$number.')';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_error_message($msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the interface list for the interface.
|
||||
$interfaces_list = [];
|
||||
foreach ($interfaces as $interface) {
|
||||
// Get the interface name, removing " " characters and avoid "blank" interfaces.
|
||||
if (isset($interface['ifDescr']) && $interface['ifDescr']['value'] != '') {
|
||||
$ifname = $interface['ifDescr']['value'];
|
||||
} else if (isset($interface['ifName']) && $interface['ifName']['value'] != '') {
|
||||
$ifname = $interface['ifName']['value'];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
$interfaces_list[$interface['ifIndex']['value']] = str_replace('"', '', $ifname);
|
||||
}
|
||||
|
||||
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||
echo "<form method='post' id='walk_form' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
|
||||
|
||||
$table->width = '100%';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->class = 'databox filters';
|
||||
|
||||
$table->data[0][0] = '<b>'.__('Target IP').'</b>';
|
||||
$table->data[0][1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
||||
|
||||
$table->data[0][2] = '<b>'.__('Port').'</b>';
|
||||
$table->data[0][3] = html_print_input_text('tcp_port', $tcp_port, '', 5, 20, true);
|
||||
|
||||
$table->data[1][0] = '<b>'.__('Use agent ip').'</b>';
|
||||
$table->data[1][1] = html_print_checkbox('use_agent', 1, $use_agent, true);
|
||||
|
||||
$servers_to_exec = [];
|
||||
$servers_to_exec[0] = __('Local console');
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once('include/functions_satellite.php');
|
||||
|
||||
$rows = get_proxy_servers();
|
||||
|
||||
// Check if satellite server has remote configuration enabled.
|
||||
$satellite_remote = config_agents_has_remote_configuration($id_agent);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if ($row['server_type'] != 13) {
|
||||
$s_type = ' (Standard)';
|
||||
} else {
|
||||
$id_satellite = $row['id_server'];
|
||||
$s_type = ' (Satellite)';
|
||||
}
|
||||
|
||||
$servers_to_exec[$row['id_server']] = $row['name'].$s_type;
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[1][2] = '<b>'.__('Server to execute command').'</b>'.ui_print_help_icon('agent_snmp_explorer_tab', true);
|
||||
$table->data[1][2] .= '<span id=satellite_remote_tip>'.ui_print_help_tip(__('In order to use remote executions you need to enable remote execution in satellite server'), true, 'images/tip_help.png', false, 'display:').'</span>';
|
||||
$table->data[1][4] = html_print_select(
|
||||
$servers_to_exec,
|
||||
'server_to_exec',
|
||||
$server_to_exec,
|
||||
'satellite_remote_warn('.$id_satellite.','.$satellite_remote.')',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$snmp_versions['1'] = 'v. 1';
|
||||
$snmp_versions['2'] = 'v. 2';
|
||||
$snmp_versions['2c'] = 'v. 2c';
|
||||
$snmp_versions['3'] = 'v. 3';
|
||||
|
||||
$table->data[2][0] = '<b>'.__('SNMP community').'</b>';
|
||||
$table->data[2][1] = html_print_input_text('snmp_community', $snmp_community, '', 15, 60, true);
|
||||
|
||||
$table->data[2][2] = '<b>'.__('SNMP version').'</b>';
|
||||
$table->data[2][3] = html_print_select($snmp_versions, 'snmp_version', $snmp_version, '', '', '', true, false, false, '');
|
||||
|
||||
$table->data[2][3] .= '<div id="spinner_modules" style="float: left; display: none;">'.html_print_image('images/spinner.gif', true).'</div>';
|
||||
html_print_input_hidden('snmpwalk', 1);
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
unset($table);
|
||||
|
||||
// SNMP3 OPTIONS.
|
||||
$table->width = '100%';
|
||||
|
||||
$table->data[2][1] = '<b>'.__('Auth user').'</b>';
|
||||
$table->data[2][2] = html_print_input_text('snmp3_auth_user', $snmp3_auth_user, '', 15, 60, true);
|
||||
$table->data[2][3] = '<b>'.__('Auth password').'</b>';
|
||||
$table->data[2][4] = html_print_input_password('snmp3_auth_pass', $snmp3_auth_pass, '', 15, 60, true);
|
||||
$table->data[2][4] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_awsie', true);
|
||||
|
||||
$table->data[5][0] = '<b>'.__('Privacy method').'</b>';
|
||||
$table->data[5][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'snmp3_privacy_method', $snmp3_privacy_method, '', '', '', true);
|
||||
$table->data[5][2] = '<b>'.__('privacy pass').'</b>';
|
||||
$table->data[5][3] = html_print_input_password('snmp3_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true);
|
||||
|
||||
$table->data[6][0] = '<b>'.__('Auth method').'</b>';
|
||||
$table->data[6][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'snmp3_auth_method', $snmp3_auth_method, '', '', '', true);
|
||||
$table->data[6][2] = '<b>'.__('Security level').'</b>';
|
||||
$table->data[6][3] = html_print_select(
|
||||
[
|
||||
'noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'),
|
||||
'authPriv' => __('Auth and privacy method'),
|
||||
],
|
||||
'snmp3_security_level',
|
||||
$snmp3_security_level,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
if ($snmp_version == 3) {
|
||||
echo '<div id="snmp3_options">';
|
||||
} else {
|
||||
echo '<div id="snmp3_options" style="display: none;">';
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
echo '</div>';
|
||||
|
||||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
echo '<span id="oid_loading" class="invisible">'.html_print_image('images/spinner.gif', true).'</span>';
|
||||
html_print_submit_button(__('SNMP Walk'), 'snmp_walk', false, ['class' => 'sub next']);
|
||||
echo '</div>';
|
||||
|
||||
if ($snmpwalk && !$snmpis) {
|
||||
ui_print_error_message(__('Unable to do SNMP walk'));
|
||||
}
|
||||
|
||||
unset($table);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
if (!empty($interfaces_list)) {
|
||||
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||
echo "<form method='post' action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=snmp_interfaces_explorer&id_agente=".$id_agent."'>";
|
||||
echo '<span id="form_interfaces">';
|
||||
|
||||
$id_snmp_serialize = serialize_in_temp($interfaces, $config['id_user'].'_snmp');
|
||||
html_print_input_hidden('id_snmp_serialize', $id_snmp_serialize);
|
||||
|
||||
$id_snmp_int_ip_serialize = serialize_in_temp($interfaces_ip, $config['id_user'].'_snmp_int_ip');
|
||||
html_print_input_hidden('id_snmp_int_ip_serialize', $id_snmp_int_ip_serialize);
|
||||
|
||||
html_print_input_hidden('create_modules', 1);
|
||||
html_print_input_hidden('ip_target', $ip_target);
|
||||
html_print_input_hidden('use_agent', $use_agent);
|
||||
html_print_input_hidden('tcp_port', $tcp_port);
|
||||
html_print_input_hidden('snmp_community', $snmp_community);
|
||||
html_print_input_hidden('snmp_version', $snmp_version);
|
||||
html_print_input_hidden('snmp3_auth_user', $snmp3_auth_user);
|
||||
html_print_input_hidden('snmp3_auth_pass', $snmp3_auth_pass);
|
||||
html_print_input_hidden('snmp3_auth_method', $snmp3_auth_method);
|
||||
html_print_input_hidden('snmp3_privacy_method', $snmp3_privacy_method);
|
||||
html_print_input_hidden('snmp3_privacy_pass', $snmp3_privacy_pass);
|
||||
html_print_input_hidden('snmp3_security_level', $snmp3_security_level);
|
||||
html_print_input_hidden('server_to_exec', $server_to_exec);
|
||||
|
||||
$table->width = '100%';
|
||||
|
||||
// Agent selector.
|
||||
$table->data[0][0] = '<b>'.__('Interfaces').'</b>';
|
||||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
|
||||
|
||||
$table->data[1][1] = __('When selecting interfaces');
|
||||
$table->data[1][1] .= '<br>';
|
||||
$table->data[1][1] .= html_print_select(
|
||||
[
|
||||
1 => __('Show common modules'),
|
||||
0 => __('Show all modules'),
|
||||
],
|
||||
'modules_selection_mode',
|
||||
1,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
$table->data[1][2] = html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
html_print_submit_button(__('Create modules'), '', false, ['class' => 'sub add']);
|
||||
echo '</div>';
|
||||
unset($table);
|
||||
|
||||
echo '</span>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
ui_require_jquery_file('pandora.controls');
|
||||
ui_require_jquery_file('ajaxqueue');
|
||||
ui_require_jquery_file('bgiframe');
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
$(document).ready (function () {
|
||||
var inputActive = true;
|
||||
|
||||
$('#server_to_exec option').trigger('change');
|
||||
|
||||
$(document).data('text_for_module', $("#none_text").html());
|
||||
|
||||
$("#id_snmp").change(snmp_changed_by_multiple_snmp);
|
||||
|
||||
$("#snmp_version").change(function () {
|
||||
if (this.value == "3") {
|
||||
$("#snmp3_options").css("display", "");
|
||||
}
|
||||
else {
|
||||
$("#snmp3_options").css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
$("#walk_form").submit(function() {
|
||||
$("#submit-snmp_walk").disable ();
|
||||
$("#oid_loading").show ();
|
||||
$("#no_snmp").hide ();
|
||||
$("#form_interfaces").hide ();
|
||||
});
|
||||
|
||||
// When select interfaces changes
|
||||
$("#modules_selection_mode").change (function() {
|
||||
$("#id_snmp").trigger('change');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function snmp_changed_by_multiple_snmp (event, id_snmp, selected) {
|
||||
var idSNMP = Array();
|
||||
var get_common_modules = $("#modules_selection_mode option:selected").val();
|
||||
|
||||
jQuery.each ($("#id_snmp option:selected"), function (i, val) {
|
||||
idSNMP.push($(val).val());
|
||||
});
|
||||
$('#module').attr ('disabled', 1);
|
||||
$('#module').empty ();
|
||||
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
||||
|
||||
jQuery.post ('ajax.php',
|
||||
{"page" : "godmode/agentes/agent_manager",
|
||||
"get_modules_json_for_multiple_snmp": 1,
|
||||
"get_common_modules" : get_common_modules,
|
||||
"id_snmp[]": idSNMP,
|
||||
"id_snmp_serialize": $("#hidden-id_snmp_serialize").val()
|
||||
},
|
||||
function (data) {
|
||||
$('#module').empty ();
|
||||
c = 0;
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
$('#module').append ($('<option></option>').html (s).attr ("value", i));
|
||||
$('#module').fadeIn ('normal');
|
||||
c++;
|
||||
});
|
||||
|
||||
if (c == 0) {
|
||||
if (typeof($(document).data('text_for_module')) != 'undefined') {
|
||||
$('#module').append ($('<option></option>').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true));
|
||||
}
|
||||
else {
|
||||
if (typeof(data['any_text']) != 'undefined') {
|
||||
$('#module').append ($('<option></option>').html (data['any_text']).attr ("value", 0).prop('selected', true));
|
||||
}
|
||||
else {
|
||||
var anyText = $("#any_text").html(); //Trick for catch the translate text.
|
||||
|
||||
if (anyText == null) {
|
||||
anyText = 'Any';
|
||||
}
|
||||
|
||||
$('#module').append ($('<option></option>').html (anyText).attr ("value", 0).prop('selected', true));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selected != undefined)
|
||||
$('#module').attr ('value', selected);
|
||||
$('#module').removeAttr('disabled');
|
||||
},
|
||||
"json");
|
||||
}
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
@ -1,873 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Pandora FMS - http://pandorafms.com.
|
||||
* * ==================================================
|
||||
* * Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
* * Please see http://pandorafms.org for full contribution list
|
||||
* * This program is free software; you can redistribute it and/or
|
||||
* * modify it under the terms of the GNU General Public License
|
||||
* * as published by the Free Software Foundation; version 2
|
||||
* * This program is distributed in the hope that it will be useful,
|
||||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* * GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
global $config;
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once 'include/functions_modules.php';
|
||||
require_once 'include/functions_alerts.php';
|
||||
require_once 'include/functions_reporting.php';
|
||||
require_once 'include/functions_network_components.php';
|
||||
require_once 'include/functions_wmi.php';
|
||||
require_once 'include/graphs/functions_utils.php';
|
||||
|
||||
check_login();
|
||||
|
||||
$ip_target = (string) get_parameter('ip_target', $ipAgent);
|
||||
// Host.
|
||||
$plugin_user = (string) get_parameter('plugin_user', 'Administrator');
|
||||
// Username.
|
||||
$plugin_pass = io_safe_output(get_parameter('plugin_pass', ''));
|
||||
// Password.
|
||||
$tcp_send = (string) get_parameter('tcp_send');
|
||||
// Namespace.
|
||||
$server_to_exec = get_parameter('server_to_exec', 0);
|
||||
|
||||
// See if id_agente is set (either POST or GET, otherwise -1.
|
||||
$id_agent = $idAgent;
|
||||
|
||||
// Get passed variables.
|
||||
$wmiexplore = (int) get_parameter('wmiexplore', 0);
|
||||
$create_modules = (int) get_parameter('create_modules', 0);
|
||||
|
||||
$interfaces = [];
|
||||
|
||||
$wmi_client = 'wmic';
|
||||
|
||||
if ($wmiexplore) {
|
||||
$wmi_command = wmi_compose_query(
|
||||
$wmi_client,
|
||||
$plugin_user,
|
||||
$plugin_pass,
|
||||
$ip_target,
|
||||
$tcp_send
|
||||
);
|
||||
|
||||
$processes = [];
|
||||
$services = [];
|
||||
$disks = [];
|
||||
$network_component_groups = [];
|
||||
|
||||
// Processes.
|
||||
$wmi_processes = $wmi_command.' "select Name from Win32_Process"';
|
||||
$processes_name_field = 1;
|
||||
if (enterprise_installed() && (int) $server_to_exec != 0) {
|
||||
$server_data = db_get_row('tserver', 'id_server', $server_to_exec);
|
||||
|
||||
if (empty($server_data['port'])) {
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_processes."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
} else {
|
||||
exec(
|
||||
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_processes."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
}
|
||||
} else {
|
||||
exec($wmi_processes, $output);
|
||||
}
|
||||
|
||||
$fail = false;
|
||||
if (preg_match('/^Failed/', $output[0])) {
|
||||
$fail = true;
|
||||
}
|
||||
|
||||
if (!$fail) {
|
||||
foreach ($output as $index => $row) {
|
||||
// First and second rows are Class and column names, ignore it.
|
||||
if ($index < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row_exploded = explode('|', $row);
|
||||
|
||||
if (!in_array($row_exploded[$processes_name_field], $processes)) {
|
||||
if (preg_match('/ERROR/', $row_exploded[$processes_name_field])) {
|
||||
$processes[$row_exploded[$prouycesses_name_field]] = __('None');
|
||||
} else {
|
||||
$processes[$row_exploded[$prouycesses_name_field]] = $row_exploded[$processes_name_field];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($output);
|
||||
|
||||
// Services.
|
||||
$wmi_services = $wmi_command.' "select Name from Win32_Service"';
|
||||
$services_name_field = 0;
|
||||
$services_check_field = 1;
|
||||
|
||||
if (enterprise_installed() && (int) $server_to_exec != 0) {
|
||||
$server_data = db_get_row(
|
||||
'tserver',
|
||||
'id_server',
|
||||
$server_to_exec
|
||||
);
|
||||
if (empty($server_data['port'])) {
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_services."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
} else {
|
||||
exec(
|
||||
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_services."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
}
|
||||
} else {
|
||||
exec($wmi_services, $output);
|
||||
}
|
||||
|
||||
foreach ($output as $index => $row) {
|
||||
// First and second rows are Class and column names, ignore it.
|
||||
if ($index < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row_exploded = explode('|', $row);
|
||||
|
||||
if (!in_array($row_exploded[$services_name_field], $services)) {
|
||||
if (preg_match('/ERROR/', $row_exploded[$services_name_field])) {
|
||||
$services[$row_exploded[$services_name_field]] = __('None');
|
||||
} else {
|
||||
$services[$row_exploded[$services_name_field]] = $row_exploded[$services_name_field];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($output);
|
||||
|
||||
// Disks.
|
||||
$wmi_disks = $wmi_command.' "Select DeviceID from Win32_LogicalDisk"';
|
||||
$disks_name_field = 0;
|
||||
|
||||
if (enterprise_installed() && (int) $server_to_exec != 0) {
|
||||
$server_data = db_get_row('tserver', 'id_server', $server_to_exec);
|
||||
|
||||
if (empty($server_data['port'])) {
|
||||
exec(
|
||||
'ssh pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_disks."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
} else {
|
||||
exec(
|
||||
'ssh -p '.$server_data['port'].' pandora_exec_proxy@'.$server_data['ip_address']."
|
||||
'".$wmi_disks."'",
|
||||
$output,
|
||||
$rc
|
||||
);
|
||||
}
|
||||
} else {
|
||||
exec($wmi_disks, $output);
|
||||
}
|
||||
|
||||
foreach ($output as $index => $row) {
|
||||
// First and second rows are Class and column names, ignore it.
|
||||
if ($index < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row_exploded = explode('|', $row);
|
||||
|
||||
if (!in_array($row_exploded[$disks_name_field], $services)) {
|
||||
if (preg_match('/ERROR/', $row_exploded[$disks_name_field])) {
|
||||
$disks[$row_exploded[$disks_name_field]] = __('None');
|
||||
} else {
|
||||
$disk_string = sprintf(
|
||||
__('Free space on %s'),
|
||||
$row_exploded[$disks_name_field]
|
||||
);
|
||||
$disks[$row_exploded[$disks_name_field]] = $disk_string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($output);
|
||||
|
||||
// WMI Components.
|
||||
$network_component_groups = network_components_get_groups(MODULE_WMI);
|
||||
}
|
||||
}
|
||||
|
||||
if ($create_modules) {
|
||||
$modules = get_parameter('module', []);
|
||||
|
||||
$services = [];
|
||||
$processes = [];
|
||||
$disks = [];
|
||||
$components = [];
|
||||
|
||||
foreach ($modules as $module) {
|
||||
// Split module data to get type.
|
||||
$module_exploded = explode('_', $module);
|
||||
$type = $module_exploded[0];
|
||||
|
||||
// Delete type from module data.
|
||||
unset($module_exploded[0]);
|
||||
|
||||
// Rebuild module data.
|
||||
$module = implode('_', $module_exploded);
|
||||
|
||||
switch ($type) {
|
||||
case 'service':
|
||||
$services[] = $module;
|
||||
break;
|
||||
|
||||
case 'process':
|
||||
$processes[] = $module;
|
||||
break;
|
||||
|
||||
case 'disk':
|
||||
$disks[] = $module;
|
||||
break;
|
||||
|
||||
case 'component':
|
||||
$components[] = $module;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Common values for WMI modules.
|
||||
$values = [
|
||||
'ip_target' => $ip_target,
|
||||
'tcp_send' => $tcp_send,
|
||||
'plugin_user' => $plugin_user,
|
||||
'plugin_pass' => $plugin_pass,
|
||||
'id_modulo' => MODULE_WMI,
|
||||
];
|
||||
|
||||
if ($server_to_exec != 0) {
|
||||
$sql = sprintf(
|
||||
'SELECT server_type FROM tserver WHERE id_server = %d',
|
||||
$server_to_exec
|
||||
);
|
||||
$row = db_get_row_sql($sql);
|
||||
|
||||
if ($row['server_type'] == 13) {
|
||||
$values['id_modulo'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Create Service modules.
|
||||
$services_values = $values;
|
||||
|
||||
$services_values['snmp_community'] = 'Running';
|
||||
// Key string.
|
||||
$services_values['tcp_port'] = 1;
|
||||
// Field number (Running/Stopped).
|
||||
$services_values['id_tipo_modulo'] = 2;
|
||||
// Generic boolean.
|
||||
$services_result = wmi_create_wizard_modules(
|
||||
$id_agent,
|
||||
$services,
|
||||
'services',
|
||||
$services_values,
|
||||
0,
|
||||
0,
|
||||
$server_to_exec
|
||||
);
|
||||
|
||||
// Create Process modules.
|
||||
$processes_values = $values;
|
||||
|
||||
$processes_values['tcp_port'] = 0;
|
||||
// Field number (OID).
|
||||
$processes_values['id_tipo_modulo'] = 2;
|
||||
// Generic boolean.
|
||||
$processes_result = wmi_create_wizard_modules(
|
||||
$id_agent,
|
||||
$processes,
|
||||
'processes',
|
||||
$processes_values,
|
||||
0,
|
||||
0,
|
||||
$server_to_exec
|
||||
);
|
||||
|
||||
// Create Space on disk modules.
|
||||
$disks_values = $values;
|
||||
|
||||
$disks_values['tcp_port'] = 1;
|
||||
// Free space in bytes.
|
||||
$disks_values['id_tipo_modulo'] = 1;
|
||||
// Generic numeric.
|
||||
$disks_values['unit'] = 'Bytes';
|
||||
// Unit.
|
||||
$disks_result = wmi_create_wizard_modules(
|
||||
$id_agent,
|
||||
$disks,
|
||||
'disks',
|
||||
$disks_values,
|
||||
0,
|
||||
0,
|
||||
$server_to_exec
|
||||
);
|
||||
|
||||
// Create modules from component.
|
||||
$components_values = $values;
|
||||
|
||||
$components_values['id_agente'] = $id_agent;
|
||||
|
||||
$components_result = wmi_create_module_from_components(
|
||||
$components,
|
||||
$components_values,
|
||||
0,
|
||||
0,
|
||||
$server_to_exec
|
||||
);
|
||||
|
||||
|
||||
// Errors/Success messages.
|
||||
$success_message = '';
|
||||
$error_message = '';
|
||||
if (!empty($services_result)) {
|
||||
if (count($services_result[NOERR]) > 0) {
|
||||
$success_message .= sprintf(
|
||||
__('%s service modules created succesfully'),
|
||||
count($services_result[NOERR])
|
||||
).'<br>';
|
||||
}
|
||||
|
||||
if (count($services_result[ERR_GENERIC]) > 0) {
|
||||
$error_message .= sprintf(
|
||||
__('Error creating %s service modules'),
|
||||
count($services_result[ERR_GENERIC])
|
||||
).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($processes_result)) {
|
||||
if (count($processes_result[NOERR]) > 0) {
|
||||
$success_message .= sprintf(
|
||||
__('%s process modules created succesfully'),
|
||||
count($processes_result[NOERR])
|
||||
).'<br>';
|
||||
}
|
||||
|
||||
if (count($processes_result[ERR_GENERIC]) > 0) {
|
||||
$error_message .= sprintf(
|
||||
__('Error creating %s process modules'),
|
||||
count($processes_result[ERR_GENERIC])
|
||||
).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($disks_result)) {
|
||||
if (count($disks_result[NOERR]) > 0) {
|
||||
$success_message .= sprintf(
|
||||
__('%s disk space modules created succesfully'),
|
||||
count($disks_result[NOERR])
|
||||
).'<br>';
|
||||
}
|
||||
|
||||
if (count($disks_result[ERR_GENERIC]) > 0) {
|
||||
$error_message .= sprintf(
|
||||
__('Error creating %s disk space modules'),
|
||||
count($disks_result[ERR_GENERIC])
|
||||
).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($components_result)) {
|
||||
if (count($components_result[NOERR]) > 0) {
|
||||
$success_message .= sprintf(
|
||||
__('%s modules created from components succesfully'),
|
||||
count($components_result[NOERR])
|
||||
).'<br>';
|
||||
}
|
||||
|
||||
if (count($components_result[ERR_GENERIC]) > 0) {
|
||||
$error_message .= sprintf(
|
||||
__('Error creating %s modules from components'),
|
||||
count($components_result[ERR_GENERIC])
|
||||
).'<br>';
|
||||
}
|
||||
|
||||
if (count($components_result[ERR_EXIST]) > 0) {
|
||||
$error_message .= sprintf(
|
||||
__('%s modules already exist'),
|
||||
count($components_result[ERR_EXIST])
|
||||
).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($success_message)) {
|
||||
ui_print_success_message($success_message);
|
||||
}
|
||||
|
||||
if (!empty($error_message)) {
|
||||
ui_print_error_message($error_message);
|
||||
}
|
||||
}
|
||||
|
||||
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||
echo "<form method='post' id='wmi_form'
|
||||
action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=wmi_explorer&id_agente=$id_agent'>";
|
||||
|
||||
$table->width = '100%';
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->class = 'databox filters';
|
||||
|
||||
$table->data[0][0] = '<b>'.__('Target IP').'</b>';
|
||||
$table->data[0][1] = html_print_input_text(
|
||||
'ip_target',
|
||||
$ip_target,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[0][2] = '<b>'.__('Namespace').'</b>';
|
||||
$table->data[0][3] = html_print_input_text(
|
||||
'tcp_send',
|
||||
$tcp_send,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][0] = '<b>'.__('Username').'</b>';
|
||||
$table->data[1][1] = html_print_input_text(
|
||||
'plugin_user',
|
||||
$plugin_user,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][2] = '<b>'.__('Password').'</b>';
|
||||
$table->data[1][3] = html_print_input_password(
|
||||
'plugin_pass',
|
||||
$plugin_pass,
|
||||
'',
|
||||
15,
|
||||
60,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">
|
||||
'.html_print_image('images/spinner.gif', true).'</div>';
|
||||
html_print_input_hidden('wmiexplore', 1);
|
||||
|
||||
$servers_to_exec = [];
|
||||
$servers_to_exec[0] = __('Local console');
|
||||
if (enterprise_installed()) {
|
||||
enterprise_include_once('include/functions_satellite.php');
|
||||
|
||||
$rows = get_proxy_servers();
|
||||
foreach ($rows as $row) {
|
||||
if ($row['server_type'] != 13) {
|
||||
$s_type = ' (Standard)';
|
||||
} else {
|
||||
$s_type = ' (Satellite)';
|
||||
}
|
||||
|
||||
$servers_to_exec[$row['id_server']] = $row['name'].$s_type;
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[2][0] = '<b>'.__('Server to execute command').'</b>'.ui_print_help_icon('agent_snmp_explorer_tab', true);
|
||||
$table->data[2][1] = html_print_select(
|
||||
$servers_to_exec,
|
||||
'server_to_exec',
|
||||
$server_to_exec,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
echo '<span id="oid_loading" class="invisible">
|
||||
'.html_print_image('images/spinner.gif', true).'</span>';
|
||||
html_print_submit_button(
|
||||
__('WMI Explore'),
|
||||
'wmi_explore',
|
||||
false,
|
||||
['class' => 'sub next']
|
||||
);
|
||||
echo '</div><br>';
|
||||
|
||||
if ($wmiexplore && $fail) {
|
||||
ui_print_error_message(__('Unable to do WMI explorer'));
|
||||
}
|
||||
|
||||
unset($table);
|
||||
|
||||
echo '</form>';
|
||||
|
||||
if ($wmiexplore && !$fail) {
|
||||
echo '<br><span id ="none_text" style="display: none;">'.__('None').'</span>';
|
||||
echo "<form method='post'
|
||||
action='index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=agent_wizard&wizard_section=wmi_explorer&id_agente=$id_agent'>";
|
||||
echo '<span id="form_interfaces">';
|
||||
|
||||
html_print_input_hidden('create_modules', 1);
|
||||
html_print_input_hidden('ip_target', $ip_target);
|
||||
// Host.
|
||||
html_print_input_hidden('plugin_user', $plugin_user);
|
||||
// User.
|
||||
html_print_input_hidden('plugin_pass', $plugin_pass);
|
||||
// Password.
|
||||
html_print_input_hidden('tcp_send', $tcp_send);
|
||||
// Namespace.
|
||||
html_print_input_hidden('server_to_exec', $server_to_exec);
|
||||
|
||||
$table->width = '100%';
|
||||
|
||||
// Mode selector.
|
||||
$modes = [];
|
||||
$modes['services'] = __('Services');
|
||||
$modes['processes'] = __('Processes');
|
||||
$modes['disks'] = __('Free space on disk');
|
||||
$modes['components'] = __('WMI components');
|
||||
|
||||
$table->data[1][0] = __('Wizard mode').': ';
|
||||
$table->data[1][0] .= html_print_select(
|
||||
$modes,
|
||||
'wmi_wizard_modes',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$table->cellstyle[1][0] = 'vertical-align: middle;';
|
||||
|
||||
$table->colspan[1][0] = 2;
|
||||
$table->data[1][2] = '<b>'.__('Modules').'</b>';
|
||||
$table->cellstyle[1][2] = 'text-align: center;';
|
||||
|
||||
// Components list.
|
||||
$table->data[2][0] = '<div class="wizard_mode_form wizard_mode_components">';
|
||||
$table->data[2][0] .= __('Filter by group').'<br>';
|
||||
$table->data[2][0] .= html_print_select(
|
||||
$network_component_groups,
|
||||
'network_component_group',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'width: 300px;'
|
||||
).'<br>';
|
||||
$table->data[2][0] .= html_print_select(
|
||||
[],
|
||||
'network_component',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 300px;'
|
||||
);
|
||||
$table->data[2][0] .= '</div>';
|
||||
|
||||
// Services list.
|
||||
$table->data[2][0] .= '<div class="wizard_mode_form wizard_mode_services">';
|
||||
$table->data[2][0] .= html_print_select(
|
||||
$services,
|
||||
'services',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 300px;'
|
||||
);
|
||||
$table->data[2][0] .= '</div>';
|
||||
// Processes list.
|
||||
$table->data[2][0] .= '<div class="wizard_mode_form wizard_mode_processes">';
|
||||
$table->data[2][0] .= html_print_select(
|
||||
$processes,
|
||||
'processes',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 300px;'
|
||||
);
|
||||
$table->data[2][0] .= '</div>';
|
||||
$table->data[2][0] .= '<span id="no_component"
|
||||
class="invisible error wizard_mode_form wizard_mode_components">';
|
||||
|
||||
$table->data[2][0] .= __('No component was found');
|
||||
$table->data[2][0] .= '</span>';
|
||||
|
||||
// Disks list.
|
||||
$table->data[2][0] .= '<div class="wizard_mode_form wizard_mode_disks">';
|
||||
$table->data[2][0] .= html_print_select(
|
||||
$disks,
|
||||
'disks',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 300px;'
|
||||
);
|
||||
$table->data[2][0] .= '</div>';
|
||||
$table->cellstyle[2][0] = 'vertical-align: bottom; text-align: center;';
|
||||
|
||||
|
||||
// Components arrow.
|
||||
$table->data[2][1] = '<div
|
||||
class="wizard_mode_form wizard_mode_components wizard_mode_components_arrow clickable">
|
||||
'.html_print_image(
|
||||
'images/darrowright.png',
|
||||
true,
|
||||
['title' => __('Add to modules list')]
|
||||
).'</div>';
|
||||
// Services arrow.
|
||||
$table->data[2][1] .= '<div
|
||||
class="wizard_mode_form wizard_mode_services wizard_mode_services_arrow clickable">
|
||||
'.html_print_image(
|
||||
'images/darrowright.png',
|
||||
true,
|
||||
['title' => __('Add to modules list')]
|
||||
).'</div>';
|
||||
// Processes arrow.
|
||||
$table->data[2][1] .= '<div
|
||||
class="wizard_mode_form wizard_mode_processes wizard_mode_processes_arrow clickable">
|
||||
'.html_print_image(
|
||||
'images/darrowright.png',
|
||||
true,
|
||||
['title' => __('Add to modules list')]
|
||||
).'</div>';
|
||||
// Disks arrow.
|
||||
$table->data[2][1] .= '<div
|
||||
class="wizard_mode_form wizard_mode_disks wizard_mode_disks_arrow clickable">
|
||||
'.html_print_image(
|
||||
'images/darrowright.png',
|
||||
true,
|
||||
['title' => __('Add to modules list')]
|
||||
).'</div>';
|
||||
|
||||
|
||||
$table->data[2][1] .= '<br><br>
|
||||
<div class="wizard_mode_delete_arrow clickable">
|
||||
'.html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
['title' => __('Remove from modules list')]
|
||||
).'</div>';
|
||||
$table->cellstyle[2][1] = 'vertical-align: middle; text-align: center;';
|
||||
|
||||
$table->data[2][2] = html_print_select(
|
||||
[],
|
||||
'module[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:300px; height: 100%;'
|
||||
);
|
||||
$table->data[2][2] .= html_print_input_hidden(
|
||||
'agent',
|
||||
$id_agent,
|
||||
true
|
||||
);
|
||||
$table->cellstyle[2][2] = 'vertical-align: top; text-align: center;';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo "<div style='text-align:right; width:".$table->width."'>";
|
||||
html_print_submit_button(
|
||||
__('Create modules'),
|
||||
'create_modules_btn',
|
||||
false,
|
||||
['class' => 'sub add']
|
||||
);
|
||||
echo '</div>';
|
||||
unset($table);
|
||||
|
||||
echo '</span>';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
ui_require_jquery_file('pandora.controls');
|
||||
ui_require_jquery_file('ajaxqueue');
|
||||
ui_require_jquery_file('bgiframe');
|
||||
ui_require_javascript_file('pandora_modules');
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
|
||||
$(document).ready (function () {
|
||||
$("#wmi_form").submit(function() {
|
||||
$("#oid_loading").show ();
|
||||
});
|
||||
|
||||
network_component_group_change_event();
|
||||
$('#network_component_group').trigger('change');
|
||||
|
||||
$("#wmi_wizard_modes").change(function() {
|
||||
$(".wizard_mode_form").hide();
|
||||
var selected_mode = $("#wmi_wizard_modes").val();
|
||||
$(".wizard_mode_" + selected_mode).show();
|
||||
$('#form_interfaces').show();
|
||||
});
|
||||
|
||||
$("#wmi_wizard_modes").trigger('change');
|
||||
|
||||
<?php
|
||||
if (!$wmiexplore || $fail) {
|
||||
?>
|
||||
$('#form_interfaces').hide();
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
$('.wizard_mode_services_arrow').click(function() {
|
||||
jQuery.each($("select[name='services'] option:selected"), function (key, value) {
|
||||
var id = 'service_' + $(value).attr('value');
|
||||
var name = $(value).html() + ' (<?php echo __('Service'); ?>)';
|
||||
if (name != <?php echo "'".__('None')."'"; ?>) {
|
||||
if($("#module").find("option[value='" + id + "']").length == 0) {
|
||||
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
|
||||
}
|
||||
else {
|
||||
alert("<?php echo __('Repeated'); ?>");
|
||||
}
|
||||
$("#module").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.wizard_mode_processes_arrow').click(function() {
|
||||
jQuery.each($("select[name='processes'] option:selected"), function (key, value) {
|
||||
var id = 'process_' + $(value).attr('value');
|
||||
var name = $(value).html() + ' (<?php echo __('Process'); ?>)';
|
||||
if (name != <?php echo "'".__('None')."'"; ?>) {
|
||||
if($("#module").find("option[value='" + id + "']").length == 0) {
|
||||
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
|
||||
}
|
||||
else {
|
||||
alert("<?php echo __('Repeated'); ?>");
|
||||
}
|
||||
$("#module").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.wizard_mode_disks_arrow').click(function() {
|
||||
jQuery.each($("select[name='disks'] option:selected"), function (key, value) {
|
||||
var id = 'disk_' + $(value).attr('value');
|
||||
var name = $(value).html();
|
||||
if (name != <?php echo "'".__('None')."'"; ?>) {
|
||||
if($("#module").find("option[value='" + id + "']").length == 0) {
|
||||
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
|
||||
}
|
||||
else {
|
||||
alert("<?php echo __('Repeated'); ?>");
|
||||
}
|
||||
$("#module").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.wizard_mode_components_arrow').click(function() {
|
||||
jQuery.each($("select[name='network_component'] option:selected"), function (key, value) {
|
||||
var id = 'component_' + $(value).attr('value');
|
||||
var name = $(value).html();
|
||||
if (name != <?php echo "'".__('None')."'"; ?>) {
|
||||
if($("#module").find("option[value='" + id + "']").length == 0) {
|
||||
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
|
||||
}
|
||||
else {
|
||||
alert("<?php echo __('Repeated'); ?>");
|
||||
}
|
||||
$("#module").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.wizard_mode_delete_arrow').click(function() {
|
||||
jQuery.each($("select[name='module[]'] option:selected"), function (key, value) {
|
||||
var name = $(value).html();
|
||||
if (name != <?php echo "'".__('None')."'"; ?>) {
|
||||
$(value).remove();
|
||||
}
|
||||
});
|
||||
|
||||
if($("#module option").length == 0) {
|
||||
$("select[name='module[]']").append($("<option></option>").val(0).html(<?php echo "'".__('None')."'"; ?>));
|
||||
}
|
||||
});
|
||||
|
||||
$("#submit-create_modules_btn").click(function () {
|
||||
if($("#module option").length == 0 || ($("#module option").length == 1 && $("#module option").eq(0).val() == 0)) {
|
||||
alert("<?php echo __('Modules list is empty'); ?>");
|
||||
return false;
|
||||
}
|
||||
$('#module option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* ]]> */
|
||||
</script>
|
@ -1378,8 +1378,8 @@ if ($update_module || $create_module) {
|
||||
$ip_target = (string) get_parameter('ip_target');
|
||||
// No autofill if the module is a webserver module.
|
||||
if ($ip_target == ''
|
||||
&& $id_module_type < MODULE_WEBSERVER_CHECK_LATENCY
|
||||
&& $id_module_type > MODULE_WEBSERVER_RETRIEVE_STRING_DATA
|
||||
&& $id_module_type < MODULE_TYPE_WEB_DATA
|
||||
&& $id_module_type > MODULE_TYPE_WEB_CONTENT_STRING
|
||||
) {
|
||||
$ip_target = 'auto';
|
||||
}
|
||||
|
@ -24,7 +24,16 @@ require_once $config['homedir'].'/include/functions_modules.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_servers.php';
|
||||
|
||||
$search_string = io_safe_output(urldecode(trim(get_parameter('search_string', ''))));
|
||||
$search_string = io_safe_output(
|
||||
urldecode(
|
||||
trim(
|
||||
get_parameter(
|
||||
'search_string',
|
||||
''
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
global $policy_page;
|
||||
|
||||
@ -32,17 +41,27 @@ if (!isset($policy_page)) {
|
||||
$policy_page = false;
|
||||
}
|
||||
|
||||
// Search string filter form
|
||||
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
|
||||
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
|
||||
echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
|
||||
echo __('Search').' '.html_print_input_text(
|
||||
'search_string',
|
||||
$search_string,
|
||||
'',
|
||||
15,
|
||||
255,
|
||||
true
|
||||
);
|
||||
html_print_input_hidden('search', 1);
|
||||
// Search string filter form.
|
||||
if (($policy_page) || (isset($agent))) {
|
||||
echo '<form id="" method="post" action="">';
|
||||
} else {
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
}
|
||||
|
||||
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >';
|
||||
echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
|
||||
echo __('Search').' '.html_print_input_text('search_string', $search_string, '', 15, 255, true);
|
||||
html_print_input_hidden('search', 1);
|
||||
echo '</td>';
|
||||
echo "<td class='datos' style='width:10%'>";
|
||||
html_print_submit_button(__('Filter'), 'filter', false, 'class="sub search"');
|
||||
@ -50,38 +69,38 @@ echo '</td>';
|
||||
echo "<td class='datos' style='width:10%'></td>";
|
||||
echo '</form>';
|
||||
// Check if there is at least one server of each type available to assign that
|
||||
// kind of modules. If not, do not show server type in combo
|
||||
// kind of modules. If not, do not show server type in combo.
|
||||
$network_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 1'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$wmi_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 6'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$plugin_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 4'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
$prediction_available = db_get_sql(
|
||||
'SELECT count(*)
|
||||
FROM tserver
|
||||
WHERE server_type = 5'
|
||||
);
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE
|
||||
// Development mode to use all servers
|
||||
// POSTGRESQL AND ORACLE COMPATIBLE.
|
||||
// Development mode to use all servers.
|
||||
if ($develop_bypass || is_metaconsole()) {
|
||||
$network_available = 1;
|
||||
$wmi_available = 1;
|
||||
$plugin_available = 1;
|
||||
// FIXME when prediction predictions server modules can be configured
|
||||
// on metaconsole
|
||||
// FIXME when prediction predictions server modules can be configured.
|
||||
// on metaconsole.
|
||||
$prediction_available = is_metaconsole() ? 0 : 1;
|
||||
}
|
||||
|
||||
@ -140,7 +159,7 @@ if (($policy_page) || (isset($agent))) {
|
||||
}
|
||||
|
||||
if ($show_creation) {
|
||||
// Create module/type combo
|
||||
// Create module/type combo.
|
||||
echo '<form id="create_module_type" method="post" action="'.$url.'">';
|
||||
if (!$policy_page) {
|
||||
echo '<td class="datos" style="font-weight: bold; width:20%;">';
|
||||
@ -151,13 +170,33 @@ if (($policy_page) || (isset($agent))) {
|
||||
$checked = false;
|
||||
}
|
||||
|
||||
html_print_checkbox('status_hierachy_mode', '', $checked, false, false, 'onChange=change_mod_filter();');
|
||||
html_print_checkbox(
|
||||
'status_hierachy_mode',
|
||||
'',
|
||||
$checked,
|
||||
false,
|
||||
false,
|
||||
'onChange=change_mod_filter();'
|
||||
);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '<td class="datos" style="font-weight: bold; width:20%;">';
|
||||
echo __('<p>Type</p>');
|
||||
html_print_select($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;');
|
||||
html_print_select(
|
||||
$modules,
|
||||
'moduletype',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'max-width:300px;'
|
||||
);
|
||||
html_print_input_hidden('edit_module', 1);
|
||||
echo '</td>';
|
||||
echo '<td class="datos" style="width:10%;">';
|
||||
@ -212,7 +251,13 @@ if ($multiple_delete) {
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
enterprise_hook('config_agents_delete_module_in_conf', [modules_get_agentmodule_agent($id_agent_module_del), modules_get_agentmodule_name($id_agent_module_del)]);
|
||||
enterprise_hook(
|
||||
'config_agents_delete_module_in_conf',
|
||||
[
|
||||
modules_get_agentmodule_agent($id_agent_module_del),
|
||||
modules_get_agentmodule_name($id_agent_module_del),
|
||||
]
|
||||
);
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -220,7 +265,12 @@ if ($multiple_delete) {
|
||||
// error. NOTICE that we don't delete all data here, just marking for deletion
|
||||
// and delete some simple data.
|
||||
$status = '';
|
||||
$agent_id_of_module = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module_del);
|
||||
$agent_id_of_module = db_get_value(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
'id_agente_modulo',
|
||||
(int) $id_agent_module_del
|
||||
);
|
||||
|
||||
if (db_process_sql(
|
||||
"UPDATE tagente_modulo
|
||||
@ -235,7 +285,7 @@ if ($multiple_delete) {
|
||||
) {
|
||||
$error++;
|
||||
} else {
|
||||
// Set flag to update module status count
|
||||
// Set flag to update module status count.
|
||||
if ($agent_id_of_module !== false) {
|
||||
db_process_sql(
|
||||
'UPDATE tagente
|
||||
@ -286,32 +336,48 @@ if ($multiple_delete) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
|
||||
// If result is empty then module doesn't have this type of submodules
|
||||
$ops_json = enterprise_hook('modules_get_synthetic_operations', [$id_agent_module_del]);
|
||||
// Trick to detect if we are deleting a synthetic module (avg or arithmetic).
|
||||
// If result is empty then module doesn't have this type of submodules.
|
||||
$ops_json = enterprise_hook(
|
||||
'modules_get_synthetic_operations',
|
||||
[$id_agent_module_del]
|
||||
);
|
||||
$result_ops_synthetic = json_decode($ops_json);
|
||||
if (!empty($result_ops_synthetic)) {
|
||||
$result = enterprise_hook('modules_delete_synthetic_operations', [$id_agent_module_del]);
|
||||
$result = enterprise_hook(
|
||||
'modules_delete_synthetic_operations',
|
||||
[$id_agent_module_del]
|
||||
);
|
||||
if ($result === false) {
|
||||
$error++;
|
||||
}
|
||||
} //end if
|
||||
else {
|
||||
$result_components = enterprise_hook('modules_get_synthetic_components', [$id_agent_module_del]);
|
||||
} else {
|
||||
$result_components = enterprise_hook(
|
||||
'modules_get_synthetic_components',
|
||||
[$id_agent_module_del]
|
||||
);
|
||||
$count_components = 1;
|
||||
if (!empty($result_components)) {
|
||||
// Get number of components pending to delete to know when it's needed to update orders
|
||||
// Get number of components pending to delete to know when it's needed to update orders.
|
||||
$num_components = count($result_components);
|
||||
$last_target_module = 0;
|
||||
foreach ($result_components as $id_target_module) {
|
||||
// Detects change of component or last component to update orders
|
||||
if (($count_components == $num_components) or ($last_target_module != $id_target_module)) {
|
||||
// Detects change of component or last component to update orders.
|
||||
if (($count_components == $num_components) || ($last_target_module != $id_target_module)
|
||||
) {
|
||||
$update_orders = true;
|
||||
} else {
|
||||
$update_orders = false;
|
||||
}
|
||||
|
||||
$result = enterprise_hook('modules_delete_synthetic_operations', [$id_target_module, $id_agent_module_del, $update_orders]);
|
||||
$result = enterprise_hook(
|
||||
'modules_delete_synthetic_operations',
|
||||
[
|
||||
$id_target_module,
|
||||
$id_agent_module_del,
|
||||
$update_orders,
|
||||
]
|
||||
);
|
||||
if ($result === false) {
|
||||
$error++;
|
||||
}
|
||||
@ -323,7 +389,7 @@ if ($multiple_delete) {
|
||||
}
|
||||
|
||||
|
||||
// Check for errors
|
||||
// Check for errors.
|
||||
if ($error != 0) {
|
||||
} else {
|
||||
$count_correct_delete_modules++;
|
||||
@ -509,7 +575,7 @@ switch ($sortField) {
|
||||
}
|
||||
|
||||
|
||||
// Build the order sql
|
||||
// Build the order sql.
|
||||
if (!empty($order)) {
|
||||
$order_sql = ' ORDER BY ';
|
||||
}
|
||||
@ -525,7 +591,7 @@ foreach ($order as $ord) {
|
||||
$order_sql .= $ord['field'].' '.$ord['order'];
|
||||
}
|
||||
|
||||
// Get limit and offset parameters
|
||||
// Get limit and offset parameters.
|
||||
$limit = (int) $config['block_size'];
|
||||
$offset = (int) get_parameter('offset');
|
||||
|
||||
@ -559,9 +625,15 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
|
||||
|
||||
$search_string_entities = io_safe_input($search_string);
|
||||
|
||||
$basic_where = sprintf("(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND", $search_string, $search_string_entities, $search_string, $search_string_entities);
|
||||
$basic_where = sprintf(
|
||||
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
|
||||
$search_string,
|
||||
$search_string_entities,
|
||||
$search_string,
|
||||
$search_string_entities
|
||||
);
|
||||
|
||||
// Tags acl
|
||||
// Tags acl.
|
||||
$agent_tags = tags_get_user_applied_agent_tags($id_agente);
|
||||
if ($agent_tags !== true) {
|
||||
$where_tags = ' AND ttag_module.id_tag IN ('.implode(',', $agent_tags).')';
|
||||
@ -619,7 +691,7 @@ if ($modules === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare pagination
|
||||
// Prepare pagination.
|
||||
$url = '?'.'sec=gagente&'.'tab=module&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$id_agente.'&'.'sort_field='.$sortField.'&'.'&sort='.$sort.'&'.'search_string='.urlencode($search_string);
|
||||
|
||||
if ($paginate_module) {
|
||||
@ -635,17 +707,48 @@ $table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->head = [];
|
||||
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->head[0] = __('Name').ui_get_sorting_arrows($url_name.'up', $url_name.'down', $selectNameUp, $selectNameDown);
|
||||
$table->head['checkbox'] = html_print_checkbox(
|
||||
'all_delete',
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
);
|
||||
$table->head[0] = __('Name').ui_get_sorting_arrows(
|
||||
$url_name.'up',
|
||||
$url_name.'down',
|
||||
$selectNameUp,
|
||||
$selectNameDown
|
||||
);
|
||||
|
||||
// The access to the policy is granted only with AW permission
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
|
||||
// The access to the policy is granted only with AW permission.
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl(
|
||||
$config['id_user'],
|
||||
$agent['id_grupo'],
|
||||
'AW'
|
||||
)
|
||||
) {
|
||||
$table->head[1] = "<span title='".__('Policy')."'>".__('P.').'</span>';
|
||||
}
|
||||
|
||||
$table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows($url_server.'up', $url_server.'down', $selectServerUp, $selectServerDown);
|
||||
$table->head[3] = __('Type').ui_get_sorting_arrows($url_type.'up', $url_type.'down', $selectTypeUp, $selectTypeDown);
|
||||
$table->head[4] = __('Interval').ui_get_sorting_arrows($url_interval.'up', $url_interval.'down', $selectIntervalUp, $selectIntervalDown);
|
||||
$table->head[2] = "<span title='".__('Server')."'>".__('S.').'</span>'.ui_get_sorting_arrows(
|
||||
$url_server.'up',
|
||||
$url_server.'down',
|
||||
$selectServerUp,
|
||||
$selectServerDown
|
||||
);
|
||||
$table->head[3] = __('Type').ui_get_sorting_arrows(
|
||||
$url_type.'up',
|
||||
$url_type.'down',
|
||||
$selectTypeUp,
|
||||
$selectTypeDown
|
||||
);
|
||||
$table->head[4] = __('Interval').ui_get_sorting_arrows(
|
||||
$url_interval.'up',
|
||||
$url_interval.'down',
|
||||
$selectIntervalUp,
|
||||
$selectIntervalDown
|
||||
);
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Status');
|
||||
$table->head[7] = __('Warn');
|
||||
@ -690,7 +793,16 @@ if ($checked) {
|
||||
}
|
||||
|
||||
foreach ($modules as $module) {
|
||||
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') && ! check_acl_one_of_groups($config['id_user'], $all_groups, 'AD')) {
|
||||
if (! check_acl_one_of_groups(
|
||||
$config['id_user'],
|
||||
$all_groups,
|
||||
'AW'
|
||||
) && ! check_acl_one_of_groups(
|
||||
$config['id_user'],
|
||||
$all_groups,
|
||||
'AD'
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -712,7 +824,9 @@ foreach ($modules as $module) {
|
||||
if (!$checked) {
|
||||
if ($module['id_module_group'] != $last_modulegroup) {
|
||||
$last_modulegroup = $module['id_module_group'];
|
||||
$data[0] = '<strong>'.modules_get_modulegroup_name($last_modulegroup).'</strong>';
|
||||
$data[0] = '<strong>'.modules_get_modulegroup_name(
|
||||
$last_modulegroup
|
||||
).'</strong>';
|
||||
$i = array_push($table->data, $data);
|
||||
$table->rowstyle[($i - 1)] = 'text-align: center';
|
||||
$table->rowclass[($i - 1)] = 'datos3';
|
||||
@ -727,14 +841,23 @@ foreach ($modules as $module) {
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
$data['checkbox'] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
||||
$data['checkbox'] = html_print_checkbox(
|
||||
'id_delete[]',
|
||||
$module['id_agente_modulo'],
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[0] = '';
|
||||
|
||||
if (isset($module['deep']) && ($module['deep'] != 0)) {
|
||||
$data[0] .= str_repeat(' ', $module['deep']);
|
||||
$data[0] .= html_print_image('images/icono_escuadra.png', true, ['style' => 'padding-bottom: inherit;']).' ';
|
||||
$data[0] .= html_print_image(
|
||||
'images/icono_escuadra.png',
|
||||
true,
|
||||
['style' => 'padding-bottom: inherit;']
|
||||
).' ';
|
||||
}
|
||||
|
||||
if ($module['quiet']) {
|
||||
@ -754,17 +877,38 @@ foreach ($modules as $module) {
|
||||
}
|
||||
|
||||
if ($module['disabled']) {
|
||||
$data[0] .= '<em class="disabled_module">'.ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[…]', 'font-size: 7.2pt').'</em>';
|
||||
$data[0] .= '<em class="disabled_module">'.ui_print_truncate_text(
|
||||
$module['nombre'],
|
||||
'module_medium',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
'[…]',
|
||||
'font-size: 7.2pt'
|
||||
).'</em>';
|
||||
} else {
|
||||
$data[0] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[…]', 'font-size: 7.2pt');
|
||||
$data[0] .= ui_print_truncate_text(
|
||||
$module['nombre'],
|
||||
'module_medium',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
'[…]',
|
||||
'font-size: 7.2pt'
|
||||
);
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
$data[0] .= '</a>';
|
||||
}
|
||||
|
||||
// The access to the policy is granted only with AW permission
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
|
||||
// The access to the policy is granted only with AW permission.
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl(
|
||||
$config['id_user'],
|
||||
$agent['id_grupo'],
|
||||
'AW'
|
||||
)
|
||||
) {
|
||||
$policyInfo = policies_info_module_policy($module['id_agente_modulo']);
|
||||
if ($policyInfo === false) {
|
||||
$data[1] = '';
|
||||
@ -798,17 +942,27 @@ foreach ($modules as $module) {
|
||||
}
|
||||
}
|
||||
|
||||
// Module type (by server type )
|
||||
// Module type (by server type ).
|
||||
$data[2] = '';
|
||||
if ($module['id_modulo'] > 0) {
|
||||
$data[2] = servers_show_type($module['id_modulo']);
|
||||
}
|
||||
|
||||
$module_status = db_get_row('tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
$module_status = db_get_row(
|
||||
'tagente_estado',
|
||||
'id_agente_modulo',
|
||||
$module['id_agente_modulo']
|
||||
);
|
||||
|
||||
modules_get_status($module['id_agente_modulo'], $module_status['estado'], $module_status['datos'], $status, $title);
|
||||
modules_get_status(
|
||||
$module['id_agente_modulo'],
|
||||
$module_status['estado'],
|
||||
$module_status['datos'],
|
||||
$status,
|
||||
$title
|
||||
);
|
||||
|
||||
// This module is initialized ? (has real data)
|
||||
// This module is initialized ? (has real data).
|
||||
if ($status == STATUS_MODULE_NO_DATA) {
|
||||
$data[2] .= html_print_image(
|
||||
'images/error.png',
|
||||
@ -817,13 +971,13 @@ foreach ($modules as $module) {
|
||||
);
|
||||
}
|
||||
|
||||
// Module type (by data type)
|
||||
// Module type (by data type).
|
||||
$data[3] = '';
|
||||
if ($type) {
|
||||
$data[3] = ui_print_moduletype_icon($type, true);
|
||||
}
|
||||
|
||||
// Module interval
|
||||
// Module interval.
|
||||
if ($module['module_interval']) {
|
||||
$data[4] = human_time_description_raw($module['module_interval']);
|
||||
} else {
|
||||
@ -831,12 +985,23 @@ foreach ($modules as $module) {
|
||||
}
|
||||
|
||||
if ($module['id_modulo'] == MODULE_DATA && $module['id_policy_module'] != 0) {
|
||||
$data[4] .= ui_print_help_tip(__('The policy modules of data type will only update their intervals when policy is applied.'), true);
|
||||
$data[4] .= ui_print_help_tip(
|
||||
__('The policy modules of data type will only update their intervals when policy is applied.'),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[5] = ui_print_truncate_text($module['descripcion'], 'description', false);
|
||||
$data[5] = ui_print_truncate_text(
|
||||
$module['descripcion'],
|
||||
'description',
|
||||
false
|
||||
);
|
||||
|
||||
$data[6] = ui_print_status_image($status, htmlspecialchars($title), true);
|
||||
$data[6] = ui_print_status_image(
|
||||
$status,
|
||||
htmlspecialchars($title),
|
||||
true
|
||||
);
|
||||
|
||||
// MAX / MIN values.
|
||||
if ($module['id_tipo_modulo'] != 25) {
|
||||
@ -884,7 +1049,7 @@ foreach ($modules as $module) {
|
||||
);
|
||||
$data[8] .= '</a> ';
|
||||
|
||||
// Make a data normalization
|
||||
// Make a data normalization.
|
||||
if (isset($numericModules[$type])) {
|
||||
if ($numericModules[$type] === true) {
|
||||
$data[8] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&fix_module='.$module['id_agente_modulo'].'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
@ -904,7 +1069,7 @@ foreach ($modules as $module) {
|
||||
$data[8] .= ' ';
|
||||
}
|
||||
|
||||
// create network component action
|
||||
// Create network component action.
|
||||
if ((is_user_admin($config['id_user']))
|
||||
&& ($module['id_modulo'] == MODULE_NETWORK)
|
||||
) {
|
||||
@ -927,7 +1092,7 @@ foreach ($modules as $module) {
|
||||
}
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
// Delete module
|
||||
// Delete module.
|
||||
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[9] .= html_print_image(
|
||||
@ -959,7 +1124,12 @@ html_print_table($table);
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_submit_button(__('Delete'), 'multiple_delete', false, 'class="sub delete"');
|
||||
html_print_submit_button(
|
||||
__('Delete'),
|
||||
'multiple_delete',
|
||||
false,
|
||||
'class="sub delete"'
|
||||
);
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
@ -1290,7 +1290,7 @@ ui_require_jquery_file('json');
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
var disabledBecauseInPolicy = '<?php echo $disabledBecauseInPolicy; ?>';
|
||||
var disabledBecauseInPolicy = <?php echo '\''.(empty($disabledBecauseInPolicy) === true ? '0' : '1').'\''; ?>;
|
||||
$("#right").click (function () {
|
||||
jQuery.each($("select[name='id_tag_available[]'] option:selected"), function (key, value) {
|
||||
tag_name = $(value).html();
|
||||
@ -1551,7 +1551,10 @@ $(document).ready (function () {
|
||||
|
||||
//readonly and add class input
|
||||
function disabled_status (disabledBecauseInPolicy) {
|
||||
if($('#dynamic_interval_select').val() != 0 && $('#dynamic_interval').val() != 0){
|
||||
var dynamic_interval_select_value = $('#dynamic_interval_select').val();
|
||||
var dynamic_interval_value = $('#dynamic_interval_select').val();
|
||||
if(typeof dynamic_interval_select_value != "undefined" && typeof dynamic_interval_value != "undefined"
|
||||
&& dynamic_interval_select_value != 0 && dynamic_interval_value != 0){
|
||||
$('#text-min_warning').prop('readonly', true);
|
||||
$('#text-min_warning').addClass('readonly');
|
||||
$('#text-max_warning').prop('readonly', true);
|
||||
|
@ -464,6 +464,8 @@ $data[1] = html_print_select(
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$data[1] .= '<br> <br><a class="info_cell" href="'.ui_get_full_url('index.php?sec=gagente&sec2=godmode/groups/group_list&tab=credbox').'">'.__('Manage credentials').'</a>';
|
||||
|
||||
$array_os = [
|
||||
'inherited' => __('Inherited'),
|
||||
'linux' => __('SSH'),
|
||||
|
@ -43,7 +43,47 @@ if (empty($update_module_id)) {
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Target IP').' '.ui_print_help_icon('wmi_module_tab', true);
|
||||
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
||||
|
||||
if ($page == 'enterprise/godmode/policies/policy_modules') {
|
||||
if ($ip_target != 'auto' && $ip_target != '') {
|
||||
$custom_ip_target = $ip_target;
|
||||
$ip_target = 'custom';
|
||||
} else if ($ip_target == '') {
|
||||
$ip_target = 'force_pri';
|
||||
$custom_ip_target = '';
|
||||
} else {
|
||||
$custom_ip_target = '';
|
||||
}
|
||||
|
||||
$target_ip_values = [];
|
||||
$target_ip_values['auto'] = __('Auto');
|
||||
$target_ip_values['force_pri'] = __('Force primary key');
|
||||
$target_ip_values['custom'] = __('Custom');
|
||||
|
||||
$data[1] = html_print_select(
|
||||
$target_ip_values,
|
||||
'ip_target',
|
||||
$ip_target,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
'width:200px;'
|
||||
);
|
||||
|
||||
$data[1] .= html_print_input_text('custom_ip_target', $custom_ip_target, '', 15, 60, true);
|
||||
} else {
|
||||
if ($ip_target == 'auto') {
|
||||
$ip_target = agents_get_address($id_agente);
|
||||
}
|
||||
|
||||
$data[1] = html_print_input_text('ip_target', $ip_target, '', 15, 60, true);
|
||||
}
|
||||
|
||||
$data[2] = __('Namespace').ui_print_help_tip(__('Optional. WMI namespace. If unsure leave blank.'), true);
|
||||
$data[3] = html_print_input_text(
|
||||
'tcp_send',
|
||||
@ -136,3 +176,21 @@ $data[3] = html_print_input_text(
|
||||
);
|
||||
|
||||
push_table_simple($data, 'key_field');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
var custom_ip_target = "<?php echo $custom_ip_target; ?>";
|
||||
if(custom_ip_target == ''){
|
||||
$("#text-custom_ip_target").hide();
|
||||
}
|
||||
$('#ip_target').change(function() {
|
||||
if($(this).val() == 'custom') {
|
||||
$("#text-custom_ip_target").show();
|
||||
}
|
||||
else{
|
||||
$("#text-custom_ip_target").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -1,17 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Alert actions
|
||||
*
|
||||
* @category Alerts
|
||||
* @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
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/functions_alerts.php';
|
||||
@ -63,9 +78,9 @@ if ($copy_action) {
|
||||
$al_action = alerts_get_alert_action($id);
|
||||
|
||||
if ($al_action !== false) {
|
||||
// If user tries to copy an action with group=ALL
|
||||
// If user tries to copy an action with group=ALL.
|
||||
if ($al_action['id_group'] == 0) {
|
||||
// then must have "PM" access privileges
|
||||
// Then must have "PM" access privileges.
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
@ -74,17 +89,20 @@ if ($copy_action) {
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
} //end if
|
||||
else {
|
||||
} else {
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
|
||||
$own_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'LM')
|
||||
);
|
||||
} else {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM', false));
|
||||
$own_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'LM', false)
|
||||
);
|
||||
}
|
||||
|
||||
$is_in_group = in_array($al_action['id_group'], $own_groups);
|
||||
// Then action group have to be in his own groups
|
||||
// Then action group have to be in his own groups.
|
||||
if (!$is_in_group) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
@ -99,9 +117,15 @@ if ($copy_action) {
|
||||
$result = alerts_clone_alert_action($id);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit('Command management', 'Duplicate alert action '.$id.' clone to '.$result);
|
||||
db_pandora_audit(
|
||||
'Command management',
|
||||
'Duplicate alert action '.$id.' clone to '.$result
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit('Command management', 'Fail try to duplicate alert action '.$id);
|
||||
db_pandora_audit(
|
||||
'Command management',
|
||||
'Fail try to duplicate alert action '.$id
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
@ -121,9 +145,9 @@ if ($delete_action) {
|
||||
$al_action = alerts_get_alert_action($id);
|
||||
|
||||
if ($al_action !== false) {
|
||||
// If user tries to delete an action with group=ALL
|
||||
// If user tries to delete an action with group=ALL.
|
||||
if ($al_action['id_group'] == 0) {
|
||||
// then must have "PM" access privileges
|
||||
// Then must have "PM" access privileges.
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
@ -133,17 +157,21 @@ if ($delete_action) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// If user tries to delete an action of others groups
|
||||
// If user tries to delete an action of others groups.
|
||||
} else {
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
|
||||
$own_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'LM')
|
||||
);
|
||||
} else {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM', false));
|
||||
$own_groups = array_keys(
|
||||
users_get_groups($config['id_user'], 'LM', false)
|
||||
);
|
||||
}
|
||||
|
||||
$is_in_group = in_array($al_action['id_group'], $own_groups);
|
||||
// Then action group have to be in his own groups
|
||||
// Then action group have to be in his own groups.
|
||||
if (!$is_in_group) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
@ -159,9 +187,15 @@ if ($delete_action) {
|
||||
$result = alerts_delete_alert_action($id);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit('Command management', 'Delete alert action #'.$id);
|
||||
db_pandora_audit(
|
||||
'Command management',
|
||||
'Delete alert action #'.$id
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit('Command management', 'Fail try to delete alert action #'.$id);
|
||||
db_pandora_audit(
|
||||
'Command management',
|
||||
'Fail try to delete alert action #'.$id
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
@ -171,9 +205,16 @@ if ($delete_action) {
|
||||
);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === true) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
$search_string = (string) get_parameter('search_string', '');
|
||||
$group = (int) get_parameter('group', 0);
|
||||
$group_search = (int) get_parameter('group_search', 0);
|
||||
$id_command_search = (int) get_parameter('id_command_search', 0);
|
||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions';
|
||||
|
||||
// Filter table.
|
||||
@ -183,6 +224,7 @@ $table_filter->class = 'databox filters';
|
||||
$table_filter->style = [];
|
||||
$table_filter->style[0] = 'font-weight: bold';
|
||||
$table_filter->style[2] = 'font-weight: bold';
|
||||
$table_filter->style[4] = 'font-weight: bold';
|
||||
$table_filter->data = [];
|
||||
|
||||
$table_filter->data[0][0] = __('Search');
|
||||
@ -195,16 +237,54 @@ $table_filter->data[0][1] = html_print_input_text(
|
||||
true
|
||||
);
|
||||
$table_filter->data[0][2] = __('Group');
|
||||
$table_filter->data[0][3] = html_print_select_groups($config['id_user'], 'LM', true, 'group', $group, '', '', 0, true);
|
||||
$table_filter->data[0][4] = '<div class="action-buttons">';
|
||||
$table_filter->data[0][4] .= html_print_submit_button(
|
||||
$table_filter->data[0][3] = html_print_select_groups(
|
||||
$config['id_user'],
|
||||
'LM',
|
||||
true,
|
||||
'group_search',
|
||||
$group_search,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
$table_filter->data[0][4] = __('Command');
|
||||
$commands_sql = db_get_all_rows_filter(
|
||||
'talert_commands',
|
||||
['id_group' => array_keys(users_get_groups(false, 'LW'))],
|
||||
[
|
||||
'id',
|
||||
'name',
|
||||
],
|
||||
'AND',
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
$commands = db_get_all_rows_sql($commands_sql);
|
||||
$table_filter->data[0][5] = html_print_select(
|
||||
index_array($commands, 'id', 'name'),
|
||||
'id_command_search',
|
||||
$id_command_search,
|
||||
'',
|
||||
__('None'),
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:150px'
|
||||
);
|
||||
$table_filter->data[0][6] = '<div class="action-buttons">';
|
||||
$table_filter->data[0][6] .= html_print_submit_button(
|
||||
__('Search'),
|
||||
'',
|
||||
false,
|
||||
'class="sub search"',
|
||||
true
|
||||
);
|
||||
$table_filter->data[0][4] .= '</div>';
|
||||
$table_filter->data[0][5] .= '</div>';
|
||||
|
||||
|
||||
$show_table_filter = '<form method="post" action="'.$url.'">';
|
||||
@ -223,38 +303,49 @@ $table->class = 'info_table';
|
||||
$table->data = [];
|
||||
$table->head = [];
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Group');
|
||||
$table->head[2] = __('Copy');
|
||||
$table->head[3] = __('Delete');
|
||||
$table->head[1] = __('Command');
|
||||
$table->head[2] = __('Group');
|
||||
if (is_central_policies_on_node() === false) {
|
||||
$table->head[3] = __('Copy');
|
||||
$table->head[4] = __('Delete');
|
||||
}
|
||||
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->size = [];
|
||||
$table->size[1] = '200px';
|
||||
$table->size[2] = '40px';
|
||||
$table->size[3] = '40px';
|
||||
$table->size[4] = '40px';
|
||||
$table->align = [];
|
||||
$table->align[1] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[3] = 'left';
|
||||
$table->align[4] = 'left';
|
||||
|
||||
$filter = [];
|
||||
if (!is_user_admin($config['id_user']) && $group === 0) {
|
||||
$filter['talert_actions.id_group'] = array_keys(users_get_groups(false, 'LM'));
|
||||
$filter['talert_actions.id_group'] = array_keys(
|
||||
users_get_groups(false, 'LM')
|
||||
);
|
||||
}
|
||||
|
||||
if ($group !== 0) {
|
||||
$filter['talert_actions.id_group'] = $group;
|
||||
if ($group_search !== 0) {
|
||||
$filter['talert_actions.id_group'] = $group_search;
|
||||
}
|
||||
|
||||
if ($search_string !== '') {
|
||||
$filter['talert_actions.name'] = '%'.$search_string.'%';
|
||||
}
|
||||
|
||||
if ($id_command_search !== 0) {
|
||||
$filter['talert_commands.id'] = $id_command_search;
|
||||
}
|
||||
|
||||
$actions = db_get_all_rows_filter(
|
||||
'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
|
||||
$filter,
|
||||
'talert_actions.* , talert_commands.id_group AS command_group'
|
||||
'talert_actions.* , talert_commands.id_group AS command_group, talert_commands.name AS command_name'
|
||||
);
|
||||
|
||||
if ($actions === false) {
|
||||
$actions = [];
|
||||
}
|
||||
@ -280,9 +371,10 @@ foreach ($actions as $action) {
|
||||
$data = [];
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.$action['name'].'</a>';
|
||||
$data[1] = ui_print_group_icon($action['id_group'], true).' ';
|
||||
$data[1] = $action['command_name'];
|
||||
$data[2] = ui_print_group_icon($action['id_group'], true).' ';
|
||||
if (!alerts_validate_command_to_action($action['id_group'], $action['command_group'])) {
|
||||
$data[1] .= html_print_image(
|
||||
$data[2] .= html_print_image(
|
||||
'images/error.png',
|
||||
true,
|
||||
// FIXME: Translation.
|
||||
@ -292,18 +384,20 @@ foreach ($actions as $action) {
|
||||
);
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], $action['id_group'], 'LM')) {
|
||||
if (is_central_policies_on_node() === false
|
||||
&& check_acl($config['id_user'], $action['id_group'], 'LM')
|
||||
) {
|
||||
$table->cellclass[] = [
|
||||
2 => 'action_buttons',
|
||||
3 => 'action_buttons',
|
||||
4 => 'action_buttons',
|
||||
];
|
||||
|
||||
$id_action = $action['id'];
|
||||
$text_confirm = __('Are you sure?');
|
||||
|
||||
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
|
||||
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
|
||||
onClick="copy_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/copy.png', true).'</a>';
|
||||
$data[3] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
|
||||
$data[4] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions"
|
||||
onClick="delete_action('.$id_action.',\''.$text_confirm.'\');">'.html_print_image('images/cross.png', true).'</a>';
|
||||
}
|
||||
|
||||
@ -318,12 +412,14 @@ if (isset($data)) {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
html_print_input_hidden('create_alert', 1);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
if (is_central_policies_on_node() === false) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
html_print_input_hidden('create_alert', 1);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
?>
|
||||
@ -334,7 +430,7 @@ function copy_action(id_action, text_confirm) {
|
||||
if (!confirm(text_confirm)) {
|
||||
return false;
|
||||
} else {
|
||||
jQuery.post ("ajax.php",
|
||||
jQuery.post ("ajax.php",
|
||||
{
|
||||
"page" : "godmode/alerts/alert_actions",
|
||||
"copy_action" : 1,
|
||||
|
@ -46,6 +46,8 @@ if (is_ajax()) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
$get_recovery_fields = (int) get_parameter('get_recovery_fields', 1);
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
|
||||
// If command ID is not provided, check for action id.
|
||||
if ($id == 0) {
|
||||
$id_action = (int) get_parameter('id_action');
|
||||
@ -124,40 +126,142 @@ if (is_ajax()) {
|
||||
// HTML type.
|
||||
if (preg_match('/^_html_editor_$/i', $field_value)) {
|
||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$editor_type_chkbx .= __('Basic').ui_print_help_tip(__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'), true);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_value')", '', true);
|
||||
$editor_type_chkbx .= __('Basic');
|
||||
$editor_type_chkbx .= ui_print_help_tip(
|
||||
__('For sending emails, text must be HTML format, if you want to use plain text, type it between the following labels: <pre></pre>'),
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||
'editor_type_value_'.$i,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
"removeTinyMCE('textarea_field".$i."_value')",
|
||||
'',
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= ' ';
|
||||
$editor_type_chkbx .= __('Advanced').' ';
|
||||
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_value')", '', true);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||
'editor_type_value_'.$i,
|
||||
0,
|
||||
'',
|
||||
true,
|
||||
$is_central_policies_on_node,
|
||||
"addTinyMCE('textarea_field".$i."_value')",
|
||||
'',
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= '</small></b></div>';
|
||||
$ffield = $editor_type_chkbx;
|
||||
$ffield .= html_print_textarea('field'.$i.'_value', 1, 1, '', 'class="fields"', true);
|
||||
$ffield .= html_print_textarea(
|
||||
'field'.$i.'_value',
|
||||
1,
|
||||
1,
|
||||
'',
|
||||
'class="fields"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$editor_type_chkbx .= __('Basic').' ';
|
||||
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_recovery_value')", '', true);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||
'editor_type_recovery_value_'.$i,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
"removeTinyMCE('textarea_field".$i."_recovery_value')",
|
||||
'',
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= ' ';
|
||||
$editor_type_chkbx .= __('Advanced').' ';
|
||||
$editor_type_chkbx .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_recovery_value')", '', true);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||
'editor_type_recovery_value_'.$i,
|
||||
0,
|
||||
'',
|
||||
true,
|
||||
$is_central_policies_on_node,
|
||||
"addTinyMCE('textarea_field".$i."_recovery_value')",
|
||||
'',
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= '</small></b></div>';
|
||||
$rfield = $editor_type_chkbx;
|
||||
$rfield .= html_print_textarea('field'.$i.'_recovery_value', 1, 1, '', 'class="fields_recovery"', true);
|
||||
$rfield .= html_print_textarea(
|
||||
'field'.$i.'_recovery_value',
|
||||
1,
|
||||
1,
|
||||
'',
|
||||
'class="fields_recovery"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
} else if (preg_match('/^_content_type_$/i', $field_value)) {
|
||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$editor_type_chkbx .= __('Text/plain').ui_print_help_tip(__('For sending emails only text plain'), true);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_value', 'text/plain', '', '', false, '', '', true);
|
||||
$editor_type_chkbx .= __('Text/plain');
|
||||
$editor_type_chkbx .= ui_print_help_tip(
|
||||
__('For sending emails only text plain'),
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||
'field'.$i.'_value',
|
||||
'text/plain',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= ' ';
|
||||
$editor_type_chkbx .= __('Text/html').' ';
|
||||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_value', 'text/html', '', 'text/html', false, '', '', true);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||
'field'.$i.'_value',
|
||||
'text/html',
|
||||
'',
|
||||
'text/html',
|
||||
$is_central_policies_on_node,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= '</small></b></div>';
|
||||
$ffield = $editor_type_chkbx;
|
||||
|
||||
$editor_type_chkbx = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$editor_type_chkbx .= __('Text/plain').ui_print_help_tip(__('For sending emails only text plain'), true);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/plain', '', '', false, '', '', true);
|
||||
$editor_type_chkbx .= __('Text/plain');
|
||||
$editor_type_chkbx .= ui_print_help_tip(
|
||||
__('For sending emails only text plain'),
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||
'field'.$i.'_recovery_value',
|
||||
'text/plain',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= ' ';
|
||||
$editor_type_chkbx .= __('Text/html').' ';
|
||||
$editor_type_chkbx .= html_print_radio_button_extended('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true);
|
||||
$editor_type_chkbx .= html_print_radio_button_extended(
|
||||
'field'.$i.'_recovery_value',
|
||||
'text/html',
|
||||
'',
|
||||
'text/html',
|
||||
$is_central_policies_on_node,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$editor_type_chkbx .= '</small></b></div>';
|
||||
$rfield = $editor_type_chkbx;
|
||||
// Select type.
|
||||
@ -187,12 +291,13 @@ if (is_ajax()) {
|
||||
'field'.$i.'_value',
|
||||
'',
|
||||
'',
|
||||
__('None'),
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'fields'
|
||||
'fields',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$rfield = html_print_select(
|
||||
$fields_value_select,
|
||||
@ -204,7 +309,8 @@ if (is_ajax()) {
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'fields_recovery'
|
||||
'fields_recovery',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
} else {
|
||||
$ffield = html_print_textarea(
|
||||
@ -213,7 +319,9 @@ if (is_ajax()) {
|
||||
1,
|
||||
$fv[0],
|
||||
'style="min-height:40px; '.$style.'" class="fields"',
|
||||
true
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$rfield = html_print_textarea(
|
||||
'field'.$i.'_recovery_value',
|
||||
@ -221,7 +329,9 @@ if (is_ajax()) {
|
||||
1,
|
||||
$fv[0],
|
||||
'style="min-height:40px; '.$style.'" class="fields_recovery',
|
||||
true
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -232,7 +342,9 @@ if (is_ajax()) {
|
||||
1,
|
||||
'',
|
||||
'style="min-height:40px; '.$style.'" class="fields"',
|
||||
true
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$rfield = html_print_textarea(
|
||||
'field'.$i.'_recovery_value',
|
||||
@ -240,7 +352,9 @@ if (is_ajax()) {
|
||||
1,
|
||||
'',
|
||||
'style="min-height:40px; '.$style.'" class="fields_recovery"',
|
||||
true
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
}
|
||||
|
||||
@ -404,6 +518,15 @@ if ($copy_command) {
|
||||
}
|
||||
}
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
$table = new stdClass;
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
|
||||
@ -457,7 +580,7 @@ foreach ($commands as $command) {
|
||||
);
|
||||
$data['action'] = '';
|
||||
$table->cellclass[]['action'] = 'action_buttons';
|
||||
if (! $command['internal']) {
|
||||
if ($is_central_policies_on_node === false && !$command['internal']) {
|
||||
$data['action'] = '<span style="display: inline-flex">';
|
||||
$data['action'] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_commands&copy_command=1&id='.$command['id'].'&pure='.$pure.'"
|
||||
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/copy.png', true).'</a>';
|
||||
@ -475,11 +598,13 @@ if (count($table->data) > 0) {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert commands configured') ]);
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
html_print_input_hidden('create_alert', 1);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
if ($is_central_policies_on_node === false) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
html_print_input_hidden('create_alert', 1);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
@ -203,7 +203,7 @@ if ($searchFlag) {
|
||||
}
|
||||
|
||||
if ($actionID != -1 && $actionID != '') {
|
||||
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.')';
|
||||
$where .= ' AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = '.$actionID.') OR talert_template_modules.id IN (SELECT id FROM talert_template_modules ttm WHERE ttm.id_alert_template IN (SELECT tat.id FROM talert_templates tat WHERE tat.id_alert_action = '.$actionID.'))';
|
||||
}
|
||||
|
||||
if ($enabledisable != -1 && $enabledisable != '') {
|
||||
|
@ -119,7 +119,7 @@ if ($create_special_day) {
|
||||
$values['description'] = (string) get_parameter('description');
|
||||
|
||||
$aviable_description = true;
|
||||
if (preg_match('<script>', $values['description'])) {
|
||||
if (preg_match('/script/i', $values['description'])) {
|
||||
$aviable_description = false;
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ if ($update_special_day) {
|
||||
$id_group_orig = (string) get_parameter('id_group_orig');
|
||||
|
||||
$aviable_description = true;
|
||||
if (preg_match('<script>', $description)) {
|
||||
if (preg_match('/script/i', $description)) {
|
||||
$aviable_description = false;
|
||||
}
|
||||
|
||||
|
@ -125,13 +125,13 @@ if (defined('METACONSOLE')) {
|
||||
$sec = 'galertas';
|
||||
}
|
||||
|
||||
// This prevents to duplicate the header in case delete_templete action is performed
|
||||
// This prevents to duplicate the header in
|
||||
// case delete_templete action is performed.
|
||||
if (!$delete_template) {
|
||||
// Header
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
// ~ ui_print_page_header (__('Alerts')." » ". __('Alert templates'), "images/gm_alerts.png", false, "alerts_config", true);
|
||||
ui_print_page_header(
|
||||
__('Alerts').' » '.__('Alert templates'),
|
||||
'images/gm_alerts.png',
|
||||
@ -142,7 +142,6 @@ if (!$delete_template) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($update_template) {
|
||||
$id = (int) get_parameter('id');
|
||||
|
||||
@ -151,7 +150,7 @@ if ($update_template) {
|
||||
$fields_recovery = [];
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$values['field'.$i] = (string) get_parameter('field'.$i);
|
||||
$values['field'.$i.'_recovery'] = $recovery_notify ? (string) get_parameter('field'.$i.'_recovery') : '';
|
||||
$values['field'.$i.'_recovery'] = ($recovery_notify) ? (string) get_parameter('field'.$i.'_recovery') : '';
|
||||
}
|
||||
|
||||
$values['recovery_notify'] = $recovery_notify;
|
||||
@ -164,13 +163,15 @@ if ($update_template) {
|
||||
);
|
||||
}
|
||||
|
||||
// If user tries to delete a template with group=ALL then must have "PM" access privileges
|
||||
// If user tries to delete a template with group=ALL
|
||||
// then must have "PM" access privileges.
|
||||
if ($delete_template) {
|
||||
$id = get_parameter('id');
|
||||
$al_template = alerts_get_alert_template($id);
|
||||
|
||||
if ($al_template !== false) {
|
||||
// If user tries to delete a template with group=ALL then must have "PM" access privileges
|
||||
// If user tries to delete a template with group=ALL
|
||||
// then must have "PM" access privileges.
|
||||
if ($al_template['id_group'] == 0) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
@ -192,8 +193,7 @@ if ($delete_template) {
|
||||
);
|
||||
}
|
||||
}
|
||||
} //end if
|
||||
else {
|
||||
} else {
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$own_groups = array_keys(users_get_groups($config['id_user'], 'LM'));
|
||||
@ -202,7 +202,7 @@ if ($delete_template) {
|
||||
}
|
||||
|
||||
$is_in_group = in_array($al_template['id_group'], $own_groups);
|
||||
// Then template group have to be is his own groups
|
||||
// Then template group have to be is his own groups.
|
||||
if ($is_in_group) {
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
@ -241,9 +241,15 @@ if ($delete_template) {
|
||||
$result = alerts_delete_alert_template($id);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit('Template alert management', 'Delete alert template #'.$id);
|
||||
db_pandora_audit(
|
||||
'Template alert management',
|
||||
'Delete alert template #'.$id
|
||||
);
|
||||
} else {
|
||||
db_pandora_audit('Template alert management', 'Fail try to delete alert template #'.$id);
|
||||
db_pandora_audit(
|
||||
'Template alert management',
|
||||
'Fail try to delete alert template #'.$id
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
@ -253,6 +259,11 @@ if ($delete_template) {
|
||||
);
|
||||
}
|
||||
|
||||
if (is_central_policies_on_node() === true) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
$search_string = (string) get_parameter('search_string');
|
||||
$search_type = (string) get_parameter('search_type');
|
||||
@ -269,7 +280,7 @@ $url = ui_get_url_refresh(
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table->cellspacing = 0;
|
||||
$table->cellpadding = 0;
|
||||
}
|
||||
@ -313,7 +324,7 @@ $table->data[0][4] .= html_print_submit_button(
|
||||
);
|
||||
$table->data[0][4] .= '</div>';
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$filter = '<form class="" method="post" action="'.$url.'">';
|
||||
$filter .= html_print_table($table, true);
|
||||
$filter .= '</form>';
|
||||
@ -351,6 +362,7 @@ $templates = alerts_get_alert_templates(
|
||||
'description',
|
||||
'type',
|
||||
'id_group',
|
||||
'previous_name',
|
||||
]
|
||||
);
|
||||
if ($templates === false) {
|
||||
@ -394,18 +406,34 @@ foreach ($templates as $template) {
|
||||
$data[1] = ui_print_group_icon($template['id_group'], true);
|
||||
$data[3] = alerts_get_alert_templates_type_name($template['type']);
|
||||
|
||||
if (check_acl($config['id_user'], $template['id_group'], 'LM')) {
|
||||
if (is_central_policies_on_node() === false
|
||||
&& check_acl($config['id_user'], $template['id_group'], 'LM')
|
||||
) {
|
||||
$table->cellclass[][4] = 'action_buttons';
|
||||
$data[4] = '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'" style="display: inline; float: left">';
|
||||
$data[4] .= html_print_input_hidden('duplicate_template', 1, true);
|
||||
$data[4] .= html_print_input_hidden('source_id', $template['id'], true);
|
||||
$data[4] .= html_print_input_image('dup', 'images/copy.png', 1, '', true, ['title' => __('Duplicate')]);
|
||||
$data[4] .= html_print_input_image(
|
||||
'dup',
|
||||
'images/copy.png',
|
||||
1,
|
||||
'',
|
||||
true,
|
||||
['title' => __('Duplicate')]
|
||||
);
|
||||
$data[4] .= '</form> ';
|
||||
|
||||
$data[4] .= '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||
$data[4] .= html_print_input_hidden('delete_template', 1, true);
|
||||
$data[4] .= html_print_input_hidden('id', $template['id'], true);
|
||||
$data[4] .= html_print_input_image('del', 'images/cross.png', 1, '', true, ['title' => __('Delete')]);
|
||||
$data[4] .= html_print_input_image(
|
||||
'del',
|
||||
'images/cross.png',
|
||||
1,
|
||||
'',
|
||||
true,
|
||||
['title' => __('Delete')]
|
||||
);
|
||||
$data[4] .= '</form> ';
|
||||
} else {
|
||||
$data[4] = '';
|
||||
@ -415,18 +443,34 @@ foreach ($templates as $template) {
|
||||
}
|
||||
|
||||
ui_pagination($total_templates, $url);
|
||||
if (isset($data)) {
|
||||
if (isset($data) === true) {
|
||||
html_print_table($table);
|
||||
ui_pagination($total_templates, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination(
|
||||
$total_templates,
|
||||
$url,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
'offset',
|
||||
true,
|
||||
'pagination-bottom'
|
||||
);
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert templates defined') ]);
|
||||
ui_print_info_message(
|
||||
[
|
||||
'no_close' => true,
|
||||
'message' => __('No alert templates defined'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
html_print_input_hidden('create_alert', 1);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
if (is_central_policies_on_node() === false) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
html_print_input_hidden('create_alert', 1);
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
@ -60,7 +60,7 @@ if ($al_action !== false) {
|
||||
__('Alerts').' » '.__('Configure alert action'),
|
||||
'images/gm_alerts.png',
|
||||
false,
|
||||
'',
|
||||
'alert_config',
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -73,19 +73,27 @@ if ($al_action !== false) {
|
||||
__('Alerts').' » '.__('Configure alert action'),
|
||||
'images/gm_alerts.png',
|
||||
false,
|
||||
'',
|
||||
'alert_config',
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$name = '';
|
||||
$id_command = '';
|
||||
$group = 0;
|
||||
// All group is 0
|
||||
$action_threshold = 0;
|
||||
// All group is 0
|
||||
// All group is 0.
|
||||
if ($id) {
|
||||
$action = alerts_get_alert_action($id);
|
||||
$name = $action['name'];
|
||||
@ -95,7 +103,7 @@ if ($id) {
|
||||
$action_threshold = $action['action_threshold'];
|
||||
}
|
||||
|
||||
// Hidden div with help hint to fill with javascript
|
||||
// Hidden div with help hint to fill with javascript.
|
||||
html_print_div(
|
||||
[
|
||||
'id' => 'help_alert_macros_hint',
|
||||
@ -126,7 +134,26 @@ $table->size = [];
|
||||
$table->size[0] = '20%';
|
||||
$table->data = [];
|
||||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 255, true);
|
||||
$table->data[0][1] = html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
35,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
if (io_safe_output($name) == 'Monitoring Event') {
|
||||
$table->data[0][1] .= ' '.ui_print_help_tip(
|
||||
__('This action may stop working, if you change its name.'),
|
||||
@ -141,7 +168,21 @@ $table->data[1][0] = __('Group');
|
||||
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
|
||||
$table->data[1][1] = html_print_select_groups(false, 'LW', true, 'group', $group, '', '', 0, true);
|
||||
$table->data[1][1] = html_print_select_groups(
|
||||
false,
|
||||
'LW',
|
||||
true,
|
||||
'group',
|
||||
$group,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->colspan[1][1] = 2;
|
||||
|
||||
$table->data[2][0] = __('Command');
|
||||
@ -163,10 +204,15 @@ $table->data[2][1] = html_print_select_from_sql(
|
||||
'',
|
||||
__('None'),
|
||||
0,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[2][1] .= ' ';
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if ($is_central_policies_on_node === false
|
||||
&& check_acl($config['id_user'], 0, 'PM')
|
||||
) {
|
||||
$table->data[2][1] .= __('Create Command');
|
||||
$table->data[2][1] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_command&pure='.$pure.'">';
|
||||
$table->data[2][1] .= html_print_image('images/add.png', true);
|
||||
@ -188,7 +234,7 @@ $table->data[3][1] = html_print_extended_select_for_time(
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
@ -237,12 +283,12 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
// Store the value in a hidden to keep it on first execution
|
||||
$table->data['field'.$i][1] .= html_print_input_hidden(
|
||||
'field'.$i.'_value',
|
||||
!empty($action['field'.$i]) ? $action['field'.$i] : '',
|
||||
(!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '',
|
||||
true
|
||||
);
|
||||
$table->data['field'.$i][2] .= html_print_input_hidden(
|
||||
'field'.$i.'_recovery_value',
|
||||
!empty($action['field'.$i.'_recovery']) ? $action['field'.$i.'_recovery'] : '',
|
||||
(!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '',
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -251,46 +297,44 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
echo '<form method="post" action="'.'index.php?sec='.$sec.'&'.'sec2=godmode/alerts/alert_actions&'.'pure='.$pure.'">';
|
||||
$table_html = html_print_table($table, true);
|
||||
|
||||
//
|
||||
// Hack to hook the bubble dialog of clippy in any place, the intro.js
|
||||
// fails with new elements in the dom from javascript code
|
||||
// ----------------------------------------------------------------------
|
||||
/*
|
||||
$table_html = str_replace(
|
||||
"</table>",
|
||||
"</div>",
|
||||
$table_html);
|
||||
$table_html = str_replace(
|
||||
'<tr id="table_macros-field1" style="" class="datos2">',
|
||||
"</tbody></table>
|
||||
<div id=\"clippy_fields\">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr id=\"table_macros-field1\" class=\"datos\">",
|
||||
$table_html);
|
||||
*/
|
||||
//
|
||||
echo $table_html;
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($id) {
|
||||
html_print_input_hidden('id', $id);
|
||||
if ($al_action['id_group'] == 0) {
|
||||
// then must have "PM" access privileges
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if ($is_central_policies_on_node === false) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($id) {
|
||||
html_print_input_hidden('id', $id);
|
||||
if ($al_action['id_group'] == 0) {
|
||||
// Then must have "PM" access privileges.
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
html_print_input_hidden('update_action', 1);
|
||||
html_print_submit_button(
|
||||
__('Update'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub upd"'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
html_print_input_hidden('update_action', 1);
|
||||
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
|
||||
html_print_submit_button(
|
||||
__('Update'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub upd"'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
html_print_input_hidden('update_action', 1);
|
||||
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
|
||||
html_print_input_hidden('create_action', 1);
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub wand"'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
html_print_input_hidden('create_action', 1);
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
@ -36,7 +36,7 @@ $pure = get_parameter('pure', 0);
|
||||
$alert = [];
|
||||
|
||||
// Header.
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
ui_print_page_header(
|
||||
@ -83,6 +83,10 @@ if ($update_command) {
|
||||
$values['command'] = $command;
|
||||
$values['description'] = $description;
|
||||
$values['id_group'] = $id_group;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'talert_commands', 'id', $id);
|
||||
}
|
||||
|
||||
// Check it the new name is used in the other command.
|
||||
$id_check = db_get_value('id', 'talert_commands', 'name', $name);
|
||||
@ -135,30 +139,39 @@ if ($id) {
|
||||
$fields_hidden = $alert['fields_hidden'];
|
||||
}
|
||||
|
||||
if (!empty($fields_descriptions)) {
|
||||
if (empty($fields_descriptions) === false) {
|
||||
$fields_descriptions = json_decode($fields_descriptions, true);
|
||||
}
|
||||
|
||||
if (!empty($fields_values)) {
|
||||
if (empty($fields_values) === false) {
|
||||
$fields_values = json_decode($fields_values, true);
|
||||
}
|
||||
|
||||
if (!empty($fields_hidden)) {
|
||||
if (empty($fields_hidden) === false) {
|
||||
$fields_hidden = json_decode($fields_hidden, true);
|
||||
}
|
||||
|
||||
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table->head[0] = ($id) ? __('Update Command') : __('Create Command');
|
||||
$table->head_colspan[0] = 4;
|
||||
$table->headstyle[0] = 'text-align: center';
|
||||
}
|
||||
|
||||
$table->style = [];
|
||||
if (!defined('METACONSOLE')) {
|
||||
if (is_metaconsole() === false) {
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->style[4] = 'font-weight: bold';
|
||||
@ -170,11 +183,38 @@ $table->data = [];
|
||||
|
||||
$table->colspan['name'][1] = 3;
|
||||
$table->data['name'][0] = __('Name');
|
||||
$table->data['name'][2] = html_print_input_text('name', $name, '', 35, 255, true);
|
||||
$table->data['name'][2] = html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
35,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->colspan['command'][1] = 3;
|
||||
$table->data['command'][0] = __('Command');
|
||||
$table->data['command'][1] = html_print_textarea('command', 8, 30, $command, '', true);
|
||||
$table->data['command'][1] = html_print_textarea(
|
||||
'command',
|
||||
8,
|
||||
30,
|
||||
$command,
|
||||
'',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->colspan['group'][1] = 3;
|
||||
$table->data['group'][0] = __('Group');
|
||||
@ -187,60 +227,124 @@ $table->data['group'][1] = html_print_select_groups(
|
||||
false,
|
||||
'',
|
||||
0,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->colspan['description'][1] = 3;
|
||||
$table->data['description'][0] = __('Description');
|
||||
$table->data['description'][1] = html_print_textarea('description', 10, 30, $description, '', true);
|
||||
$table->data['description'][1] = html_print_textarea(
|
||||
'description',
|
||||
10,
|
||||
30,
|
||||
$description,
|
||||
'',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
|
||||
|
||||
if (!empty($fields_descriptions)) {
|
||||
if (empty($fields_descriptions) === false) {
|
||||
$field_description = $fields_descriptions[($i - 1)];
|
||||
} else {
|
||||
$field_description = '';
|
||||
}
|
||||
|
||||
$table->data['field'.$i][1] = html_print_input_text('field'.$i.'_description', $field_description, '', 30, 255, true);
|
||||
$table->data['field'.$i][1] = html_print_input_text(
|
||||
'field'.$i.'_description',
|
||||
$field_description,
|
||||
'',
|
||||
30,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i).ui_print_help_tip(__('value1,tag1;value2,tag2;value3,tag3'), true);
|
||||
$table->data['field'.$i][2] = sprintf(__('Field %s values'), $i);
|
||||
$table->data['field'.$i][2] .= ui_print_help_tip(
|
||||
__('value1,tag1;value2,tag2;value3,tag3'),
|
||||
true
|
||||
);
|
||||
|
||||
if (!empty($fields_values)) {
|
||||
if (empty($fields_values) === false) {
|
||||
$field_values = $fields_values[($i - 1)];
|
||||
} else {
|
||||
$field_values = '';
|
||||
}
|
||||
|
||||
if (!empty($fields_hidden)) {
|
||||
if (empty($fields_hidden) === false) {
|
||||
$selected = (bool) $fields_hidden[($i - 1)];
|
||||
} else {
|
||||
$selected = false;
|
||||
}
|
||||
|
||||
$table->data['field'.$i][3] = html_print_input_text('field'.$i.'_values', $field_values, '', 55, 255, true, false, false, '', 'field_value');
|
||||
$table->data['field'.$i][3] = html_print_input_text(
|
||||
'field'.$i.'_values',
|
||||
$field_values,
|
||||
'',
|
||||
55,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'field_value',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data['field'.$i][4] = __('Hide');
|
||||
|
||||
$table->data['field'.$i][5] = html_print_checkbox_extended('field'.$i.'_hide', 1, $selected, false, 'cursor: \'pointer\'', 'class="hide_inputs"', true);
|
||||
$table->data['field'.$i][5] = html_print_checkbox_extended(
|
||||
'field'.$i.'_hide',
|
||||
1,
|
||||
$selected,
|
||||
$is_central_policies_on_node,
|
||||
'cursor: \'pointer\'',
|
||||
'class="hide_inputs"',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_commands&pure='.$pure.'">';
|
||||
html_print_table($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($id) {
|
||||
html_print_input_hidden('id', $id);
|
||||
html_print_input_hidden('update_command', 1);
|
||||
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
|
||||
} else {
|
||||
html_print_input_hidden('create_command', 1);
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
|
||||
if ($is_central_policies_on_node === false) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($id) {
|
||||
html_print_input_hidden('id', $id);
|
||||
html_print_input_hidden('update_command', 1);
|
||||
html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"');
|
||||
} else {
|
||||
html_print_input_hidden('create_command', 1);
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"');
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
@ -251,20 +355,20 @@ $(document).ready (function () {
|
||||
|
||||
$(".hide_inputs").each(function(index) {
|
||||
var $input_in_row = $(this).closest('tr').find('.field_value');
|
||||
if($(this).is(':checked')) {
|
||||
if($(this).is(':checked')) {
|
||||
$input_in_row.prop('style', '-webkit-text-security: disc;');
|
||||
} else {
|
||||
} else {
|
||||
$input_in_row.prop('style', '');
|
||||
}
|
||||
});
|
||||
|
||||
$(".hide_inputs").click(function() {
|
||||
var $input_in_row = $(this).closest('tr').find('.field_value');
|
||||
if($(this).is(':checked')) {
|
||||
if($(this).is(':checked')) {
|
||||
$input_in_row.prop('style', '-webkit-text-security: disc;');
|
||||
} else {
|
||||
} else {
|
||||
$input_in_row.prop('style', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -34,6 +34,9 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||
$duplicate_template = (bool) get_parameter('duplicate_template');
|
||||
$id = (int) get_parameter('id');
|
||||
$pure = get_parameter('pure', 0);
|
||||
$step = (int) get_parameter('step', 1);
|
||||
// We set here the number of steps.
|
||||
define('LAST_STEP', 3);
|
||||
|
||||
// If user tries to duplicate/edit a template with group=ALL then must have "PM" access privileges
|
||||
if ($duplicate_template) {
|
||||
@ -56,7 +59,6 @@ if ($a_template !== false) {
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
$step = (int) get_parameter('step', 1);
|
||||
if ($step == 1) {
|
||||
$help_header = '';
|
||||
} else if ($step == 2) {
|
||||
@ -113,7 +115,6 @@ if ($a_template !== false) {
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header();
|
||||
} else {
|
||||
$step = (int) get_parameter('step', 1);
|
||||
if ($step == 1) {
|
||||
$help_header = '';
|
||||
} else if ($step == 2) {
|
||||
@ -252,24 +253,20 @@ function update_template($step)
|
||||
$wizard_level = (string) get_parameter('wizard_level');
|
||||
$priority = (int) get_parameter('priority');
|
||||
$id_group = get_parameter('id_group');
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$name_check = db_get_value('name', 'talert_templates', 'name', $name);
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$name_check = db_get_value('name', 'talert_templates', 'to_char(name)', $name);
|
||||
break;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$previous_name = db_get_value('name', 'talert_templates', 'id', $id);
|
||||
} else {
|
||||
$previous_name = '';
|
||||
}
|
||||
|
||||
$values = [
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'id_group' => $id_group,
|
||||
'priority' => $priority,
|
||||
'wizard_level' => $wizard_level,
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'id_group' => $id_group,
|
||||
'priority' => $priority,
|
||||
'wizard_level' => $wizard_level,
|
||||
'previous_name' => $previous_name,
|
||||
];
|
||||
|
||||
$result = alerts_update_alert_template($id, $values);
|
||||
@ -363,7 +360,15 @@ function update_template($step)
|
||||
}
|
||||
|
||||
|
||||
// We set here the number of steps
|
||||
$is_central_policies_on_node = is_central_policies_on_node();
|
||||
|
||||
if ($is_central_policies_on_node === true) {
|
||||
ui_print_warning_message(
|
||||
__('This node is configured with centralized mode. All alerts templates information is read only. Go to metaconsole to manage it.')
|
||||
);
|
||||
}
|
||||
|
||||
// We set here the number of steps.
|
||||
define('LAST_STEP', 3);
|
||||
|
||||
$step = (int) get_parameter('step', 1);
|
||||
@ -579,27 +584,74 @@ if ($step == 2) {
|
||||
$show_matches = false;
|
||||
}
|
||||
|
||||
// Firing conditions and events
|
||||
// Firing conditions and events.
|
||||
$table->colspan = [];
|
||||
// $table->colspan[4][1] = 1;
|
||||
$table->data[0][0] = __('Days of week');
|
||||
$table->data[0][1] = __('Mon');
|
||||
$table->data[0][1] .= html_print_checkbox('monday', 1, $monday, true);
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
'monday',
|
||||
1,
|
||||
$monday,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[0][1] .= __('Tue');
|
||||
$table->data[0][1] .= html_print_checkbox('tuesday', 1, $tuesday, true);
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
'tuesday',
|
||||
1,
|
||||
$tuesday,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[0][1] .= __('Wed');
|
||||
$table->data[0][1] .= html_print_checkbox('wednesday', 1, $wednesday, true);
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
'wednesday',
|
||||
1,
|
||||
$wednesday,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[0][1] .= __('Thu');
|
||||
$table->data[0][1] .= html_print_checkbox('thursday', 1, $thursday, true);
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
'thursday',
|
||||
1,
|
||||
$thursday,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[0][1] .= __('Fri');
|
||||
$table->data[0][1] .= html_print_checkbox('friday', 1, $friday, true);
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
'friday',
|
||||
1,
|
||||
$friday,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[0][1] .= __('Sat');
|
||||
$table->data[0][1] .= html_print_checkbox('saturday', 1, $saturday, true);
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
'saturday',
|
||||
1,
|
||||
$saturday,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[0][1] .= __('Sun');
|
||||
$table->data[0][1] .= html_print_checkbox('sunday', 1, $sunday, true);
|
||||
$table->data[0][1] .= html_print_checkbox(
|
||||
'sunday',
|
||||
1,
|
||||
$sunday,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data[0][2] = __('Use special days list');
|
||||
$table->data[0][3] = html_print_checkbox('special_day', 1, $special_day, true);
|
||||
$table->data[0][3] = html_print_checkbox(
|
||||
'special_day',
|
||||
1,
|
||||
$special_day,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data[1][0] = __('Time from');
|
||||
$table->data[1][1] = html_print_input_text(
|
||||
@ -608,7 +660,18 @@ if ($step == 2) {
|
||||
'',
|
||||
7,
|
||||
8,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[1][2] = __('Time to');
|
||||
$table->data[1][3] = html_print_input_text(
|
||||
@ -617,7 +680,18 @@ if ($step == 2) {
|
||||
'',
|
||||
7,
|
||||
8,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->colspan['threshold'][1] = 3;
|
||||
@ -629,7 +703,11 @@ if ($step == 2) {
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('Min. number of alerts');
|
||||
@ -639,11 +717,32 @@ if ($step == 2) {
|
||||
'',
|
||||
5,
|
||||
7,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data[3][2] = __('Reset counter for non-sustained alerts').ui_print_help_tip(__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'), true);
|
||||
$table->data[3][3] = html_print_checkbox('min_alerts_reset_counter', 1, $min_alerts_reset_counter, true);
|
||||
$table->data[3][2] = __('Reset counter for non-sustained alerts');
|
||||
$table->data[3][2] .= ui_print_help_tip(
|
||||
__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'),
|
||||
true
|
||||
);
|
||||
$table->data[3][3] = html_print_checkbox(
|
||||
'min_alerts_reset_counter',
|
||||
1,
|
||||
$min_alerts_reset_counter,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data[4][0] = __('Max. number of alerts');
|
||||
$table->data[4][1] = html_print_input_text(
|
||||
@ -652,39 +751,43 @@ if ($step == 2) {
|
||||
'',
|
||||
5,
|
||||
7,
|
||||
true
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data[4][2] = __('Disable event');
|
||||
$table->data[4][3] = html_print_checkbox('disable_event', 1, $disable_event, true);
|
||||
$table->data[4][3] = html_print_checkbox(
|
||||
'disable_event',
|
||||
1,
|
||||
$disable_event,
|
||||
true,
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data[5][0] = __('Default action');
|
||||
$usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true)));
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$sql_query = sprintf(
|
||||
'
|
||||
SELECT id, name
|
||||
FROM talert_actions
|
||||
WHERE id_group IN (%s)
|
||||
ORDER BY name',
|
||||
$usr_groups
|
||||
);
|
||||
break;
|
||||
$usr_groups = implode(
|
||||
',',
|
||||
array_keys(users_get_groups($config['id_user'], 'LM', true))
|
||||
);
|
||||
|
||||
case 'oracle':
|
||||
$sql_query = sprintf(
|
||||
'
|
||||
SELECT id,
|
||||
dbms_lob.substr(name,4000,1) AS nombre
|
||||
FROM talert_actions
|
||||
WHERE id_group IN (%s)
|
||||
ORDER BY dbms_lob.substr(name,4000,1)',
|
||||
$usr_groups
|
||||
);
|
||||
break;
|
||||
}
|
||||
$sql_query = sprintf(
|
||||
'
|
||||
SELECT id, name
|
||||
FROM talert_actions
|
||||
WHERE id_group IN (%s)
|
||||
ORDER BY name',
|
||||
$usr_groups
|
||||
);
|
||||
|
||||
$table->data[5][1] = html_print_select_from_sql(
|
||||
$sql_query,
|
||||
@ -696,11 +799,12 @@ if ($step == 2) {
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
false,
|
||||
false,
|
||||
0
|
||||
).ui_print_help_tip(
|
||||
);
|
||||
$table->data[5][1] .= ui_print_help_tip(
|
||||
__('Unless they\'re left blank, the fields from the action will override those set on the template.'),
|
||||
true
|
||||
);
|
||||
@ -715,7 +819,9 @@ if ($step == 2) {
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->data[6][1] .= '<span id="matches_value" '.($show_matches ? '' : 'style="display: none"').'>';
|
||||
$table->data[6][1] .= ' '.html_print_checkbox('matches_value', 1, $matches, true);
|
||||
@ -760,7 +866,7 @@ if ($step == 2) {
|
||||
$table->data['value'][1] .= '</span>';
|
||||
$table->colspan['value'][1] = 3;
|
||||
|
||||
// Min first, then max, that's more logical
|
||||
// Min first, then max, that's more logical.
|
||||
$table->data['min'][0] = __('Min.');
|
||||
$table->data['min'][1] = html_print_input_text(
|
||||
'min',
|
||||
@ -798,25 +904,12 @@ if ($step == 2) {
|
||||
$table->size[1] = '45%';
|
||||
$table->size[2] = '45%';
|
||||
|
||||
// Alert recover
|
||||
// Alert recover.
|
||||
if (! $recovery_notify) {
|
||||
$table->cellstyle['label_fields'][2] = 'display:none;';
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$table->cellstyle['field'.$i][2] = 'display:none;';
|
||||
}
|
||||
|
||||
/*
|
||||
$table->cellstyle['field1'][2] = 'display:none;';
|
||||
$table->cellstyle['field2'][2] = 'display:none;';
|
||||
$table->cellstyle['field3'][2] = 'display:none;';
|
||||
$table->cellstyle['field4'][2] = 'display:none;';
|
||||
$table->cellstyle['field5'][2] = 'display:none;';
|
||||
$table->cellstyle['field6'][2] = 'display:none;';
|
||||
$table->cellstyle['field7'][2] = 'display:none;';
|
||||
$table->cellstyle['field8'][2] = 'display:none;';
|
||||
$table->cellstyle['field9'][2] = 'display:none;';
|
||||
$table->cellstyle['field10'][2] = 'display:none;';
|
||||
*/
|
||||
}
|
||||
|
||||
$table->data[0][0] = __('Alert recovery');
|
||||
@ -833,7 +926,9 @@ if ($step == 2) {
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
$table->colspan[0][1] = 2;
|
||||
|
||||
@ -842,45 +937,98 @@ if ($step == 2) {
|
||||
$table->data['label_fields'][2] = __('Recovery fields');
|
||||
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
if (isset($template[$name])) {
|
||||
if (isset($template[$name]) === true) {
|
||||
$value = $template[$name];
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
|
||||
// $table->rowclass['field'.$i] = 'row_field';
|
||||
$table->data['field'.$i][0] = sprintf(__('Field %s'), $i);
|
||||
// TinyMCE
|
||||
// triggering fields
|
||||
// basic
|
||||
$table->data['field'.$i][1] = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$table->data['field'.$i][1] .= __('Basic').' ';
|
||||
$table->data['field'.$i][1] .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."')", '', true);
|
||||
// Advanced
|
||||
$table->data['field'.$i][1] .= ' ';
|
||||
$table->data['field'.$i][1] .= __('Advanced').' ';
|
||||
$table->data['field'.$i][1] .= html_print_radio_button_extended('editor_type_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."')", '', true);
|
||||
$table->data['field'.$i][1] .= '</small></b></div>';
|
||||
// TinyMCE.
|
||||
// triggering fields.
|
||||
// Basic.
|
||||
$table->data['field'.$i][1] = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$table->data['field'.$i][1] .= __('Basic').' ';
|
||||
$table->data['field'.$i][1] .= html_print_radio_button_extended(
|
||||
'editor_type_value_'.$i,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
"removeTinyMCE('textarea_field".$i."')",
|
||||
'',
|
||||
true
|
||||
);
|
||||
// Advanced.
|
||||
$table->data['field'.$i][1] .= ' ';
|
||||
$table->data['field'.$i][1] .= __('Advanced').' ';
|
||||
$table->data['field'.$i][1] .= html_print_radio_button_extended(
|
||||
'editor_type_value_'.$i,
|
||||
0,
|
||||
'',
|
||||
true,
|
||||
$is_central_policies_on_node,
|
||||
"addTinyMCE('textarea_field".$i."')",
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->data['field'.$i][1] .= '</small></b></div>';
|
||||
|
||||
// Texarea
|
||||
$table->data['field'.$i][1] .= html_print_textarea('field'.$i, 1, 1, isset($fields[$i]) ? $fields[$i] : '', 'style="min-height:40px;" class="fields"', true);
|
||||
// Texarea.
|
||||
$table->data['field'.$i][1] .= html_print_textarea(
|
||||
'field'.$i,
|
||||
1,
|
||||
1,
|
||||
isset($fields[$i]) ? $fields[$i] : '',
|
||||
'style="min-height:40px;" class="fields"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
// Recovery
|
||||
// basic
|
||||
$table->data['field'.$i][2] = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$table->data['field'.$i][2] .= __('Basic').' ';
|
||||
$table->data['field'.$i][2] .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', false, false, "removeTinyMCE('textarea_field".$i."_recovery')", '', true);
|
||||
// advanced
|
||||
$table->data['field'.$i][2] .= ' ';
|
||||
$table->data['field'.$i][2] .= __('Advanced').' ';
|
||||
$table->data['field'.$i][2] .= html_print_radio_button_extended('editor_type_recovery_value_'.$i, 0, '', true, false, "addTinyMCE('textarea_field".$i."_recovery')", '', true);
|
||||
$table->data['field'.$i][2] .= '</small></b></div>';
|
||||
// Recovery.
|
||||
// Basic.
|
||||
$table->data['field'.$i][2] = '<div style="padding: 4px 0px;"><b><small>';
|
||||
$table->data['field'.$i][2] .= __('Basic').' ';
|
||||
$table->data['field'.$i][2] .= html_print_radio_button_extended(
|
||||
'editor_type_recovery_value_'.$i,
|
||||
0,
|
||||
'',
|
||||
false,
|
||||
$is_central_policies_on_node,
|
||||
"removeTinyMCE('textarea_field".$i."_recovery')",
|
||||
'',
|
||||
true
|
||||
);
|
||||
// Advanced.
|
||||
$table->data['field'.$i][2] .= ' ';
|
||||
$table->data['field'.$i][2] .= __('Advanced').' ';
|
||||
$table->data['field'.$i][2] .= html_print_radio_button_extended(
|
||||
'editor_type_recovery_value_'.$i,
|
||||
0,
|
||||
'',
|
||||
true,
|
||||
$is_central_policies_on_node,
|
||||
"addTinyMCE('textarea_field".$i."_recovery')",
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->data['field'.$i][2] .= '</small></b></div>';
|
||||
|
||||
// Texarea
|
||||
$table->data['field'.$i][2] .= html_print_textarea('field'.$i.'_recovery', 1, 1, isset($fields_recovery[$i]) ? $fields_recovery[$i] : '', 'style="min-height:40px" class="fields"', true);
|
||||
// Texarea.
|
||||
$table->data['field'.$i][2] .= html_print_textarea(
|
||||
'field'.$i.'_recovery',
|
||||
1,
|
||||
1,
|
||||
isset($fields_recovery[$i]) ? $fields_recovery[$i] : '',
|
||||
'style="min-height:40px" class="fields"',
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Step 1 by default
|
||||
// Step 1 by default.
|
||||
$table->size = [];
|
||||
$table->size[0] = '20%';
|
||||
$table->data = [];
|
||||
@ -916,20 +1064,53 @@ if ($step == 2) {
|
||||
}
|
||||
|
||||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = html_print_input_text('name', $name, '', 35, 255, true);
|
||||
$table->data[0][1] = html_print_input_text(
|
||||
'name',
|
||||
$name,
|
||||
'',
|
||||
35,
|
||||
255,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
|
||||
$table->data[0][1] .= ' '.__('Group');
|
||||
$groups = users_get_groups();
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
// Only display group "All" if user is administrator or has "PM" privileges
|
||||
// Only display group "All" if user is administrator or has "PM" privileges.
|
||||
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
|
||||
$display_all_group = true;
|
||||
} else {
|
||||
$display_all_group = false;
|
||||
}
|
||||
|
||||
$table->data[0][1] .= ' '.html_print_select_groups(false, 'AR', $display_all_group, 'id_group', $id_group, '', '', 0, true);
|
||||
$table->data[0][1] .= ' ';
|
||||
$table->data[0][1] .= html_print_select_groups(
|
||||
false,
|
||||
'AR',
|
||||
$display_all_group,
|
||||
'id_group',
|
||||
$id_group,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
|
||||
$table->data[1][0] = __('Description');
|
||||
@ -939,7 +1120,9 @@ if ($step == 2) {
|
||||
30,
|
||||
$description,
|
||||
'',
|
||||
true
|
||||
true,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
$table->data[2][0] = __('Priority');
|
||||
@ -952,7 +1135,9 @@ if ($step == 2) {
|
||||
0,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
false,
|
||||
'',
|
||||
$is_central_policies_on_node
|
||||
);
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
@ -1000,25 +1185,32 @@ if (!$create_alert && !$create_template) {
|
||||
}
|
||||
|
||||
if (!$disabled) {
|
||||
if ($step >= LAST_STEP) {
|
||||
html_print_submit_button(__('Finish'), 'finish', false, 'class="sub upd"');
|
||||
} else {
|
||||
html_print_input_hidden('step', ($step + 1));
|
||||
if ($step == 2) {
|
||||
// Javascript onsubmit to avoid min = 0 and max = 0
|
||||
if ($is_central_policies_on_node === false) {
|
||||
if ($step >= LAST_STEP) {
|
||||
html_print_submit_button(
|
||||
__('Next'),
|
||||
'next',
|
||||
__('Finish'),
|
||||
'finish',
|
||||
false,
|
||||
'class="sub next" onclick="return check_fields_step2();"'
|
||||
'class="sub upd"'
|
||||
);
|
||||
} else {
|
||||
html_print_submit_button(
|
||||
__('Next'),
|
||||
'next',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
html_print_input_hidden('step', ($step + 1));
|
||||
if ($step == 2) {
|
||||
// Javascript onsubmit to avoid min = 0 and max = 0
|
||||
html_print_submit_button(
|
||||
__('Next'),
|
||||
'next',
|
||||
false,
|
||||
'class="sub next" onclick="return check_fields_step2();"'
|
||||
);
|
||||
} else {
|
||||
html_print_submit_button(
|
||||
__('Next'),
|
||||
'next',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1041,7 +1233,7 @@ var matches_not = <?php echo '"'.__("The alert would fire when the value doesn\'
|
||||
var is = <?php echo "'".__('The alert would fire when the value is <span id="value"></span>')."'"; ?>;
|
||||
var is_not = <?php echo "'".__('The alert would fire when the value is not <span id="value"></span>')."'"; ?>;
|
||||
var between = <?php echo "'".__('The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>')."'"; ?>;
|
||||
var between_not = <?php echo '"'.__("The alert would fire when the value is not between <span id=\'min\'></span> and <span id=\'max\'></span>").'"'; ?>;
|
||||
var between_not = <?php echo '"'.__('The alert would fire when the value is not between <span id=min></span> and <span id=max></span>').'"'; ?>;
|
||||
var under = <?php echo "'".__('The alert would fire when the value is below <span id="min"></span>')."'"; ?>;
|
||||
var over = <?php echo "'".__('The alert would fire when the value is above <span id="max"></span>')."'"; ?>;
|
||||
var warning = <?php echo "'".__('The alert would fire when the module is in warning status')."'"; ?>;
|
||||
|
@ -35,12 +35,15 @@ global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
require_once $config['homedir'].'/include/functions_groups.php';
|
||||
require_once $config['homedir'].'/include/functions_agents.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
enterprise_include_once('meta/include/functions_agents_meta.php');
|
||||
|
||||
if (is_metaconsole()) {
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
enterprise_include_once('meta/include/functions_agents_meta.php');
|
||||
enterprise_hook('open_meta_frame');
|
||||
}
|
||||
|
||||
if (is_ajax()) {
|
||||
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||
@ -348,7 +351,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
||||
$propagate = (bool) get_parameter('propagate');
|
||||
|
||||
$aviable_name = true;
|
||||
if (preg_match('<script>', $name)) {
|
||||
if (preg_match('/script/i', $name)) {
|
||||
$aviable_name = false;
|
||||
}
|
||||
|
||||
@ -403,7 +406,7 @@ if ($update_group) {
|
||||
$other = (string) get_parameter('other');
|
||||
|
||||
$aviable_name = true;
|
||||
if (preg_match('<script>', $name)) {
|
||||
if (preg_match('/script/i', $name)) {
|
||||
$aviable_name = false;
|
||||
}
|
||||
|
||||
@ -714,7 +717,12 @@ if ($tab == 'tree') {
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
$url = 'index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group='.$group['id_grupo'];
|
||||
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
|
||||
if (is_metaconsole()) {
|
||||
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'].'&tab=groups';
|
||||
} else {
|
||||
$url_delete = 'index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group='.$group['id_grupo'];
|
||||
}
|
||||
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = '<a href="'.$url.'">'.$group['nombre'].'</a>';
|
||||
if ($group['icon'] != '') {
|
||||
@ -724,8 +732,8 @@ if ($tab == 'tree') {
|
||||
[
|
||||
'style' => '',
|
||||
'class' => 'bot',
|
||||
'alt' => $group['nombre'],
|
||||
'title' => $group['nombre'],
|
||||
'alt' => io_safe_input($group['nombre']),
|
||||
'title' => io_safe_input($group['nombre']),
|
||||
],
|
||||
false,
|
||||
false,
|
||||
|
@ -92,6 +92,12 @@ if ($satellite_options != ENTERPRISE_NOT_HOOK) {
|
||||
$options_satellite = array_merge($options_satellite, $satellite_options);
|
||||
}
|
||||
|
||||
$options_services = enterprise_hook('massive_services_options');
|
||||
if ($options_services === ENTERPRISE_NOT_HOOK) {
|
||||
$options_services = [];
|
||||
}
|
||||
|
||||
|
||||
if (in_array($option, array_keys($options_alerts))) {
|
||||
$tab = 'massive_alerts';
|
||||
} else if (in_array($option, array_keys($options_agents))) {
|
||||
@ -108,6 +114,8 @@ if (in_array($option, array_keys($options_alerts))) {
|
||||
$tab = 'massive_satellite';
|
||||
} else if (in_array($option, array_keys($options_plugins))) {
|
||||
$tab = 'massive_plugins';
|
||||
} else if (in_array($option, array_keys($options_services))) {
|
||||
$tab = 'massive_services';
|
||||
}
|
||||
|
||||
if ($tab == 'massive_agents' && $option == '') {
|
||||
@ -173,6 +181,10 @@ switch ($tab) {
|
||||
$options = $options_plugins;
|
||||
break;
|
||||
|
||||
case 'massive_services':
|
||||
$options = $options_services;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
@ -241,6 +253,11 @@ if ($satellitetab == ENTERPRISE_NOT_HOOK) {
|
||||
$satellitetab = '';
|
||||
}
|
||||
|
||||
$servicestab = enterprise_hook('massive_services_tab');
|
||||
|
||||
if ($servicestab == ENTERPRISE_NOT_HOOK) {
|
||||
$servicestab = '';
|
||||
}
|
||||
|
||||
$onheader = [];
|
||||
$onheader['massive_agents'] = $agentstab;
|
||||
@ -254,6 +271,7 @@ $onheader['massive_alerts'] = $alertstab;
|
||||
$onheader['policies'] = $policiestab;
|
||||
$onheader['snmp'] = $snmptab;
|
||||
$onheader['satellite'] = $satellitetab;
|
||||
$onheader['services'] = $servicestab;
|
||||
|
||||
/*
|
||||
Hello there! :)
|
||||
|
@ -124,6 +124,9 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (check_acl($config['id_user'], 0, 'UM')) {
|
||||
$sub['godmode/users/user_list']['text'] = __('Users management');
|
||||
$sub['godmode/users/user_list']['id'] = 'Users management';
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$sub['godmode/users/profile_list']['text'] = __('Profile management');
|
||||
$sub['godmode/users/profile_list']['id'] = 'Profile management';
|
||||
}
|
||||
@ -189,6 +192,7 @@ if (check_acl($config['id_user'], 0, 'AW')) {
|
||||
enterprise_hook('massivepolicies_submenu');
|
||||
enterprise_hook('massivesnmp_submenu');
|
||||
enterprise_hook('massivesatellite_submenu');
|
||||
enterprise_hook('massiveservices_submenu');
|
||||
|
||||
$sub['gmassive']['sub2'] = $sub2;
|
||||
}
|
||||
|
@ -46,14 +46,15 @@ if (defined('METACONSOLE')) {
|
||||
$sec = 'gmodules';
|
||||
}
|
||||
|
||||
|
||||
$create = (bool) get_parameter('create');
|
||||
$update = (bool) get_parameter('update');
|
||||
$delete = (bool) get_parameter('delete');
|
||||
$new = (bool) get_parameter('new');
|
||||
$id = (int) get_parameter('id');
|
||||
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
|
||||
$pure = get_parameter('pure', 0);
|
||||
if (is_management_allowed() === true) {
|
||||
$create = (bool) get_parameter('create');
|
||||
$update = (bool) get_parameter('update');
|
||||
$delete = (bool) get_parameter('delete');
|
||||
$new = (bool) get_parameter('new');
|
||||
$id = (int) get_parameter('id');
|
||||
$multiple_delete = (bool) get_parameter('multiple_delete', 0);
|
||||
$pure = get_parameter('pure', 0);
|
||||
}
|
||||
|
||||
if ($create) {
|
||||
$name = (string) get_parameter('name');
|
||||
@ -186,7 +187,7 @@ if ($multiple_delete) {
|
||||
);
|
||||
}
|
||||
|
||||
if (($id || $new) && !$delete && !$multiple_delete) {
|
||||
if (($id || $new) && !$delete && !$multiple_delete && is_management_allowed() === true) {
|
||||
include_once 'manage_nc_groups_form.php';
|
||||
return;
|
||||
}
|
||||
@ -229,7 +230,10 @@ $table->class = 'info_table';
|
||||
$table->head = [];
|
||||
$table->head['checkbox'] = html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Action');
|
||||
if (is_management_allowed() === true) {
|
||||
$table->head[1] = __('Action');
|
||||
}
|
||||
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->align = [];
|
||||
@ -258,31 +262,42 @@ foreach ($groups as $group) {
|
||||
}
|
||||
|
||||
$table->cellclass[][1] = 'action_buttons';
|
||||
$data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
|
||||
if (is_management_allowed() === true) {
|
||||
$data[1] = "<a onclick='if(confirm(\"".__('Are you sure?')."\")) return true; else return false;'
|
||||
href='index.php?sec=".$sec.'&sec2=godmode/modules/manage_nc_groups&delete=1&id='.$group['id_sg']."&offset=0'>".html_print_image('images/cross.png', true, ['title' => __('Delete')]).'</a>';
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
if (is_management_allowed() === false) {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. This page is for read only. Go to metaconsole to manage the component groups.'));
|
||||
}
|
||||
|
||||
if (isset($data)) {
|
||||
echo "<form method='post' action='index.php?sec=".$sec."&sec2=godmode/modules/manage_nc_groups'>";
|
||||
html_print_input_hidden('multiple_delete', 1);
|
||||
html_print_table($table);
|
||||
echo "<div style='padding-left: 10px; float: right;'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
echo '</div>';
|
||||
if (is_management_allowed() === true) {
|
||||
echo "<div style='padding-left: 10px; float: right;'>";
|
||||
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 component groups') ]);
|
||||
}
|
||||
|
||||
if (is_management_allowed() === true) {
|
||||
echo '<form method="post" action='.$url.'>';
|
||||
echo '<div class="" style="float:right;">';
|
||||
html_print_input_hidden('new', 1);
|
||||
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '<form method="post" action='.$url.'>';
|
||||
echo '<div class="" style="float:right;">';
|
||||
html_print_input_hidden('new', 1);
|
||||
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
|
@ -47,6 +47,39 @@ 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.
|
||||
if (defined('METACONSOLE')) {
|
||||
$sec = 'advanced';
|
||||
|
||||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
$new_component = (bool) get_parameter('new_component');
|
||||
} else {
|
||||
$id_modulo = (int) get_parameter('id_component_type');
|
||||
$new_component = (bool) get_parameter('new_component');
|
||||
if ($id_modulo == COMPONENT_TYPE_NETWORK || $id_modulo == COMPONENT_TYPE_PLUGIN || $id_modulo == COMPONENT_TYPE_WMI || $id_modulo == COMPONENT_TYPE_WIZARD) {
|
||||
$help_header = 'local_module_tab';
|
||||
} else if (!$new_component) {
|
||||
$help_header = 'network_component_tab';
|
||||
} else {
|
||||
$help_header = 'network_component_tab';
|
||||
}
|
||||
|
||||
ui_print_page_header(
|
||||
__('Remote components'),
|
||||
'',
|
||||
false,
|
||||
$help_header,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'modulemodal',
|
||||
GENERIC_SIZE_TEXT,
|
||||
'',
|
||||
__('Configuration').' / '.__('Templates').' / '.__('Remote components')
|
||||
);
|
||||
$sec = 'gmodules';
|
||||
}
|
||||
|
||||
$type = (int) get_parameter('type');
|
||||
$name = (string) get_parameter('name');
|
||||
$description = (string) get_parameter('description');
|
||||
@ -180,6 +213,68 @@ if ($duplicate_network_component) {
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
// Wizard Common.
|
||||
$module_enabled = get_parameter_switch('module_enabled');
|
||||
$module_protocol = get_parameter('module_protocol', 'snmp');
|
||||
$scan_type = (int) get_parameter('scan_type', SCAN_TYPE_FIXED);
|
||||
$execution_type = (int) get_parameter('execution_type', EXECUTION_TYPE_NETWORK);
|
||||
// Wizard SNMP.
|
||||
$manufacturer_id = get_parameter('manufacturer_id');
|
||||
$name_oid = get_parameter('name_oid');
|
||||
$value = get_parameter('value_oid');
|
||||
// Other Wizard WMI fields.
|
||||
$query_filter = '';
|
||||
$wmi_class = get_parameter('wmi_class');
|
||||
$query_key_field = get_parameter('query_key_field');
|
||||
// Enabled Module.
|
||||
$enabled = get_parameter_switch('enabled');
|
||||
|
||||
if ($id_modulo === COMPONENT_TYPE_WIZARD) {
|
||||
// Wizard Common extra fields.
|
||||
$macros = [];
|
||||
|
||||
$macros['satellite_execution'] = get_parameter('satellite_execution_'.$module_protocol);
|
||||
$macros['value_operation'] = get_parameter('value_operation_'.$module_protocol);
|
||||
$macros['server_plugin'] = get_parameter('server_plugin_'.$module_protocol);
|
||||
|
||||
if ($module_protocol === 'snmp') {
|
||||
// If not select any manufacturer_id, there is 'all'.
|
||||
if (empty($manufacturer_id) === true) {
|
||||
$manufacturer_id = 'all';
|
||||
}
|
||||
} else if ($module_protocol === 'wmi') {
|
||||
// Wizard WMI Query filters.
|
||||
$query_filter = [];
|
||||
$query_filter['scan'] = get_parameter('query_filter_scan');
|
||||
$query_filter['execution'] = get_parameter('query_filter_execution');
|
||||
$query_filter['field'] = get_parameter('field_value_filter');
|
||||
$query_filter['key_string'] = get_parameter('key_string_filter');
|
||||
$query_filter = json_encode($query_filter);
|
||||
}
|
||||
|
||||
// Default extra field.
|
||||
$extra_fields = [ 'extra_field_1' => '' ];
|
||||
// If Plugin execution is selected.
|
||||
if ($execution_type === EXECUTION_TYPE_PLUGIN || $module_protocol === 'wmi') {
|
||||
// Search all parameters received with extra_fields.
|
||||
foreach ($_REQUEST as $parameter => $thisValue) {
|
||||
// Extra fields (OIDs Macros or WMI Extra fields)
|
||||
if (preg_match('/extra_field_'.$module_protocol.'_/', $parameter) !== 0) {
|
||||
$tmpParameter = explode('_', $parameter);
|
||||
$extra_fields['extra_field_'.$tmpParameter[3]] = get_parameter($parameter);
|
||||
}
|
||||
|
||||
// The plugin macros.
|
||||
if (preg_match('/'.$module_protocol.'_field/', $parameter) !== 0) {
|
||||
$macros[$parameter] = io_safe_input($thisValue);
|
||||
}
|
||||
}
|
||||
|
||||
// All of macros saved in the same array.
|
||||
$macros = json_encode(array_merge($extra_fields, $macros));
|
||||
}
|
||||
}
|
||||
|
||||
$custom_string_1 = '';
|
||||
$custom_string_2 = '';
|
||||
$custom_string_3 = '';
|
||||
@ -210,7 +305,7 @@ if (defined('METACONSOLE')) {
|
||||
$sec = 'gmodules';
|
||||
}
|
||||
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
|
||||
// New support for snmp v3.
|
||||
$tcp_send = $snmp_version;
|
||||
$plugin_user = $snmp3_auth_user;
|
||||
@ -219,7 +314,7 @@ if ($type >= 15 && $type <= 18) {
|
||||
$custom_string_1 = $snmp3_privacy_method;
|
||||
$custom_string_2 = $snmp3_privacy_pass;
|
||||
$custom_string_3 = $snmp3_security_level;
|
||||
} else if ($type >= 34 && $type <= 37) {
|
||||
} else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) {
|
||||
$tcp_send = $command_text;
|
||||
$custom_string_1 = $command_credential_identifier;
|
||||
$custom_string_2 = $command_os;
|
||||
@ -235,7 +330,7 @@ if ($create_component) {
|
||||
|
||||
if ($name && !$name_check) {
|
||||
$id = network_components_create_network_component(
|
||||
$name,
|
||||
strip_tags(io_safe_input($name), '<br>'),
|
||||
$type,
|
||||
$id_group,
|
||||
[
|
||||
@ -275,7 +370,6 @@ if ($create_component) {
|
||||
'post_process' => $post_process,
|
||||
'unit' => $unit,
|
||||
'wizard_level' => $wizard_level,
|
||||
'macros' => $macros,
|
||||
'critical_instructions' => $critical_instructions,
|
||||
'warning_instructions' => $warning_instructions,
|
||||
'unknown_instructions' => $unknown_instructions,
|
||||
@ -289,6 +383,17 @@ if ($create_component) {
|
||||
'min_ff_event_critical' => $ff_event_critical,
|
||||
'ff_type' => $ff_type,
|
||||
'each_ff' => $each_ff,
|
||||
'manufacturer_id' => $manufacturer_id,
|
||||
'protocol' => $module_protocol,
|
||||
'scan_type' => $scan_type,
|
||||
'execution_type' => $execution_type,
|
||||
'value' => $value,
|
||||
'query_class' => $wmi_class,
|
||||
'query_key_field' => $query_key_field,
|
||||
'query_filters' => $query_filter,
|
||||
'name_oid' => $name_oid,
|
||||
'module_enabled' => $module_enabled,
|
||||
'enabled' => $enabled,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
@ -298,9 +403,17 @@ if ($create_component) {
|
||||
if ($id === false || !$id) {
|
||||
db_pandora_audit(
|
||||
'Module management',
|
||||
'Fail try to create network component'
|
||||
'Fail try to create remote component'
|
||||
);
|
||||
ui_print_error_message(__('Could not be created'));
|
||||
|
||||
if ($name_check !== false) {
|
||||
// If name exists, advice about it.
|
||||
ui_print_error_message(__('Could not be created because the component exists'));
|
||||
} else {
|
||||
// Other cases.
|
||||
ui_print_error_message(__('Could not be created'));
|
||||
}
|
||||
|
||||
include_once 'godmode/modules/manage_network_components_form.php';
|
||||
return;
|
||||
}
|
||||
@ -318,7 +431,7 @@ if ($update_component) {
|
||||
$id,
|
||||
[
|
||||
'type' => $type,
|
||||
'name' => $name,
|
||||
'name' => strip_tags(io_safe_input($name, '<br>')),
|
||||
'id_group' => $id_group,
|
||||
'description' => $description,
|
||||
'module_interval' => $module_interval,
|
||||
@ -356,7 +469,6 @@ if ($update_component) {
|
||||
'post_process' => $post_process,
|
||||
'unit' => $unit,
|
||||
'wizard_level' => $wizard_level,
|
||||
'macros' => $macros,
|
||||
'critical_instructions' => $critical_instructions,
|
||||
'warning_instructions' => $warning_instructions,
|
||||
'unknown_instructions' => $unknown_instructions,
|
||||
@ -370,6 +482,17 @@ if ($update_component) {
|
||||
'min_ff_event_critical' => $ff_event_critical,
|
||||
'ff_type' => $ff_type,
|
||||
'each_ff' => $each_ff,
|
||||
'manufacturer_id' => $manufacturer_id,
|
||||
'protocol' => $module_protocol,
|
||||
'scan_type' => $scan_type,
|
||||
'execution_type' => $execution_type,
|
||||
'value' => $value,
|
||||
'query_class' => $wmi_class,
|
||||
'query_key_field' => $query_key_field,
|
||||
'query_filters' => $query_filter,
|
||||
'name_oid' => $name_oid,
|
||||
'module_enabled' => $module_enabled,
|
||||
'enabled' => $enabled,
|
||||
]
|
||||
);
|
||||
} else {
|
||||
@ -559,11 +682,6 @@ foreach ($component_groups as $component_group_key => $component_group_val) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Only show component groups with local components.
|
||||
if ($num_components == 0 && $num_components_childs == 0) {
|
||||
unset($component_groups[$component_group_key]);
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[0][1] = html_print_select(
|
||||
@ -665,14 +783,16 @@ $table->head['checkbox'] = html_print_checkbox(
|
||||
false
|
||||
);
|
||||
$table->head[0] = __('Module name');
|
||||
$table->head[1] = __('Type');
|
||||
$table->head[1] = __('Server');
|
||||
$table->head[2] = __('Type');
|
||||
$table->head[3] = __('Description');
|
||||
$table->head[4] = __('Group');
|
||||
$table->head[5] = __('Max/Min');
|
||||
$table->head[6] = __('Action');
|
||||
$table->size = [];
|
||||
$table->size['checkbox'] = '20px';
|
||||
$table->size[1] = '75px';
|
||||
$table->size[1] = '40px';
|
||||
$table->size[2] = '50px';
|
||||
$table->size[6] = '80px';
|
||||
$table->align[6] = 'left';
|
||||
$table->data = [];
|
||||
@ -698,7 +818,6 @@ foreach ($components as $component) {
|
||||
$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);
|
||||
switch ($component['id_modulo']) {
|
||||
case MODULE_NETWORK:
|
||||
$data[1] .= html_print_image(
|
||||
@ -724,11 +843,20 @@ foreach ($components as $component) {
|
||||
);
|
||||
break;
|
||||
|
||||
case MODULE_WIZARD:
|
||||
$data[1] .= html_print_image(
|
||||
'images/wand.png',
|
||||
true,
|
||||
['title' => __('Wizard module')]
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not possible.
|
||||
break;
|
||||
}
|
||||
|
||||
$data[2] = ui_print_moduletype_icon($component['type'], true);
|
||||
$data[3] = "<span style='font-size: 8px'>".mb_strimwidth(io_safe_output($component['description']), 0, 60, '...').'</span>';
|
||||
$data[4] = network_components_get_group_name($component['id_group']);
|
||||
$data[5] = $component['max'].' / '.$component['min'];
|
||||
@ -777,9 +905,10 @@ echo '<div class="" style="float:right;">';
|
||||
html_print_input_hidden('new_component', 1);
|
||||
html_print_select(
|
||||
[
|
||||
2 => __('Create a new network component'),
|
||||
4 => __('Create a new plugin component'),
|
||||
6 => __('Create a new WMI component'),
|
||||
COMPONENT_TYPE_NETWORK => __('Create a new network component'),
|
||||
COMPONENT_TYPE_PLUGIN => __('Create a new plugin component'),
|
||||
COMPONENT_TYPE_WMI => __('Create a new WMI component'),
|
||||
COMPONENT_TYPE_WIZARD => __('Create a new wizard component'),
|
||||
],
|
||||
'id_component_type',
|
||||
'',
|
||||
|
@ -110,56 +110,69 @@ if ($create_network_from_module) {
|
||||
if (isset($id)) {
|
||||
$component = network_components_get_network_component((int) $id);
|
||||
if ($component !== false) {
|
||||
$id_component_type = $component['id_modulo'];
|
||||
$name = $component['name'];
|
||||
$type = $component['type'];
|
||||
$description = $component['description'];
|
||||
$max = $component['max'];
|
||||
$min = $component['min'];
|
||||
$module_interval = $component['module_interval'];
|
||||
$tcp_port = $component['tcp_port'];
|
||||
$tcp_rcv = $component['tcp_rcv'];
|
||||
$tcp_send = $component['tcp_send'];
|
||||
$snmp_community = $component['snmp_community'];
|
||||
$snmp_oid = $component['snmp_oid'];
|
||||
$id_module_group = $component['id_module_group'];
|
||||
$id_group = $component['id_group'];
|
||||
$id_plugin = $component['id_plugin'];
|
||||
$plugin_user = $component['plugin_user'];
|
||||
$plugin_pass = io_output_password($component['plugin_pass']);
|
||||
$plugin_parameter = $component['plugin_parameter'];
|
||||
$macros = $component['macros'];
|
||||
$max_timeout = $component['max_timeout'];
|
||||
$max_retries = $component['max_retries'];
|
||||
$dynamic_interval = $component['dynamic_interval'];
|
||||
$dynamic_max = $component['dynamic_max'];
|
||||
$dynamic_min = $component['dynamic_min'];
|
||||
$dynamic_two_tailed = $component['dynamic_two_tailed'];
|
||||
$min_warning = $component['min_warning'];
|
||||
$max_warning = $component['max_warning'];
|
||||
$str_warning = $component['str_warning'];
|
||||
$max_critical = $component['max_critical'];
|
||||
$min_critical = $component['min_critical'];
|
||||
$str_critical = $component['str_critical'];
|
||||
$ff_event = $component['min_ff_event'];
|
||||
$history_data = $component['history_data'];
|
||||
$post_process = $component['post_process'];
|
||||
$unit = $component['unit'];
|
||||
$wizard_level = $component['wizard_level'];
|
||||
$critical_instructions = $component['critical_instructions'];
|
||||
$warning_instructions = $component['warning_instructions'];
|
||||
$unknown_instructions = $component['unknown_instructions'];
|
||||
$critical_inverse = $component['critical_inverse'];
|
||||
$warning_inverse = $component['warning_inverse'];
|
||||
$id_category = $component['id_category'];
|
||||
$tags = $component['tags'];
|
||||
$ff_event_normal = $component['min_ff_event_normal'];
|
||||
$ff_event_warning = $component['min_ff_event_warning'];
|
||||
$ff_event_critical = $component['min_ff_event_critical'];
|
||||
$ff_type = $component['ff_type'];
|
||||
$each_ff = $component['each_ff'];
|
||||
$id_component_type = $component['id_modulo'];
|
||||
$name = io_safe_output($component['name']);
|
||||
$type = $component['type'];
|
||||
$description = $component['description'];
|
||||
$max = $component['max'];
|
||||
$min = $component['min'];
|
||||
$module_interval = $component['module_interval'];
|
||||
$tcp_port = $component['tcp_port'];
|
||||
$tcp_rcv = $component['tcp_rcv'];
|
||||
$tcp_send = $component['tcp_send'];
|
||||
$snmp_community = $component['snmp_community'];
|
||||
$snmp_oid = $component['snmp_oid'];
|
||||
$id_module_group = $component['id_module_group'];
|
||||
$id_group = $component['id_group'];
|
||||
$id_plugin = $component['id_plugin'];
|
||||
$plugin_user = $component['plugin_user'];
|
||||
$plugin_pass = io_output_password($component['plugin_pass']);
|
||||
$plugin_parameter = $component['plugin_parameter'];
|
||||
$macros = $component['macros'];
|
||||
$max_timeout = $component['max_timeout'];
|
||||
$max_retries = $component['max_retries'];
|
||||
$dynamic_interval = $component['dynamic_interval'];
|
||||
$dynamic_max = $component['dynamic_max'];
|
||||
$dynamic_min = $component['dynamic_min'];
|
||||
$dynamic_two_tailed = $component['dynamic_two_tailed'];
|
||||
$min_warning = $component['min_warning'];
|
||||
$max_warning = $component['max_warning'];
|
||||
$str_warning = $component['str_warning'];
|
||||
$max_critical = $component['max_critical'];
|
||||
$min_critical = $component['min_critical'];
|
||||
$str_critical = $component['str_critical'];
|
||||
$ff_event = $component['min_ff_event'];
|
||||
$history_data = $component['history_data'];
|
||||
$post_process = $component['post_process'];
|
||||
$unit = $component['unit'];
|
||||
$wizard_level = $component['wizard_level'];
|
||||
$critical_instructions = $component['critical_instructions'];
|
||||
$warning_instructions = $component['warning_instructions'];
|
||||
$unknown_instructions = $component['unknown_instructions'];
|
||||
$critical_inverse = $component['critical_inverse'];
|
||||
$warning_inverse = $component['warning_inverse'];
|
||||
$id_category = $component['id_category'];
|
||||
$tags = $component['tags'];
|
||||
$ff_event_normal = $component['min_ff_event_normal'];
|
||||
$ff_event_warning = $component['min_ff_event_warning'];
|
||||
$ff_event_critical = $component['min_ff_event_critical'];
|
||||
$ff_type = $component['ff_type'];
|
||||
$each_ff = $component['each_ff'];
|
||||
$manufacturer_id = $component['manufacturer_id'];
|
||||
$module_protocol = $component['protocol'];
|
||||
$scan_type = $component['scan_type'];
|
||||
$execution_type = $component['execution_type'];
|
||||
$value = $component['value'];
|
||||
$wmi_class = $component['query_class'];
|
||||
$query_key_field = $component['query_key_field'];
|
||||
$query_Key_wmi = $component['key_string'];
|
||||
$name_oid = $component['name_oid'];
|
||||
$value_oid = $component['value_oid'];
|
||||
$query_filter = $component['query_filters'];
|
||||
$module_enabled = $component['module_enabled'];
|
||||
$enabled = $component['enabled'];
|
||||
|
||||
if ($type >= 15 && $type <= 18) {
|
||||
if ($type >= MODULE_TYPE_REMOTE_SNMP && $type <= MODULE_TYPE_REMOTE_SNMP_PROC) {
|
||||
// New support for snmp v3.
|
||||
$snmp_version = $component['tcp_send'];
|
||||
$snmp3_auth_user = $component['plugin_user'];
|
||||
@ -170,7 +183,7 @@ if (isset($id)) {
|
||||
$component['custom_string_2']
|
||||
);
|
||||
$snmp3_security_level = $component['custom_string_3'];
|
||||
} else if ($type >= 34 && $type <= 37) {
|
||||
} else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) {
|
||||
$command_text = $component['tcp_send'];
|
||||
$command_credential_identifier = $component['custom_string_1'];
|
||||
$command_os = $component['custom_string_2'];
|
||||
@ -192,7 +205,7 @@ if (isset($id)) {
|
||||
$tcp_send = '';
|
||||
$snmp_community = '';
|
||||
$id_module_group = '';
|
||||
if ($id_component_type == 6) {
|
||||
if ($id_component_type == COMPONENT_TYPE_WMI) {
|
||||
$id_group = 14;
|
||||
} else {
|
||||
$id_group = '';
|
||||
@ -238,28 +251,67 @@ if (isset($id)) {
|
||||
$command_text = '';
|
||||
$command_os = 'inherited';
|
||||
$command_credential_identifier = '';
|
||||
|
||||
$macros = '';
|
||||
$manufacturer_id = '';
|
||||
$module_protocol = 'snmp';
|
||||
$scan_type = SCAN_TYPE_FIXED;
|
||||
$execution_type = EXECUTION_TYPE_NETWORK;
|
||||
$value = '';
|
||||
$wmi_class = '';
|
||||
$query_key_field = '';
|
||||
$query_Key_wmi = '';
|
||||
$name_oid = '';
|
||||
$value_oid = '';
|
||||
$query_filter = '';
|
||||
$module_enabled = true;
|
||||
$enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
|
||||
if ($id_component_type == 6) {
|
||||
|
||||
/**
|
||||
* Common function for adding rows to main table
|
||||
*
|
||||
* @param array $row Array with the data for add.
|
||||
* @param mixed $id If added, the DOM id for this block.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function push_table_row($row, $id=false)
|
||||
{
|
||||
global $table;
|
||||
|
||||
if ($id) {
|
||||
$data = [$id => $row];
|
||||
} else {
|
||||
$data = [$row];
|
||||
}
|
||||
|
||||
$table->data = array_merge($table->data, $data);
|
||||
}
|
||||
|
||||
|
||||
$remote_components_path = $config['homedir'].'/godmode/modules/';
|
||||
if ($id_component_type == COMPONENT_TYPE_WMI) {
|
||||
$categories = [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
];
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_common.php';
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_wmi.php';
|
||||
} else if ($id_component_type == 4) {
|
||||
include $remote_components_path.'manage_network_components_form_common.php';
|
||||
include $remote_components_path.'manage_network_components_form_wmi.php';
|
||||
} else if ($id_component_type == COMPONENT_TYPE_PLUGIN) {
|
||||
$categories = [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
];
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_common.php';
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_plugin.php';
|
||||
} else if ($id_component_type == 2 || $create_network_from_module) {
|
||||
include $remote_components_path.'manage_network_components_form_common.php';
|
||||
include $remote_components_path.'manage_network_components_form_plugin.php';
|
||||
} else if ($id_component_type == COMPONENT_TYPE_WIZARD) {
|
||||
$categories = [
|
||||
3,
|
||||
4,
|
||||
@ -269,8 +321,19 @@ if ($id_component_type == 6) {
|
||||
$categories[] = 10;
|
||||
}
|
||||
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_common.php';
|
||||
include $config['homedir'].'/godmode/modules/manage_network_components_form_network.php';
|
||||
include $remote_components_path.'manage_network_components_form_wizard.php';
|
||||
} else if ($id_component_type == COMPONENT_TYPE_NETWORK || $create_network_from_module) {
|
||||
$categories = [
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
];
|
||||
if (enterprise_installed()) {
|
||||
$categories[] = 10;
|
||||
}
|
||||
|
||||
include $remote_components_path.'manage_network_components_form_common.php';
|
||||
include $remote_components_path.'manage_network_components_form_network.php';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -291,15 +354,10 @@ if (defined('METACONSOLE')) {
|
||||
$table->headstyle[0] = 'text-align: center';
|
||||
}
|
||||
|
||||
$table->colspan['description'][1] = 3;
|
||||
$data = [];
|
||||
$data[0] = __('Description');
|
||||
$data[1] = html_print_textarea('description', 2, 65, $description, '', true);
|
||||
push_table_row($data, 'description');
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
html_print_button(__('Go back'), 'go_back', false, 'history.go(-1);', 'class="sub cancel"');
|
||||
html_print_input_hidden('id_component_type', $id_component_type);
|
||||
if ($id) {
|
||||
html_print_input_hidden('update_component', 1);
|
||||
|
@ -23,23 +23,6 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'],
|
||||
return;
|
||||
}
|
||||
|
||||
include_javascript_d3();
|
||||
|
||||
|
||||
function push_table_row($row, $id=false)
|
||||
{
|
||||
global $table;
|
||||
|
||||
if ($id) {
|
||||
$data = [$id => $row];
|
||||
} else {
|
||||
$data = [$row];
|
||||
}
|
||||
|
||||
$table->data = array_merge($table->data, $data);
|
||||
}
|
||||
|
||||
|
||||
$table->id = 'network_component';
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox';
|
||||
@ -323,7 +306,11 @@ $table->data[12][0] = __('Unknown instructions').ui_print_help_tip(__('Instructi
|
||||
$table->data[12][1] = html_print_textarea('unknown_instructions', 2, 65, $unknown_instructions, '', true);
|
||||
$table->colspan[12][1] = 3;
|
||||
|
||||
$next_row = 13;
|
||||
$table->data[13][0] = __('Description');
|
||||
$table->data[13][1] = html_print_textarea('description', 2, 65, $description, '', true);
|
||||
$table->colspan[13][1] = 3;
|
||||
|
||||
$next_row = 14;
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$table->data[$next_row][0] = __('Category');
|
||||
|
@ -180,15 +180,28 @@ $data[1] = html_print_extended_select_for_post_process(
|
||||
'post_process',
|
||||
$post_process,
|
||||
'',
|
||||
__('Empty'),
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
true
|
||||
);
|
||||
$data[2] = '';
|
||||
$data[3] = '';
|
||||
|
||||
$data[2] = __('Name OID').' '.ui_print_help_icon('xxx', true);
|
||||
$data[3] = html_print_input_text_extended(
|
||||
'name_oid',
|
||||
$name_oid,
|
||||
'name_oid',
|
||||
'',
|
||||
30,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
push_table_row($data, 'field_process');
|
||||
|
||||
// Advanced stuff.
|
||||
|
@ -0,0 +1,839 @@
|
||||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2020 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/graphs/functions_d3.php';
|
||||
|
||||
check_login();
|
||||
include_javascript_d3();
|
||||
|
||||
if (!check_acl($config['id_user'], 0, 'PM')
|
||||
&& !check_acl($config['id_user'], 0, 'AW')
|
||||
) {
|
||||
db_pandora_audit('ACL Violation', 'Trying to access Agent Management');
|
||||
include 'general/noaccess.php';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add to the table the extra fields.
|
||||
*
|
||||
* @param array $extra_fields Array with the extra fields needed.
|
||||
* @param string $protocol Protocol for define the text.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function generateExtraFields($extra_fields, $protocol)
|
||||
{
|
||||
global $table;
|
||||
$cntFields = 0;
|
||||
|
||||
foreach ($extra_fields as $k => $field) {
|
||||
// Avoid the not extra fields.
|
||||
if (preg_match('/extra_field_/', $k) === 0) {
|
||||
continue;
|
||||
} else {
|
||||
$cntFields++;
|
||||
}
|
||||
|
||||
// Get the number of extra field.
|
||||
$tmpExtraField = explode('_', $k);
|
||||
$idField = $tmpExtraField[2];
|
||||
|
||||
if ($protocol === 'snmp') {
|
||||
$extraFieldText = '_oid_'.$idField.'_';
|
||||
$rowId = 'pluginRow-'.$protocol.'Row';
|
||||
} else if ($protocol === 'wmi') {
|
||||
$extraFieldText = '_field_wmi_'.$idField.'_';
|
||||
$rowId = $protocol.'Row';
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data[0] = '<div style="text-align: right;">'.$extraFieldText.'</div>';
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'extra_field_'.$protocol.'_'.$idField,
|
||||
$field,
|
||||
'extra_field_'.$protocol.'_'.$idField,
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$table->colspan['oid-list-'.$rowId.'-row-'.$idField][1] = 3;
|
||||
push_table_row($data, 'oid-list-'.$rowId.'-row-'.$idField);
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$image_add = html_print_div(
|
||||
[
|
||||
'id' => 'add_field_button',
|
||||
'class' => 'float-right clickable',
|
||||
'content' => html_print_image(
|
||||
'images/add.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Add a macro oid'),
|
||||
'onclick' => 'manageComponentFields(\'add\', \'oid-list-'.$rowId.'\');',
|
||||
]
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$image_del = html_print_div(
|
||||
[
|
||||
'id' => 'del_field_button',
|
||||
'class' => 'float-right',
|
||||
'style' => $cntFields <= 1 ? 'opacity: 0.5;' : '',
|
||||
'content' => html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Remove last macro oid'),
|
||||
'onclick' => 'manageComponentFields(\'del\', \'oid-list-'.$rowId.'\');',
|
||||
'style' => 'margin-left: 1em;',
|
||||
]
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$data[0] = html_print_div(
|
||||
[
|
||||
'id' => 'combo_oid_button',
|
||||
'content' => $image_del.$image_add,
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
push_table_row($data, 'manage-oid-list-'.$rowId);
|
||||
}
|
||||
|
||||
|
||||
// Get the data.
|
||||
$module_type_list = [
|
||||
MODULE_TYPE_NUMERIC => __('Numeric'),
|
||||
MODULE_TYPE_INCREMENTAL => __('Incremental'),
|
||||
MODULE_TYPE_BOOLEAN => __('Boolean'),
|
||||
MODULE_TYPE_ALPHANUMERIC => __('Alphanumeric'),
|
||||
];
|
||||
|
||||
$module_protocol_list = [
|
||||
'snmp' => 'SNMP',
|
||||
'wmi' => 'WMI',
|
||||
];
|
||||
|
||||
$scan_type_list = [
|
||||
SCAN_TYPE_FIXED => 'Fixed',
|
||||
SCAN_TYPE_DYNAMIC => 'Dynamic',
|
||||
];
|
||||
|
||||
$execution_type_list = [
|
||||
EXECUTION_TYPE_NETWORK => 'Network',
|
||||
EXECUTION_TYPE_PLUGIN => 'Plugin',
|
||||
];
|
||||
// Establish module type value.
|
||||
switch ($type) {
|
||||
case MODULE_TYPE_REMOTE_SNMP:
|
||||
case MODULE_TYPE_GENERIC_DATA:
|
||||
$module_type = MODULE_TYPE_NUMERIC;
|
||||
break;
|
||||
|
||||
case MODULE_TYPE_REMOTE_SNMP_INC:
|
||||
case MODULE_TYPE_GENERIC_DATA_INC:
|
||||
$module_type = MODULE_TYPE_INCREMENTAL;
|
||||
break;
|
||||
|
||||
case MODULE_TYPE_REMOTE_SNMP_STRING:
|
||||
case MODULE_TYPE_GENERIC_DATA_STRING:
|
||||
$module_type = MODULE_TYPE_ALPHANUMERIC;
|
||||
break;
|
||||
|
||||
case MODULE_TYPE_REMOTE_SNMP_PROC:
|
||||
case MODULE_TYPE_GENERIC_PROC:
|
||||
$module_type = MODULE_TYPE_BOOLEAN;
|
||||
break;
|
||||
|
||||
default:
|
||||
$module_type = MODULE_TYPE_NUMERIC;
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($query_filter) === false) {
|
||||
$query_filter = json_decode($query_filter, true);
|
||||
}
|
||||
|
||||
$component_group_list = network_components_get_groups();
|
||||
|
||||
// List of server plugins related with Wizard SNMP.
|
||||
$server_plugin_data = [];
|
||||
$server_plugin_list = [];
|
||||
$plugins = db_get_all_rows_sql(
|
||||
'SELECT id, description, execute, name, macros, parameters FROM tplugin'
|
||||
);
|
||||
foreach ($plugins as $plugin) {
|
||||
$server_plugin_list[$plugin['id']] = $plugin['name'];
|
||||
$server_plugin_data[$plugin['id']] = [
|
||||
'description' => $plugin['description'],
|
||||
'name' => $plugin['name'],
|
||||
'parameters' => $plugin['parameters'],
|
||||
'macros' => array_reverse(json_decode($plugin['macros'], true)),
|
||||
'execute' => $plugin['execute'],
|
||||
'macrosElement' => base64_encode(json_encode(io_safe_output(json_decode($macros, true)))),
|
||||
];
|
||||
}
|
||||
|
||||
// Store the plugin data for JS managing in JSON format.
|
||||
$hiddenPluginServers = '';
|
||||
foreach ($server_plugin_data as $index => $plugin) {
|
||||
// Description can have special chars that would crash Javascript.
|
||||
$plugin['description'] = mb_strimwidth(io_safe_output($plugin['description']), 0, 80, '...');
|
||||
$hiddenPluginServers .= html_print_input_hidden(
|
||||
'server_plugin_data_'.$index,
|
||||
json_encode(io_safe_input($plugin))
|
||||
);
|
||||
}
|
||||
|
||||
// Generate needed OID macros.
|
||||
$extra_fields_names = [];
|
||||
foreach ($extra_fields as $k => $field) {
|
||||
$extra_fields_names[$k] = $module_protocol === 'snmp' ? '_oid_'.$k.'_' : $k;
|
||||
}
|
||||
|
||||
// Convert the string DB format of macros to JSON.
|
||||
$macros = json_decode($macros);
|
||||
// Only for extra field generate purposes.
|
||||
if (empty($macros) === true) {
|
||||
$macros = ['extra_field_1' => ''];
|
||||
}
|
||||
|
||||
//
|
||||
// Construction of form.
|
||||
//
|
||||
$table->id = 'network_component';
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox';
|
||||
$table->style = [];
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
$table->colspan = [];
|
||||
if (!enterprise_installed()) {
|
||||
$table->colspan[0][1] = 3;
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Enabled');
|
||||
$data[1] = html_print_checkbox_switch(
|
||||
'enabled',
|
||||
1,
|
||||
$enabled,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false
|
||||
);
|
||||
|
||||
$data[2] = __('Add by default');
|
||||
$data[3] = html_print_checkbox_switch(
|
||||
'module_enabled',
|
||||
1,
|
||||
$module_enabled,
|
||||
true,
|
||||
false,
|
||||
'',
|
||||
false
|
||||
);
|
||||
|
||||
push_table_row($data, 'module-enable-row');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Module name');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'name',
|
||||
$name,
|
||||
'name',
|
||||
'',
|
||||
50,
|
||||
255,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
$data[2] = __('Module protocol');
|
||||
$data[3] = html_print_select(
|
||||
$module_protocol_list,
|
||||
'module_protocol',
|
||||
$module_protocol,
|
||||
'manageVisibleFields()',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
).' '.html_print_image(
|
||||
'images/'.$module_protocol.'.png',
|
||||
true,
|
||||
[
|
||||
'title' => strtoupper($module_protocol).' '.__('Protocol'),
|
||||
'class' => 'add_comments_button',
|
||||
'style' => 'width: 18px;',
|
||||
'id' => 'module_protocol_symbol',
|
||||
]
|
||||
);
|
||||
$type = 4;
|
||||
$data[4] = html_print_input_hidden('type', $type, true);
|
||||
|
||||
push_table_row($data, 'module-name-type-row');
|
||||
|
||||
$data = [];
|
||||
|
||||
$data[0] = __('Name OID');
|
||||
$data[1] = html_print_input_text('name_oid', $name_oid, '', 50, 255, true);
|
||||
|
||||
$data[2] = __('Manufacturer ID');
|
||||
$data[3] = html_print_select_from_sql(
|
||||
'SELECT manufacturer as `id`, manufacturer FROM tpen GROUP BY manufacturer',
|
||||
'manufacturer_id',
|
||||
$manufacturer_id,
|
||||
'',
|
||||
'All',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
);
|
||||
|
||||
push_table_row($data, 'manufacturer-nameOID-snmpRow-row');
|
||||
|
||||
$data = [];
|
||||
|
||||
$data[0] = __('Module type');
|
||||
$data[1] = html_print_select(
|
||||
$module_type_list,
|
||||
'module_type',
|
||||
$module_type,
|
||||
'changeModuleType()',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
);
|
||||
|
||||
$data[2] = __('Component Group');
|
||||
$data[3] = html_print_select(
|
||||
$component_group_list,
|
||||
'id_group',
|
||||
$id_group,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
);
|
||||
|
||||
push_table_row($data, 'moduleType-blockName-row');
|
||||
|
||||
$data = [];
|
||||
|
||||
$data[0] = __('Module unit');
|
||||
$data[1] = html_print_extended_select_for_unit(
|
||||
'unit',
|
||||
$unit,
|
||||
'',
|
||||
'',
|
||||
'0',
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
push_table_row($data, 'moduleUnit-blockName-row');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Warning');
|
||||
// Warning interval values.
|
||||
$data[1] = '<span class="minmax_values" id="warning_minmax_values">';
|
||||
$data[1] .= '<em>'.__('Min.').'</em> ';
|
||||
$data[1] .= html_print_input_text('min_warning', $min_warning, '', 5, 15, true);
|
||||
$data[1] .= '<br /><em>'.__('Max.').'</em> ';
|
||||
$data[1] .= html_print_input_text('max_warning', $max_warning, '', 5, 15, true);
|
||||
$data[1] .= '</span>';
|
||||
// Warning string values.
|
||||
$data[1] .= '<span class="string_values" id="warning_string_values"><em>'.__('String').' </em> ';
|
||||
$data[1] .= html_print_input_text('str_warning', $str_warning, '', 5, 1024, true).'</span>';
|
||||
// Warning inverse values.
|
||||
$data[1] .= '<br /><em>'.__('Inverse interval').'</em> ';
|
||||
$data[1] .= html_print_checkbox('warning_inverse', 1, $warning_inverse, true);
|
||||
|
||||
$data[2] = '<svg id="svg_dinamic" width="500" height="300"> </svg>';
|
||||
$table->colspan['warning-svg-row'][2] = 2;
|
||||
$table->rowspan['warning-svg-row'][2] = 3;
|
||||
|
||||
push_table_row($data, 'warning-svg-row');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Critical');
|
||||
// Critical interval values.
|
||||
$data[1] = '<span class="minmax_values" id="critical_minmax_values">';
|
||||
$data[1] .= '<em>'.__('Min.').'</em> ';
|
||||
$data[1] .= html_print_input_text(
|
||||
'min_critical',
|
||||
$min_critical,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true
|
||||
);
|
||||
$data[1] .= '<br /><em>'.__('Max.').'</em> ';
|
||||
$data[1] .= html_print_input_text(
|
||||
'max_critical',
|
||||
$max_critical,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true
|
||||
);
|
||||
$data[1] .= '</span>';
|
||||
// Critical string values.
|
||||
$data[1] .= '<span class="string_values" id="critical_string_values"><em>'.__('String').' </em> ';
|
||||
$data[1] .= html_print_input_text('str_critical', $str_critical, '', 5, 1024, true).'</span>';
|
||||
// Critical inverse values.
|
||||
$data[1] .= '<br /><em>'.__('Inverse interval').'</em> ';
|
||||
$data[1] .= html_print_checkbox('critical_inverse', 1, $critical_inverse, true);
|
||||
|
||||
push_table_row($data, 'critical-row');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Description');
|
||||
$data[1] = html_print_textarea('description', 2, 65, $description, '', true);
|
||||
$table->colspan['module-description-row'][1] = 3;
|
||||
|
||||
push_table_row($data, 'module-description-row');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Scan Type');
|
||||
$data[1] = html_print_select(
|
||||
$scan_type_list,
|
||||
'scan_type',
|
||||
$scan_type,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
);
|
||||
|
||||
$data[2] = __('Execution type');
|
||||
$data[3] = html_print_select(
|
||||
$execution_type_list,
|
||||
'execution_type',
|
||||
$execution_type,
|
||||
'manageVisibleFields()',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
);
|
||||
|
||||
push_table_row($data, 'scan-execution-row');
|
||||
|
||||
//
|
||||
// SNMP rows.
|
||||
//
|
||||
$data = [];
|
||||
$data[0] = __('Value OID');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'value_oid',
|
||||
(string) $value,
|
||||
'value_oid',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['value-oid-networkRow-snmpRow'][1] = 3;
|
||||
push_table_row($data, 'value-oid-networkRow-snmpRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Macros OID');
|
||||
|
||||
push_table_row($data, 'title-oid-macros-pluginRow-snmpRow');
|
||||
|
||||
// Generation of extra fields needed.
|
||||
generateExtraFields($macros, 'snmp');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Value operation');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'value_operation_snmp',
|
||||
$macros->value_operation,
|
||||
'value_operation_snmp',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['value-operation-pluginRow-snmpRow'][1] = 3;
|
||||
push_table_row($data, 'value-operation-pluginRow-snmpRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Satellite execution');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'satellite_execution_snmp',
|
||||
$macros->satellite_execution,
|
||||
'satellite_execution_snmp',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['satellite-execution-pluginRow-snmpRow'][1] = 3;
|
||||
push_table_row($data, 'satellite-execution-pluginRow-snmpRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Server plugin');
|
||||
$data[1] = html_print_select(
|
||||
$server_plugin_list,
|
||||
'server_plugin_snmp',
|
||||
$macros->server_plugin,
|
||||
'changePlugin()',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
).' <span id="selected_plugin_description_snmp"></span>';
|
||||
|
||||
push_table_row($data, 'server-plugin-pluginRow-snmpRow');
|
||||
|
||||
// The creation of this fields will be dynamically.
|
||||
$data = [];
|
||||
$data[0] = 'field0';
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'field0_snmp_field',
|
||||
'',
|
||||
'field0_snmp_fields',
|
||||
'',
|
||||
30,
|
||||
255,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
push_table_row($data, 'plugin-snmp-fields-dynamicMacroRow-pluginRow-snmpRow-0');
|
||||
|
||||
//
|
||||
// WMI Fields.
|
||||
//
|
||||
$data = [];
|
||||
$data[0] = __('WMI class');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'wmi_class',
|
||||
$wmi_class,
|
||||
'wmi_class',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['wmi-class-wmiRow'][1] = 3;
|
||||
push_table_row($data, 'wmi-class-wmiRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Query key field').' (_field_wmi_0_)';
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'query_key_field',
|
||||
$query_key_field,
|
||||
'query_key_field',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['query-key-field-wmiRow'][1] = 3;
|
||||
push_table_row($data, 'query-key-field-wmiRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Query extra fields');
|
||||
|
||||
push_table_row($data, 'title-extra-field-wmiRow');
|
||||
|
||||
// Generation of extra fields needed.
|
||||
generateExtraFields($macros, 'wmi');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Query filters');
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
|
||||
push_table_row($data, 'title-query-filters-wmiRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = '<div style="text-align: right;">'.__('Scan').'</div>';
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'query_filter_scan',
|
||||
$query_filter['scan'],
|
||||
'query_filter_scan',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['query-filter-scan-wmiRow'][1] = 3;
|
||||
push_table_row($data, 'query-filter-scan-wmiRow');
|
||||
|
||||
if ($execution_type == EXECUTION_TYPE_NETWORK) {
|
||||
$data = [];
|
||||
$data[0] = '<div style="text-align: right;">'.__('Execution').'</div>';
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'query_filter_execution',
|
||||
$query_filter['execution'],
|
||||
'query_filter_execution',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['query-filter-execution-wmiRow'][1] = 3;
|
||||
push_table_row($data, 'query-filter-execution-wmiRow');
|
||||
}
|
||||
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Field value');
|
||||
$data[1] = html_print_input_number(
|
||||
[
|
||||
'name' => 'field_value_filter',
|
||||
'value' => $query_filter['field'],
|
||||
'id' => 'field_value_filter',
|
||||
'min' => 0,
|
||||
'return' => true,
|
||||
]
|
||||
);
|
||||
|
||||
$data[2] = __('Key string');
|
||||
$data[3] = html_print_input_text_extended(
|
||||
'key_string_filter',
|
||||
$query_filter['key_string'],
|
||||
'key_string_filter',
|
||||
'',
|
||||
30,
|
||||
255,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
push_table_row($data, 'filters-list-fields-networkRow-wmiRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Value operation');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'value_operation_wmi',
|
||||
$macros->value_operation,
|
||||
'value_operation_wmi',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['value-operation-pluginRow-wmiRow'][1] = 3;
|
||||
push_table_row($data, 'value-operation-pluginRow-wmiRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Satellite execution');
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'satellite_execution_wmi',
|
||||
$macros->satellite_execution,
|
||||
'satellite_execution_wmi',
|
||||
'',
|
||||
100,
|
||||
10000,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
$table->colspan['satellite-execution-pluginRow-wmiRow'][1] = 3;
|
||||
push_table_row($data, 'satellite-execution-pluginRow-wmiRow');
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Server plugin');
|
||||
$data[1] = html_print_select(
|
||||
$server_plugin_list,
|
||||
'server_plugin_wmi',
|
||||
$macros->server_plugin,
|
||||
'changePlugin()',
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
''
|
||||
).' <span id="selected_plugin_description_wmi"></span>';
|
||||
|
||||
push_table_row($data, 'server-plugin-pluginRow-wmiRow');
|
||||
|
||||
// The creation of this fields will be dynamically.
|
||||
$data = [];
|
||||
$data[0] = 'field0';
|
||||
$data[1] = html_print_input_text_extended(
|
||||
'field0_wmi_field',
|
||||
'',
|
||||
'field0_wmi_fields',
|
||||
'',
|
||||
30,
|
||||
255,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
push_table_row($data, 'plugin-wmi-fields-dynamicMacroRow-pluginRow-wmiRow-0');
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Definition of constants
|
||||
const EXECUTION_TYPE_NETWORK =
|
||||
<?php
|
||||
echo '"'.EXECUTION_TYPE_NETWORK.'"';
|
||||
?>
|
||||
;
|
||||
const EXECUTION_TYPE_PLUGIN =
|
||||
<?php
|
||||
echo '"'.EXECUTION_TYPE_PLUGIN.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_NUMERIC =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_NUMERIC.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_INCREMENTAL =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_INCREMENTAL.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_BOOLEAN =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_BOOLEAN.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_ALPHANUMERIC =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_ALPHANUMERIC.'"';
|
||||
?>
|
||||
;
|
||||
|
||||
const MODULE_TYPE_REMOTE_SNMP =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_REMOTE_SNMP.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_REMOTE_SNMP_INC =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_REMOTE_SNMP_INC.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_REMOTE_SNMP_STRING =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_REMOTE_SNMP_STRING.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_REMOTE_SNMP_PROC =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_REMOTE_SNMP_PROC.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_GENERIC_DATA =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_GENERIC_DATA.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_GENERIC_PROC =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_GENERIC_PROC.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_GENERIC_DATA_STRING =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_GENERIC_DATA_STRING.'"';
|
||||
?>
|
||||
;
|
||||
const MODULE_TYPE_GENERIC_DATA_INC =
|
||||
<?php
|
||||
echo '"'.MODULE_TYPE_GENERIC_DATA_INC.'"';
|
||||
?>
|
||||
;
|
||||
|
||||
$(document).ready(function(){
|
||||
// Show the needed fields.
|
||||
manageVisibleFields();
|
||||
// Show the proper module type
|
||||
changeModuleType();
|
||||
$(
|
||||
"#network_component-plugin-snmp-fields-dynamicMacroRow-pluginRow-snmpRow-0"
|
||||
).attr("style", "display: none;");
|
||||
// Change plugin values and macros.
|
||||
changePlugin();
|
||||
});
|
||||
|
||||
</script>
|
@ -190,8 +190,20 @@ if ($editGraph) {
|
||||
$weights = implode(',', $weight_array);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$count_module_array = count($module_array);
|
||||
if ($count_module_array > 10) {
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'The maximum number of items in a chart is 10. You have %s elements, only first 10 will be displayed.',
|
||||
$count_module_array
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Modules table.
|
||||
if (count($module_array) > 0) {
|
||||
if ($count_module_array > 0) {
|
||||
echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters'>";
|
||||
echo '<tr>
|
||||
<th>'.__('P.').'</th>
|
||||
@ -202,7 +214,7 @@ if (count($module_array) > 0) {
|
||||
<th>'.__('Delete').'</th>
|
||||
<th>'.__('Sort').'</th>';
|
||||
$color = 0;
|
||||
for ($a = 0; $a < count($module_array); $a++) {
|
||||
for ($a = 0; $a < $count_module_array; $a++) {
|
||||
// Calculate table line color.
|
||||
if ($color == 1) {
|
||||
$tdcolor = 'datos';
|
||||
|
@ -164,9 +164,9 @@ echo '</div></td></tr>';
|
||||
|
||||
echo "<tr><td class='datos2'><b>".__('Percentil').'</b></td>';
|
||||
echo "<td class='datos2'>".html_print_checkbox('percentil', 1, $percentil, true).'</td>';
|
||||
echo "<td class='datos2'><div id='thresholdDiv' name='thresholdDiv'><b>".__('Equalize maximum thresholds').'</b>';
|
||||
html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false);
|
||||
echo '</div></td></tr>';
|
||||
echo "<td class='datos2 thresholdDiv'><b>".__('Equalize maximum thresholds').'</b></td>';
|
||||
echo "<td class='datos2 thresholdDiv'>".html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, true, false, '', false);
|
||||
echo '</td></tr>';
|
||||
echo "<tr><td class='datos2'><b>".__('Add summatory series').'</b></td>';
|
||||
echo "<td class='datos2'>".html_print_checkbox('summatory_series', 1, $summatory_series, true)."</td>
|
||||
<td class='datos2'><b>".__('Add average series').'</b></td>';
|
||||
@ -175,6 +175,7 @@ echo "<tr><td class='datos2'><b>".__('Modules and series').'</b></td>';
|
||||
|
||||
echo "<td class='datos2'>".html_print_checkbox('modules_series', 1, $modules_series, true).'</td>';
|
||||
echo "<td class='datos2'><b>".__('Show full scale graph (TIP)').'</td>';
|
||||
echo "<td class='datos2'>".html_print_checkbox('fullscale', 1, $fullscale, true).'</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
@ -190,9 +191,9 @@ echo '</form>';
|
||||
echo '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
if ($("#stacked").val() == '.CUSTOM_GRAPH_BULLET_CHART.') {
|
||||
$("#thresholdDiv").show();
|
||||
$(".thresholdDiv").show();
|
||||
}else{
|
||||
$("#thresholdDiv").hide();
|
||||
$(".thresholdDiv").hide();
|
||||
}
|
||||
|
||||
if(!$("#checkbox-summatory_series").is(":checked") && !$("#checkbox-average_series").is(":checked")){
|
||||
@ -207,16 +208,16 @@ echo '<script type="text/javascript">
|
||||
$("[name=threshold]").prop("checked", false);
|
||||
$(".stacked").hide();
|
||||
$("input[name=\'width\']").hide();
|
||||
$("#thresholdDiv").hide();
|
||||
$(".thresholdDiv").hide();
|
||||
} else if ($(this).val() == '.CUSTOM_GRAPH_BULLET_CHART.') {
|
||||
$("#thresholdDiv").show();
|
||||
$(".thresholdDiv").show();
|
||||
$(".stacked").show();
|
||||
$("input[name=\'width\']").show();
|
||||
} else {
|
||||
$("[name=threshold]").prop("checked", false);
|
||||
$(".stacked").show();
|
||||
$("input[name=\'width\']").show();
|
||||
$("#thresholdDiv").hide();
|
||||
$(".thresholdDiv").hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -71,12 +71,6 @@ if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_template_wizard.'">'.html_print_image('images/wand.png', true, ['title' => __('Visual Console Template Wizard')]).'</a>',
|
||||
];
|
||||
if ($is_metaconsole) {
|
||||
$buttons['visual_console_manager'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_manager.'">'.html_print_image('images/builder.png', true, ['title' => __('Visual Console Manager')]).'</a>',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (!$is_metaconsole) {
|
||||
|
@ -107,6 +107,7 @@ $saturday = true;
|
||||
$sunday = true;
|
||||
$time_from = '00:00:00';
|
||||
$time_to = '00:00:00';
|
||||
$compare_work_time = false;
|
||||
$show_graph = 0;
|
||||
$sla_sorted_by = 0;
|
||||
$id_agents = '';
|
||||
@ -315,6 +316,7 @@ switch ($action) {
|
||||
$sunday = $item['sunday'];
|
||||
$time_from = $item['time_from'];
|
||||
$time_to = $item['time_to'];
|
||||
$compare_work_time = $item['compare_work_time'];
|
||||
$show_graph = $item['show_graph'];
|
||||
$priority_mode = isset($style['priority_mode']) ? $style['priority_mode'] : REPORT_PRIORITY_MODE_OK;
|
||||
// 'top_n' filed will be reused for SLA sort option.
|
||||
@ -484,6 +486,16 @@ switch ($action) {
|
||||
$period = $item['period'];
|
||||
break;
|
||||
|
||||
case 'last_value':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
$idAgent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente_modulo',
|
||||
['id_agente_modulo' => $idAgentModule]
|
||||
);
|
||||
break;
|
||||
|
||||
case 'alert_report_module':
|
||||
$description = $item['description'];
|
||||
$idAgentModule = $item['id_agent_module'];
|
||||
@ -612,6 +624,7 @@ switch ($action) {
|
||||
$sunday = $item['sunday'];
|
||||
$time_from = $item['time_from'];
|
||||
$time_to = $item['time_to'];
|
||||
$compare_work_time = $item['compare_work_time'];
|
||||
$total_time = $item['total_time'];
|
||||
$time_failed = $item['time_failed'];
|
||||
$time_in_ok_status = $item['time_in_ok_status'];
|
||||
@ -744,6 +757,7 @@ switch ($action) {
|
||||
case 'historical_data':
|
||||
case 'sumatory':
|
||||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'monitor_report':
|
||||
case 'min_value':
|
||||
case 'max_value':
|
||||
@ -1202,6 +1216,22 @@ $class = 'databox filters';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="row_working_time_compare">
|
||||
<td>
|
||||
<?php
|
||||
echo __('Show 24x7 item');
|
||||
?>
|
||||
</td>
|
||||
<td colspan="6">
|
||||
<?php
|
||||
html_print_checkbox(
|
||||
'compare_work_time',
|
||||
1,
|
||||
$compare_work_time
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@ -3843,6 +3873,7 @@ $(document).ready (function () {
|
||||
case 'min_value':
|
||||
case 'monitor_report':
|
||||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'sumatory':
|
||||
case 'historical_data':
|
||||
case 'agent_configuration':
|
||||
@ -3884,6 +3915,7 @@ $(document).ready (function () {
|
||||
case 'max_value':
|
||||
case 'min_value':
|
||||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'sumatory':
|
||||
case 'historical_data':
|
||||
case 'increment':
|
||||
@ -3964,6 +3996,7 @@ $(document).ready (function () {
|
||||
case 'min_value':
|
||||
case 'monitor_report':
|
||||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'sumatory':
|
||||
case 'historical_data':
|
||||
case 'agent_configuration':
|
||||
@ -4003,6 +4036,7 @@ $(document).ready (function () {
|
||||
case 'max_value':
|
||||
case 'min_value':
|
||||
case 'database_serialized':
|
||||
case 'last_value':
|
||||
case 'sumatory':
|
||||
case 'historical_data':
|
||||
case 'increment':
|
||||
@ -4815,9 +4849,9 @@ function chooseType() {
|
||||
$("#row_failover_mode").hide();
|
||||
$("#row_failover_type").hide();
|
||||
$("#row_working_time").hide();
|
||||
$("#row_working_time_compare").hide();
|
||||
$("#row_only_display_wrong").hide();
|
||||
$("#row_combo_module").hide();
|
||||
$("#row_only_display_wrong").hide();
|
||||
$("#row_group_by_agent").hide();
|
||||
$("#general_list").hide();
|
||||
$("#row_order_uptodown").hide();
|
||||
@ -4973,6 +5007,7 @@ function chooseType() {
|
||||
$("#row_period").show();
|
||||
$("#sla_list").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_working_time_compare").show();
|
||||
$("#row_only_display_wrong").show();
|
||||
$("#row_show_graph").show();
|
||||
$("#row_sort").show();
|
||||
@ -4985,6 +5020,7 @@ function chooseType() {
|
||||
$("#row_period").show();
|
||||
$("#sla_list").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_working_time_compare").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_priority_mode").show();
|
||||
$("#row_failover_mode").show();
|
||||
@ -5142,6 +5178,12 @@ function chooseType() {
|
||||
$("#row_historical_db_check").hide();
|
||||
break;
|
||||
|
||||
case 'last_value':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
$("#row_module").show();
|
||||
break;
|
||||
|
||||
case 'alert_report_module':
|
||||
$("#row_description").show();
|
||||
$("#row_agent").show();
|
||||
@ -5257,6 +5299,7 @@ function chooseType() {
|
||||
$("#row_show_address_agent").show();
|
||||
$("#row_show_resume").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_working_time_compare").show();
|
||||
$('#row_hide_notinit_agents').show();
|
||||
$('#row_select_fields').show();
|
||||
if($("#checkbox-checkbox_show_resume").is(":checked")){
|
||||
|
@ -471,7 +471,7 @@ foreach ($items as $item) {
|
||||
if ($is_inventory_item) {
|
||||
$external_source = json_decode($item['external_source'], true);
|
||||
$agents = $external_source['id_agents'];
|
||||
$modules = $external_source['inventory_modules'];
|
||||
$modules = io_safe_output($external_source['inventory_modules']);
|
||||
|
||||
$agent_name_db = [];
|
||||
foreach ($agents as $a) {
|
||||
|
@ -170,6 +170,7 @@ if ($schedule_report != '') {
|
||||
$parameters[4] = get_parameter('report_type', '');
|
||||
$parameters['first_execution'] = strtotime($date.' '.$time);
|
||||
|
||||
|
||||
$values = [
|
||||
'id_usuario' => $config['id_user'],
|
||||
'id_user_task' => $id_user_task,
|
||||
@ -180,9 +181,11 @@ if ($schedule_report != '') {
|
||||
|
||||
$result = db_process_sql_insert('tuser_task_scheduled', $values);
|
||||
|
||||
$report_type = $parameters[4];
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Your report has been planned, and the system will email you a PDF with the report as soon as its finished'),
|
||||
__('Your report has been planned, and the system will email you a '.$report_type.' file with the report as soon as its finished'),
|
||||
__('An error has ocurred')
|
||||
);
|
||||
echo '<br>';
|
||||
@ -1379,7 +1382,10 @@ switch ($action) {
|
||||
$values['description'] = get_parameter('description');
|
||||
$values['type'] = get_parameter('type', null);
|
||||
$values['recursion'] = get_parameter('recursion', null);
|
||||
$values['show_extended_events'] = get_parameter('include_extended_events', null);
|
||||
$values['show_extended_events'] = get_parameter(
|
||||
'include_extended_events',
|
||||
null
|
||||
);
|
||||
|
||||
$label = get_parameter('label', '');
|
||||
|
||||
@ -1707,6 +1713,10 @@ switch ($action) {
|
||||
$values['friday'] = get_parameter('friday', 0);
|
||||
$values['saturday'] = get_parameter('saturday', 0);
|
||||
$values['sunday'] = get_parameter('sunday', 0);
|
||||
$values['compare_work_time'] = get_parameter(
|
||||
'compare_work_time',
|
||||
0
|
||||
);
|
||||
$values['total_time'] = get_parameter('total_time', 0);
|
||||
$values['time_failed'] = get_parameter(
|
||||
'time_failed',
|
||||
@ -2336,7 +2346,6 @@ switch ($action) {
|
||||
'checkbox_only_display_wrong',
|
||||
0
|
||||
);
|
||||
|
||||
$values['monday'] = get_parameter('monday', 0);
|
||||
$values['tuesday'] = get_parameter('tuesday', 0);
|
||||
$values['wednesday'] = get_parameter('wednesday', 0);
|
||||
@ -2344,6 +2353,10 @@ switch ($action) {
|
||||
$values['friday'] = get_parameter('friday', 0);
|
||||
$values['saturday'] = get_parameter('saturday', 0);
|
||||
$values['sunday'] = get_parameter('sunday', 0);
|
||||
$values['compare_work_time'] = get_parameter(
|
||||
'compare_work_time',
|
||||
0
|
||||
);
|
||||
$values['total_time'] = get_parameter('total_time', 0);
|
||||
$values['time_failed'] = get_parameter(
|
||||
'time_failed',
|
||||
|
@ -64,13 +64,6 @@ if ($is_enterprise !== ENTERPRISE_NOT_HOOK && $vconsoles_manage) {
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_template_wizard.'">'.html_print_image('images/wand.png', true, ['title' => __('Visual Console Template Wizard')]).'</a>',
|
||||
];
|
||||
|
||||
if ($is_metaconsole) {
|
||||
$buttons['visual_console_manager'] = [
|
||||
'active' => false,
|
||||
'text' => '<a href="'.$url_visual_console_manager.'">'.html_print_image('images/builder.png', true, ['title' => __('Visual Console Manager')]).'</a>',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (!$is_metaconsole) {
|
||||
|
@ -140,8 +140,8 @@ if (isset($_GET['server'])) {
|
||||
ui_print_error_message(__('There was a problem deleting the server'));
|
||||
}
|
||||
} else if (isset($_GET['update'])) {
|
||||
$address = get_parameter_post('address');
|
||||
$description = get_parameter_post('description');
|
||||
$address = trim(get_parameter_post('address'), ' ');
|
||||
$description = trim(get_parameter_post('description'), ' ');
|
||||
$id_server = get_parameter_post('server');
|
||||
$exec_proxy = get_parameter_post('exec_proxy');
|
||||
$port = get_parameter_post('port');
|
||||
|
@ -83,9 +83,9 @@ foreach ($osList as $os) {
|
||||
}
|
||||
|
||||
if (isset($data)) {
|
||||
ui_pagination($count_osList, false, $offset);
|
||||
ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset);
|
||||
html_print_table($table);
|
||||
ui_pagination($count_osList, false, $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined operating systems') ]);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
|
||||
|
||||
$action = get_parameter('action', 'new');
|
||||
$idOS = get_parameter('id_os', 0);
|
||||
$id_message = get_parameter('message', 0);
|
||||
if (is_metaconsole()) {
|
||||
$tab = get_parameter('tab2', 'list');
|
||||
} else {
|
||||
@ -50,6 +51,7 @@ switch ($action) {
|
||||
$textButton = __('Create');
|
||||
$classButton = 'class="sub next"';
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$actionHidden = 'update';
|
||||
$textButton = __('Update');
|
||||
@ -71,14 +73,20 @@ switch ($action) {
|
||||
}
|
||||
|
||||
if ($resultOrId === false) {
|
||||
$message = ui_print_error_message(__('Fail creating OS'), '', true);
|
||||
$message = 2;
|
||||
$tab = 'builder';
|
||||
$actionHidden = 'save';
|
||||
$textButton = __('Create');
|
||||
$classButton = 'class="sub next"';
|
||||
} else {
|
||||
$message = ui_print_success_message(__('Success creating OS'), '', true);
|
||||
$tab = 'list';
|
||||
$message = 1;
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -90,6 +98,10 @@ switch ($action) {
|
||||
$values = [];
|
||||
$values['name'] = $name;
|
||||
$values['description'] = $description;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'tconfig_os', 'id_os', $idOS);
|
||||
}
|
||||
|
||||
if (($icon !== 0) && ($icon != '')) {
|
||||
$values['icon_name'] = $icon;
|
||||
@ -100,10 +112,11 @@ switch ($action) {
|
||||
$result = db_process_sql_update('tconfig_os', $values, ['id_os' => $idOS]);
|
||||
}
|
||||
|
||||
$message = ui_print_result_message($result, __('Success updatng OS'), __('Error updating OS'), '', true);
|
||||
if ($result !== false) {
|
||||
$message = 3;
|
||||
$tab = 'list';
|
||||
} else {
|
||||
$message = 4;
|
||||
$tab = 'builder';
|
||||
$os = db_get_row_filter('tconfig_os', ['id_os' => $idOS]);
|
||||
$name = $os['name'];
|
||||
@ -112,6 +125,11 @@ switch ($action) {
|
||||
$actionHidden = 'update';
|
||||
$textButton = __('Update');
|
||||
$classButton = 'class="sub upd"';
|
||||
if (is_metaconsole()) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
@ -120,11 +138,20 @@ switch ($action) {
|
||||
$count = $count[0]['count'];
|
||||
|
||||
if ($count > 0) {
|
||||
$message = ui_print_error_message(__('There are agents with this OS.'), '', true);
|
||||
$message = 5;
|
||||
} else {
|
||||
$result = (bool) db_process_sql_delete('tconfig_os', ['id_os' => $idOS]);
|
||||
if ($result) {
|
||||
$message = 6;
|
||||
} else {
|
||||
$message = 7;
|
||||
}
|
||||
}
|
||||
|
||||
$message = ui_print_result_message($result, __('Success deleting'), __('Error deleting'), '', true);
|
||||
if (is_metaconsole()) {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message);
|
||||
} else {
|
||||
header('Location:'.$config['homeurl'].'index.php?sec=gsetup&sec2=godmode/setup/os&tab='.$tab.'&message='.$message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -143,11 +170,45 @@ $buttons = [
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
// Header
|
||||
// Header.
|
||||
ui_print_page_header(__('Edit OS'), '', false, '', true, $buttons);
|
||||
}
|
||||
|
||||
echo $message;
|
||||
if (!empty($id_message)) {
|
||||
switch ($id_message) {
|
||||
case 1:
|
||||
echo ui_print_success_message(__('Success creating OS'), '', true);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
echo ui_print_error_message(__('Fail creating OS'), '', true);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
echo ui_print_success_message(__('Success updating OS'), '', true);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
echo ui_print_error_message(__('Error updating OS'), '', true);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
echo ui_print_error_message(__('There are agents with this OS.'), '', true);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
echo ui_print_success_message(__('Success deleting'), '', true);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
echo ui_print_error_message(__('Error deleting'), '', true);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Default.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($tab) {
|
||||
case 'list':
|
||||
|
@ -276,6 +276,9 @@ $table->data[$i++][1] = html_print_checkbox_switch('event_storm_protection', 1,
|
||||
$table->data[$i][0] = __('Command Snapshot');
|
||||
$table->data[$i++][1] = html_print_checkbox_switch('command_snapshot', 1, $config['command_snapshot'], true);
|
||||
|
||||
$table->data[$i][0] = __('Change remote config encoding');
|
||||
$table->data[$i++][1] = html_print_checkbox_switch('use_custom_encoding', 1, $config['use_custom_encoding'], true);
|
||||
|
||||
$table->data[$i][0] = __('Server logs directory');
|
||||
$table->data[$i++][1] = html_print_input_text(
|
||||
'server_log_dir',
|
||||
@ -329,15 +332,18 @@ $table->data[$i++][1] = html_print_input_text(
|
||||
$table->data[$i][0] = __('Include agents manually disabled');
|
||||
$table->data[$i++][1] = html_print_checkbox_switch('include_agents', 1, $config['include_agents'], true);
|
||||
|
||||
$table->data[$i][0] = __('Audit log directory');
|
||||
$table->data[$i++][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
|
||||
|
||||
$table->data[$i][0] = __('Set alias as name by default in agent creation');
|
||||
$table->data[$i++][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
|
||||
|
||||
$table->data[$i][0] = __('Unique IP');
|
||||
$table->data[$i++][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
|
||||
|
||||
$table->data[$i][0] = __('Enable console log').ui_print_help_tip(__('Log location').': pandora_console/log/console.log', true);
|
||||
$table->data[$i++][1] = html_print_checkbox_switch('console_log_enabled', 1, $config['console_log_enabled'], true);
|
||||
|
||||
$table->data[$i][0] = __('Enable audit log').ui_print_help_tip(__('Log location').': pandora_console/log/audit.log', true);
|
||||
$table->data[$i++][1] = html_print_checkbox_switch('audit_log_enabled', 1, $config['audit_log_enabled'], true);
|
||||
|
||||
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&section=general&pure='.$config['pure'].'">';
|
||||
|
||||
echo '<fieldset>';
|
||||
|
@ -870,8 +870,8 @@ $row++;
|
||||
$table_chars->data[$row][0] = __('Show only average');
|
||||
|
||||
$options_soft_graphs = [];
|
||||
$options_soft_graphs[0] = __('Standard mode');
|
||||
$options_soft_graphs[1] = __('Classic mode');
|
||||
$options_soft_graphs[0] = __('Show only average by default');
|
||||
$options_soft_graphs[1] = __('Show MAX/AVG/MIN by default');
|
||||
|
||||
$table_chars->data[$row][1] = html_print_select($options_soft_graphs, 'type_mode_graph', $config['type_mode_graph'], '', '', 0, true, false, false);
|
||||
$row++;
|
||||
@ -1065,8 +1065,12 @@ $row++;
|
||||
}
|
||||
}
|
||||
|
||||
// Logo
|
||||
$table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo');
|
||||
// Logo.
|
||||
$table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip(
|
||||
__("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."),
|
||||
true
|
||||
);
|
||||
|
||||
$table_report->data['custom_report_front-logo'][1] = html_print_select(
|
||||
$customLogos,
|
||||
'custom_report_front_logo',
|
||||
@ -1076,7 +1080,7 @@ $row++;
|
||||
'',
|
||||
true
|
||||
);
|
||||
// Preview
|
||||
// Preview.
|
||||
$table_report->data['custom_report_front-preview'][0] = __('Custom report front').' - '.'Preview';
|
||||
if (empty($config['custom_report_front_logo'])) {
|
||||
$config['custom_report_front_logo'] = 'images/pandora_logo_white.jpg';
|
||||
@ -1084,23 +1088,32 @@ $row++;
|
||||
|
||||
$table_report->data['custom_report_front-preview'][1] = '<span id="preview_image">'.html_print_image($config['custom_report_front_logo'], true).'</span>';
|
||||
|
||||
// Header
|
||||
// Header.
|
||||
$table_report->data['custom_report_front-header'][0] = __('Custom report front').' - '.__('Header');
|
||||
|
||||
// Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection.
|
||||
$table_report->data['custom_report_front-header'][1] = html_print_textarea(
|
||||
'custom_report_front_header',
|
||||
5,
|
||||
15,
|
||||
$config['custom_report_front_header'],
|
||||
io_safe_output($config['custom_report_front_header']),
|
||||
'style="width: 38em;"',
|
||||
true
|
||||
);
|
||||
|
||||
// First page
|
||||
// First page.
|
||||
// Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection.
|
||||
if ($config['custom_report_front']) {
|
||||
$firstpage_content = $config['custom_report_front_firstpage'];
|
||||
} else {
|
||||
$firstpage_content = io_safe_output($config['custom_report_front_firstpage']);
|
||||
}
|
||||
|
||||
$table_report->data['custom_report_front-first_page'][0] = __('Custom report front').' - '.__('First page');
|
||||
$custom_report_front_firstpage = str_replace(
|
||||
'(_URLIMAGE_)',
|
||||
ui_get_full_url(false, true, false, false),
|
||||
$config['custom_report_front_firstpage']
|
||||
io_safe_output($firstpage_content)
|
||||
);
|
||||
$table_report->data['custom_report_front-first_page'][1] = html_print_textarea(
|
||||
'custom_report_front_firstpage',
|
||||
@ -1111,13 +1124,15 @@ $row++;
|
||||
true
|
||||
);
|
||||
|
||||
// Footer
|
||||
// Footer.
|
||||
$table_report->data['custom_report_front-footer'][0] = __('Custom report front').' - '.__('Footer');
|
||||
|
||||
// Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection.
|
||||
$table_report->data['custom_report_front-footer'][1] = html_print_textarea(
|
||||
'custom_report_front_footer',
|
||||
5,
|
||||
15,
|
||||
$config['custom_report_front_footer'],
|
||||
io_safe_output($config['custom_report_front_footer']),
|
||||
'style="width: 38em;"',
|
||||
true
|
||||
);
|
||||
@ -1327,6 +1342,15 @@ $row++;
|
||||
|
||||
$row++;
|
||||
|
||||
$decimal_separator = [
|
||||
'.' => '.',
|
||||
',' => ',',
|
||||
];
|
||||
$table_other->data[$row][0] = __('CSV decimal separator').ui_print_help_tip(__('Only for csv reports'), true);
|
||||
$table_other->data[$row][1] = html_print_select($decimal_separator, 'csv_decimal_separator', $config['csv_decimal_separator'], '', '', '', true, false, false);
|
||||
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = __('Data multiplier to use in graphs/data');
|
||||
$options_data_multiplier = [];
|
||||
$options_data_multiplier[0] = __('Use 1024 when module unit are bytes');
|
||||
|
@ -117,7 +117,7 @@ if ($save_alert || $modify_alert) {
|
||||
$al_field7 = (string) get_parameter_post('field7_value');
|
||||
$al_field8 = (string) get_parameter_post('field8_value');
|
||||
$al_field9 = (string) get_parameter_post('field9_value');
|
||||
$al_field10 = (string) get_parameter_post('al_field10');
|
||||
$al_field10 = (string) get_parameter_post('field10_value');
|
||||
$al_field11 = (string) get_parameter_post('field11_value');
|
||||
$al_field12 = (string) get_parameter_post('field12_value');
|
||||
$al_field13 = (string) get_parameter_post('field13_value');
|
||||
|
@ -79,6 +79,10 @@ if ($update_tag && $id_tag != 0) {
|
||||
$values['url'] = $url_tag;
|
||||
$values['email'] = $email_tag;
|
||||
$values['phone'] = $phone_tag;
|
||||
// Only for Metaconsole. Save the previous name for synchronizing.
|
||||
if (is_metaconsole()) {
|
||||
$values['previous_name'] = db_get_value('name', 'ttag', 'id_tag', $id_tag);
|
||||
}
|
||||
|
||||
$result = false;
|
||||
if ($values['name'] != '') {
|
||||
|
@ -35,6 +35,10 @@ if ($delete != 0 && is_metaconsole()) {
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
if ($tag_name != '' && is_metaconsole()) {
|
||||
open_meta_frame();
|
||||
}
|
||||
|
||||
// Metaconsole nodes
|
||||
$servers = false;
|
||||
if (is_metaconsole()) {
|
||||
@ -182,7 +186,7 @@ $row[] = $filter_button;
|
||||
|
||||
$table->data[] = $row;
|
||||
|
||||
$filter_form = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag=0">';
|
||||
$filter_form = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/tag/tag&tag_name="'.$tag_name.'>';
|
||||
$filter_form .= html_print_table($table, true);
|
||||
$filter_form .= '</form>';
|
||||
// End of filter form
|
||||
|
@ -112,14 +112,88 @@ if (! check_acl($config['id_user'], 0, 'UM')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disabled at the moment.
|
||||
if (!check_referer()) {
|
||||
require ("general/noaccess.php");
|
||||
if (is_ajax()) {
|
||||
$delete_profile = (bool) get_parameter('delete_profile');
|
||||
if ($delete_profile) {
|
||||
$id2 = (string) get_parameter('id_user');
|
||||
$id_up = (int) get_parameter('id_user_profile');
|
||||
|
||||
return;
|
||||
$perfilUser = db_get_row('tusuario_perfil', 'id_up', $id_up);
|
||||
$id_perfil = $perfilUser['id_perfil'];
|
||||
$perfil = db_get_row('tperfil', 'id_perfil', $id_perfil);
|
||||
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
'Deleted profile for user '.io_safe_input($id2),
|
||||
false,
|
||||
false,
|
||||
'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo']
|
||||
);
|
||||
|
||||
$return = profile_delete_user_profile($id2, $id_up);
|
||||
ui_print_result_message(
|
||||
$return,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted')
|
||||
);
|
||||
|
||||
|
||||
$has_profile = db_get_row('tusuario_perfil', 'id_usuario', $id2);
|
||||
if ($has_profile == false) {
|
||||
$result = delete_user($id2);
|
||||
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
__('Deleted user %s', io_safe_input($id_user))
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully deleted'),
|
||||
__('There was a problem deleting the user')
|
||||
);
|
||||
|
||||
// Delete the user in all the consoles
|
||||
if (defined('METACONSOLE')) {
|
||||
$servers = metaconsole_get_servers();
|
||||
foreach ($servers as $server) {
|
||||
// Connect to the remote console
|
||||
metaconsole_connect($server);
|
||||
|
||||
// Delete the user
|
||||
$result = delete_user($id_user);
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
__('Deleted user %s from metaconsole', io_safe_input($id_user))
|
||||
);
|
||||
}
|
||||
|
||||
// Restore the db connection
|
||||
metaconsole_restore_db();
|
||||
|
||||
// Log to the metaconsole too
|
||||
if ($result) {
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
__('Deleted user %s from %s', io_safe_input($id_user), io_safe_input($server['server_name']))
|
||||
);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
__('Successfully deleted from %s', io_safe_input($server['server_name'])),
|
||||
__('There was a problem deleting the user from %s', io_safe_input($server['server_name']))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
$tab = get_parameter('tab', 'user');
|
||||
|
||||
@ -168,9 +242,9 @@ if ($config['user_can_update_info']) {
|
||||
$new_user = (bool) get_parameter('new_user');
|
||||
$create_user = (bool) get_parameter('create_user');
|
||||
$add_profile = (bool) get_parameter('add_profile');
|
||||
$delete_profile = (bool) get_parameter('delete_profile');
|
||||
$update_user = (bool) get_parameter('update_user');
|
||||
$status = get_parameter('status', -1);
|
||||
$json_profile = get_parameter('json_profile', '');
|
||||
|
||||
// Reset status var if current action is not update_user
|
||||
if ($new_user || $create_user || $add_profile
|
||||
@ -372,6 +446,41 @@ if ($create_user) {
|
||||
|
||||
$user_info = get_user_info($id);
|
||||
$new_user = false;
|
||||
|
||||
if (!empty($json_profile)) {
|
||||
$json_profile = json_decode(io_safe_output($json_profile), true);
|
||||
foreach ($json_profile as $key => $profile) {
|
||||
if (!empty($profile)) {
|
||||
$group2 = $profile['group'];
|
||||
$profile2 = $profile['profile'];
|
||||
$tags = $profile['tags'];
|
||||
foreach ($tags as $k => $tag) {
|
||||
if (empty($tag)) {
|
||||
unset($tags[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
$tags = implode(',', $tags);
|
||||
$no_hierarchy = $profile['hierarchy'];
|
||||
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
'Added profile for user '.io_safe_input($id2),
|
||||
false,
|
||||
false,
|
||||
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags
|
||||
);
|
||||
|
||||
$result_profile = profile_create_user_profile($id, $profile2, $group2, false, $tags, $no_hierarchy);
|
||||
|
||||
ui_print_result_message(
|
||||
$result_profile,
|
||||
__('Profile added successfully'),
|
||||
__('Profile cannot be added')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$user_info = $values;
|
||||
$new_user = true;
|
||||
@ -598,7 +707,7 @@ if ($status != -1) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($add_profile) {
|
||||
if ($add_profile && empty($json_profile)) {
|
||||
$id2 = (string) get_parameter('id');
|
||||
$group2 = (int) get_parameter('assign_group');
|
||||
$profile2 = (int) get_parameter('assign_profile');
|
||||
@ -628,34 +737,38 @@ if ($add_profile) {
|
||||
);
|
||||
}
|
||||
|
||||
if ($delete_profile) {
|
||||
$id2 = (string) get_parameter('id_user');
|
||||
$id_up = (int) get_parameter('id_user_profile');
|
||||
|
||||
$perfilUser = db_get_row('tusuario_perfil', 'id_up', $id_up);
|
||||
$id_perfil = $perfilUser['id_perfil'];
|
||||
$perfil = db_get_row('tperfil', 'id_perfil', $id_perfil);
|
||||
|
||||
db_pandora_audit(
|
||||
'User management',
|
||||
'Deleted profile for user '.io_safe_input($id2),
|
||||
false,
|
||||
false,
|
||||
'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo']
|
||||
);
|
||||
|
||||
$return = profile_delete_user_profile($id2, $id_up);
|
||||
ui_print_result_message(
|
||||
$return,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted')
|
||||
);
|
||||
}
|
||||
|
||||
if ($values) {
|
||||
$user_info = $values;
|
||||
}
|
||||
|
||||
if (!users_is_admin() && $config['id_user'] != $id && !$new_user) {
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
if (isset($group_um[0])) {
|
||||
$group_um_string = implode(',', array_keys(users_get_groups($config['id_user'], 'um', true)));
|
||||
} else {
|
||||
$group_um_string = implode(',', array_keys($group_um));
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
"SELECT tusuario_perfil.* FROM tusuario_perfil
|
||||
INNER JOIN tperfil ON tperfil.id_perfil = tusuario_perfil.id_perfil
|
||||
WHERE id_usuario like '%s' AND id_grupo IN (%s) AND user_management = 0",
|
||||
$id,
|
||||
$group_um_string
|
||||
);
|
||||
|
||||
$result = db_get_all_rows_sql($sql);
|
||||
if ($result == false || $user_info['is_admin']) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access User Management'
|
||||
);
|
||||
include 'general/noaccess.php';
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
if ($id) {
|
||||
echo '<div class="user_form_title">'.__('Update User').'</div>';
|
||||
@ -762,19 +875,22 @@ if ($config['user_can_update_password']) {
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
$global_profile = '<div class="label_select_simple user_global_profile" ><span class="input_label" style="margin:0;">'.__('Global Profile').'</span>';
|
||||
$global_profile .= '<div class="switch_radio_button">';
|
||||
$global_profile .= html_print_radio_button_extended(
|
||||
'is_admin',
|
||||
1,
|
||||
[
|
||||
'label' => __('Administrator'),
|
||||
'help_tip' => __('This user has permissions to manage all. An admin user should not requiere additional group permissions, except for using Enterprise ACL.'),
|
||||
],
|
||||
$user_info['is_admin'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
if (users_is_admin()) {
|
||||
$global_profile .= html_print_radio_button_extended(
|
||||
'is_admin',
|
||||
1,
|
||||
[
|
||||
'label' => __('Administrator'),
|
||||
'help_tip' => __('This user has permissions to manage all. An admin user should not requiere additional group permissions, except for using Enterprise ACL.'),
|
||||
],
|
||||
$user_info['is_admin'],
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$global_profile .= html_print_radio_button_extended(
|
||||
'is_admin',
|
||||
0,
|
||||
@ -1027,7 +1143,7 @@ if ($meta) {
|
||||
$metaconsole_access_node .= html_print_checkbox('metaconsole_access_node', 1, $user_info['metaconsole_access_node'], true).'</div>';
|
||||
}
|
||||
|
||||
echo '<form method="post" autocomplete="off">';
|
||||
echo '<form id="user_profile_form" method="post" autocomplete="off">';
|
||||
|
||||
|
||||
if (!$id) {
|
||||
@ -1067,14 +1183,19 @@ if (!is_metaconsole()) {
|
||||
echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_assigned_server.$metaconsole_access_node;
|
||||
}
|
||||
|
||||
echo '</div>
|
||||
</div>
|
||||
echo '</div>
|
||||
</div>
|
||||
|
||||
<div class="user_edit_third_row white_box">
|
||||
<div class="edit_user_comments">'.$comments.'</div>
|
||||
</div>
|
||||
<div class="user_edit_third_row white_box">'.$ehorus.'</div>
|
||||
</div>';
|
||||
if (!empty($ehorus)) {
|
||||
echo '<div class="user_edit_third_row white_box">'.$ehorus.'</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
profile_print_profile_table($id);
|
||||
|
||||
echo '<div style="width: 100%" class="action-buttons">';
|
||||
if ($config['admin_can_add_user']) {
|
||||
@ -1088,16 +1209,15 @@ if ($config['admin_can_add_user']) {
|
||||
}
|
||||
}
|
||||
|
||||
html_print_input_hidden('json_profile', '');
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo '<br />';
|
||||
|
||||
// Don't show anything else if we're creating an user
|
||||
if (!empty($id) && !$new_user) {
|
||||
profile_print_profile_table($id);
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
$delete_image = html_print_input_image('del', 'images/cross.png', 1, '', true, ['onclick' => 'delete_profile(event, this)']);
|
||||
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
?>
|
||||
@ -1132,13 +1252,14 @@ if (!is_metaconsole()) {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var json_profile = $('#hidden-json_profile');
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
$('input:radio[name="is_admin"]').change(function() {
|
||||
if($('#radiobtn0002').prop('checked')) {
|
||||
$('#metaconsole_agents_manager_div').show();
|
||||
$('#metaconsole_access_node_div').show();
|
||||
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
|
||||
if($('#checkbox-metaconsole_agents_manager').prop('checked')) {
|
||||
$('#metaconsole_assigned_server_div').show();
|
||||
}
|
||||
}
|
||||
@ -1167,8 +1288,105 @@ $(document).ready (function () {
|
||||
});
|
||||
$('#checkbox-ehorus_user_level_enabled').trigger('change');
|
||||
|
||||
var img_delete = '<?php echo $delete_image; ?>';
|
||||
var id_user = '<?php echo $id; ?>';
|
||||
var data = [];
|
||||
|
||||
$('input:image[name="add"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
var profile = $('#assign_profile').val();
|
||||
var profile_text = $('#assign_profile option:selected').text();
|
||||
var group = $('#assign_group').val();
|
||||
var group_text = $('#assign_group option:selected').text();
|
||||
var tags = $('#assign_tags').val();
|
||||
var tags_text = $('#assign_tags option:selected').toArray().map(item => item.text).join();
|
||||
if ( $('#checkbox-no_hierarchy').is(':checked')) {
|
||||
var hierarchy = 1;
|
||||
var hierarchy_text = '<?php echo __('yes'); ?>';
|
||||
} else {
|
||||
var hierarchy = 0;
|
||||
var hierarchy_text = '<?php echo __('no'); ?>';
|
||||
}
|
||||
|
||||
if (profile === '0' || group === '-1') {
|
||||
alert('<?php echo __('please select profile and group'); ?>');
|
||||
return;
|
||||
}
|
||||
|
||||
if (id_user === '') {
|
||||
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
||||
data.push(new_json);
|
||||
json_profile.val('['+data+']');
|
||||
$('#table_profiles tr:last').before(
|
||||
`<tr>
|
||||
<td>${profile_text}</td>
|
||||
<td>${group_text}</td>
|
||||
<td>${tags_text}</td>
|
||||
<td>${hierarchy_text}</td>
|
||||
<td>${img_delete}</td>
|
||||
</tr>`
|
||||
);
|
||||
} else {
|
||||
this.form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
$('input:image[name="del"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
var rows = $("#table_profiles tr").length;
|
||||
if (rows <= 3) {
|
||||
if (!confirm('<?php echo __('Deleting last profile'); ?>' + '. ' + '<?php echo __('Are you sure?'); ?>')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var id_user_profile = $(this).siblings();
|
||||
id_user_profile = id_user_profile[1].value;
|
||||
var row = $(this).closest('tr');
|
||||
|
||||
var params = [];
|
||||
params.push("delete_profile=1");
|
||||
params.push("id_user=" + id_user);
|
||||
params.push("id_user_profile=" + id_user_profile);
|
||||
params.push("page=godmode/users/configure_user");
|
||||
jQuery.ajax ({
|
||||
data: params.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
success: function (data) {
|
||||
row.remove();
|
||||
var rows = $("#table_profiles tr").length;
|
||||
if (rows <= 2) {
|
||||
window.location.replace("<?php echo ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0', false, false, false); ?>");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#submit-crtbutton').click(function (e) {
|
||||
e.preventDefault();
|
||||
var rows = $("#table_profiles tr").length;
|
||||
if (rows <= 2) {
|
||||
alert('<?php echo __('please add a profile'); ?>');
|
||||
} else {
|
||||
this.form.submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function delete_profile(event, btn) {
|
||||
event.preventDefault();
|
||||
var row = btn.parentNode.parentNode;
|
||||
var position = row.rowIndex;
|
||||
row.parentNode.removeChild(row);
|
||||
|
||||
var json = json_profile.val();
|
||||
var test = JSON.parse(json);
|
||||
delete test[position-1];
|
||||
json_profile.val(JSON.stringify(test));
|
||||
|
||||
}
|
||||
|
||||
function show_data_section () {
|
||||
section = $("#section").val();
|
||||
|
||||
|
@ -22,7 +22,7 @@ require_once $config['homedir'].'/include/functions_profile.php';
|
||||
require_once $config['homedir'].'/include/functions_users.php';
|
||||
require_once $config['homedir'].'/include/functions_groups.php';
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'UM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access User Management'
|
||||
|
@ -129,16 +129,25 @@ if (defined('METACONSOLE')) {
|
||||
user_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
} else {
|
||||
$buttons = [
|
||||
'user' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure='.$pure.'">'.html_print_image('images/gm_users.png', true, ['title' => __('User management')]).'</a>',
|
||||
],
|
||||
'profile' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/profile_list&tab=profile&pure='.$pure.'">'.html_print_image('images/profiles.png', true, ['title' => __('Profile management')]).'</a>',
|
||||
],
|
||||
];
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$buttons = [
|
||||
'user' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure='.$pure.'">'.html_print_image('images/gm_users.png', true, ['title' => __('User management')]).'</a>',
|
||||
],
|
||||
'profile' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/profile_list&tab=profile&pure='.$pure.'">'.html_print_image('images/profiles.png', true, ['title' => __('Profile management')]).'</a>',
|
||||
],
|
||||
];
|
||||
} else {
|
||||
$buttons = [
|
||||
'user' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure='.$pure.'">'.html_print_image('images/gm_users.png', true, ['title' => __('User management')]).'</a>',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
@ -356,10 +365,23 @@ if (!defined('METACONSOLE')) {
|
||||
$table->valign[6] = 'top';
|
||||
}
|
||||
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
if (isset($group_um[0])) {
|
||||
$group_um_string = implode(',', array_keys(users_get_groups($config['id_user'], 'um', true)));
|
||||
} else {
|
||||
$group_um_string = implode(',', array_keys($group_um));
|
||||
}
|
||||
|
||||
|
||||
$info1 = [];
|
||||
|
||||
$info1 = get_users($order);
|
||||
// Is admin or has group permissions all.
|
||||
if (users_is_admin() || isset($group_um[0])) {
|
||||
$info1 = get_users($order);
|
||||
} else {
|
||||
foreach ($group_um as $group => $value) {
|
||||
$info1 = array_merge($info1, users_get_users_by_group($group, $value));
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the users
|
||||
if ($search) {
|
||||
@ -400,33 +422,7 @@ if ($search) {
|
||||
}
|
||||
}
|
||||
|
||||
// ~
|
||||
// ~ $filter_group
|
||||
// ~ $filter_search
|
||||
// ~
|
||||
$info = [];
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
$own_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin']);
|
||||
|
||||
if ($own_info['is_admin']) {
|
||||
$info = $info1;
|
||||
}
|
||||
// If user is not admin then don't display admin users and user of others groups.
|
||||
else {
|
||||
foreach ($info1 as $key => $usr) {
|
||||
$u = get_user_info($key);
|
||||
$g = users_get_groups($key, false, $u['is_admin']);
|
||||
$result = array_intersect($g, $own_groups);
|
||||
|
||||
// Show users without profile too.
|
||||
if (!empty($result) || (db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $usr['id_user']) === false)) {
|
||||
$info[$key] = $usr;
|
||||
}
|
||||
|
||||
unset($u);
|
||||
unset($g);
|
||||
}
|
||||
}
|
||||
$info = $info1;
|
||||
|
||||
// Prepare pagination
|
||||
ui_pagination(count($info));
|
||||
@ -438,9 +434,41 @@ $rowPair = true;
|
||||
$iterator = 0;
|
||||
$cont = 0;
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if (!users_is_admin() && $user_info['is_admin']) {
|
||||
// If user is not admin then don't display admin users.
|
||||
continue;
|
||||
}
|
||||
|
||||
// User profiles.
|
||||
if (users_is_admin() || $user_id == $config['id_user'] || isset($group_um[0])) {
|
||||
$user_profiles = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $user_id);
|
||||
} else {
|
||||
$user_profiles_aux = users_get_user_profile($user_id);
|
||||
$user_profiles = [];
|
||||
foreach ($group_um as $key => $value) {
|
||||
if (isset($user_profiles_aux[$key])) {
|
||||
$user_profiles[$key] = $user_profiles_aux[$key];
|
||||
if ($user_profiles_aux[$key]['user_management'] == 1) {
|
||||
$user_info['edit'] = 0;
|
||||
} else {
|
||||
$user_info['edit'] = 1;
|
||||
}
|
||||
|
||||
unset($user_profiles_aux[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($user_profiles_aux)) {
|
||||
$user_info['not_delete'] = 1;
|
||||
}
|
||||
|
||||
if ($user_profiles == false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$cont++;
|
||||
|
||||
//
|
||||
// Manual pagination due the complicated process of the ACL data
|
||||
if ($cont <= $offset) {
|
||||
continue;
|
||||
@ -464,12 +492,14 @@ foreach ($info as $user_id => $user_info) {
|
||||
|
||||
$iterator++;
|
||||
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.$user_id.'</a>';
|
||||
if (users_is_admin() || $config['id_user'] == $user_info['id_user'] || (!$user_info['is_admin'] && (!isset($user_info['edit']) || isset($group_um[0]) || (isset($user_info['edit']) && $user_info['edit'])))) {
|
||||
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.$user_id.'</a>';
|
||||
} else {
|
||||
$data[0] = $user_id;
|
||||
}
|
||||
|
||||
$data[1] = '<ul style="margin-top: 0 !important; margin-left: auto !important; padding-left: 10px !important; list-style-type: none !important;">';
|
||||
$data[1] .= '<li>'.$user_info['fullname'].'</li>';
|
||||
/*
|
||||
$data[1] .= '<li><b>' . __('First name') . ':</b> ' . $user_info["firstname"] . '</li>';
|
||||
$data[1] .= '<li><b>' . __('Last name') . ':</b> ' . $user_info["lastname"] . '</li>';*/
|
||||
$data[1] .= '<li>'.$user_info['phone'].'</li>';
|
||||
$data[1] .= '<li>'.$user_info['email'].'</li>';
|
||||
$data[1] .= '</ul>';
|
||||
@ -485,45 +515,43 @@ foreach ($info as $user_id => $user_info) {
|
||||
]
|
||||
).' ';
|
||||
} else {
|
||||
/*
|
||||
$data[3] = html_print_image ("images/user_green.png", true,
|
||||
array ("alt" => __('User'),
|
||||
"title" => __('Standard User'))) . ' ';
|
||||
*/
|
||||
$data[3] = '';
|
||||
}
|
||||
|
||||
$data[4] = '';
|
||||
$result = db_get_all_rows_field_filter('tusuario_perfil', 'id_usuario', $user_id);
|
||||
if ($result !== false) {
|
||||
if (defined('METACONSOLE')) {
|
||||
$data[4] .= "<div width='100%'>";
|
||||
foreach ($result as $row) {
|
||||
if ($user_profiles !== false) {
|
||||
$total_profile = 0;
|
||||
|
||||
$data[4] .= '<div style="text-align: end;">';
|
||||
foreach ($user_profiles as $row) {
|
||||
if ($total_profile <= 5) {
|
||||
$data[4] .= "<div style='float:left;'>";
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / </div>';
|
||||
$data[4] .= "<div style='float:left; padding-left:5px;'>";
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</div>';
|
||||
|
||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||
$data[4] .= '<span onclick="showGroups()" style="padding-left: 15px;">
|
||||
'.html_print_image('images/input_zoom_gray.png', true, ['title' => __('Show')]).'</span>';
|
||||
}
|
||||
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= "<div id='groups_list' style='display:none;'>";
|
||||
$data[4] .= '<div >';
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / '.groups_get_name($row['id_grupo'], true).'</div>';
|
||||
$data[4] .= '<br/>';
|
||||
}
|
||||
|
||||
$total_profile++;
|
||||
}
|
||||
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= "<table width='100%'>";
|
||||
foreach ($result as $row) {
|
||||
$data[4] .= '<tr>';
|
||||
$data[4] .= '<td>';
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / ';
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</td>';
|
||||
$data[4] .= '</tr>';
|
||||
}
|
||||
|
||||
$data[4] .= '</table>';
|
||||
}
|
||||
} else {
|
||||
$data[4] .= __('The user doesn\'t have any assigned profile/group');
|
||||
}
|
||||
@ -531,21 +559,26 @@ foreach ($info as $user_id => $user_info) {
|
||||
$data[5] = ui_print_string_substr($user_info['comments'], 24, true);
|
||||
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
if ($user_info['disabled'] == 0) {
|
||||
$data[6] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/user_list&disable_user=1&pure='.$pure.'&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable')]).'</a>';
|
||||
} else {
|
||||
$data[6] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/user_list&disable_user=0&pure='.$pure.'&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb_off.png', true, ['title' => __('Enable')]).'</a>';
|
||||
}
|
||||
|
||||
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>';
|
||||
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user']) {
|
||||
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."'>".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'onclick' => "if (! confirm ('".__('Deleting User').' '.$user_info['id_user'].'. '.__('Are you sure?')."')) return false"]).'</a>';
|
||||
if (defined('METACONSOLE')) {
|
||||
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."&delete_all=1'>".html_print_image('images/cross_double.png', true, ['title' => __('Delete from all consoles'), 'onclick' => "if (! confirm ('".__('Deleting User %s from all consoles', $user_info['id_user']).'. '.__('Are you sure?')."')) return false"]).'</a>';
|
||||
$data[6] = '';
|
||||
if (users_is_admin() || $config['id_user'] == $user_info['id_user'] || isset($group_um[0]) || (!$user_info['is_admin'] && (!isset($user_info['edit']) || (isset($user_info['edit']) && $user_info['edit'])))) {
|
||||
if (!isset($user_info['not_delete'])) {
|
||||
if ($user_info['disabled'] == 0) {
|
||||
$data[6] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/user_list&disable_user=1&pure='.$pure.'&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb.png', true, ['title' => __('Disable')]).'</a>';
|
||||
} else {
|
||||
$data[6] = '<a href="index.php?sec='.$sec.'&sec2=godmode/users/user_list&disable_user=0&pure='.$pure.'&id='.$user_info['id_user'].'">'.html_print_image('images/lightbulb_off.png', true, ['title' => __('Enable')]).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'&id='.$user_id.'">'.html_print_image('images/config.png', true, ['title' => __('Edit')]).'</a>';
|
||||
if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && !isset($user_info['not_delete'])) {
|
||||
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."'>".html_print_image('images/cross.png', true, ['title' => __('Delete'), 'onclick' => "if (! confirm ('".__('Deleting User').' '.$user_info['id_user'].'. '.__('Are you sure?')."')) return false"]).'</a>';
|
||||
if (defined('METACONSOLE')) {
|
||||
$data[6] .= "<a href='index.php?sec=".$sec.'&sec2=godmode/users/user_list&user_del=1&pure='.$pure.'&delete_user='.$user_info['id_user']."&delete_all=1'>".html_print_image('images/cross_double.png', true, ['title' => __('Delete from all consoles'), 'onclick' => "if (! confirm ('".__('Deleting User %s from all consoles', $user_info['id_user']).'. '.__('Are you sure?')."')) return false"]).'</a>';
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
@ -568,3 +601,17 @@ if ($config['admin_can_add_user'] !== false) {
|
||||
echo '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
function showGroups(){
|
||||
var groups_list = document.getElementById("groups_list");
|
||||
|
||||
if(groups_list.style.display == "none"){
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "block");
|
||||
}else{
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "none");
|
||||
};
|
||||
}
|
||||
</script>';
|
||||
|
@ -1,5 +1,4 @@
|
||||
#pandora disable phpexec
|
||||
<Files *.php>
|
||||
<FilesMatch "\.(php)$">
|
||||
Deny from all
|
||||
</Files>
|
||||
php_flag engine off
|
||||
</FilesMatch>
|
@ -871,6 +871,11 @@ if ($get_response_description) {
|
||||
}
|
||||
|
||||
if ($get_response_params) {
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$response_id = get_parameter('response_id');
|
||||
|
||||
$params = db_get_value('params', 'tevent_response', 'id', $response_id);
|
||||
@ -885,6 +890,11 @@ if ($get_response_params) {
|
||||
}
|
||||
|
||||
if ($get_response_target) {
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$response_id = (int) get_parameter('response_id');
|
||||
$event_id = (int) get_parameter('event_id');
|
||||
$server_id = (int) get_parameter('server_id');
|
||||
@ -901,6 +911,11 @@ if ($get_response_target) {
|
||||
}
|
||||
|
||||
if ($get_response) {
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$response_id = get_parameter('response_id');
|
||||
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
@ -917,11 +932,21 @@ if ($get_response) {
|
||||
if ($perform_event_response) {
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$target = get_parameter('target', '');
|
||||
$response_id = get_parameter('response_id');
|
||||
$event_id = (int) get_parameter('event_id');
|
||||
$server_id = (int) get_parameter('server_id', 0);
|
||||
|
||||
$command = events_get_response_target($event_id, $response_id, $server_id);
|
||||
if (empty($target)) {
|
||||
$command = events_get_response_target($event_id, $response_id, $server_id);
|
||||
} else {
|
||||
$command = $target;
|
||||
}
|
||||
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
|
||||
@ -1011,6 +1036,11 @@ if ($perform_event_response) {
|
||||
if ($dialogue_event_response) {
|
||||
global $config;
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'EW')) {
|
||||
echo 'unauthorized';
|
||||
return;
|
||||
}
|
||||
|
||||
$event_id = get_parameter('event_id');
|
||||
$response_id = get_parameter('response_id');
|
||||
$command = get_parameter('target');
|
||||
@ -1063,7 +1093,8 @@ if ($dialogue_event_response) {
|
||||
}
|
||||
} else {
|
||||
echo "<div style='text-align:left'>";
|
||||
echo $prompt.sprintf(__('Executing command: %s', $command));
|
||||
|
||||
echo $prompt."Executing command: $command";
|
||||
echo '</div><br>';
|
||||
|
||||
echo "<div id='response_loading_command' style='display:none'>".html_print_image('images/spinner.gif', true).'</div>';
|
||||
@ -1090,7 +1121,7 @@ if ($dialogue_event_response) {
|
||||
if ($add_comment) {
|
||||
$aviability_comment = true;
|
||||
$comment = get_parameter('comment');
|
||||
if (preg_match('<script>', io_safe_output($comment))) {
|
||||
if (preg_match('/script/i', io_safe_output($comment))) {
|
||||
$aviability_comment = false;
|
||||
$return = false;
|
||||
}
|
||||
|
@ -865,16 +865,16 @@ if (check_login()) {
|
||||
$table->align[8] = 'center';
|
||||
$table->align[9] = 'right';
|
||||
|
||||
$table->headstyle[2] = 'min-width: 85px';
|
||||
$table->headstyle[3] = 'min-width: 130px';
|
||||
$table->size[3] = '30%';
|
||||
$table->headstyle[2] = 'min-width: 65px';
|
||||
$table->headstyle[3] = 'min-width: 80px';
|
||||
$table->size[3] = '25%';
|
||||
$table->style[3] = 'max-width: 28em;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;';
|
||||
$table->size[4] = '30%';
|
||||
$table->headstyle[5] = 'min-width: 85px';
|
||||
$table->headstyle[6] = 'min-width: 125px; text-align: center;';
|
||||
$table->headstyle[7] = 'min-width: 125px;';
|
||||
$table->headstyle[8] = 'min-width: 100px; text-align: center;';
|
||||
$table->headstyle[9] = 'min-width: 120px; text-align: right;';
|
||||
$table->size[4] = '25%';
|
||||
$table->headstyle[5] = 'min-width: 65px';
|
||||
$table->headstyle[6] = 'min-width: 80px; text-align: center;';
|
||||
$table->headstyle[7] = 'min-width: 80px;';
|
||||
$table->headstyle[8] = 'min-width: 70px; text-align: center;';
|
||||
$table->headstyle[9] = 'min-width: 100px; text-align: right;';
|
||||
|
||||
$last_modulegroup = 0;
|
||||
$rowIndex = 0;
|
||||
|
@ -13,6 +13,7 @@
|
||||
// GNU General Public License for more details.
|
||||
require_once $config['homedir'].'/include/functions_config.php';
|
||||
require_once $config['homedir'].'/include/functions_snmp_browser.php';
|
||||
require_once $config['homedir'].'/include/functions_snmp.php';
|
||||
require_once $config['homedir'].'/include/functions_network_components.php';
|
||||
|
||||
|
||||
@ -24,7 +25,7 @@ if (is_ajax()) {
|
||||
$method = (string) get_parameter('method', '');
|
||||
$action = (string) get_parameter('action', '');
|
||||
$target_ip = (string) get_parameter('target_ip', '');
|
||||
$community = (string) get_parameter('community', '');
|
||||
$community = (string) io_safe_output((get_parameter('community', '')));
|
||||
$snmp_version = (string) get_parameter('snmp_browser_version', '');
|
||||
$snmp3_auth_user = io_safe_output(get_parameter('snmp3_browser_auth_user'));
|
||||
$snmp3_security_level = get_parameter('snmp3_browser_security_level');
|
||||
@ -112,6 +113,17 @@ if (is_ajax()) {
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
|
||||
// Dialog no agent selected.
|
||||
$output .= '<div id="dialog_no_agents_selected" style="display:none" title="'.__('SNMP modules').'">';
|
||||
$output .= '<div>';
|
||||
$output .= "<div style='width:25%; float:left'><img style='padding-left:20px; padding-top:20px;' src='images/icono_error_mr.png'></div>";
|
||||
$output .= "<div style='width:75%; float:left;'><h3><strong style='font-family:Verdana; font-size:13pt;'>ERROR</strong></h3>";
|
||||
$output .= "<p style='font-family:Verdana; font-size:12pt;margin-bottom: 0px'>".__('Module must be applied to an agent or a policy').'</p>';
|
||||
$output .= "<p id='error_text' style='font-family:Verdana; font-size:12pt;'></p>";
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
$output .= '</div>';
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
@ -158,6 +170,11 @@ if (is_ajax()) {
|
||||
$id_target = explode(',', $id_items[0]);
|
||||
}
|
||||
|
||||
if (empty($id_items[0])) {
|
||||
echo json_encode([0 => -1]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$snmp_extradata = get_parameter('snmp_extradata', '');
|
||||
|
||||
if (!is_array($snmp_extradata)) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user