Merge branch 'develop' into 1406-Visual-consoles-e-imagenes-HTML-4623-com1

Conflicts:
	pandora_console/godmode/reporting/visual_console_builder.editor.js
This commit is contained in:
enriquecd 2017-10-30 13:27:40 +01:00
commit d98ee0d0bd
231 changed files with 55777 additions and 68563 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, AIX version # Version 7.0NG.714, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, FreeBSD Version # Version 7.0NG.714, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, HP-UX Version # Version 7.0NG.714, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.714, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.714, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, Solaris Version # Version 7.0NG.714, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.713 # Version 7.0NG.714
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.713, AIX version # Version 7.0NG.714, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.713 # Version 7.0NG.714
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.713, HPUX Version # Version 7.0NG.714, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713 # Version 7.0NG.714
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas # (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713 # Version 7.0NG.714
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas # (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713 # Version 7.0NG.714
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.713, Solaris version # Version 7.0NG.714, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, AIX version # Version 7.0NG.714, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.713-171009 Version: 7.0NG.714-171030
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.713-171009" pandora_version="7.0NG.714-171030"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.714, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, FreeBSD Version # Version 7.0NG.714, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, HP-UX Version # Version 7.0NG.714, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.714, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.714, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, NetBSD Version # Version 7.0NG.714, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, Solaris Version # Version 7.0NG.714, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.713'; use constant AGENT_VERSION => '7.0NG.714';
use constant AGENT_BUILD => '171009'; use constant AGENT_BUILD => '171030';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1363,7 +1363,7 @@ sub md5 {
# Append bit /* bit, not byte */ length of unpadded message as 64-bit # Append bit /* bit, not byte */ length of unpadded message as 64-bit
# little-endian integer to message. # little-endian integer to message.
$msg .= unpack ("B32", pack ("V", $bit_len)); $msg .= unpack ("B32", pack ("V", $bit_len));
$msg .= unpack ("B32", pack ("V", $bit_len >> 32)); $msg .= unpack ("B32", pack ("V", ($bit_len >> 16) >> 16));
# Process the message in successive 512-bit chunks. # Process the message in successive 512-bit chunks.
for (my $i = 0; $i < length ($msg); $i += 512) { for (my $i = 0; $i < length ($msg); $i += 512) {
@ -1579,6 +1579,9 @@ sub guess_os_version ($) {
# AIX # AIX
} elsif ($os eq 'aix') { } elsif ($os eq 'aix') {
$os_version = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/); $os_version = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/);
# Darwin
} elsif ($os eq 'darwin') {
$os_version = `defaults read loginwindow SystemVersionStampAsString`;
# Windows # Windows
} elsif ($os =~ /win/i) { } elsif ($os =~ /win/i) {
$os_version = `ver`; $os_version = `ver`;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.713 %define version 7.0NG.714
%define release 171009 %define release 171030
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: fileutils textutils unzip Requires: fileutils textutils unzip
Requires: util-linux procps grep Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk Requires: /sbin/ip /bin/awk
Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL) Requires: perl perl(Sys::Syslog)
# Required by plugins # Required by plugins
#Requires: sh-utils sed passwd net-tools rpm #Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0 AutoReq: 0

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.713 %define version 7.0NG.714
%define release 171009 %define release 171030
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -67,6 +67,7 @@ then
fi fi
%post %post
mkdir -p /var/log/pandora
chown pandora:root /var/log/pandora chown pandora:root /var/log/pandora
if [ ! -d /etc/pandora ] ; then if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora mkdir -p /etc/pandora
@ -91,6 +92,9 @@ if [ ! -e /etc/pandora/collections ]; then
fi fi
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent 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 mkdir -p /var/spool/pandora/data_out
chkconfig pandora_agent_daemon on chkconfig pandora_agent_daemon on

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.713" PI_VERSION="7.0NG.714"
PI_BUILD="171009" PI_BUILD="171030"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

Binary file not shown.

View File

@ -3,7 +3,7 @@ if DEBUG
PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_CXXFLAGS=-g -O0 PandoraAgent_CXXFLAGS=-g -O0
else else
PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_CXXFLAGS=-O2 PandoraAgent_CXXFLAGS=-O2
endif endif

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2014 Artica Soluciones Tecnologicas # (c) 2006-2014 Artica Soluciones Tecnologicas
# Version 7.0NG.713 # Version 7.0NG.714
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.713} {Pandora FMS Windows Agent v7.0NG.714}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{171009} {171030}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -249,6 +249,8 @@ Pandora_Module::parseModuleKindFromString (string kind) {
return MODULE_INVENTORY; return MODULE_INVENTORY;
} else if (kind == module_logevent_str) { } else if (kind == module_logevent_str) {
return MODULE_LOGEVENT; return MODULE_LOGEVENT;
} else if (kind == module_logchannel_str) {
return MODULE_LOGCHANNEL;
} else if (kind == module_wmiquery_str) { } else if (kind == module_wmiquery_str) {
return MODULE_WMIQUERY; return MODULE_WMIQUERY;
} else if (kind == module_perfcounter_str) { } else if (kind == module_perfcounter_str) {

View File

@ -86,6 +86,7 @@ namespace Pandora_Modules {
MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of
* freememory in the system */ * freememory in the system */
MODULE_LOGEVENT, /**< The module checks for log events */ MODULE_LOGEVENT, /**< The module checks for log events */
MODULE_LOGCHANNEL, /**< The module checks for log events on channel using XML functions*/
MODULE_WMIQUERY, /**< The module runs WQL queries */ MODULE_WMIQUERY, /**< The module runs WQL queries */
MODULE_PERFCOUNTER, /**< The module reads performance counters */ MODULE_PERFCOUNTER, /**< The module reads performance counters */
MODULE_TCPCHECK, /**< The module checks whether a tcp port is open */ MODULE_TCPCHECK, /**< The module checks whether a tcp port is open */
@ -126,6 +127,7 @@ namespace Pandora_Modules {
const string module_cpuusage_str = "module_cpuusage"; const string module_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory"; const string module_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent"; const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery"; const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter"; const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck"; const string module_tcpcheck_str = "module_tcpcheck";

View File

@ -31,6 +31,7 @@
#include "pandora_module_cpuusage.h" #include "pandora_module_cpuusage.h"
#include "pandora_module_inventory.h" #include "pandora_module_inventory.h"
#include "pandora_module_logevent.h" #include "pandora_module_logevent.h"
#include "pandora_module_logchannel.h"
#include "pandora_module_wmiquery.h" #include "pandora_module_wmiquery.h"
#include "pandora_module_perfcounter.h" #include "pandora_module_perfcounter.h"
#include "pandora_module_tcpcheck.h" #include "pandora_module_tcpcheck.h"
@ -69,6 +70,7 @@ using namespace Pandora_Strutils;
#define TOKEN_MIN_FF_EVENT ("module_min_ff_event ") #define TOKEN_MIN_FF_EVENT ("module_min_ff_event ")
#define TOKEN_DESCRIPTION ("module_description ") #define TOKEN_DESCRIPTION ("module_description ")
#define TOKEN_LOGEVENT ("module_logevent") #define TOKEN_LOGEVENT ("module_logevent")
#define TOKEN_LOGCHANNEL ("module_logchannel")
#define TOKEN_SOURCE ("module_source ") #define TOKEN_SOURCE ("module_source ")
#define TOKEN_EVENTTYPE ("module_eventtype ") #define TOKEN_EVENTTYPE ("module_eventtype ")
#define TOKEN_EVENTCODE ("module_eventcode ") #define TOKEN_EVENTCODE ("module_eventcode ")
@ -121,6 +123,7 @@ using namespace Pandora_Strutils;
#define TOKEN_MACRO ("module_macro") #define TOKEN_MACRO ("module_macro")
#define TOKEN_NATIVE_ENCODING ("module_native_encoding") #define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template") #define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ")
string string
parseLine (string line, string token) { parseLine (string line, string token) {
@ -157,8 +160,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_freedisk_percent, module_freememory_percent; string module_freedisk_percent, module_freememory_percent;
string module_dsn, module_freememory; string module_dsn, module_freememory;
string module_logevent, module_source, module_eventtype, module_eventcode; string module_logevent, module_source, module_eventtype, module_eventcode;
string module_logchannel;
string module_pattern, module_application, module_async; string module_pattern, module_application, module_async;
string module_watchdog, module_start_command; string module_watchdog, module_start_command, module_user_session;
string module_wmiquery, module_wmicolumn; string module_wmiquery, module_wmicolumn;
string module_retries, module_startdelay, module_retrydelay; string module_retries, module_startdelay, module_retrydelay;
string module_perfcounter, module_tcpcheck; string module_perfcounter, module_tcpcheck;
@ -195,6 +199,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_proc = ""; module_proc = "";
module_service = ""; module_service = "";
module_logevent = ""; module_logevent = "";
module_logchannel = "";
module_source = ""; module_source = "";
module_eventtype = ""; module_eventtype = "";
module_eventcode = ""; module_eventcode = "";
@ -253,6 +258,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_ff_interval = ""; module_ff_interval = "";
module_native_encoding = ""; module_native_encoding = "";
module_alert_template = ""; module_alert_template = "";
module_user_session = "";
macro = ""; macro = "";
stringtok (tokens, definition, "\n"); stringtok (tokens, definition, "\n");
@ -342,6 +348,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_logevent == "") { if (module_logevent == "") {
module_logevent = parseLine (line, TOKEN_LOGEVENT); module_logevent = parseLine (line, TOKEN_LOGEVENT);
} }
if (module_logchannel == "") {
module_logchannel = parseLine (line, TOKEN_LOGCHANNEL);
}
if (module_source == "") { if (module_source == "") {
module_source = parseLine (line, TOKEN_SOURCE); module_source = parseLine (line, TOKEN_SOURCE);
} }
@ -509,6 +518,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_alert_template.erase (0,1); module_alert_template.erase (0,1);
} }
if (module_user_session == "") {
module_user_session = parseLine (line, TOKEN_USER_SESSION);
}
if (macro == "") { if (macro == "") {
macro = parseLine (line, TOKEN_MACRO); macro = parseLine (line, TOKEN_MACRO);
@ -724,6 +737,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
} }
} }
if (module_logchannel != "") {
pos_macro = module_logchannel.find(macro_name);
if (pos_macro != string::npos){
module_logchannel.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_source != "") { if (module_source != "") {
pos_macro = module_source.find(macro_name); pos_macro = module_source.find(macro_name);
if (pos_macro != string::npos){ if (pos_macro != string::npos){
@ -1085,6 +1105,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_alert_template.replace(pos_macro, macro_name.size(), macro_value); module_alert_template.replace(pos_macro, macro_name.size(), macro_value);
} }
} }
if (module_user_session != "") {
pos_macro = module_user_session.find(macro_name);
if (pos_macro != string::npos){
module_user_session.replace(pos_macro, macro_name.size(), macro_value);
}
}
} }
} }
} }
@ -1121,6 +1148,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_proc->setRetries (atoi(module_retries.c_str ())); module_proc->setRetries (atoi(module_retries.c_str ()));
module_proc->setStartDelay (atoi(module_startdelay.c_str ())); module_proc->setStartDelay (atoi(module_startdelay.c_str ()));
module_proc->setRetryDelay (atoi(module_retrydelay.c_str ())); module_proc->setRetryDelay (atoi(module_retrydelay.c_str ()));
module_proc->setUserSession (is_enabled(module_user_session));
} }
} }
} else if (module_service != "") { } else if (module_service != "") {
@ -1142,7 +1170,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
try { try {
char buffer[100]; char buffer[100];
unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent); unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent);
if (sprintf(buffer, "Free memory %s %dMB", if (sprintf(buffer, "Free space on drive %s %dMB",
module_freedisk_percent.c_str(), memory) > 0) { module_freedisk_percent.c_str(), memory) > 0) {
module->setDescription(buffer); module->setDescription(buffer);
} }
@ -1173,6 +1201,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_eventcode, module_eventcode,
module_pattern, module_pattern,
module_application); module_application);
}
else if (module_logchannel != "") {
module = new Pandora_Module_Logchannel (module_name,
module_source,
module_eventtype,
module_eventcode,
module_pattern);
} else if (module_wmiquery != "") { } else if (module_wmiquery != "") {
module = new Pandora_Module_WMIQuery (module_name, module = new Pandora_Module_WMIQuery (module_name,
module_wmiquery, module_wmicolumn); module_wmiquery, module_wmicolumn);

View File

@ -30,6 +30,7 @@
#include "pandora_module_cpuusage.h" #include "pandora_module_cpuusage.h"
#include "pandora_module_inventory.h" #include "pandora_module_inventory.h"
#include "pandora_module_logevent.h" #include "pandora_module_logevent.h"
#include "pandora_module_logchannel.h"
#include "pandora_module_wmiquery.h" #include "pandora_module_wmiquery.h"
#include "pandora_module_perfcounter.h" #include "pandora_module_perfcounter.h"
#include "pandora_module_tcpcheck.h" #include "pandora_module_tcpcheck.h"
@ -226,6 +227,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
Pandora_Module_Freememory *module_freememory; Pandora_Module_Freememory *module_freememory;
Pandora_Module_Freememory_Percent *module_freememory_percent; Pandora_Module_Freememory_Percent *module_freememory_percent;
Pandora_Module_Logevent *module_logevent; Pandora_Module_Logevent *module_logevent;
Pandora_Module_Logchannel *module_logchannel;
Pandora_Module_WMIQuery *module_wmiquery; Pandora_Module_WMIQuery *module_wmiquery;
Pandora_Module_Perfcounter *module_perfcounter; Pandora_Module_Perfcounter *module_perfcounter;
Pandora_Module_Tcpcheck *module_tcpcheck; Pandora_Module_Tcpcheck *module_tcpcheck;
@ -288,6 +290,10 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
module_logevent = (Pandora_Module_Logevent *) module; module_logevent = (Pandora_Module_Logevent *) module;
modules->push_back (module_logevent); modules->push_back (module_logevent);
break; break;
case MODULE_LOGCHANNEL:
module_logchannel = (Pandora_Module_Logchannel *) module;
modules->push_back (module_logchannel);
break;
case MODULE_WMIQUERY: case MODULE_WMIQUERY:
module_wmiquery = (Pandora_Module_WMIQuery *) module; module_wmiquery = (Pandora_Module_WMIQuery *) module;
modules->push_back (module_wmiquery); modules->push_back (module_wmiquery);

View File

@ -0,0 +1,582 @@
/* Pandora logchannel module. This module checks for log events that match a given
pattern using XML functions provided by wevtapi.
Copyright (C) 2017 Artica ST.
Written by Fermin Hernandez.
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; either version 2, or (at your option)
any later version.
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.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <string>
#include <sstream>
#include <iostream>
#include <time.h>
#include "pandora_module_logchannel.h"
#include "../windows/pandora_wmi.h"
#include "../pandora_windows_service.h"
#include "pandora_module_logchannel.h"
#include "pandora_strutils.h"
using namespace Pandora;
using namespace Pandora_Modules;
using namespace Pandora_Strutils;
// Pointers to Wevtapi.dll functions
static HINSTANCE WINEVENT = NULL;
static EvtQueryT EvtQueryF = NULL;
static EvtNextT EvtNextF = NULL;
static EvtSeekT EvtSeekF = NULL;
static EvtCreateRenderContextT EvtCreateRenderContextF = NULL;
static EvtRenderT EvtRenderF = NULL;
static EvtCloseT EvtCloseF = NULL;
static EvtFormatMessageT EvtFormatMessageF = NULL;
static EvtOpenPublisherMetadataT EvtOpenPublisherMetadataF = NULL;
static EvtCreateBookmarkT EvtCreateBookmarkF = NULL;
static EvtUpdateBookmarkT EvtUpdateBookmarkF = NULL;
/**
* Creates a Pandora_Module_Logchannel object.
*
* @param name Module name.
* @param service_name Service internal name to check.
*/
Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern)
: Pandora_Module (name) {
int i;
vector<wstring> query;
vector<wstring>::iterator query_it;
string upper_type = type;
// Convert the type string to uppercase
for (i = 0; i < type.length(); i++) {
upper_type[i] = toupper(type[i]);
}
// Set the type filter
int type_number = -1;
if (upper_type.compare("ERROR") == 0) {
type_number = EVENTLOG_ERROR_TYPE;
} else if (upper_type.compare("WARNING") == 0) {
type_number = EVENTLOG_WARNING_TYPE;
} else if (upper_type.compare("INFORMATION") == 0) {
type_number = EVENTLOG_INFORMATION_TYPE;
} else if (upper_type.compare("AUDIT SUCCESS") == 0) {
type_number = EVENTLOG_AUDIT_SUCCESS;
} else if (upper_type.compare("AUDIT FAILURE") == 0) {
type_number = EVENTLOG_AUDIT_FAILURE;
}
// Append type to log query
if (type_number != -1) {
wstringstream ss;
ss << L"*[System[Level='" << type_number << L"']]";
query.push_back(ss.str());
}
// Set the id
int id_number = strtoul (id.c_str (), NULL, 0);
if (id_number != 0) {
wstringstream ss;
ss << L"*[System[EventID='" << id_number << L"']]";
query.push_back(ss.str());
}
// Fill the filter
if (query.size() == 0) {
this->filter = L"*";
} else {
int i = 0;
// Add filters with and
wstring item_query;
while (query.size() > 1) {
item_query = query.back();
query.pop_back();
this->filter += item_query + L" and ";
}
// Append the last value without the and
item_query = query.back();
this->filter += item_query;
}
this->source = source;
this->pattern = pattern;
if (! pattern.empty ()) {
// Compile the regular expression
if (regcomp (&this->regexp, pattern.c_str (), REG_EXTENDED) != 0) {
pandoraLog ("Invalid regular expression %s", pattern.c_str ());
}
}
this->bookmark_xml = L"";
this->setKind (module_logchannel_str);
// Load Wevtapi.dll and some functions
if (WINEVENT == NULL) {
WINEVENT = LoadLibrary("Wevtapi.dll");
if (WINEVENT == NULL) {
// Log to the bedug log, since this is not an error
pandoraLog ("Library Wevtapi.dll not available");
return;
}
EvtQueryF = (EvtQueryT) GetProcAddress (WINEVENT, "EvtQuery");
if (EvtQueryF == NULL) {
pandoraLog ("Error loading function EvtQuery from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtNextF = (EvtNextT) GetProcAddress (WINEVENT, "EvtNext");
if (EvtNextF == NULL) {
pandoraLog ("Error loading function EvtNext from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtSeekF = (EvtSeekT) GetProcAddress (WINEVENT, "EvtSeek");
if (EvtSeekF == NULL) {
pandoraLog ("Error loading function EvtSeek from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtCreateRenderContextF = (EvtCreateRenderContextT) GetProcAddress (WINEVENT, "EvtCreateRenderContext");
if (EvtCreateRenderContextF == NULL) {
pandoraLog ("Error loading function EvtCreateRenderContext from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtRenderF = (EvtRenderT) GetProcAddress (WINEVENT, "EvtRender");
if (EvtRenderF == NULL) {
pandoraLog ("Error loading function EvtRender from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtCloseF = (EvtCloseT) GetProcAddress (WINEVENT, "EvtClose");
if (EvtCloseF == NULL) {
pandoraLog ("Error loading function EvtClose from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtFormatMessageF = (EvtFormatMessageT) GetProcAddress (WINEVENT, "EvtFormatMessage");
if (EvtFormatMessageF == NULL) {
pandoraLog ("Error loading function EvtFormatMessage from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtOpenPublisherMetadataF = (EvtOpenPublisherMetadataT) GetProcAddress (WINEVENT, "EvtOpenPublisherMetadata");
if (EvtOpenPublisherMetadataF == NULL) {
pandoraLog ("Error loading function EvtOpenPublisherMetadata from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtCreateBookmarkF = (EvtCreateBookmarkT) GetProcAddress (WINEVENT, "EvtCreateBookmark");
if (EvtCreateBookmarkF == NULL) {
pandoraLog ("Error loading function EvtCreateBookmark from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
EvtUpdateBookmarkF = (EvtUpdateBookmarkT) GetProcAddress (WINEVENT, "EvtUpdateBookmark");
if (EvtUpdateBookmarkF == NULL) {
pandoraLog ("Error loading function EvtUpdateBookmark from Wevtapi.dll");
FreeLibrary (WINEVENT);
WINEVENT = NULL;
return;
}
}
}
void
Pandora_Module_Logchannel::run () {
list<LogChannelList> event_list;
list<LogChannelList>::iterator event;
SYSTEMTIME system_time;
// Run
try {
Pandora_Module::run ();
} catch (Interval_Not_Fulfilled e) {
return;
}
// Initialize log event query
this->initializeLogChannel();
// Read events on a list
this->getLogEvents (event_list);
// Return if no data stored on list
if (event_list.size () < 1) return;
for (event = event_list.begin (); event != event_list.end(); ++event) {
// Store the data
this->setOutput (event->message, &(event->timestamp));
}
}
/**
* Fill the first bookmark of events.
*/
void
Pandora_Module_Logchannel::initializeLogChannel () {
EVT_HANDLE hEvents[1];
EVT_HANDLE hResults;
EVT_HANDLE hBookmark;
DWORD dwReturned = 0;
// Check whether the first bookmark is set
if (!this->bookmark_xml.empty()) return;
// Open the event log with a query
hResults = EvtQueryF (
NULL,
strAnsiToUnicode (this->source.c_str()).c_str(),
this->filter.c_str(),
EvtOpenChannelPath | EvtQueryForwardDirection
);
if (hResults == NULL) {
pandoraDebug ("Could not open event log channel. Error: '%d'", GetLastError());
return;
}
// Put the events on the last event
if (!EvtSeekF(hResults, 0, NULL, 0, EvtSeekRelativeToLast)) {
pandoraDebug("Cannot positionate the event at first. 'Error %d'.", GetLastError());
EvtCloseF(hResults);
return;
}
// Read next event to positionate the bookmark
if (!EvtNextF(hResults, 1, hEvents, INFINITE, 0, &dwReturned)) {
if (GetLastError() != ERROR_NO_MORE_ITEMS) {
pandoraDebug ("EvtNext (initializeLogChannel) error: %d", GetLastError());
EvtCloseF(hResults);
return;
}
}
// If no events read, do not use bookmark to read all events
if (dwReturned == 0) {
pandoraDebug("No events found positionating bookmark.");
EvtCloseF(hResults);
return;
}
// Create the bookmar
pandoraDebug("Creating bookmark to channel %s", this->source.c_str());
hBookmark = EvtCreateBookmarkF(NULL);
if (hBookmark == NULL) {
pandoraDebug("EvtCreateBookmark (initializeLogChannel) failed %d", GetLastError());
EvtCloseF(hResults);
EvtCloseF(hEvents[0]);
return;
}
if (!EvtUpdateBookmarkF(hBookmark, hEvents[0])) {
pandoraDebug("EvtUpdateBookmarkF (initializeLogChannel) failed %d", GetLastError());
EvtCloseF(hResults);
EvtCloseF(hEvents[0]);
EvtCloseF(hBookmark);
return;
}
// Save the bookmark like an XML.
this->updateBookmarkXML(hBookmark);
// Clean tasks
EvtCloseF(hResults);
EvtCloseF(hBookmark);
EvtCloseF(hEvents[0]);
}
/**
* Update the bookmark XML. Returns false if fails
*/
bool
Pandora_Module_Logchannel::updateBookmarkXML (EVT_HANDLE hBookmark) {
LPWSTR pBookmarkXml = NULL;
DWORD dwBufferSize = 0;
DWORD dwBufferUsed = 0;
DWORD dwPropertyCount = 0;
DWORD status = 0;
if (!EvtRenderF(NULL, hBookmark, EvtRenderBookmark, dwBufferSize, pBookmarkXml, &dwBufferUsed, &dwPropertyCount)){
if (ERROR_INSUFFICIENT_BUFFER == (status = GetLastError())){
dwBufferSize = dwBufferUsed;
pBookmarkXml = (LPWSTR)malloc(dwBufferSize);
if (pBookmarkXml){
EvtRenderF(NULL, hBookmark, EvtRenderBookmark, dwBufferSize, pBookmarkXml, &dwBufferUsed, &dwPropertyCount);
}
else{
pandoraDebug("Error loading the bookmark. Cannot load enough memory");
this->cleanBookmark();
free(pBookmarkXml);
return false;
}
}
if (ERROR_SUCCESS != (status = GetLastError())){
pandoraDebug("EvtRender (updateBookmarkXML) failed with %d\n", GetLastError());
this->cleanBookmark();
free(pBookmarkXml);
return false;
}
}
this->bookmark_xml = pBookmarkXml;
free(pBookmarkXml);
return true;
}
/**
* Clean the bookmark XML.
*/
void
Pandora_Module_Logchannel::cleanBookmark () {
this->bookmark_xml = L"";
}
/**
* Reads available events from the event log.
*/
void
Pandora_Module_Logchannel::getLogEvents (list<LogChannelList> &event_list) {
EVT_HANDLE hResults = NULL;
EVT_HANDLE hBookmark = NULL;
EVT_HANDLE hEvents[1];
EVT_HANDLE hContext = NULL;
PEVT_VARIANT pRenderedValues = NULL;
EVT_HANDLE hProviderMetadata = NULL;
LPWSTR pwsMessage = NULL;
LPWSTR ppValues[] = {L"Event/System/Provider/@Name", L"Event/System/TimeCreated/@SystemTime"};
DWORD count = sizeof(ppValues)/sizeof(LPWSTR);
DWORD dwReturned = 0;
DWORD dwBufferSize = 0;
DWORD dwBufferUsed = 0;
DWORD dwPropertyCount = 0;
DWORD status = ERROR_SUCCESS;
SYSTEMTIME eventTime;
FILETIME lft, ft;
bool update_bookmark = false;
// An empty bookmark XML means that log cannot be open
if (this->bookmark_xml.empty()) return;
// Open the event log with a query
hResults = EvtQueryF (
NULL,
strAnsiToUnicode (this->source.c_str()).c_str(),
this->filter.c_str(),
EvtOpenChannelPath | EvtQueryForwardDirection
);
if (hResults == NULL) {
pandoraDebug ("Could not open event log channel '%s'. Error: '%d'", this->source.c_str(), GetLastError());
EvtCloseF(hResults);
this->cleanBookmark();
return;
}
// Seek on the bookmark
hBookmark = EvtCreateBookmarkF(this->bookmark_xml.c_str());
if (hBookmark == NULL) {
pandoraDebug("Cannot read the string bookmark. Error: %d.", GetLastError());
EvtCloseF(hResults);
this->cleanBookmark();
return;
}
if (!EvtSeekF(hResults, 1, hBookmark, 0, EvtSeekRelativeToBookmark)) {
pandoraDebug("Cannot positionate the event at bookmark. Error %d.", GetLastError());
EvtCloseF(hResults);
EvtCloseF(hBookmark);
this->cleanBookmark();
return;
}
// Read events one by one
hEvents[0] = NULL;
while (EvtNextF(hResults, 1, hEvents, INFINITE, 0, &dwReturned)) {
hContext = EvtCreateRenderContextF(count, (LPCWSTR*)ppValues, EvtRenderContextValues);
if (NULL == hContext) {
pandoraDebug ("EvtCreateRenderContext error: %d", GetLastError());
EvtCloseF(hResults);
EvtCloseF(hBookmark);
EvtCloseF(hEvents[0]);
this->cleanBookmark();
return;
}
// Reinitialize the buffers
dwBufferSize = 0;
dwBufferUsed = 0;
if (! EvtRenderF(hContext, hEvents[0], EvtRenderEventValues, dwBufferSize, pRenderedValues, &dwBufferUsed, &dwPropertyCount)) {
if ((status = GetLastError()) == ERROR_INSUFFICIENT_BUFFER) {
dwBufferSize = dwBufferUsed;
pRenderedValues = (PEVT_VARIANT)malloc(dwBufferSize);
if (pRenderedValues) {
EvtRenderF(hContext, hEvents[0], EvtRenderEventValues, dwBufferSize, pRenderedValues, &dwBufferUsed, &dwPropertyCount);
}
else {
pandoraDebug ("EvtRender error: %d", status);
EvtCloseF(hResults);
EvtCloseF(hBookmark);
EvtCloseF(hEvents[0]);
EvtCloseF(hContext);
this->cleanBookmark();
return;
}
}
if ((status = GetLastError()) != ERROR_SUCCESS) {
pandoraDebug ("EvtRender error getting buffer size: %d", status);
EvtCloseF(hResults);
EvtCloseF(hBookmark);
EvtCloseF(hEvents[0]);
EvtCloseF(hContext);
this->cleanBookmark();
return;
}
}
// Get the SYSTEMTIME of log
ULONGLONG ullTimeStamp = pRenderedValues[1].FileTimeVal;
ft.dwHighDateTime = (DWORD)((ullTimeStamp >> 32) & 0xFFFFFFFF);
ft.dwLowDateTime = (DWORD)(ullTimeStamp & 0xFFFFFFFF);
// Time format conversions
if (!FileTimeToLocalFileTime(&ft, &lft)){
pandoraDebug("UTC FILETIME to LOCAL FILETIME error: %d.", GetLastError());
} else if (!FileTimeToSystemTime(&lft, &eventTime)){
pandoraDebug("FILETIME to SYSTEMTIME error: %d.", GetLastError());
}
// Get the handle to the provider's metadata that contains the message strings
hProviderMetadata = EvtOpenPublisherMetadataF(NULL, pRenderedValues[0].StringVal, NULL, 0, 0);
if (hProviderMetadata == NULL) {
pandoraDebug ("EvtOpenPublisherMetadata error: %d", GetLastError());
EvtCloseF(hResults);
EvtCloseF(hBookmark);
EvtCloseF(hEvents[0]);
EvtCloseF(hContext);
free(pRenderedValues);
this->cleanBookmark();
return;
}
// Read the event message
pwsMessage = GetMessageString(hProviderMetadata, hEvents[0], EvtFormatMessageEvent);
if (pwsMessage == NULL) {
EvtCloseF(hResults);
EvtCloseF(hBookmark);
EvtCloseF(hEvents[0]);
EvtCloseF(hContext);
free(pRenderedValues);
EvtCloseF(hProviderMetadata);
this->cleanBookmark();
return;
}
// Check the regex and save the message if pass the regex
if (this->pattern.empty () || regexec (&this->regexp, strUnicodeToAnsi(pwsMessage).c_str (), 0, NULL, 0) == 0){
// Save the event message
LogChannelList event_item;
event_item.message = strUnicodeToAnsi(pwsMessage);
event_item.timestamp= eventTime;
event_list.push_back (event_item);
}
// Clean up some used vars
EvtCloseF(hContext);
free(pRenderedValues);
EvtCloseF(hProviderMetadata);
free(pwsMessage);
// Update the bookmark
if (!EvtUpdateBookmarkF(hBookmark, hEvents[0])) {
pandoraDebug("EvtUpdateBookmarkF (getLogEvents) failed %d", GetLastError());
EvtCloseF(hResults);
EvtCloseF(hBookmark);
EvtCloseF(hEvents[0]);
this->cleanBookmark();
return;
}
// Cleanup current event and read the next log
EvtCloseF(hEvents[0]);
hEvents[0] = NULL;
// Information token to update bookmark
update_bookmark = true;
}
status = GetLastError();
if (status != ERROR_NO_MORE_ITEMS) {
pandoraDebug ("EvtNext getLogEvents error: %d", GetLastError());
EvtCloseF(hResults);
EvtCloseF(hBookmark);
this->cleanBookmark();
return;
}
// Update bookmark if there is new events
if (update_bookmark) this->updateBookmarkXML(hBookmark);
// Clean handlers
EvtCloseF(hResults);
EvtCloseF(hBookmark);
}
// Gets the specified message string from the event. If the event does not
// contain the specified message, the function returns NULL.
// See http://msdn.microsoft.com/en-us/library/windows/desktop/dd996923(v=vs.85).aspx
LPWSTR
Pandora_Module_Logchannel::GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId) {
LPWSTR pBuffer = NULL;
DWORD dwBufferSize = 0;
DWORD dwBufferUsed = 0;
DWORD status = 0;
if (!EvtFormatMessageF(hMetadata, hEvent, 0, 0, NULL, FormatId, dwBufferSize, pBuffer, &dwBufferUsed)) {
status = GetLastError();
if (ERROR_INSUFFICIENT_BUFFER == status) {
// An event can contain one or more keywords. The function returns keywords
// as a list of keyword strings. To process the list, you need to know the
// size of the buffer, so you know when you have read the last string, or you
// can terminate the list of strings with a second null terminator character
// as this example does.
if ((EvtFormatMessageKeyword == FormatId)) {
pBuffer[dwBufferSize-1] = L'\0';
}
else {
dwBufferSize = dwBufferUsed;
}
pBuffer = (LPWSTR)malloc(dwBufferSize * sizeof(WCHAR));
if (pBuffer) {
EvtFormatMessageF(hMetadata, hEvent, 0, 0, NULL, FormatId, dwBufferSize, pBuffer, &dwBufferUsed);
// Add the second null terminator character.
if ((EvtFormatMessageKeyword == FormatId)) {
pBuffer[dwBufferUsed-1] = L'\0';
}
}
else {
return NULL;
}
}
else {
pandoraDebug ("EvtFormatMessage error: %d", status);
return NULL;
}
}
return pBuffer;
}

View File

@ -0,0 +1,76 @@
/* Pandora logchannel module. This module checks for log events that match a given
pattern using XML functions provided by wevtapi.
Copyright (C) 2017 Artica ST.
Written by Fermin Hernandez.
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; either version 2, or (at your option)
any later version.
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.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PANDORA_MODULE_LOGCHANNEL_H__
#define __PANDORA_MODULE_LOGCHANNEL_H__
#include "pandora_module.h"
#include "boost/regex.h"
#include "../windows/winevt.h"
// Log event read buffer size
#define BUFFER_SIZE 1024
// Types for pointers to Wevtapi.dll functions
typedef EVT_HANDLE WINAPI (*EvtQueryT) (EVT_HANDLE Session, LPCWSTR Path, LPCWSTR Query, DWORD Flags);
typedef WINBOOL WINAPI (*EvtNextT) (EVT_HANDLE ResultSet, DWORD EventArraySize, EVT_HANDLE* EventArray, DWORD Timeout, DWORD Flags, PDWORD Returned);
typedef WINBOOL WINAPI (*EvtSeekT) (EVT_HANDLE ResultSet, LONGLONG Position, EVT_HANDLE Bookmark, DWORD Timeout, DWORD Flags);
typedef EVT_HANDLE WINAPI (*EvtCreateRenderContextT) (DWORD ValuePathsCount, LPCWSTR *ValuePaths, DWORD Flags);
typedef WINBOOL WINAPI (*EvtRenderT) (EVT_HANDLE Context, EVT_HANDLE Fragment, DWORD Flags, DWORD BufferSize, PVOID Buffer, PDWORD BufferUsed, PDWORD PropertyCount);
typedef WINBOOL WINAPI (*EvtCloseT) (EVT_HANDLE Object);
typedef WINBOOL WINAPI (*EvtFormatMessageT) (EVT_HANDLE PublisherMetadata, EVT_HANDLE Event, DWORD MessageId, DWORD ValueCount, PEVT_VARIANT Values, DWORD Flags, DWORD BufferSize, LPWSTR Buffer, PDWORD BufferUsed);
typedef EVT_HANDLE WINAPI (*EvtOpenPublisherMetadataT) (EVT_HANDLE Session, LPCWSTR PublisherIdentity, LPCWSTR LogFilePath, LCID Locale, DWORD Flags);
typedef EVT_HANDLE WINAPI (*EvtCreateBookmarkT) (LPCWSTR BookmarkXml);
typedef WINBOOL WINAPI (*EvtUpdateBookmarkT) (EVT_HANDLE Bookmark, EVT_HANDLE Event);
namespace Pandora_Modules {
/**
* This module checks for log events that match a given
* pattern. Events can be filtered by source and type.
*/
class Pandora_Module_Logchannel : public Pandora_Module {
struct LogChannelList {
string message;
SYSTEMTIME timestamp;
};
private:
regex_t regexp;
string source;
string pattern;
wstring filter;
wstring bookmark_xml;
HANDLE messages_dll;
void initializeLogChannel ();
bool updateBookmarkXML (EVT_HANDLE hBookmark);
void getLogEvents (list<LogChannelList> &event_list);
void cleanBookmark ();
LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId);
public:
Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern);
void run ();
};
}
#endif

View File

@ -48,6 +48,7 @@ Pandora_Module_Proc::Pandora_Module_Proc (string name, string process_name)
this->setKind (module_proc_str); this->setKind (module_proc_str);
this->watchdog = false; this->watchdog = false;
this->user_session = false;
this->start_command = ""; this->start_command = "";
this->retries = 3; this->retries = 3;
this->start_delay = 5000; this->start_delay = 5000;
@ -95,6 +96,11 @@ Pandora_Module_Proc::getRetryDelay () const {
return this->retry_delay; return this->retry_delay;
} }
bool
Pandora_Module_Proc::getUserSession () const {
return this->user_session;
}
void void
Pandora_Module_Proc::setWatchdog (bool watchdog) { Pandora_Module_Proc::setWatchdog (bool watchdog) {
this->watchdog = watchdog; this->watchdog = watchdog;
@ -131,6 +137,11 @@ Pandora_Module_Proc::setRetryDelay (int mseconds) {
this->retry_delay = mseconds; this->retry_delay = mseconds;
} }
void
Pandora_Module_Proc::setUserSession (bool usession) {
this->user_session = usession;
}
void void
async_run (Pandora_Module_Proc *module) { async_run (Pandora_Module_Proc *module) {
HANDLE *processes = NULL; HANDLE *processes = NULL;
@ -156,7 +167,7 @@ async_run (Pandora_Module_Proc *module) {
} }
Sleep (module->getRetryDelay ()); Sleep (module->getRetryDelay ());
Pandora_Wmi::runProgram (module->getStartCommand ()); Pandora_Wmi::runProgram (module->getStartCommand (), NULL, module->getUserSession());
Sleep (module->getStartDelay ()); Sleep (module->getStartDelay ());
counter++; counter++;
continue; continue;

View File

@ -32,6 +32,7 @@ namespace Pandora_Modules {
string process_name; string process_name;
HANDLE thread; HANDLE thread;
bool watchdog; bool watchdog;
bool user_session;
string start_command; string start_command;
int retries; int retries;
int start_delay; int start_delay;
@ -46,12 +47,14 @@ namespace Pandora_Modules {
int getRetries () const; int getRetries () const;
int getStartDelay () const; int getStartDelay () const;
int getRetryDelay () const; int getRetryDelay () const;
bool getUserSession () const;
void setWatchdog (bool watchdog); void setWatchdog (bool watchdog);
void setStartCommand (string command); void setStartCommand (string command);
void setRetries (int retries); void setRetries (int retries);
void setStartDelay (int mseconds); void setStartDelay (int mseconds);
void setRetryDelay (int mseconds); void setRetryDelay (int mseconds);
void setUserSession (bool usession);
void run (); void run ();
}; };

View File

@ -124,7 +124,6 @@ async_run (Pandora_Module_Service *module) {
// If time out and polling, // If time out and polling,
// check the service status actively // check the service status actively
if (result == WAIT_TIMEOUT && polling) { if (result == WAIT_TIMEOUT && polling) {
pandoraLog("Timeout. Polling");
module->execute_async_service(prev_res, module, modules); module->execute_async_service(prev_res, module, modules);
} }
continue; continue;

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.713(Build 171009)") #define PANDORA_VERSION ("7.0NG.714(Build 171030)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.713(Build 171009))" VALUE "ProductVersion", "(7.0NG.714(Build 171030))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -501,7 +501,7 @@ Pandora_Wmi::getSystemName () {
* @param flags Process creation flags * @param flags Process creation flags
*/ */
bool bool
Pandora_Wmi::runProgram (string command, DWORD flags) { Pandora_Wmi::runProgram (string command, DWORD flags, BOOL user_session) {
PROCESS_INFORMATION process_info; PROCESS_INFORMATION process_info;
STARTUPINFO startup_info; STARTUPINFO startup_info;
bool success; bool success;
@ -514,11 +514,75 @@ Pandora_Wmi::runProgram (string command, DWORD flags) {
startup_info.cb = sizeof (startup_info); startup_info.cb = sizeof (startup_info);
ZeroMemory (&process_info, sizeof (process_info)); ZeroMemory (&process_info, sizeof (process_info));
if (user_session) {
DWORD sessionId = WTSGetActiveConsoleSessionId();
startup_info.cb = sizeof(STARTUPINFO);
startup_info.hStdError = 0;
startup_info.hStdInput = 0;
startup_info.hStdOutput = 0;
if (
startup_info.hStdError != 0
|| startup_info.hStdInput != 0
|| startup_info.hStdOutput != 0
) {
startup_info.dwFlags |= STARTF_USESTDHANDLES;
}
HANDLE procHandle = GetCurrentProcess();
HANDLE token, userToken;
// Tray to open the process
if (OpenProcessToken(procHandle, TOKEN_DUPLICATE, &token) == 0) {
pandoraDebug ("Open Process Token fails with error %d.", GetLastError());
return false;
}
// Duplicate token
if (DuplicateTokenEx(token,
MAXIMUM_ALLOWED,
0,
SecurityImpersonation,
TokenPrimary,
&userToken) == 0) {
pandoraDebug ("Duplicate token fails with error %d.", GetLastError());
return false;
}
// Set Token Information
if (SetTokenInformation(userToken,
(TOKEN_INFORMATION_CLASS)TokenSessionId,
&sessionId,
sizeof(sessionId)) == 0) {
// Error 1314 will be thrown if agent is not running as service.
if (GetLastError() != 1314) {
pandoraDebug ("Set token information fails with error %d.", GetLastError());
return false;
}
}
LPSTR command_exec = (LPSTR)command.c_str();
// Create Process As User
// Changed inherit and command
success = CreateProcessAsUser(
userToken,
0,
command_exec,
0,
0,
FALSE,
flags,
0,
NULL,
&startup_info,
&process_info);
} else {
pandoraDebug ("Start process \"%s\".", command.c_str ()); pandoraDebug ("Start process \"%s\".", command.c_str ());
cmd = strdup (command.c_str ()); cmd = strdup (command.c_str ());
success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags, success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags,
NULL, NULL, &startup_info, &process_info); NULL, NULL, &startup_info, &process_info);
pandoraFree (cmd); pandoraFree (cmd);
}
if (success) { if (success) {
pandoraDebug ("The process \"%s\" was started.", command.c_str ()); pandoraDebug ("The process \"%s\" was started.", command.c_str ());

View File

@ -53,7 +53,7 @@ namespace Pandora_Wmi {
string getOSBuild (); string getOSBuild ();
string getSystemName (); string getSystemName ();
string getSystemAddress (); string getSystemAddress ();
bool runProgram (string command, DWORD flags = 0); bool runProgram (string command, DWORD flags = 0, BOOL user_session = false);
bool startService (string service_name); bool startService (string service_name);
bool stopService (string service_name); bool stopService (string service_name);
void runWMIQuery (string wmi_query, void runWMIQuery (string wmi_query,

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.713-171009 Version: 7.0NG.714-171030
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.713-171009" pandora_version="7.0NG.714-171030"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -66,11 +66,14 @@ function mainAgentsModules() {
$modulegroup = get_parameter('modulegroup', 0); $modulegroup = get_parameter('modulegroup', 0);
$refr = get_parameter('refresh', 0); // By default 30 seconds $refr = get_parameter('refresh', 0); // By default 30 seconds
$recursion = get_parameter('recursion', 0);
$group_id = (int)get_parameter('group_id', 0); $group_id = (int)get_parameter('group_id', 0);
$offset = (int)get_parameter('offset', 0); $offset = (int)get_parameter('offset', 0);
$hor_offset = (int)get_parameter('hor_offset', 0); $hor_offset = (int)get_parameter('hor_offset', 0);
$block = $config['block_size']; $block = $config['block_size'];
if(get_parameter('modulegroup') != null){
$agents_id = (array)get_parameter('id_agents2', -1); $agents_id = (array)get_parameter('id_agents2', -1);
}
$selection_a_m = (int)get_parameter('selection_agent_module'); $selection_a_m = (int)get_parameter('selection_agent_module');
$modules_selected = (array)get_parameter('module', 0); $modules_selected = (array)get_parameter('module', 0);
$update_item = (string)get_parameter('edit_item',''); $update_item = (string)get_parameter('edit_item','');
@ -139,6 +142,8 @@ function mainAgentsModules() {
$filter_groups_label = '<b>'.__('Group').'</b>'; $filter_groups_label = '<b>'.__('Group').'</b>';
$filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;'); $filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;');
$filter_recursion_label = '<b>'.__('Recursion').'</b>';
$filter_recursion = html_print_checkbox('recursion', 1, 0, true);
//groups module //groups module
$filter_module_groups_label = '<b>'.__('Module group').'</b>'; $filter_module_groups_label = '<b>'.__('Module group').'</b>';
$filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name", $filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name",
@ -250,7 +255,7 @@ function mainAgentsModules() {
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">'; echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
echo "<tr>"; echo "<tr>";
echo "<td>" . $filter_groups_label . "</td>"; echo "<td>" . $filter_groups_label . "</td>";
echo "<td>" . $filter_groups . "</td>"; echo "<td>" . $filter_groups ."&nbsp;&nbsp;&nbsp;". $filter_recursion_label . $filter_recursion. "</td>";
echo "<td></td>"; echo "<td></td>";
echo "<td></td>"; echo "<td></td>";
echo "<td>" . $filter_module_groups_label . "</td>"; echo "<td>" . $filter_module_groups_label . "</td>";
@ -375,9 +380,14 @@ function mainAgentsModules() {
} }
if ($group_id > 0) { if ($group_id > 0) {
if($recursion){
$filter_groups['id_grupo'] = array_merge($group_id,
groups_get_id_recursive($group_id, true));
}
else{
$filter_groups['id_grupo'] = $group_id; $filter_groups['id_grupo'] = $group_id;
} }
}
$agents = agents_get_agents ($filter_groups); $agents = agents_get_agents ($filter_groups);
$nagents = count($agents); $nagents = count($agents);
@ -675,12 +685,41 @@ $ignored_params['refresh']='';
} }
$("#group_id").change (function () { $("#group_id").change (function () {
jQuery.post ("ajax.php", jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente", {"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1, "get_agents_group_json" : 1,
"id_group" : this.value, "id_group" : this.value,
"privilege" : "AW", "privilege" : "AW",
"keys_prefix" : "_" "keys_prefix" : "_",
"recursion" : $('#checkbox-recursion').is(':checked')
},
function (data, status) {
$("#id_agents2").html('');
$("#module").html('');
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
option = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["alias"]);
$("#id_agents").append (option);
$("#id_agents2").append (option);
});
},
"json"
);
});
$("#checkbox-recursion").change (function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
"id_group" : $("#group_id").val(),
"privilege" : "AW",
"keys_prefix" : "_",
"recursion" : $('#checkbox-recursion').is(':checked')
}, },
function (data, status) { function (data, status) {
$("#id_agents2").html(''); $("#id_agents2").html('');

View File

@ -1,818 +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.
if (is_ajax()) {
$generate_info = (bool) get_parameter("generate_info");
if ($generate_info) {
$pandora_diag = (bool) get_parameter("pandora_diag");
$system_info = (bool) get_parameter("system_info");
$log_info = (bool) get_parameter("log_info");
$log_num_lines = (int) get_parameter('log_num_lines', 2000);
$checks = array();
$checks['pandora_diagnostic'] = $pandora_diag;
$checks['system_info'] = $system_info;
$checks['log_info'] = $log_info;
$result = generate_info($checks, $log_num_lines);
echo json_encode($result);
return;
}
return;
}
function getPandoraDiagnostic(&$systemInfo) {
global $config;
global $build_version;
global $pandora_version;
$systemInfo["Pandora FMS Build"] = $build_version;
$systemInfo["Pandora FMS Version"] = $pandora_version;
$systemInfo["Homedir"] = $config["homedir"];
$systemInfo["HomeUrl"] = $config["homeurl"];
$systemInfo["PHP Version"] = phpversion();
$systemInfo['tagente'] = db_get_sql("SELECT COUNT(*) FROM tagente");
$systemInfo['tagent_access'] = db_get_sql("SELECT COUNT(*) FROM tagent_access");
$systemInfo['tagente_datos'] = db_get_sql("SELECT COUNT(*) FROM tagente_datos");
$systemInfo['tagente_datos_string'] = db_get_sql("SELECT COUNT(*) FROM tagente_datos_string");
$systemInfo['tagente_estado'] = db_get_sql("SELECT COUNT(*) FROM tagente_estado");
$systemInfo['tagente_modulo'] = db_get_sql("SELECT COUNT(*) FROM tagente_modulo");
$systemInfo['talert_actions'] = db_get_sql("SELECT COUNT(*) FROM talert_actions");
$systemInfo['talert_commands'] = db_get_sql("SELECT COUNT(*) FROM tagente");
$systemInfo['talert_template_modules'] = db_get_sql("SELECT COUNT(*) FROM talert_template_modules");
$systemInfo['tlayout'] = db_get_sql("SELECT COUNT(*) FROM tlayout");
if ($config['enterprise_installed'])
$systemInfo['tlocal_component'] = db_get_sql("SELECT COUNT(*) FROM tlocal_component");
$systemInfo['tserver'] = db_get_sql("SELECT COUNT(*) FROM tserver");
$systemInfo['treport'] = db_get_sql("SELECT COUNT(*) FROM treport");
$systemInfo['ttrap'] = db_get_sql("SELECT COUNT(*) FROM ttrap");
$systemInfo['tusuario'] = db_get_sql("SELECT COUNT(*) FROM tusuario");
$systemInfo['tsesion'] = db_get_sql("SELECT COUNT(*) FROM tsesion");
switch ($config["dbtype"]) {
case "mysql":
$systemInfo['db_scheme_version'] = db_get_sql("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_version'");
$systemInfo['db_scheme_build'] = db_get_sql("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_build'");
$systemInfo['enterprise_installed'] = db_get_sql("SELECT `value` FROM tconfig WHERE `token` = 'enterprise_installed'");
$systemInfo['db_maintance'] = date ("Y/m/d H:i:s", db_get_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'"));
$systemInfo['customer_key'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'customer_key';");
$systemInfo['updating_code_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'updating_code_path'");
$systemInfo['current_update'] = db_get_sql("SELECT value FROM tupdate_settings WHERE `key` = 'current_update'");
break;
case "postgresql":
$systemInfo['db_scheme_version'] = db_get_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_version'");
$systemInfo['db_scheme_build'] = db_get_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_scheme_build'");
$systemInfo['enterprise_installed'] = db_get_sql("SELECT \"value\" FROM tconfig WHERE \"token\" = 'enterprise_installed'");
$systemInfo['db_maintance'] = date ("Y/m/d H:i:s", db_get_sql ("SELECT \"value\" FROM tconfig WHERE \"token\" = 'db_maintance'"));
$systemInfo['customer_key'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'customer_key';");
$systemInfo['updating_code_path'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'updating_code_path'");
$systemInfo['current_update'] = db_get_sql("SELECT value FROM tupdate_settings WHERE \"key\" = 'current_update'");
break;
case "oracle":
$systemInfo['db_scheme_version'] = db_get_sql("SELECT " . db_escape_key_identifier('value') . " FROM tconfig WHERE \"token\" = 'db_scheme_version'");
$systemInfo['db_scheme_build'] = db_get_sql("SELECT " . db_escape_key_identifier('value') . " FROM tconfig WHERE \"token\" = 'db_scheme_build'");
$systemInfo['enterprise_installed'] = db_get_sql("SELECT " . db_escape_key_identifier('value') . " FROM tconfig WHERE \"token\" = 'enterprise_installed'");
$systemInfo['db_maintance'] = db_get_sql ("SELECT " . db_escape_key_identifier('value') . " FROM tconfig WHERE \"token\" = 'db_maintance'");
$systemInfo['customer_key'] = db_get_sql("SELECT " . db_escape_key_identifier('value') . " FROM tupdate_settings WHERE \"key =\" 'customer_key';");
$systemInfo['updating_code_path'] = db_get_sql("SELECT " . db_escape_key_identifier('value') . " FROM tupdate_settings WHERE \"key =\" 'updating_code_path'");
$systemInfo['current_update'] = db_get_sql("SELECT " . db_escape_key_identifier('value') . " FROM tupdate_settings WHERE \"key =\" 'current_update'");
break;
}
}
function getSystemInfo(&$systemInfo, $script = false) {
global $config;
$systemInfo['system_name'] = php_uname('s');
$systemInfo['system_host'] = php_uname('n');
$systemInfo['system_release'] = php_uname('r');
$systemInfo['system_version'] = php_uname('v');
$systemInfo['system_machine'] = php_uname('m');
if (!$script) {
$systemInfo['apache_version'] = apache_get_version();
$systemInfo['apache_modules'] = apache_get_modules();
}
$systemInfo['php_ini'] = ini_get_all();
$systemInfo['phpversion'] = phpversion();
foreach (get_loaded_extensions() as $module) {
$systemInfo['php_load_extensions'][$module] = phpversion($module);
}
$result = shell_exec('df -h | tail --lines=+2');
$temp = explode("\n", $result);
$disk = array();
foreach($temp as $line) {
$line = preg_replace('/[ ][ ]*/', " ", $line);
$temp2 = explode(' ', $line);
if (count($temp2) < 5) {
break;
}
$info = array(
'Filesystem' => $temp2[0],
'Size' => $temp2[1],
'Used' => $temp2[2],
'Use%' => $temp2[3],
'Avail' => $temp2[4],
'Mounted_on' => $temp2[5]
);
$disk[] = $info;
}
$systemInfo['disk'] = $disk;
$result = shell_exec('uptime');
preg_match('/.* load average: (.*)/', $result, $matches);
$systemInfo['load_average'] = $matches[1];
$result = shell_exec('ps -Ao cmd | tail --lines=+2');
$temp = explode("\n", $result);
foreach ($temp as $line) {
if ($line != '') {
$process[] = $line;
}
}
$systemInfo['process'] = $process;
$logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
$result = shell_exec('du -h ' . $logs_directory . ' | cut -d"/" -f1');
$systemInfo['size_var_log_pandora'] = $result;
$result = shell_exec('date');
$systemInfo['date'] = $result;
}
function getLastLinesLog($file, $numLines = 2000) {
$result = shell_exec('tail -n ' . $numLines . ' ' . $file);
return $result;
}
function show_logfile($file_name, $numLines = 2000) {
global $config;
if (!file_exists($file_name)) {
echo "<h2 class=error>" . __("Cannot find file") . "(" . $file_name .
")</h2>";
}
else {
if (!is_readable($file_name)) {
echo "<h2 class=error>" . __("Cannot read file") . "(" . $file_name .
")</h2>";
}
else {
echo "<h2>" . $file_name . "</h2>";
echo "<textarea style='width: 98%; height: 200px;' name='$file_name'>";
echo shell_exec('tail -n ' . $numLines . ' ' . $file_name);
echo "</textarea>";
}
}
}
function logFilesLines($file_name, $numLines) {
global $config;
if (!file_exists($file_name)) {
return '';
}
else {
if (!is_readable($file_name)) {
return '';
}
else {
return shell_exec('tail -n ' . $numLines . ' ' . $file_name);
}
}
}
function getLastLog($numLines = 2000) {
global $config;
$logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
show_logfile($config["homedir"]."/pandora_console.log", $numLines);
show_logfile($logs_directory."/pandora_server.log", $numLines);
show_logfile($logs_directory."/pandora_server.error", $numLines);
show_logfile("/etc/mysql/my.cnf", $numLines);
show_logfile($config["homedir"]."/include/config.php", $numLines);
show_logfile("/etc/pandora/pandora_server.conf", $numLines);
show_logfile("/var/log/syslog", $numLines);
}
function show_array($title, $anchor, $array = array()) {
$table = new StdClass();
$table->width = '100%';
$table->class = "databox filters";
$table->head = array();
$table->head[0] = $title;
$table->data = array();
foreach ($array as $index => $item) {
if (!is_array($item)) {
$row = array();
$row[] = $index;
$row[] = $item;
$table->data[] = $row;
}
else {
foreach ($item as $index2 => $item2) {
if (!is_array($item2)) {
$row = array();
$row[] = $index;
$row[] = $index2;
$row[] = $item2;
$table->data[] = $row;
}
else {
foreach ($item2 as $index3 => $item3) {
$row = array();
$row[] = $index;
$row[] = $index2;
$row[] = $index3;
$row[] = $item3;
$table->data[] = $row;
}
}
}
}
}
echo "<h1><a name='" . $anchor . "'>" . $title . "</a></h1>";
html_print_table($table);
}
function generate_info($checks, $log_num_lines = 2000) {
global $config;
$pandora_diag = isset($checks['pandora_diagnostic']) ? $checks['pandora_diagnostic'] : false;
$system_info = isset($checks['system_info']) ? $checks['system_info'] : false;
$log_info = isset($checks['log_info']) ? $checks['log_info'] : false;
$tempDirSystem = sys_get_temp_dir();
$nameDir = 'dir_' . uniqid();
$tempDir = $tempDirSystem . '/' . $nameDir . '/';
mkdir($tempDir);
$zipArchive = $config['attachment_store'] . '/last_info.zip';
@unlink($zipArchive);
$url_zip = ui_get_full_url(false);
$url = $url_zip . 'attachment/last_info.zip';
$result = array();
$result['success'] = false;
$result['url'] = $url;
$result['location'] = $zipArchive;
$some_check = $log_info || $system_info || $pandora_diag;
$zip = new ZipArchive;
$zip_openned = $zip->open($zipArchive, ZIPARCHIVE::CREATE) === true;
if ($some_check && $zip_openned) {
if ($pandora_diag) {
$systemInfo = array();
getPandoraDiagnostic($systemInfo);
$file = fopen($tempDir . 'pandora_diagnostic.txt', 'w');
if ($file !== false) {
ob_start();
foreach ($systemInfo as $index => $item) {
if (is_array($item)) {
foreach ($item as $secondIndex => $secondItem) {
echo $index. ";" . $secondIndex . ";" . $secondItem . "\n";
}
}
else {
echo $index . ";" . $item . "\n";
}
}
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$zip->addFile($tempDir . 'pandora_diagnostic.txt', 'pandora_diagnostic.txt');
}
if ($system_info) {
$info = array();
getSystemInfo($info);
$file = fopen($tempDir . 'system_info.txt', 'w');
if ($file !== false) {
ob_start();
$string = "";
foreach ($info as $index => $item) {
if (is_array($item)) {
foreach ($item as $secondIndex => $secondItem) {
if (is_array($secondItem)) {
foreach ($secondItem as $thirdIndex => $thirdItem) {
if (is_array($thirdItem)) {
echo $index. ";" . $secondIndex . ";" . $thirdIndex . "\n";
}
else {
echo $index. ";" . $secondIndex . ";" . $thirdIndex . ";" . $thirdItem . "\n";
}
}
}
else {
echo $index. ";" . $secondIndex . ";" . $secondItem . "\n";
}
}
}
else {
echo $index . ";" . $item . "\n";
}
}
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$zip->addFile($tempDir . 'system_info.txt', 'system_info.txt');
}
$server_logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
if ($log_info) {
file_put_contents($tempDir . 'pandora_console.log.lines_' . $log_num_lines, getLastLinesLog($config["homedir"]."/pandora_console.log", $log_num_lines));
$zip->addFile($tempDir . 'pandora_console.log.lines_' . $log_num_lines, 'pandora_console.log.lines_' . $log_num_lines);
file_put_contents($tempDir . 'pandora_server.log.lines_' . $log_num_lines, getLastLinesLog($server_logs_directory."/pandora_server.log", $log_num_lines));
$zip->addFile($tempDir . 'pandora_server.log.lines_' . $log_num_lines, 'pandora_server.log.lines_' . $log_num_lines);
file_put_contents($tempDir . 'pandora_server.error.lines_' . $log_num_lines, getLastLinesLog($server_logs_directory."/pandora_server.error", $log_num_lines));
$zip->addFile($tempDir . 'pandora_server.error.lines_' . $log_num_lines, 'pandora_server.error.lines_' . $log_num_lines);
file_put_contents($tempDir . 'my.cnf.lines_' . $log_num_lines, getLastLinesLog("/etc/mysql/my.cnf", $log_num_lines));
$zip->addFile($tempDir . 'my.cnf.lines_' . $log_num_lines, 'my.cnf.lines_' . $log_num_lines);
file_put_contents($tempDir . 'config.php.lines_' . $log_num_lines, getLastLinesLog($config["homedir"]."/include/config.php", $log_num_lines));
$zip->addFile($tempDir . 'config.php.lines_' . $log_num_lines, 'config.php.lines_' . $log_num_lines);
file_put_contents($tempDir . 'pandora_server.conf.lines_' . $log_num_lines, getLastLinesLog("/etc/pandora/pandora_server.conf", $log_num_lines));
$zip->addFile($tempDir . 'pandora_server.conf.lines_' . $log_num_lines, 'pandora_server.conf.lines_' . $log_num_lines);
file_put_contents($tempDir . 'syslog.lines_' . $log_num_lines, getLastLinesLog("/var/log/syslog", $log_num_lines));
$zip->addFile($tempDir . 'syslog.lines_' . $log_num_lines, 'syslog.lines_' . $log_num_lines);
}
$zip->close();
$result['date'] = ui_print_timestamp(filectime($zipArchive), true);
$result['success'] = true;
}
elseif (!$some_check) {
$result['message'] = __('No options selected');
}
elseif (!$zip_openned) {
$result['message'] = __('There was an error with the zip file');
}
return $result;
}
function mainSystemInfo() {
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
return;
}
$show = (bool) get_parameter('show');
$generate = (bool) get_parameter('generate');
$pandora_diag = (bool) get_parameter('pandora_diag', 0);
$system_info = (bool) get_parameter('system_info', 0);
$log_info = (bool) get_parameter('log_info', 0);
$log_num_lines = (int) get_parameter('log_num_lines', 2000);
ui_print_page_header (__("System Info"), "images/extensions.png", false, "", true, "" );
echo '<div class="notify">';
echo __("This extension can run as PHP script in a shell for extract more information, but it must be run as root or across sudo. For example: <i>sudo php /var/www/pandora_console/extensions/system_info.php -d -s -c</i>");
echo '</div>';
$table = new StdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->align = array();
if ($pandora_diag) {
$table->data[0][0] = '<a href="#diag_info">' .
__('Pandora Diagnostic info') . "</a>";
}
else {
$table->data[0][0] = __('Pandora Diagnostic info');
}
$table->data[0][0] .= html_print_checkbox('pandora_diag', 1, $pandora_diag, true);
if ($system_info) {
$table->data[0][2] = '<a href="#system_info">' . __('System info') . '</a>';
}
else {
$table->data[0][2] = __('System info');
}
$table->data[0][2] .= html_print_checkbox('system_info', 1, $system_info, true);
if ($log_info) {
$table->data[0][3] = '<a href="#log_info">' . __('Log Info') . '</a>';
}
else {
$table->data[0][3] = __('Log Info');
}
$table->data[0][3] .= html_print_checkbox('log_info', 1, $log_info, true);
$table->data[0][4] = __('Number lines of log');
$table->data[0][4] .= html_print_input_text('log_num_lines', $log_num_lines, __('Number lines of log'), 5, 10, true);
$default_location = $config['attachment_store'] . '/last_info.zip';
$file_exists = file_exists($default_location) && is_readable($default_location);
$table_file = new StdClass();
$table_file->id = "table_file";
$table_file->class = "databox filters";
$table_file->width = '100%';
$table_file->style = array();
$table_file->style[0] = "font-weight: bold";
$table_file->data = array();
$display_file_link = $file_exists ? "" : "style=\"display: none;\"";
$url = ui_get_full_url(false) . "attachment/last_info.zip";
$file_link = "<a href=\"$url\" $display_file_link>";
$file_link .= html_print_image('images/file.png', true, array('title' => __('Download'))); // Download image
$file_link .= "</a>";
$data = array();
$data[0] = __('File');
$data['cell-link'] = $file_link;
$table_file->data['row_link'] = $data;
$data = array();
$data[0] = __('Created');
$data['cell-date'] = $file_exists ? ui_print_timestamp(filectime($default_location), true) : '';
$table_file->data['row_date'] = $data;
$data = array();
$data[0] = __('Location');
$data['cell-location'] = $file_exists ? $default_location : '';
$table_file->data['row_location'] = $data;
echo "<form method='post' action='index.php?extension_in_menu=gsetup&sec=gextensions&sec2=extensions/system_info'>";
html_print_table($table);
$display_table_file = $file_exists ? "" : "style=\"display: none;\"";
echo "<div id=\"table_file_container\" $display_table_file>";
html_print_table($table_file);
echo "</div>";
echo "<div style='width: " . $table->width . "; text-align: right;'>";
html_print_submit_button(__('Generate file'), 'generate', false, 'class="sub next"');
html_print_image('images/spinner.gif', false, array('id' => 'spinner_img', 'title' => __('Loading'), 'style' => 'display: none;'));
echo "</div>";
echo "</form>";
if ($show) {
if ($pandora_diag) {
$info = array();
getPandoraDiagnostic($info);
show_array(__('Pandora Diagnostic info'), 'diag_info', $info);
}
if ($system_info) {
$info = array();
getSystemInfo($info);
show_array(__('System info'), 'system_info', $info);
}
if ($log_info) {
echo "<h1><a name='log_info'>" . __('Log Info') . "</a></h1>";
getLastLog($log_num_lines);
}
}
elseif ($generate) {
$checks = array();
$checks['pandora_diagnostic'] = $pandora_diag;
$checks['system_info'] = $system_info;
$checks['log_info'] = $log_info;
$result = generate_info($checks, $log_num_lines);
if ($result['success']) {
echo '<b>' . __('File') . ':</b> ' . $result['url'] . '<br />';
echo '<b>' . __('Location') . ':</b> ' . $result['location'];
}
elseif (isset($result['message'])) {
echo $result['message'];
}
else {
echo __('Error');
}
}
?>
<script type="text/javascript">
$("#submit-generate").click(function(e) {
e.preventDefault();
if ($("#checkbox-pandora_diag").prop('checked')
|| $("#checkbox-system_info").prop('checked')
|| $("#checkbox-log_info").prop('checked')) {
generate_info();
} else {
alert('<?php echo __('At least one option must be selected'); ?>');
}
});
function generate_info () {
$("#submit-generate").hide();
$("#spinner_img").show();
$.ajax({
url: 'ajax.php',
type: 'POST',
dataType: 'json',
data: {
page: <?php echo json_encode(EXTENSIONS_DIR) ?> + '/system_info',
generate_info: 1,
pandora_diag: Number($("#checkbox-pandora_diag").prop('checked')),
system_info: Number($("#checkbox-system_info").prop('checked')),
log_info: Number($("#checkbox-log_info").prop('checked')),
log_num_lines: $("#text-log_num_lines").val()
},
complete: function() {
$("#spinner_img").hide();
$("#submit-generate").show();
},
success: function(data) {
if (data.success) {
$("#table_file-row_link-cell-link").find("a").prop("href", data.url).show();
$("#table_file-row_date-cell-date").html(data.date);
$("#table_file-row_location-cell-location").html(data.location);
$("#table_file_container").slideDown();
}
else {
$("#table_file-row_link-cell-link").find("a").prop("href", "");
$("#table_file-row_date-cell-date").html("");
$("#table_file-row_location-cell-location").html("");
$("#table_file_container").slideUp();
alert(data.message);
}
},
error: function(xhr, textStatus, errorThrown) {
$("#table_file-row_link-cell-link").find("a").prop("href", "");
$("#table_file-row_date-cell-date").html("");
$("#table_file-row_location-cell-location").html("");
$("#table_file_container").slideUp();
alert('<?php echo __('Error'); ?>');
}
});
}
</script>
<?php
}
function consoleMode() {
//Execution across the shell
global $config;
global $argv;
$tempDirSystem = sys_get_temp_dir();
$nameDir = 'dir_' . uniqid();
$tempDir = $tempDirSystem . '/' . $nameDir . '/';
$result = mkdir($tempDir);
if ($result == false) {
echo "Error in creation of temp dir.";
return;
}
$pandoraDiag = false;
$pandoraSystemInfo = false;
$pandoraConfFiles = false;
if ((array_search('-h', $argv) !== false)
|| (array_search('--help', $argv) !== false)) {
echo "Usage is:\n" .
"\t-h --help : show this help\n" .
"\t-d --pandora_diagnostic : generate pandora diagnostic data\n" .
"\t-s --system_info : generate system info data\n" .
"\t-c --conf_files : generate conf\n";
}
else {
$index = array_search('-d', $argv);
if ($index === false) {
$index = array_search('--pandora_diagnostic', $argv);
}
if ($index !== false) {
$pandoraDiag = true;
}
$index = array_search('-s', $argv);
if ($index === false) {
$index = array_search('--system_info', $argv);
}
if ($index !== false) {
$pandoraSystemInfo = true;
}
$index = array_search('-c', $argv);
if ($index === false) {
$index = array_search('--conf_files', $argv);
}
if ($index !== false) {
$pandoraConfFiles = true;
}
if ($pandoraDiag) {
$systemInfo = array();
getPandoraDiagnostic($systemInfo);
$file = fopen($tempDir . 'pandora_diagnostic.txt', 'w');
if ($file !== false) {
ob_start();
foreach ($systemInfo as $index => $item) {
if (is_array($item)) {
foreach ($item as $secondIndex => $secondItem) {
echo $index. ";" . $secondIndex . ";" . $secondItem . "\n";
}
}
else {
echo $index . ";" . $item . "\n";
}
}
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
}
if ($pandoraSystemInfo) {
$systemInfo = array();
getSystemInfo($systemInfo, true);
$file = fopen($tempDir . 'system_info.txt', 'w');
if ($file !== false) {
ob_start();
foreach ($systemInfo as $index => $item) {
if (is_array($item)) {
foreach ($item as $secondIndex => $secondItem) {
if (is_array($secondItem)) {
foreach ($secondItem as $thirdIndex => $thirdItem) {
echo $index. ";" . $secondIndex . ";" . $thirdIndex . ";" . $thirdItem . "\n";
}
}
else {
echo $index. ";" . $secondIndex . ";" . $secondItem . "\n";
}
}
}
else {
echo $index . ";" . $item . "\n";
}
}
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
}
if ($pandoraConfFiles) {
$lines = 2000;
$system_logs_directory = (!empty($config["server_log_dir"])) ? io_safe_output($config["server_log_dir"]) : "/var/log/pandora";
$file = fopen($tempDir . 'pandora_console.log' . $lines, 'w');
if ($file !== false) {
ob_start();
echo getLastLinesLog($config["homedir"]."/pandora_console.log", $lines);
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$file = fopen($tempDir . 'pandora_server.log' . $lines, 'w');
if ($file !== false) {
ob_start();
echo getLastLinesLog($system_logs_directory."/pandora_server.log", $lines);
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$file = fopen($tempDir . 'pandora_server.error' . $lines, 'w');
if ($file !== false) {
ob_start();
echo getLastLinesLog($system_logs_directory."/pandora_server.error", $lines);
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$file = fopen($tempDir . 'my.cnf', 'w');
if ($file !== false) {
ob_start();
echo file_get_contents('/etc/mysql/my.cnf');
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$file = fopen($tempDir . 'my.cnf', 'w');
if ($file !== false) {
ob_start();
echo file_get_contents($config["homedir"]."/include/config.php");
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$file = fopen($tempDir . 'pandora_server.conf', 'w');
if ($file !== false) {
ob_start();
echo file_get_contents("/etc/pandora/pandora_server.conf");
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$file = fopen($tempDir . 'syslog' . $lines, 'w');
if ($file !== false) {
ob_start();
echo getLastLinesLog("/var/log/syslog", $lines);
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$file = fopen($tempDir . 'pandora_server.error' . $lines, 'w');
if ($file !== false) {
ob_start();
echo getLastLinesLog($system_logs_directory."/pandora_server.error", $lines);
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
$file = fopen($tempDir . 'pandora_server.log' . $lines, 'w');
if ($file !== false) {
ob_start();
echo getLastLinesLog($system_logs_directory."/pandora_server.log", $lines);
$output = ob_get_clean();
fwrite($file, $output);
fclose($file);
}
}
echo 'tar zcvf ' . $tempDirSystem . '/' . $nameDir . '.tar.gz ' . $tempDir . '*' . "\n";
$result = shell_exec('tar zcvf ' . $tempDirSystem . '/' . $nameDir . '.tar.gz ' . $tempDir . '*');
//TODO Delete the temp directory
echo "You find the result file in " . $tempDirSystem . '/' . $nameDir . ".tar.gz\n";
}
}
if (!isset($argv)) {
//Execution across the browser
extensions_add_godmode_function('mainSystemInfo');
extensions_add_godmode_menu_option(__('System Info'), 'PM', 'gextensions', null, "v1r1");
}
else {
$dir = dirname($_SERVER['PHP_SELF']);
$dir = str_replace("\\", "/", $dir); // Windows compatibility
if (file_exists($dir . "/../include/config.php"))
include $dir . "/../include/config.php";
consoleMode();
}
?>

View File

@ -1,15 +1,3 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
UPDATE `talert_commands`
SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.',
`fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;Type\",\"\",\"\",\"\",\"\",\"\",\"\"]',
`fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]'
WHERE id=1;
UPDATE `talert_actions`
SET `field4` = 'text/html',
`field4_recovery` = 'text/html'
WHERE id = 1;
COMMIT; COMMIT;

View File

@ -125,7 +125,7 @@ echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic
render_row (phpversion(), "PHP Version"); render_row (phpversion(), "PHP Version");
render_row (ini_get('max_execution_time'), "PHP Max ejecution time"); render_row (ini_get('max_execution_time'), "PHP Max execution time");
render_row (ini_get('max_input_time'), "PHP Max input time"); render_row (ini_get('max_input_time'), "PHP Max input time");
@ -161,13 +161,9 @@ render_info_data ("SELECT COUNT( DISTINCT tagente.id_agente)
AND tagente_estado.id_agente = tagente.id_agente AND tagente_estado.id_agente = tagente.id_agente
AND tagente_estado.estado = 3","Total unknown agents"); AND tagente_estado.estado = 3","Total unknown agents");
render_info_data ("SELECT COUNT( DISTINCT tagente.id_agente) render_info_data ("SELECT COUNT(tagente_estado.estado)
FROM tagente_estado, tagente, tagente_modulo FROM tagente_estado
WHERE tagente.disabled = 0 WHERE tagente_estado.estado = 4","Total not-init modules");
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.id_agente = tagente.id_agente
AND tagente_estado.estado = 4","Total not-init modules");
$last_run_difference = ''; $last_run_difference = '';

View File

@ -1150,10 +1150,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 4); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 7);
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '708'); INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '714');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents` -- Table `tplanned_downtime_agents`
@ -1183,6 +1183,7 @@ ALTER TABLE tusuario ADD COLUMN `id_filter` int(10) UNSIGNED NULL DEFAULT NULL;
ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter(`id_filter`) ON DELETE SET NULL; ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter(`id_filter`) ON DELETE SET NULL;
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0'; ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
alter table tusuario add autorefresh_white_list text not null default ''; alter table tusuario add autorefresh_white_list text not null default '';
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_modulo` -- Table `tagente_modulo`

View File

@ -191,7 +191,7 @@ config_check();
$_GET['refr'] = null; $_GET['refr'] = null;
} }
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); $select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']); $autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
@ -389,7 +389,15 @@ config_check();
$("#combo_refr").toggle (); $("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px'); $("#combo_refr").css('padding-right', '9px');
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + "30"); <?php
if($select[0]['time_autorefresh']){
?>
var refresh = '<?php echo $select[0]["time_autorefresh"] ?>';
$(document).attr ("location", href + refresh);
<?php
}
?>
<?php <?php
} }
} }

View File

@ -181,7 +181,7 @@ $order_collation = "";
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$order_collation = ""; $order_collation = "";
//$order_collation = "COLLATE utf8_general_ci"; $order_collation = "COLLATE utf8_general_ci";
break; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":
@ -540,10 +540,6 @@ if ($agents !== false) {
} }
echo '<span class="left">'; echo '<span class="left">';
echo "<strong>"; echo "<strong>";
if ($agent['quiet']) {
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
echo "&nbsp;";
}
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
$main_tab = 'main'; $main_tab = 'main';
@ -562,7 +558,9 @@ if ($agents !== false) {
"</a>"; "</a>";
echo "</strong>"; echo "</strong>";
$in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"])); $in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime
INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime
WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . ' AND tplanned_downtime.executed = 1');
if ($agent["disabled"]) { if ($agent["disabled"]) {
ui_print_help_tip(__('Disabled')); ui_print_help_tip(__('Disabled'));
@ -572,6 +570,11 @@ if ($agents !== false) {
} }
} }
if ($agent['quiet']) {
echo "&nbsp;";
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
}
if ($in_planned_downtime) { if ($in_planned_downtime) {
ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png'); ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png');

View File

@ -45,10 +45,10 @@ echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
echo __('Search') . ' ' . echo __('Search') . ' ' .
html_print_input_text ('search_string', $search_string, '', 15, 255, true); html_print_input_text ('search_string', $search_string, '', 15, 255, true);
echo "</td>"; echo "</td>";
echo "<td class='datos' style='width:20%'>"; echo "<td class='datos' style='width:10%'>";
html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"'); html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"');
echo "</td>"; echo "</td>";
echo "<td class='datos' style='width:20%'></td>"; echo "<td class='datos' style='width:10%'></td>";
echo '</form>'; echo '</form>';
// Check if there is at least one server of each type available to assign that // 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
@ -119,7 +119,7 @@ if (($policy_page) || (isset($agent))) {
// Create module/type combo // Create module/type combo
echo '<form id="create_module_type" method="post" action="'.$url.'">'; echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) { if (!$policy_page) {
echo '<td class="datos" style="font-weight: bold;">'; echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __('Show in hierachy mode'); echo __('Show in hierachy mode');
if ($checked == "true") { if ($checked == "true") {
$checked = true; $checked = true;
@ -130,12 +130,12 @@ if (($policy_page) || (isset($agent))) {
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>';
} }
echo '<td class="datos" style="font-weight: bold;">'; echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __("Type"); echo __("Type");
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); html_print_input_hidden ('edit_module', 1);
echo '</td>'; echo '</td>';
echo '<td class="datos">'; echo '<td class="datos" style="width:10%;">';
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">'; echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">';
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';

View File

@ -291,7 +291,7 @@ if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>'; $table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy); $table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
if (!modules_is_string_type($id_module_type) || $edit) { if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="350" height="200" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"> </svg>'; $table_simple->data[4][2] = '<svg id="svg_dinamic" width="350px" height="200px" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"></svg>';
$table_simple->colspan[4][2] = 2; $table_simple->colspan[4][2] = 2;
$table_simple->rowspan[4][2] = 3; $table_simple->rowspan[4][2] = 3;
} }
@ -1323,8 +1323,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_normal") .attr("id", "legend_normal")
.attr("x", 72) .attr("x", 72)
.attr("y", -30) .attr("y", -30)
.attr("width", 10) .attr("width", '10px')
.attr("height", 10) .attr("height", '10px')
.style("fill", "#82B92E"); .style("fill", "#82B92E");
//legend Warning text //legend Warning text
@ -1343,8 +1343,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_warning") .attr("id", "legend_warning")
.attr("x", 168) .attr("x", 168)
.attr("y", -30) .attr("y", -30)
.attr("width", 10) .attr("width", '10px')
.attr("height", 10) .attr("height", '10px')
.style("fill", "#ffd731"); .style("fill", "#ffd731");
//legend Critical text //legend Critical text
@ -1363,8 +1363,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_critical") .attr("id", "legend_critical")
.attr("x", 258) .attr("x", 258)
.attr("y", -30) .attr("y", -30)
.attr("width", 10) .attr("width", '10px')
.attr("height", 10) .attr("height", '10px')
.style("fill", "#fc4444"); .style("fill", "#fc4444");
//styles for number and axes //styles for number and axes
@ -1382,8 +1382,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "warning_rect") .attr("id", "warning_rect")
.attr("x", 3) .attr("x", 3)
.attr("y", 0) .attr("y", 0)
.attr("width", 300) .attr("width", '300px')
.attr("height", 200) .attr("height", '200px')
.style("fill", "#82B92E"); .style("fill", "#82B92E");
//controls the inverse warning //controls the inverse warning

View File

@ -165,26 +165,8 @@ if (is_ajax ()) {
$rfield = $editor_type_chkbx; $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);
} }
elseif(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 .= "&nbsp;&nbsp;&nbsp;&nbsp;";
$editor_type_chkbx .= __('Text/html') . "&nbsp;&nbsp;";
$editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_value', 'text/html', '', 'text/html', false, '', '', 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 .= "&nbsp;&nbsp;&nbsp;&nbsp;";
$editor_type_chkbx .= __('Text/html') . "&nbsp;&nbsp;";
$editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true);
$editor_type_chkbx .= "</small></b></div>";
$rfield = $editor_type_chkbx;
// Select type // Select type
}else { else {
$fields_value_select = array(); $fields_value_select = array();
$fv = explode(';', $field_value); $fv = explode(';', $field_value);

View File

@ -305,34 +305,9 @@ $(document).ready (function () {
// Replace the old column with the new // Replace the old column with the new
$table_macros_field.replaceWith(field_row); $table_macros_field.replaceWith(field_row);
if (old_value != '' || old_recovery_value != '') { if (old_value != '' || old_recovery_value != '') {
var inputType = $("[name=field" + i + "_value]").attr('type')
if (inputType == 'radio') {
if(old_value == 'text/plain'){
if ($("[name=field" + i + "_value]").val() == 'text/plain') {
$("[name=field" + i + "_value]").attr('checked','checked');
}
}
else{
if($("[name=field" + i + "_value]").val() == 'text/html') {
$("[name=field" + i + "_value]").attr('checked','checked');
}
}
if(old_recovery_value == 'text/plain'){
if ($("[name=field" + i + "_recovery_value]").val() == 'text/plain') {
$("[name=field" + i + "_recovery_value]").attr('checked','checked');
}
}
else{
if ($("[name=field" + i + "_recovery_value]").val() == 'text/html') {
$("[name=field" + i + "_recovery_value]").attr('checked','checked');
}
}
}
else {
$("[name=field" + i + "_value]").val(old_value); $("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_recovery_value]").val(old_recovery_value); $("[name=field" + i + "_recovery_value]").val(old_recovery_value);
} }
}
else { else {
$("[name=field" + i + "_value]") $("[name=field" + i + "_value]")
.val($("[name=field" + i + "_value]") .val($("[name=field" + i + "_value]")

View File

@ -1,110 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database audit purge'), "images/gm_db.png", false, "", true);
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation",
"Trying to access Database Management Audit");
require ("general/noaccess.php");
return;
}
// All data (now)
$time["all"] = get_system_time ();
// 1 day ago
$time["1day"] = $time["all"] - SECONDS_1DAY;
// 3 days ago
$time["3day"] = $time["all"] - ( SECONDS_1DAY * 3);
// 1 week ago
$time["1week"] = $time["all"] - SECONDS_1WEEK;
// 2 weeks ago
$time["2week"] = $time["all"] - SECONDS_2WEEK;
// 1 month ago
$time["1month"] = $time["all"] - SECONDS_1MONTH;
// Three months ago
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
// Todo for a good DB maintenance
/*
- Delete too on datos_string and and datos_inc tables
- A function to "compress" data, and interpolate big chunks of data (1 month - 60000 registers)
onto a small chunk of interpolated data (1 month - 600 registers)
- A more powerful selection (by Agent, by Module, etc).
*/
# ADQUIRE DATA PASSED AS FORM PARAMETERS
# ======================================
# Purge data using dates
if (isset($_POST["purgedb"])) { # Fixed 2005-1-13, nil
$from_date = get_parameter_post("date_purge");
$deleted = db_process_sql_delete('tsesion', array('utimestamp' => '< ' . $from_date));
if ($deleted)
ui_print_success_message(__('Success data deleted'));
else
ui_print_error_message(__('Error deleting data'));
}
# End of get parameters block
echo "<table cellpadding='4' cellspacing='4' class='databox filters' width='100%'>";
echo "<tr><td class='datos'>";
$result = db_get_row_sql ("SELECT COUNT(*) AS total, MIN(fecha) AS first_date, MAX(fecha) AS latest_date FROM tsesion");
echo "<b>".__('Total')."</b></td>";
echo "<td class='datos'>".$result["total"]." ".__('Records')."</td>";
echo "<tr>";
echo "<td class='datos2'><b>".__('First date')."</b></td>";
echo "<td class='datos2'>".$result["first_date"]."</td></tr>";
echo "<tr><td class='datos'>";
echo "<b>".__('Latest date')."</b></td>";
echo "<td class='datos'>".$result["latest_date"]."</td>";
echo "</tr></table>";
?>
<h4><?php echo __('Purge data') ?></h4>
<form name="db_audit" method="post" action="index.php?sec=gdbman&sec2=godmode/db/db_audit">
<table width='100%' cellpadding='4' cellspacing='4' class='databox filters'>
<tr><td class='datos'>
<select name="date_purge">
<option value="<?php echo $time["3month"] ?>"><?php echo __('Purge audit data over 90 days') ?></option>
<option value="<?php echo $time["1month"] ?>"><?php echo __('Purge audit data over 30 days') ?></option>
<option value="<?php echo $time["2week"] ?>"><?php echo __('Purge audit data over 14 days') ?></option>
<option value="<?php echo $time["1week"] ?>"><?php echo __('Purge audit data over 7 days') ?></option>
<option value="<?php echo $time["3day"] ?>"><?php echo __('Purge audit data over 3 days') ?></option>
<option value="<?php echo $time["1day"] ?>"><?php echo __('Purge audit data over 1 day') ?></option>
<option value="<?php echo $time["all"] ?>"><?php echo __('Purge all audit data') ?></option>
</select>
</td>
<td class="datos">
<input class="sub wand" type="submit" name="purgedb" value="<?php echo __('Do it!') ?>" onClick="if (!confirm('<?php echo __('Are you sure?') ?>')) return false;">
</table>
</form>

View File

@ -1,94 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login ();
ui_print_page_header (__('Database maintenance').' &raquo; ' .
__('Event database cleanup'), "images/gm_db.png", false, "", true);
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation", "Trying to access Database Management Event");
require ("general/noaccess.php");
exit;
}
# ADQUIRE DATA PASSED AS FORM PARAMETERS
# ======================================
# Purge data using dates
if (isset ($_POST["date_purge"])) {
$from_date = (int) get_parameter_post ("date_purge");
$deleted = db_process_sql_delete('tevento',
array('utimestamp' => '< ' . $from_date));
if ($deleted !== false) {
ui_print_success_message(__('Successfully deleted old events'));
}
else {
ui_print_error_message(__('Error deleting old events'));
}
}
# End of get parameters block
$row = db_get_row_sql ("
SELECT COUNT(*) AS total,
MIN(timestamp) AS first_date,
MAX(timestamp) AS latest_date
FROM tevento");
$table = new stdClass();
$table->data = array ();
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->class = "databox filters";
$table->width = '100%';
$table->data[0][0] = '<b>'.__('Total').':</b>';
$table->data[0][1] = $row["total"].' '.__('Records');
$table->data[1][0] = '<b>'.__('First date').':</b>';
$table->data[1][1] = $row["first_date"];
$table->data[2][0] = '<b>'.__('Latest data').':</b>';
$table->data[2][1] = $row["latest_date"];
html_print_table ($table);
unset ($table);
echo '<h4>'.__('Purge data').'</h4>';
echo '<form name="db_audit" method="post" action="index.php?sec=gdbman&sec2=godmode/db/db_event">';
echo '<table width="100%" cellpadding="4" cellspacing="4" class="databox filters">
<tr><td class="datos">';
$time = get_system_time ();
$fields = array ();
$fields[$time - SECONDS_3MONTHS] = __('Purge event data over 90 days');
$fields[$time - SECONDS_1MONTH] = __('Purge event data over 30 days');
$fields[$time - SECONDS_2WEEK] = __('Purge event data over 14 days');
$fields[$time - SECONDS_1WEEK] = __('Purge event data over 7 days');
$fields[$time - (SECONDS_1WEEK * 3)] = __('Purge event data over 3 days');
$fields[$time - SECONDS_1DAY] = __('Purge event data over 1 day');
$fields[$time] = __('Purge all event data');
html_print_select ($fields, "date_purge", '', '', '', '0', false, false, false, "w255");
echo '</td><td class="datos">';
html_print_submit_button (__('Do it!'),'purgedb', false, 'class="sub wand" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;"');
echo '</td></tr></table></form>';
?>

View File

@ -1,36 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation",
"Trying to access Database Management Info");
require ("general/noaccess.php");
return;
}
require_once ($config['homedir'] . '/include/functions_graph.php');
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database information'), "images/gm_db.png", false, "", true);
echo '<h4>'.__('Module data received').'</h4>';
echo grafico_db_agentes_purge(0, 600, 400);
?>

View File

@ -1,356 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once ($config["homedir"] . '/include/functions_graph.php');
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit( "ACL Violation",
"Trying to access Database Purge Section");
include ("general/noaccess.php");
exit;
}
//id_agent = -1: None selected; id_agent = 0: All
$id_agent = (int) get_parameter_post ("agent", -1);
ui_print_page_header (__('Database maintenance') . ' &raquo; ' .
__('Database purge'), "images/gm_db.png", false, "", true);
echo grafico_db_agentes_purge($id_agent);
echo '<br /><br />';
echo '<h4>' . __('Get data from agent') . '</h4>';
// All data (now)
$time["all"] = get_system_time ();
// 1 day ago
$time["1day"] = $time["all"] - SECONDS_1DAY;
// 3 days ago
$time["3day"] = $time["all"] - SECONDS_1DAY * 3;
// 1 week ago
$time["1week"] = $time["all"] - SECONDS_1WEEK;
// 2 weeks ago
$time["2week"] = $time["all"] - SECONDS_1WEEK * 2;
// 1 month ago
$time["1month"] = $time["all"] - SECONDS_1MONTH;
// Three months ago
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
//Init data
$data["1day"] = 0;
$data["3day"] = 0;
$data["1week"] = 0;
$data["2week"] = 0;
$data["1month"] = 0;
$data["3month"] = 0;
$data["total"] = 0;
// Purge data using dates
if (isset($_POST["purgedb"])) {
$from_date = get_parameter_post ("date_purge", 0);
if ($id_agent > 0) {
echo sprintf(
__("Purge task launched for agent %s :: Data older than %s"),
agents_get_name ($id_agent), human_time_description_raw ($from_date));
echo "<h3>" .
__('Please be patient. This operation can take a long time depending on the amount of modules.') .
"</h3>";
$sql = sprintf ("SELECT id_agente_modulo
FROM tagente_modulo
WHERE id_agente = %d", $id_agent);
$result = db_get_all_rows_sql ($sql);
if (empty ($result)) {
$result = array ();
}
$errors = 0;
$affected = 0;
foreach ($result as $row) {
echo sprintf(__('Deleting records for module %s'),
modules_get_agentmodule_name ($row["id_agente_modulo"]));
echo "<br />";
flush (); //Flush here in case there are errors and the script dies, at least we know where we ended
set_time_limit (); //Reset the time limit just in case
$result = db_process_sql_delete('tagente_datos',
array('id_agente_modulo' => $row["id_agente_modulo"],
'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
else
$affected += $result;
if ($errors == 0) {
$result = db_process_sql_delete('tagente_datos_inc',
array('id_agente_modulo' => $row["id_agente_modulo"],
'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
else
$affected += $result;
}
if ($errors == 0) {
$result = db_process_sql_delete('tagente_datos_string',
array('id_agente_modulo' => $row["id_agente_modulo"],
'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
else
$affected += $result;
}
if ($errors == 0) {
$result = db_process_sql_delete('tagente_datos_log4x',
array('id_agente_modulo' => $row["id_agente_modulo"],
'utimestamp' => '< ' . $from_date));
if ($result === false)
$errors++;
else
$affected += $result;
}
}
if ($errors > 0) {
echo sprintf(__('Total errors: %s'), $errors);
echo sprintf(__('Total records deleted: %s'), $affected);
}
else {
echo sprintf(__('Total records deleted: %s'), $affected);
}
}
else {
//All agents
echo __('Deleting records for all agents');
flush ();
db_process_sql_delete('tagente_datos',
array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_inc',
array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_string',
array('utimestamp' => '< ' . $from_date));
db_process_sql_delete('tagente_datos_log4x',
array('utimestamp' => '< ' . $from_date));
}
echo "<br /><br />";
}
# Select Agent for further operations.
$agents = agents_get_group_agents (0, true);
$agents[-1] = __('Choose agent');
$agents[0] = __('All agents');
echo '<form action="index.php?sec=gdbman&sec2=godmode/db/db_purge" method="post">';
echo '<div style="width:100%;">';
html_print_select ($agents, "agent", $id_agent, "this.form.submit();", "", "", false, false, false);
ui_print_help_tip (__("Select the agent you want information about"));
echo '<noscript>';
html_print_submit_button (__('Get data'), 'purgedb_ag', false, 'class="sub upd"');
ui_print_help_tip (__("Click here to get the data from the agent specified in the select box"));
echo '</noscript><br />';
if ($id_agent > 0) {
$title = __('Information on agent %s in the database', agents_get_name ($id_agent));
}
else {
$title = __('Information on all agents in the database');
}
echo '<h4>' . $title . '</h4>';
//Flush before we do some SQL stuff
flush ();
if ($id_agent > 0) { //If the agent is not All or Not selected
$modules = agents_get_modules ($id_agent);
$query = sprintf (" AND id_agente_modulo IN (%s)", implode (",", array_keys ($modules)));
}
else {
$query = "";
}
$data["1day"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] = db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_inc
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_string
WHERE 1=1 %s", $query));
$data["1day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1day"], $query));
$data["3day"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["3day"], $query));
$data["1week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1week"], $query));
$data["2week"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["2week"], $query));
$data["1month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["1month"], $query));
$data["3month"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp > %d %s", $time["3month"], $query));
$data["total"] += db_get_sql (sprintf ("
SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE 1=1 %s", $query));
$table->width = '98%';
$table->border = 0;
$table->class = "databox";
$table->data[0][0] = __('Packets less than three months old');
$table->data[0][1] = format_numeric($data["3month"]);
$table->data[1][0] = __('Packets less than one month old');
$table->data[1][1] = format_numeric($data["1month"]);
$table->data[2][0] = __('Packets less than two weeks old');
$table->data[2][1] = format_numeric($data["2week"]);
$table->data[3][0] = __('Packets less than one week old');
$table->data[3][1] = format_numeric($data["1week"]);
$table->data[4][0] = __('Packets less than three days old');
$table->data[4][1] = format_numeric($data["3day"]);
$table->data[5][0] = __('Packets less than one day old');
$table->data[5][1] = format_numeric($data["1day"]);
$table->data[6][0] = '<strong>'.__('Total number of packets').'</strong>';
$table->data[6][1] = '<strong>'.format_numeric($data["total"]).'</strong>';
html_print_table ($table);
echo '<br />';
echo '<h4>' . __('Purge data') . '</h4>';
$table->data = array ();
$times = array ();
$times[$time["3month"]] = __('Purge data over 3 months');
$times[$time["1month"]] = __('Purge data over 1 month');
$times[$time["2week"]] = __('Purge data over 2 weeks');
$times[$time["1week"]] = __('Purge data over 1 week');
$times[$time["3day"]] = __('Purge data over 3 days');
$times[$time["1day"]] = __('Purge data over 1 day');
$times[$time["all"]] = __('All data until now');
$table->data[0][0] = html_print_select ($times, 'date_purge', '', '',
'', '', true, false, false);
$table->data[0][1] = html_print_submit_button (__('Purge'), "purgedb",
false, 'class="sub wand"', true);
html_print_table ($table);
echo '</form>';
?>

View File

@ -1,122 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation","Trying to access Database Debug Admin section");
require ("general/noaccess.php");
exit;
}
require_once($config['homedir'] . "/include/functions_agents.php");
require_once($config['homedir'] . "/include/functions_modules.php");
require_once($config['homedir'] . '/include/functions_users.php');
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database debug'), "images/gm_db.png", false, "", true);
if ((isset ($_GET["operacion"])) && (!isset ($_POST["update_agent"]))) {
// DATA COPY
if (isset ($_POST["eliminar"])) {
$max = get_parameter_post ("max", 0);
$min = get_parameter_post ("min", 0);
if ($max == $min) {
ui_print_error_message(__('Error').': '.__('Maximum is equal to minimum'));
return;
}
$origen_modulo = get_parameter_post ("origen_modulo", array ());
if (empty ($origen_modulo)) {
ui_print_success_message(__('Error').': '.__('No modules have been selected'));
return;
}
// Source (agent)
$id_origen = (int) get_parameter_post ("origen", 0);
// Copy
foreach ($origen_modulo as $id_agentemodulo) {
echo "<br /><br />".__('Filtering data module')."<b> [".modules_get_agentmodule_name ($id_agentemodulo)."]</b>";
if ($config["dbtype"] == 'oracle') {
$sql = sprintf ("DELETE FROM tagente_datos
WHERE id_agente_modulo = %d
AND (datos < TO_BINARY_DOUBLE('%s')
OR datos > TO_BINARY_DOUBLE('%s'))", $id_agentemodulo, $min, $max);
}
else {
$sql = sprintf ("DELETE FROM tagente_datos
WHERE id_agente_modulo = %d
AND (datos < '%s'
OR datos > '%s')", $id_agentemodulo, $min, $max);
}
db_process_sql ($sql);
}
} //if copy modules or alerts
echo '<br /><br />';
ui_print_success_message(__('Filtering completed'));
}
echo '<form method="post" action="index.php?sec=gdbman&sec2=godmode/db/db_refine&operacion=1">';
echo "<table width='100%' border='0' cellspacing='4' cellpadding='4' class='databox filters'>";
echo '<tr><td class="datost">';
echo '<div style="float:left; width: 250px;">';
echo '<b>'.__('Source agent').'</b><br /><br />';
$agent_selected = get_parameter_post ("origen", 0);
$agents = agents_get_group_agents (array_keys (users_get_groups ($config["id_user"], "DM")));
html_print_select ($agents, "origen", $agent_selected, 'javascript:this.form.update_agent.click();', __('No agent selected'), '0', false, false, false, '', false, 'max-width:300px !important;');
echo '&nbsp;&nbsp;';
html_print_submit_button (__('Get Info'), 'update_agent', false, 'style="display:none;"');
echo '<br /><br />';
echo '<b>'.__('Modules').'</b><br /><br />';
$module_selected = get_parameter_post ("origen", array ());
$modules = agents_get_modules ($module_selected, false, 'delete_pending != 1');
html_print_select ($modules, "origen_modulo[]", $module_selected, '', '', '0', false, true, false, '', false, 'max-width: 300px !important;');
echo '</div>'; //Left div
echo '<div style="float:left; width:\'98%\'; margin-left:20% ">
<b>'.__('Purge data out of these limits').'</b><br /><br />';
echo '<table><tr><td>';
echo __('Minimum').': ';
echo '</td><td>';
html_print_input_text ("min", 0, __('Minimum'), 4, 0, false);
echo '</td></tr>';
echo '<tr><td>';
echo __('Maximum').': ';
echo '</td><td>';
html_print_input_text ("max", 0, __('Maximum'), 4, 0, false);
echo '</td></tr>';
echo '</table>';
echo '</div>';
echo '<div style="clear:both;">&nbsp;</div>';
html_print_submit_button (__('Delete'), 'eliminar', false, 'class="sub delete" onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;"');
echo '</td></tr></table>';
?>

View File

@ -600,7 +600,7 @@ $(document).ready (function () {
var params = { var params = {
"page" : "operation/agentes/ver_agente", "page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1, "get_agent_modules_json" : 1,
"get_id_and_name" : 1, "get_distinct_name" : 1,
"indexed" : 0, "indexed" : 0,
"privilege" : "AW" "privilege" : "AW"
}; };
@ -799,7 +799,6 @@ $(document).ready (function () {
var others = true; var others = true;
} }
if(any && others){ if(any && others){
document.forms["form_modules"].agents[i].selected = false;
document.forms["form_modules"].agents[0].selected = false; document.forms["form_modules"].agents[0].selected = false;
} }
} }
@ -815,7 +814,6 @@ $(document).ready (function () {
var others = true; var others = true;
} }
if(any && others){ if(any && others){
document.forms["form_modules"].module[i].selected = false;
document.forms["form_modules"].module[0].selected = false; document.forms["form_modules"].module[0].selected = false;
} }
} }

View File

@ -741,7 +741,7 @@ $(document).ready (function () {
var params = { var params = {
"page" : "operation/agentes/ver_agente", "page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1, "get_agent_modules_json" : 1,
"get_id_and_name" : 1, "get_distinct_name" : 1,
"indexed" : 0 "indexed" : 0
}; };
@ -1098,7 +1098,6 @@ $(document).ready (function () {
var others = true; var others = true;
} }
if(any && others){ if(any && others){
document.forms["form_edit"].agents[i].selected = false;
document.forms["form_edit"].agents[0].selected = false; document.forms["form_edit"].agents[0].selected = false;
} }
} }
@ -1114,7 +1113,6 @@ $(document).ready (function () {
var others = true; var others = true;
} }
if(any && others){ if(any && others){
document.forms["form_edit"].module[i].selected = false;
document.forms["form_edit"].module[0].selected = false; document.forms["form_edit"].module[0].selected = false;
} }
} }

View File

@ -304,17 +304,16 @@ if (check_acl ($config['id_user'], 0, "PM") || check_acl ($config['id_user'], 0,
$sub["godmode/setup/news"]["id"] = 'Site news'; $sub["godmode/setup/news"]["id"] = 'Site news';
$sub["godmode/setup/file_manager"]["text"] = __('File manager'); $sub["godmode/setup/file_manager"]["text"] = __('File manager');
$sub["godmode/setup/file_manager"]["id"] = 'File manager'; $sub["godmode/setup/file_manager"]["id"] = 'File manager';
}
if(is_user_admin($config['id_user'])){ if(is_user_admin($config['id_user'])){
$sub["gdbman"]["text"] = __('Admin tools'); $sub["extensions/db_status"]["text"] = __('DB Schema Check');
$sub["gdbman"]["id"] = 'DB maintenance'; $sub["extensions/db_status"]["id"] = 'DB Schema Check';
$sub["gdbman"]["type"] = "direct"; $sub["extensions/db_status"]["sec"] = "gbman";
$sub["gdbman"]["subtype"] = "nolink"; $sub["extensions/dbmanager"]["text"] = __('DB Interface');
$sub["extensions/dbmanager"]["id"] = 'DB Interface';
$sub["extensions/dbmanager"]["sec"] = "gbman";
}
$sub2 = array ();
$sub["gdbman"]["sub2"] = $sub2;
} }
$menu_godmode["gextensions"]["sub"] = $sub; $menu_godmode["gextensions"]["sub"] = $sub;
@ -337,14 +336,10 @@ if (is_array ($config['extensions'])) {
continue; continue;
} }
if($extension['godmode_menu']['name'] != 'DB Schema check' && $extension['godmode_menu']['name'] != 'DB interface'){
$extmenu = $extension['godmode_menu']; $extmenu = $extension['godmode_menu'];
if ($extmenu["name"] == 'DB interface' && !is_user_admin($config['id_user'])) {
continue;
}
if ($extmenu["name"] == 'DB Schema check' && !is_user_admin($config['id_user'])) {
continue;
} }
//Check the ACL for this user //Check the ACL for this user
@ -363,6 +358,9 @@ if (is_array ($config['extensions'])) {
if (strlen($extmenu['fatherId']) > 0) { if (strlen($extmenu['fatherId']) > 0) {
if (array_key_exists('subfatherId',$extmenu)) { if (array_key_exists('subfatherId',$extmenu)) {
if (strlen($extmenu['subfatherId']) > 0) { if (strlen($extmenu['subfatherId']) > 0) {
if($extmenu['name'] = "DB schema check"){
}
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]["text"] = __($extmenu['name']); $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]["text"] = __($extmenu['name']);
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]["id"] = $extmenu['name']; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]["id"] = $extmenu['name'];
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]["refr"] = 0; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['subfatherId']]['sub2'][$extmenu['sec2']]["refr"] = 0;

View File

@ -473,8 +473,8 @@ $next_row++;
.attr("id", "legend_normal") .attr("id", "legend_normal")
.attr("x", 72) .attr("x", 72)
.attr("y", -30) .attr("y", -30)
.attr("width", 10) .attr("width", '10px')
.attr("height", 10) .attr("height", '10px')
.style("fill", "#82B92E"); .style("fill", "#82B92E");
//legend Warning text //legend Warning text

View File

@ -46,6 +46,9 @@ $delete_layout = (bool) get_parameter ('delete_layout');
$refr = (int) get_parameter('refr', $config['vc_refr']); $refr = (int) get_parameter('refr', $config['vc_refr']);
$offset = (int) get_parameter('offset', 0); $offset = (int) get_parameter('offset', 0);
$pagination = (int) get_parameter ("pagination", $config["block_size"]); $pagination = (int) get_parameter ("pagination", $config["block_size"]);
$search = (string) get_parameter("search","");
$ag_group = (int)get_parameter("ag_group",0);
$recursion = get_parameter("recursion",0);
if ($delete_layout || $copy_layout) { if ($delete_layout || $copy_layout) {
// Visual console required // Visual console required
@ -199,6 +202,50 @@ if ($delete_layout || $copy_layout) {
} }
} }
if ($ag_group > 0) {
$ag_groups = array();
$ag_groups = (array)$ag_group;
if ($recursion) {
$ag_groups = groups_get_id_recursive($ag_group, true);
}
}
echo "<table class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'>
<tr>";
if(!is_metaconsole()){
echo "<form method='post'
action='index.php?sec=network&amp;sec2=godmode/reporting/map_builder'>";
} else {
echo "<form method='post'
action='index.php?sec=screen&sec2=screens/screens&action=visualmap'>";
}
echo "<td style='width:33%;'>";
echo __('Search') . '&nbsp;';
html_print_input_text ("search", $search, '', 50);
echo "</td>";
echo "<td style='width:25%;'>";
echo __('Group') . '&nbsp;';
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
html_print_select_groups(false, "AR", $return_all_group, "ag_group", $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false);
echo "<td style='width:25%;'>";
echo __('Group Recursion') . '&nbsp;';
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
echo "</td><td style='width:22%;'>";
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
echo "</form>";
echo "</td>";
echo "</tr></table>";
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
@ -228,31 +275,69 @@ $table->align[4] = 'left';
// or has "VR" privileges, otherwise show only maps of user group // or has "VR" privileges, otherwise show only maps of user group
$filters['offset'] = $offset; $filters['offset'] = $offset;
$filters['limit'] = $pagination; $filters['limit'] = $pagination;
if(!empty($search)){
$filters['name'] = io_safe_input($search);
}
if($ag_group){
$filters['group'] = array_flip($ag_groups);
}
$own_info = get_user_info ($config['id_user']); $own_info = get_user_info ($config['id_user']);
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
$url = 'index.php?sec=network&amp;sec2=godmode/reporting/map_builder&pagination='.$pagination; $url = 'index.php?sec=network&amp;sec2=godmode/reporting/map_builder&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination;
} }
else { else {
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pagination='.$pagination; $url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination;
} }
if ($own_info['is_admin'] || $vconsoles_read) { if ($own_info['is_admin'] || $vconsoles_read) {
if($ag_group){
$maps = visual_map_get_user_layouts (0,false,$filters,false);
unset($filters['offset']);
unset($filters['limit']);
$total_maps = count(visual_map_get_user_layouts(0,false,$filters,false));
}else{
$maps = visual_map_get_user_layouts (0,false,$filters); $maps = visual_map_get_user_layouts (0,false,$filters);
$total_maps = count(visual_map_get_user_layouts()); unset($filters['offset']);
unset($filters['limit']);
$total_maps = count(visual_map_get_user_layouts(0,false,$filters));
}
} }
else { else {
$maps = visual_map_get_user_layouts ($config['id_user'], false, $maps = visual_map_get_user_layouts ($config['id_user'], false,
$filters, false); $filters, false);
unset($filters['offset']);
unset($filters['limit']);
$total_maps = count(visual_map_get_user_layouts ($config['id_user'], false, $total_maps = count(visual_map_get_user_layouts ($config['id_user'], false,
false, false)); $filters, false));
} }
if (!$maps && !is_metaconsole()) { if (!$maps && !is_metaconsole()) {
$total = count(visual_map_get_user_layouts ($config['id_user'], false,
false, false));
if(!$total){
require_once ($config['homedir'] . "/general/firts_task/map_builder.php"); require_once ($config['homedir'] . "/general/firts_task/map_builder.php");
} else {
ui_print_info_message(
array(
'no_close'=>false,
'message'=> __('No available data to show')));
}
} }
elseif (!$maps && is_metaconsole()) { elseif (!$maps && is_metaconsole()) {
$total = count(visual_map_get_user_layouts ($config['id_user'], false,
false, false));
if(!$total){
ui_print_info_message( ui_print_info_message(
array( array(
'no_close'=>true, 'no_close'=>true,
'message'=> __('There are no visual console defined yet.'))); 'message'=> __('There are no visual console defined yet.')));
}else{
ui_print_info_message(
array(
'no_close'=>false,
'message'=> __('No available data to show')));
}
} }
else { else {
ui_pagination ($total_maps, $url, $offset, $pagination); ui_pagination ($total_maps, $url, $offset, $pagination);

View File

@ -911,6 +911,9 @@ You can of course remove the warnings, that's why we include the source and do n
elseif(check_acl ($config['id_user'], 0, "RM")) elseif(check_acl ($config['id_user'], 0, "RM"))
html_print_select_groups($config['id_user'], html_print_select_groups($config['id_user'],
"RM", true, 'combo_group', $group, ''); "RM", true, 'combo_group', $group, '');
echo "&nbsp;&nbsp;&nbsp;".__('Recursion').html_print_checkbox('recursion', 1, 0, true);
?> ?>
</td> </td>
</tr> </tr>
@ -1079,7 +1082,6 @@ You can of course remove the warnings, that's why we include the source and do n
} }
} }
} }
// html_debug($agents);
html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px"); html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px");
?> ?>
</td> </td>
@ -2002,7 +2004,38 @@ $(document).ready (function () {
"get_agents_group_json" : 1, "get_agents_group_json" : 1,
"id_group" : this.value, "id_group" : this.value,
"privilege" : "AW", "privilege" : "AW",
"keys_prefix" : "_" "keys_prefix" : "_",
"recursion" : $('#checkbox-recursion').is(':checked')
},
function (data, status) {
$("#id_agents").html('');
$("#id_agents2").html('');
$("#module").html('');
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
id = id.substring(1);
option = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["alias"]);
$("#id_agents").append (option);
$("#id_agents2").append (option);
});
},
"json"
);
}
);
$("#checkbox-recursion").change (
function () {
jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1,
"id_group" : $("#combo_group").val(),
"privilege" : "AW",
"keys_prefix" : "_",
"recursion" : $('#checkbox-recursion').is(':checked')
}, },
function (data, status) { function (data, status) {
$("#id_agents").html(''); $("#id_agents").html('');

View File

@ -1,3 +1,37 @@
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true);
$('.check_delete').each(function(){
$('.massive_report_form_elements').prop("disabled", false);
});
}
else {
$(".check_delete").prop("checked", false);
$('.check_delete').each(function(){
$('.massive_report_form_elements').prop("disabled", true);
});
}
}
$( document ).ready(function() {
$('.check_delete').click(function(){
$('.check_delete').each(function(){
if($(this).prop( "checked" )){
$('#hidden-id_report_'+$(this).val()).prop("disabled", false);
}
else{
$('#hidden-id_report_'+$(this).val()).prop("disabled", true);
}
});
});
});
</script>
<?php <?php
// Pandora FMS - http://pandorafms.com // Pandora FMS - http://pandorafms.com
// ================================================== // ==================================================
@ -564,7 +598,8 @@ switch ($action) {
$next++; $next++;
if(!defined('METACONSOLE')) if(!defined('METACONSOLE'))
$table->head[$next] = '<span title="Operations">' . $table->head[$next] = '<span title="Operations">' .
__('Op.') . '</span>'; __('Op.') . '</span>'.html_print_checkbox('all_delete', 0, false, true, false,
'check_all_checkboxes();');
//$table->size = array (); //$table->size = array ();
$table->size[$next] = '10%'; $table->size[$next] = '10%';
@ -703,9 +738,13 @@ switch ($action) {
$data[$next] .= '<form method="post" style="display:inline;" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">'; $data[$next] .= '<form method="post" style="display:inline;" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true);
$data[$next] .= html_print_input_hidden ('action','delete_report', true); $data[$next] .= html_print_input_hidden ('action','delete_report', true);
$data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, '', $data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, 'margin-right: 10px;',
true, array ('title' => __('Delete'))); true, array ('title' => __('Delete')));
$data[$next] .= html_print_checkbox_extended ('massive_report_check', $report['id_report'], false, false, '', 'class="check_delete"', true);
$data[$next] .= '</form>'; $data[$next] .= '</form>';
} }
} }
@ -733,8 +772,19 @@ switch ($action) {
else else
echo '<div class="action-buttons" style="width: 100%;">'; echo '<div class="action-buttons" style="width: 100%;">';
html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"');
echo "</div>";
echo "</form>"; echo "</form>";
echo '<form style="display:inline;" id="massive_report_form" method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=delete">';
foreach ($reports as $report) {
echo '<input class="massive_report_form_elements" id="hidden-id_report_'.$report['id_report'].'" name="id_report[]" type="hidden" disabled value="'.$report['id_report'].'">';
}
echo '<input id="hidden-action" name="action" type="hidden" value="delete_report">';
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete" style="margin-left:5px;"');
echo '</form>';
echo "</div>";
} }
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
@ -2059,3 +2109,4 @@ switch ($activeTab) {
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?> ?>

View File

@ -202,6 +202,22 @@ echo "</form>";
$(document).ready (function () { $(document).ready (function () {
var metaconsole = null;
function is_metaconsole() {
if (metaconsole === null)
metaconsole = $("input[name='metaconsole']").val();
if (metaconsole != 0)
return true;
else
return false;
}
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
$("#modsize").click(function(event){ $("#modsize").click(function(event){
event.preventDefault(); event.preventDefault();
@ -260,7 +276,7 @@ $(document).ready (function () {
} }
else{ else{
original_image=new Image(); original_image=new Image();
original_image.src='images/console/background/'+$('#background').val(); original_image.src= url_hack_metaconsole + 'images/console/background/'+$('#background').val();
if (parseInt(original_image.width) < 1024){ if (parseInt(original_image.width) < 1024){
alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px'); alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px');
$('input[name=width]').val('1024'); $('input[name=width]').val('1024');
@ -310,7 +326,7 @@ $(document).ready (function () {
var size_changer_state = false; var size_changer_state = false;
$("#background").change(function() { $("#background").change(function() {
$('#imagen2').attr('src','images/console/background/'+$('#background').val()); $('#imagen2').attr('src', url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('#imagen2').width(230); $('#imagen2').width(230);
$('#imagen2').show(); $('#imagen2').show();
}); });
@ -323,7 +339,7 @@ $(document).ready (function () {
$("#background").mouseout(function() { $("#background").mouseout(function() {
if(size_changer_state){ if(size_changer_state){
$('#imagen').attr('src','images/console/background/'+$('#background').val()); $('#imagen').attr('src',url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('input[name=width]').val($('#imagen').width()); $('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height()); $('input[name=height]').val($('#imagen').height());
$('#preimagew').html($('#imagen').width()); $('#preimagew').html($('#imagen').width());

View File

@ -127,21 +127,15 @@ function visual_map_main() {
// Begin - Background label color changer // Begin - Background label color changer
$( "#text-label_ifr" ).contents().find( "body" ).bind("contextmenu", function(e) { $( "#text-label_ifr" ).contents().find( "body" ).bind('mousewheel', function(e){
e.preventDefault(); e.preventDefault();
});
$( "#text-label_ifr" ).contents().find( "body" ).mousedown(function(e){
if(e.which == 3)
{
if($( "#text-label_ifr" ).contents().find( "body" ).css('background-color') == 'rgb(211, 211, 211)'){ if($( "#text-label_ifr" ).contents().find( "body" ).css('background-color') == 'rgb(211, 211, 211)'){
$( "#text-label_ifr" ).contents().find( "body" ).css('background-color','white'); $( "#text-label_ifr" ).contents().find( "body" ).css('background-color','white');
} }
else{ else{
$( "#text-label_ifr" ).contents().find( "body" ).css('background-color','lightgray'); $( "#text-label_ifr" ).contents().find( "body" ).css('background-color','lightgray');
} }
}
}); });
// End - Background label color changer // End - Background label color changer
@ -383,6 +377,12 @@ function update_button_palette_callback() {
if (values['type_percentile'] == 'bubble') { if (values['type_percentile'] == 'bubble') {
setPercentileBubble(idItem, values); setPercentileBubble(idItem, values);
} }
else if (values['type_percentile'] == 'circular_progress_bar') {
setPercentileCircular(idItem, values);
}
else if (values['type_percentile'] == 'interior_circular_progress_bar') {
setPercentileInteriorCircular(idItem, values);
}
else { else {
setPercentileBar(idItem, values); setPercentileBar(idItem, values);
} }
@ -424,6 +424,17 @@ function update_button_palette_callback() {
$("#image_" + idItem).attr("src", "images/spinner.gif"); $("#image_" + idItem).attr("src", "images/spinner.gif");
setModuleGraph(idItem); setModuleGraph(idItem);
break; break;
case 'bars_graph':
if($('input[name=width_percentile]').val() == ''){
alert('Undefined width');
return false;
}
$("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif");
setBarsGraph(idItem, values);
break;
case 'auto_sla_graph': case 'auto_sla_graph':
if($('input[name=width]').val() == ''){ if($('input[name=width]').val() == ''){
alert('Undefined width'); alert('Undefined width');
@ -438,14 +449,12 @@ function update_button_palette_callback() {
setEventsBar(idItem, values); setEventsBar(idItem, values);
break; break;
case 'donut_graph':
$("#image_" + idItem).attr("src", "images/spinner.gif");
setDonutsGraph(idItem, values);
break;
case 'simple_value': case 'simple_value':
//checkpoint
// if(($('#text-label_ifr').contents().find('#tinymce p').html() == '_VALUE_' ||
// $('#text-label_ifr').contents().find('#tinymce').html() == '_VALUE_')
// && $('#data_image_check').html() != 'On'){
// alert('_VALUE_ exactly value is only enable for data image. Please change label text or select a data image module.');
// return;
// }
$("#" + idItem).html(values['label']); $("#" + idItem).html(values['label']);
if( (values['label'].replace( /<.*?>/g, '' ) != '_VALUE_') if( (values['label'].replace( /<.*?>/g, '' ) != '_VALUE_')
&& (values['label'].replace( /<.*?>/g, '' ) != '(_VALUE_)') ){ && (values['label'].replace( /<.*?>/g, '' ) != '(_VALUE_)') ){
@ -460,12 +469,7 @@ function update_button_palette_callback() {
$("#" + idItem).html( $("#" + idItem).html(
'<table><tbody><tr><td></td></tr><tr><td><span style="" id="text_21" class="text">'+values["label"]+'</span></td></tr><tr><td></td></tr></tbody></table>' '<table><tbody><tr><td></td></tr><tr><td><span style="" id="text_21" class="text">'+values["label"]+'</span></td></tr><tr><td></td></tr></tbody></table>'
) )
} }
//$("#simplevalue_" + idItem)
//.html($('<img></img>').attr('src', "images/spinner.gif"));
setModuleValue(idItem,values['process_simple_value'], values['period'],values['width']); setModuleValue(idItem,values['process_simple_value'], values['period'],values['width']);
break; break;
case 'label': case 'label':
@ -612,9 +616,6 @@ function readFields() {
values['process_simple_value'] = $("select[name=process_value]").val(); values['process_simple_value'] = $("select[name=process_value]").val();
values['background'] = $("#background_image").val(); values['background'] = $("#background_image").val();
values['period'] = undefined != $("#hidden-period").val() ? $("#hidden-period").val() : $("#period").val(); values['period'] = undefined != $("#hidden-period").val() ? $("#hidden-period").val() : $("#period").val();
if (values['period'] == null) {
values['period'] = undefined != $("#hidden-period").val() ? $("#hidden-period").val() : $("#period_select").val();
}
values['width'] = $("input[name=width]").val(); values['width'] = $("input[name=width]").val();
values['width_data_image'] = $("#data_image_width").val(); values['width_data_image'] = $("#data_image_width").val();
if(selectedItem == 'simple_value' || creationItem == 'simple_value'){ if(selectedItem == 'simple_value' || creationItem == 'simple_value'){
@ -623,6 +624,7 @@ function readFields() {
} }
} }
values['height'] = $("input[name=height]").val(); values['height'] = $("input[name=height]").val();
values['bars_graph_type'] = $("select[name=bars_graph_type]").val();
values['parent'] = $("select[name=parent]").val(); values['parent'] = $("select[name=parent]").val();
values['map_linked'] = $("select[name=map_linked]").val(); values['map_linked'] = $("select[name=map_linked]").val();
values['width_percentile'] = $("input[name=width_percentile]").val(); values['width_percentile'] = $("input[name=width_percentile]").val();
@ -630,8 +632,12 @@ function readFields() {
values['width_module_graph'] = $("input[name=width_module_graph]").val(); values['width_module_graph'] = $("input[name=width_module_graph]").val();
values['height_module_graph'] = $("input[name=height_module_graph]").val(); values['height_module_graph'] = $("input[name=height_module_graph]").val();
values['event_max_time_row'] = $("select[name=event_max_time_row]").val(); values['event_max_time_row'] = $("select[name=event_max_time_row]").val();
values['type_percentile'] = $("input[name=type_percentile]:checked").val(); values['type_percentile'] = $("select[name=type_percentile]").val();
values['value_show'] = $("input[name=value_show]:checked").val(); values['percentile_color'] = $("input[name=percentile_color]").val();
values['percentile_label_color'] = $("input[name=percentile_label_color]").val();
values['percentile_label'] = $("input[name=percentile_label]").val();
values['value_show'] = $("select[name=value_show]").val();
values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0;
values['id_group'] = $("select[name=group]").val(); values['id_group'] = $("select[name=group]").val();
values['id_custom_graph'] = parseInt( values['id_custom_graph'] = parseInt(
@ -709,8 +715,10 @@ function create_button_palette_callback() {
alert($("#message_alert_no_agent").html()); alert($("#message_alert_no_agent").html());
validate = false; validate = false;
} }
if ((values['module'] == 0)) { break;
alert($("#message_alert_no_module").html()); case 'donut_graph':
if ((values['agent'] == '')) {
alert($("#message_alert_no_agent").html());
validate = false; validate = false;
} }
break; break;
@ -781,6 +789,16 @@ function create_button_palette_callback() {
} }
} }
break; break;
case 'bars_graph':
if ((values['agent'] == '')) {
alert($("#message_alert_no_agent").html());
validate = false;
}
if ((values['module'] == 0)) {
alert($("#message_alert_no_module").html());
validate = false;
}
break;
case 'simple_value': case 'simple_value':
if ((values['agent'] == '')) { if ((values['agent'] == '')) {
alert($("#message_alert_no_agent").html()); alert($("#message_alert_no_agent").html());
@ -982,6 +1000,7 @@ function toggle_item_palette() {
activeToolboxButton('static_graph', true); activeToolboxButton('static_graph', true);
activeToolboxButton('module_graph', true); activeToolboxButton('module_graph', true);
activeToolboxButton('bars_graph', true);
activeToolboxButton('simple_value', true); activeToolboxButton('simple_value', true);
activeToolboxButton('label', true); activeToolboxButton('label', true);
activeToolboxButton('icon', true); activeToolboxButton('icon', true);
@ -990,6 +1009,7 @@ function toggle_item_palette() {
activeToolboxButton('box_item', true); activeToolboxButton('box_item', true);
activeToolboxButton('line_item', true); activeToolboxButton('line_item', true);
activeToolboxButton('auto_sla_graph', true); activeToolboxButton('auto_sla_graph', true);
activeToolboxButton('donut_graph', true);
if (typeof(enterprise_activeToolboxButton) == 'function') { if (typeof(enterprise_activeToolboxButton) == 'function') {
enterprise_activeToolboxButton(true); enterprise_activeToolboxButton(true);
@ -1009,7 +1029,9 @@ function toggle_item_palette() {
activeToolboxButton('static_graph', false); activeToolboxButton('static_graph', false);
activeToolboxButton('module_graph', false); activeToolboxButton('module_graph', false);
activeToolboxButton('bars_graph', false);
activeToolboxButton('auto_sla_graph', false); activeToolboxButton('auto_sla_graph', false);
activeToolboxButton('donut_graph', false);
activeToolboxButton('simple_value', false); activeToolboxButton('simple_value', false);
activeToolboxButton('label', false); activeToolboxButton('label', false);
activeToolboxButton('icon', false); activeToolboxButton('icon', false);
@ -1282,16 +1304,21 @@ function loadFieldsFromDB(item) {
$("input[name=width_module_graph]").val(val); $("input[name=width_module_graph]").val(val);
if (key == 'height_module_graph') if (key == 'height_module_graph')
$("input[name=height_module_graph]").val(val); $("input[name=height_module_graph]").val(val);
if (key == 'bars_graph_type')
if (key == 'type_percentile') { $("select[name=bars_graph_type]").val(val);
if (val == 'percentile') { if (key == 'type_percentile')
$("input[name=type_percentile][value=percentile]") $("select[name=type_percentile]").val(val);
.attr("checked", "checked"); if (key == 'percentile_label')
} $("input[name=percentile_label]").val(val);
else { if (key == 'percentile_color') {
$("input[name=type_percentile][value=bubble]") $("input[name=percentile_color]").val(val);
.attr("checked", "checked"); $("#percentile_item_row_5 .ColorPickerDivSample")
.css('background-color', val);
} }
if (key == 'percentile_label_color') {
$("input[name=percentile_label_color]").val(val);
$("#percentile_item_row_6 .ColorPickerDivSample")
.css('background-color', val);
} }
if (key == 'value_show') { if (key == 'value_show') {
@ -1527,6 +1554,15 @@ function hiddenFields(item) {
$("#percentile_item_row_4").css('display', 'none'); $("#percentile_item_row_4").css('display', 'none');
$("#percentile_item_row_4." + item).css('display', ''); $("#percentile_item_row_4." + item).css('display', '');
$("#percentile_item_row_5").css('display', 'none');
$("#percentile_item_row_5." + item).css('display', '');
$("#percentile_item_row_6").css('display', 'none');
$("#percentile_item_row_6." + item).css('display', '');
$("#percentile_bar_row_7").css('display', 'none');
$("#percentile_bar_row_7." + item).css('display', '');
$("#period_row").css('display', 'none'); $("#period_row").css('display', 'none');
$("#period_row." + item).css('display', ''); $("#period_row." + item).css('display', '');
@ -1542,6 +1578,9 @@ function hiddenFields(item) {
$("#module_graph_size_row").css('display', 'none'); $("#module_graph_size_row").css('display', 'none');
$("#module_graph_size_row." + item).css('display', ''); $("#module_graph_size_row." + item).css('display', '');
$("#bars_graph_type").css('display', 'none');
$("#bars_graph_type." + item).css('display', '');
$("#background_color").css('display', 'none'); $("#background_color").css('display', 'none');
$("#background_color." + item).css('display', ''); $("#background_color." + item).css('display', '');
@ -1616,6 +1655,11 @@ function cleanFields(item) {
$("input[name='fill_color']").val('#ffffff'); $("input[name='fill_color']").val('#ffffff');
$("input[name='line_width']").val(3); $("input[name='line_width']").val(3);
$("input[name='line_color']").val('#000000'); $("input[name='line_color']").val('#000000');
$("select[name=type_percentile]").val('');
$("input[name=percentile_color]").val('');
$("input[name=percentile_label_color]").val('');
$("input[name=percentile_label]").val('');
$(".ColorPickerDivSample").css('background-color', '#FFF');
$("#preview").empty(); $("#preview").empty();
@ -1758,6 +1802,60 @@ function set_image(type, idElement, image) {
}); });
} }
function setBarsGraph(id_data, values) {
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
width_percentile = values['width_percentile'];
parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_type_string"});
parameter.push ({name: "id_agent", value: values['id_agent']});
parameter.push ({name: "module", value: values['module']});
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "id_visual_console", value: id_visual_console});
jQuery.ajax({
url: get_url_ajax(),
data: parameter,
type: "POST",
dataType: 'json',
success: function (data) {
if (data['no_data'] == true) {
if (values['width_percentile'] == "0") {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png');
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png');
$("#" + id_data + " img").css('width', width_percentile + 'px');
$("#" + id_data + " img").css('height', width_percentile + 'px');
}
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png');
if (values['width_percentile'] == "0") {
// Image size
}
else{
$("#" + id_data + " img").css('width', width_percentile+'px');
$("#" + id_data + " img").css('height', width_percentile+'px');
}
}
if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){
$('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2);
}
else{
$('#'+id_data+ ' img').css('margin-left', parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2);
}
}
});
}
function setModuleGraph(id_data) { function setModuleGraph(id_data) {
var parameter = Array(); var parameter = Array();
@ -1933,7 +2031,7 @@ function setPercentileBar(id_data, values) {
$("#"+ id_data).attr('src', img); $("#"+ id_data).attr('src', img);
$("#" + id_data + " img").attr('src', 'images/console/signes/percentil.png'); $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/percentil.png');
if($('#text-width_percentile').val() == 0){ if($('#text-width_percentile').val() == 0){
$("#" + id_data + " img").css('width', '130px'); $("#" + id_data + " img").css('width', '130px');
} }
@ -1956,6 +2054,142 @@ function setPercentileBar(id_data, values) {
}); });
} }
function setPercentileCircular (id_data, values) {
metaconsole = $("input[name='metaconsole']").val();
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
max_percentile = values['max_percentile'];
width_percentile = values['width_percentile'];
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "value_show", value: values['value_show']});
parameter.push ({name: "id_visual_console",
value: id_visual_console});
jQuery.ajax({
url: get_url_ajax(),
data: parameter,
type: "POST",
dataType: 'json',
success: function (data) {
module_value = data['value'];
max_percentile = data['max_percentile'];
width_percentile = data['width_percentile'];
unit_text = false;
if ((data['unit_text'] != false) || typeof(data['unit_text']) != 'boolean') {
unit_text = data['unit_text'];
}
colorRGB = data['colorRGB'];
if ( max_percentile > 0)
var percentile = Math.round(module_value / max_percentile * 100);
else
var percentile = 100;
if (unit_text == false && typeof(unit_text) == 'boolean') {
value_text = percentile + "%";
}
else {
value_text = module_value + " " + unit_text;
}
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/circular-progress-bar.png');
if($('#text-width_percentile').val() == 0){
$("#" + id_data + " img").css('width', '130px');
$("#" + id_data + " img").css('height', '130px');
}
else{
$("#" + id_data + " img").css('width', $('#text-width_percentile').val()+'px');
$("#" + id_data + " img").css('height', $('#text-width_percentile').val()+'px');
}
if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){
$('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2);
}
else{
$('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2);
}
}
});
}
function setPercentileInteriorCircular (id_data, values) {
metaconsole = $("input[name='metaconsole']").val();
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
max_percentile = values['max_percentile'];
width_percentile = values['width_percentile'];
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "value_show", value: values['value_show']});
parameter.push ({name: "id_visual_console",
value: id_visual_console});
jQuery.ajax({
url: get_url_ajax(),
data: parameter,
type: "POST",
dataType: 'json',
success: function (data) {
module_value = data['value'];
max_percentile = data['max_percentile'];
width_percentile = data['width_percentile'];
unit_text = false;
if ((data['unit_text'] != false) || typeof(data['unit_text']) != 'boolean') {
unit_text = data['unit_text'];
}
colorRGB = data['colorRGB'];
if ( max_percentile > 0)
var percentile = Math.round(module_value / max_percentile * 100);
else
var percentile = 100;
if (unit_text == false && typeof(unit_text) == 'boolean') {
value_text = percentile + "%";
}
else {
value_text = module_value + " " + unit_text;
}
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/circular-progress-bar-interior.png');
if($('#text-width_percentile').val() == 0){
$("#" + id_data + " img").css('width', '130px');
$("#" + id_data + " img").css('height', '130px');
}
else{
$("#" + id_data + " img").css('width', $('#text-width_percentile').val()+'px');
$("#" + id_data + " img").css('height', $('#text-width_percentile').val()+'px');
}
if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){
$('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2);
}
else{
$('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2);
}
}
});
}
function setEventsBar(id_data, values) { function setEventsBar(id_data, values) {
var url_hack_metaconsole = ''; var url_hack_metaconsole = '';
if (is_metaconsole()) { if (is_metaconsole()) {
@ -2005,6 +2239,53 @@ function setEventsBar(id_data, values) {
}); });
} }
function setDonutsGraph (id_data, values) {
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
width_percentile = values['width_percentile'];
parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_type_string"});
parameter.push ({name: "id_agent", value: values['id_agent']});
parameter.push ({name: "module", value: values['module']});
parameter.push ({name: "id_element", value: id_data});
parameter.push ({name: "id_visual_console", value: id_visual_console});
jQuery.ajax({
url: get_url_ajax(),
data: parameter,
type: "POST",
dataType: 'json',
success: function (data) {
if (data['no_data'] == true) {
if (values['width'] == "0") {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/wrong_donut_graph.png');
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/wrong_donut_graph.png');
$("#" + id_data + " img").css('width', width_percentile + 'px');
$("#" + id_data + " img").css('height', width_percentile + 'px');
}
}
else {
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/donut-graph.png');
if($('#text-width').val() == 0 || $('#text-height').val() == 0){
// Image size
}
else{
$("#" + id_data + " img").css('width', $('#text-width_percentile').val()+'px');
$("#" + id_data + " img").css('height', $('#text-width_percentile').val()+'px');
}
}
}
});
}
function setPercentileBubble(id_data, values) { function setPercentileBubble(id_data, values) {
metaconsole = $("input[name='metaconsole']").val(); metaconsole = $("input[name='metaconsole']").val();
@ -2056,7 +2337,7 @@ function setPercentileBubble(id_data, values) {
$("#image_" + id_data).attr('src', img); $("#image_" + id_data).attr('src', img);
$("#" + id_data + " img").attr('src', 'images/console/signes/percentil_bubble.png'); $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/percentil_bubble.png');
if($('#text-width_percentile').val() == 0){ if($('#text-width_percentile').val() == 0){
@ -2363,6 +2644,16 @@ function createItem(type, values, id_data) {
setEventsBar(id_data, values); setEventsBar(id_data, values);
break; break;
case 'donut_graph':
var sizeStyle = '';
var imageSize = '';
item = $('<div id="' + id_data + '" class="item donut_graph" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'</div>'
);
setDonutsGraph(id_data, values);
break;
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
var sizeStyle = ''; var sizeStyle = '';
@ -2404,9 +2695,77 @@ function createItem(type, values, id_data) {
setPercentileBar(id_data, values); setPercentileBar(id_data, values);
} }
else if (values['type_percentile'] == 'circular_progress_bar') {
if(values['label_position'] == 'up'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'</div>'
);
}
else if(values['label_position'] == 'down'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
else if(values['label_position'] == 'right'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" style="float:left;" />' +
'<table style="float:left;height:'+values['height']+'px"><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
else if(values['label_position'] == 'left'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" style="float:right;"/>' +
'<table style="float:left;height:'+values['height']+'px"><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
setPercentileCircular(id_data, values);
}
else if (values['type_percentile'] == 'interior_circular_progress_bar') {
if(values['label_position'] == 'up'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'</div>'
);
}
else if(values['label_position'] == 'down'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
else if(values['label_position'] == 'right'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" style="float:left;" />' +
'<table style="float:left;height:'+values['height']+'px"><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
else if(values['label_position'] == 'left'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" style="float:right;"/>' +
'<table style="float:left;height:'+values['height']+'px"><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
setPercentileInteriorCircular(id_data, values);
}
else { else {
if(values['label_position'] == 'up'){ if(values['label_position'] == 'up'){
item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' + item = $('<div id="' + id_data + '" class="item percentile_item" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' + '<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
@ -2474,6 +2833,42 @@ function createItem(type, values, id_data) {
setModuleGraph(id_data); setModuleGraph(id_data);
break; break;
case 'bars_graph':
sizeStyle = '';
imageSize = '';
if(values['label_position'] == 'up'){
item = $('<div id="' + id_data + '" class="item module_graph" style="text-align: left; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'</div>'
);
}
else if(values['label_position'] == 'down'){
item = $('<div id="' + id_data + '" class="item module_graph" style="text-align: left; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'<table><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
else if(values['label_position'] == 'left'){
item = $('<div id="' + id_data + '" class="item module_graph" style="text-align: left; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img style="float:right" class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'<table style="float:left;height:'+values['height_module_graph']+'px;"><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
else if(values['label_position'] == 'right'){
item = $('<div id="' + id_data + '" class="item module_graph" style="text-align: left; position: absolute; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
'<img style="float:left" class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
'<table style="float:right;height:'+values['height_module_graph']+'px;"><tr><td></td></tr><tr><td><span id="text_' + id_data + '" class="text">' + values['label'] + '</span></td></tr><tr><td></td></tr></table>' +
'</div>'
);
}
setBarsGraph(id_data, values);
break;
case 'simple_value': case 'simple_value':
sizeStyle = ''; sizeStyle = '';
imageSize = ''; imageSize = '';
@ -2693,7 +3088,9 @@ function updateDB_visual(type, idElement , values, event, top, left) {
case 'label': case 'label':
case 'icon': case 'icon':
case 'module_graph': case 'module_graph':
case 'bars_graph':
case 'auto_sla_graph': case 'auto_sla_graph':
case 'donut_graph':
if (type == 'simple_value') { if (type == 'simple_value') {
setModuleValue(idElement, setModuleValue(idElement,
values.process_simple_value, values.process_simple_value,
@ -2914,9 +3311,6 @@ function updateDB(type, idElement , values, event) {
} }
function copyDB(idItem) { function copyDB(idItem) {
console.log(idItem);
metaconsole = $("input[name='metaconsole']").val(); metaconsole = $("input[name='metaconsole']").val();
parameter = Array(); parameter = Array();
@ -3108,6 +3502,15 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true); activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false); activeToolboxButton('show_grid', false);
} }
if ($(divParent).hasClass('donut_graph')) {
creationItem = null;
selectedItem = 'donut_graph';
idItem = $(divParent).attr('id');
activeToolboxButton('copy_item', true);
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('group_item')) { if ($(divParent).hasClass('group_item')) {
creationItem = null; creationItem = null;
selectedItem = 'group_item'; selectedItem = 'group_item';
@ -3135,6 +3538,15 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true); activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false); activeToolboxButton('show_grid', false);
} }
if ($(divParent).hasClass('bars_graph')) {
creationItem = null;
selectedItem = 'bars_graph';
idItem = $(divParent).attr('id');
activeToolboxButton('copy_item', true);
activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false);
}
if ($(divParent).hasClass('simple_value')) { if ($(divParent).hasClass('simple_value')) {
creationItem = null; creationItem = null;
selectedItem = 'simple_value'; selectedItem = 'simple_value';
@ -3308,6 +3720,9 @@ function eventsItems(drag) {
if ($(event.target).hasClass('auto_sla_graph')) { if ($(event.target).hasClass('auto_sla_graph')) {
selectedItem = 'auto_sla_graph'; selectedItem = 'auto_sla_graph';
} }
if ($(event.target).hasClass('donut_graph')) {
selectedItem = 'donut_graph';
}
if ($(event.target).hasClass('group_item')) { if ($(event.target).hasClass('group_item')) {
selectedItem = 'group_item'; selectedItem = 'group_item';
} }
@ -3317,6 +3732,9 @@ function eventsItems(drag) {
if ($(event.target).hasClass('module_graph')) { if ($(event.target).hasClass('module_graph')) {
selectedItem = 'module_graph'; selectedItem = 'module_graph';
} }
if ($(event.target).hasClass('bars_graph')) {
selectedItem = 'bars_graph';
}
if ($(event.target).hasClass('simple_value')) { if ($(event.target).hasClass('simple_value')) {
selectedItem = 'simple_value'; selectedItem = 'simple_value';
} }
@ -3372,8 +3790,6 @@ function eventsItems(drag) {
} }
} }
else{ else{
console.log('Dragstart');
multiDragStart(event); multiDragStart(event);
} }
@ -3390,8 +3806,6 @@ function eventsItems(drag) {
updateDB(selectedItem, idItem, values, 'dragstop'); updateDB(selectedItem, idItem, values, 'dragstop');
} }
else{ else{
console.log('Dragstop');
multidragStop(event); multidragStop(event);
} }
}); });
@ -3479,10 +3893,6 @@ function eventsItems(drag) {
break; break;
} }
} }
else{
console.log('Drag');
}
}); });
} }
@ -3628,10 +4038,18 @@ function click_button_toolbox(id) {
toolbuttonActive = creationItem = 'module_graph'; toolbuttonActive = creationItem = 'module_graph';
toggle_item_palette(); toggle_item_palette();
break; break;
case 'bars_graph':
toolbuttonActive = creationItem = 'bars_graph';
toggle_item_palette();
break;
case 'auto_sla_graph': case 'auto_sla_graph':
toolbuttonActive = creationItem = 'auto_sla_graph'; toolbuttonActive = creationItem = 'auto_sla_graph';
toggle_item_palette(); toggle_item_palette();
break; break;
case 'donut_graph':
toolbuttonActive = creationItem = 'donut_graph';
toggle_item_palette();
break;
case 'simple_value': case 'simple_value':
toolbuttonActive = creationItem = 'simple_value'; toolbuttonActive = creationItem = 'simple_value';
toggle_item_palette(); toggle_item_palette();
@ -3683,12 +4101,14 @@ function click_button_toolbox(id) {
activeToolboxButton('static_graph', false); activeToolboxButton('static_graph', false);
activeToolboxButton('percentile_item', false); activeToolboxButton('percentile_item', false);
activeToolboxButton('module_graph', false); activeToolboxButton('module_graph', false);
activeToolboxButton('bars_graph', false);
activeToolboxButton('simple_value', false); activeToolboxButton('simple_value', false);
activeToolboxButton('label', false); activeToolboxButton('label', false);
activeToolboxButton('icon', false); activeToolboxButton('icon', false);
activeToolboxButton('service', false); activeToolboxButton('service', false);
activeToolboxButton('group_item', false); activeToolboxButton('group_item', false);
activeToolboxButton('auto_sla_graph', false); activeToolboxButton('auto_sla_graph', false);
activeToolboxButton('donut_graph', false);
activeToolboxButton('copy_item', false); activeToolboxButton('copy_item', false);
activeToolboxButton('edit_item', false); activeToolboxButton('edit_item', false);
activeToolboxButton('delete_item', false); activeToolboxButton('delete_item', false);
@ -3714,11 +4134,13 @@ function click_button_toolbox(id) {
activeToolboxButton('static_graph', true); activeToolboxButton('static_graph', true);
activeToolboxButton('percentile_item', true); activeToolboxButton('percentile_item', true);
activeToolboxButton('module_graph', true); activeToolboxButton('module_graph', true);
activeToolboxButton('bars_graph', true);
activeToolboxButton('simple_value', true); activeToolboxButton('simple_value', true);
activeToolboxButton('label', true); activeToolboxButton('label', true);
activeToolboxButton('icon', true); activeToolboxButton('icon', true);
activeToolboxButton('group_item', true); activeToolboxButton('group_item', true);
activeToolboxButton('auto_sla_graph', true); activeToolboxButton('auto_sla_graph', true);
activeToolboxButton('donut_graph', true);
} }
break; break;
case 'save_visualmap': case 'save_visualmap':

View File

@ -196,11 +196,18 @@ ui_require_javascript_file ('encode_decode_base64');
"10pt=.visual_font_size_10pt, " + "10pt=.visual_font_size_10pt, " +
"12pt=.visual_font_size_12pt, " + "12pt=.visual_font_size_12pt, " +
"14pt=.visual_font_size_14pt, " + "14pt=.visual_font_size_14pt, " +
"18pt=.visual_font_size_18pt, " +
"24pt=.visual_font_size_24pt, " + "24pt=.visual_font_size_24pt, " +
"28pt=.visual_font_size_28pt, " +
"36pt=.visual_font_size_36pt, " + "36pt=.visual_font_size_36pt, " +
"48pt=.visual_font_size_48pt, " +
"60pt=.visual_font_size_60pt, " +
"72pt=.visual_font_size_72pt, " + "72pt=.visual_font_size_72pt, " +
"84pt=.visual_font_size_84pt, " +
"96pt=.visual_font_size_96pt, " + "96pt=.visual_font_size_96pt, " +
"116pt=.visual_font_size_116pt, " +
"128pt=.visual_font_size_128pt, " + "128pt=.visual_font_size_128pt, " +
"140pt=.visual_font_size_140pt, " +
"154pt=.visual_font_size_154pt, " + "154pt=.visual_font_size_154pt, " +
"196pt=.visual_font_size_196pt", "196pt=.visual_font_size_196pt",
theme_advanced_toolbar_location : "top", theme_advanced_toolbar_location : "top",

View File

@ -602,11 +602,18 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
"10pt=.visual_font_size_10pt, " + "10pt=.visual_font_size_10pt, " +
"12pt=.visual_font_size_12pt, " + "12pt=.visual_font_size_12pt, " +
"14pt=.visual_font_size_14pt, " + "14pt=.visual_font_size_14pt, " +
"18pt=.visual_font_size_18pt, " +
"24pt=.visual_font_size_24pt, " + "24pt=.visual_font_size_24pt, " +
"28pt=.visual_font_size_28pt, " +
"36pt=.visual_font_size_36pt, " + "36pt=.visual_font_size_36pt, " +
"48pt=.visual_font_size_48pt, " +
"60pt=.visual_font_size_60pt, " +
"72pt=.visual_font_size_72pt, " + "72pt=.visual_font_size_72pt, " +
"84pt=.visual_font_size_84pt, " +
"96pt=.visual_font_size_96pt, " + "96pt=.visual_font_size_96pt, " +
"116pt=.visual_font_size_116pt, " +
"128pt=.visual_font_size_128pt, " + "128pt=.visual_font_size_128pt, " +
"140pt=.visual_font_size_140pt, " +
"154pt=.visual_font_size_154pt, " + "154pt=.visual_font_size_154pt, " +
"196pt=.visual_font_size_196pt", "196pt=.visual_font_size_196pt",
theme_advanced_toolbar_location : "top", theme_advanced_toolbar_location : "top",

View File

@ -205,11 +205,7 @@ switch ($activeTab) {
// If the background is changed the size is reseted // If the background is changed the size is reseted
$background_now = $visualConsole['background']; $background_now = $visualConsole['background'];
/*if ($background_now != $background && $background) {
$sizeBackground = getimagesize($config['homedir'] . '/images/console/background/' . $background);
$values['width'] = $sizeBackground[0];
$values['height'] = $sizeBackground[1];
}*/
$values['width'] = $width; $values['width'] = $width;
$values['height'] = $height; $values['height'] = $height;
switch ($action) { switch ($action) {
@ -237,7 +233,6 @@ switch ($activeTab) {
break; break;
case 'save': case 'save':
if (!defined('METACONSOLE')) {
if ($values['name'] != "" && $values['background']) if ($values['name'] != "" && $values['background'])
$idVisualConsole = db_process_sql_insert('tlayout', $values); $idVisualConsole = db_process_sql_insert('tlayout', $values);
else else
@ -262,7 +257,6 @@ switch ($activeTab) {
$statusProcessInDB = array('flag' => false, $statusProcessInDB = array('flag' => false,
'message' => ui_print_error_message(__('Could not be created.'), '', true)); 'message' => ui_print_error_message(__('Could not be created.'), '', true));
} }
}
break; break;
} }
break; break;

View File

@ -144,7 +144,7 @@ $table->data["staticgraph_modulegraph"][1] .= '&nbsp;&nbsp;&nbsp;' .
'leaguegothic' => 'League Gothic' 'leaguegothic' => 'League Gothic'
); );
$fonts = array('4pt' => '4pt','6pt' => '6pt','8pt' => '8pt','10pt' => '10pt','12pt' => '12pt','14pt' => '14pt','24pt' => '24pt','36pt' => '36pt','72pt' => '72pt','96pt' => '96pt','128pt' => '128pt','154pt' => '154pt','196pt' => '196pt'); $fonts = array('4pt' => '4pt','6pt' => '6pt','8pt' => '8pt','10pt' => '10pt','12pt' => '12pt','14pt' => '14pt','18pt' => '18pt','24pt' => '24pt','28pt' => '28pt','36pt' => '36pt','48pt' => '48pt','60pt' => '60pt','72pt' => '72pt','84pt' => '84pt','96pt' => '96pt','116pt' => '116pt','128pt' => '128pt','140pt' => '140pt','154pt' => '154pt','196pt' => '196pt');
/* /*
$fontf = array('andale mono,times' => 'Andale Mono', $fontf = array('andale mono,times' => 'Andale Mono',

View File

@ -313,7 +313,7 @@ foreach ($listIcons as $index => $value)
$table_gis->data[$row][0] = __('Default icon in GIS') . $table_gis->data[$row][0] = __('Default icon in GIS') .
ui_print_help_tip(__('Agent icon for GIS Maps. If set to "none", group icon will be used'), true); ui_print_help_tip(__('Agent icon for GIS Maps. If set to "none", group icon will be used'), true);
$table_gis->data[$row][1] = html_print_select($arraySelectIcon, $table_gis->data[$row][1] = html_print_select($arraySelectIcon,
"gis_default_icon", $config["gis_default_icon"], "", __('None'), "gis_default_icon", $config["gis_default_icon"], "", __('Agent icon group'),
'', true); '', true);
$table_gis->data[$row][1] .= "&nbsp;" . $table_gis->data[$row][1] .= "&nbsp;" .
html_print_button(__("View"), 'gis_icon_preview', false, '', '', true); html_print_button(__("View"), 'gis_icon_preview', false, '', '', true);
@ -934,6 +934,23 @@ tinyMCE.init({
}); });
$(document).ready (function () { $(document).ready (function () {
var comfort = 0;
if(comfort == 0){
$(':input,:radio,:checkbox,:file').change(function(){
$('#submit-update_button').css({'position':'fixed','right':'80px','bottom':'55px'});
var comfort = 1;
});
$("*").keydown(function(){
$('#submit-update_button').css({'position':'fixed','right':'80px','bottom':'55px'});
var comfort = 1;
});
$('#form_setup').after('<br>');
}
$("#form_setup #text-graph_color1").attachColorPicker(); $("#form_setup #text-graph_color1").attachColorPicker();
$("#form_setup #text-graph_color2").attachColorPicker(); $("#form_setup #text-graph_color2").attachColorPicker();
$("#form_setup #text-graph_color3").attachColorPicker(); $("#form_setup #text-graph_color3").attachColorPicker();

View File

@ -58,7 +58,14 @@ $baseurl = ui_get_full_url(false, false, false, false);
var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n"; var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n";
var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n"; var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n";
var text3_mr_file = "<?php echo __('planned downtime'); ?>\n"; var text3_mr_file = "<?php echo __('planned downtime'); ?>\n";
var text4_mr_file = "<?php echo __(' to this process'); ?>\n"; var text4_mr_file = "<?php
if($config['language'] == 'es'){
echo __(' to this process').'<br><br><a style=\"font-size:10pt;font-style:italic;\" target=\"blank\" href=\"http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29\">'.__('About minor release update').'</a>';
}
else{
echo __(' to this process').'<br><br><a style=\"font-size:10pt;font-style:italic;\" target=\"blank\" href=\"http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29\">'.__('About minor release update').'</a>';
}
?>";
var text1_package_file = "<?php echo __('There is a new update available'); ?>\n"; var text1_package_file = "<?php echo __('There is a new update available'); ?>\n";
var text2_package_file = "<?php echo __('There is a new update available to apply. Do you want to start the update process?'); ?>\n"; var text2_package_file = "<?php echo __('There is a new update available to apply. Do you want to start the update process?'); ?>\n";
var applying_mr = "<?php echo __('Applying DB MR'); ?>\n"; var applying_mr = "<?php echo __('Applying DB MR'); ?>\n";

View File

@ -565,7 +565,7 @@ $values = array (
'Tactical view'=>__('Tactical view'), 'Tactical view'=>__('Tactical view'),
'Alert detail' => __('Alert detail'), 'Alert detail' => __('Alert detail'),
'Other'=>__('Other')); 'Other'=>__('Other'));
if (enterprise_installed()) { if (enterprise_installed() && !is_metaconsole()) {
$values['Dashboard'] = __('Dashboard'); $values['Dashboard'] = __('Dashboard');
} }
$table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info["section"]), 'show_data_section();', '', -1, true, false, false); $table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info["section"]), 'show_data_section();', '', -1, true, false, false);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 720 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Some files were not shown because too many files have changed in this diff Show More